zcatalyst-cli 1.25.3 → 1.26.1

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 (263) hide show
  1. package/lib/api-timer.d.ts +0 -1
  2. package/lib/apig-utils.d.ts +1 -1
  3. package/lib/apig-utils.js +1 -1
  4. package/lib/appsail-utils.js +6 -7
  5. package/lib/archiver.d.ts +0 -4
  6. package/lib/archiver.js +21 -11
  7. package/lib/authentication/constants/auth.js +1 -1
  8. package/lib/authentication/credential.js +3 -3
  9. package/lib/authentication/index.js +25 -14
  10. package/lib/authentication/login.d.ts +0 -2
  11. package/lib/authentication/login.js +23 -10
  12. package/lib/bin/catalyst.js +17 -7
  13. package/lib/client-utils.d.ts +3 -3
  14. package/lib/client-utils.js +2 -2
  15. package/lib/client.js +19 -9
  16. package/lib/code-deck.d.ts +0 -2
  17. package/lib/code-deck.js +4 -4
  18. package/lib/command_needs/config.js +1 -1
  19. package/lib/command_needs/rc.js +5 -2
  20. package/lib/commands/appsail/add.js +17 -7
  21. package/lib/commands/client/setup.js +17 -7
  22. package/lib/commands/config/set.js +5 -3
  23. package/lib/commands/deploy/appsail.js +37 -14
  24. package/lib/commands/deploy/index.js +88 -66
  25. package/lib/commands/deploy/slate.js +37 -14
  26. package/lib/commands/event/generate/integ.js +18 -9
  27. package/lib/commands/functions/add.js +17 -7
  28. package/lib/commands/functions/execute.js +17 -7
  29. package/lib/commands/functions/setup.js +17 -7
  30. package/lib/commands/functions/shell.js +17 -7
  31. package/lib/commands/iac/import.js +18 -8
  32. package/lib/commands/iac/pack.js +17 -7
  33. package/lib/commands/iac/status.js +17 -7
  34. package/lib/commands/index.js +20 -12
  35. package/lib/commands/init.js +17 -7
  36. package/lib/commands/login.js +17 -7
  37. package/lib/commands/logout.js +17 -7
  38. package/lib/commands/project/list.js +17 -7
  39. package/lib/commands/project/use.js +1 -0
  40. package/lib/commands/pull.js +17 -7
  41. package/lib/commands/run.js +17 -7
  42. package/lib/commands/serve.js +17 -7
  43. package/lib/commands/signals/generate/index.js +1 -1
  44. package/lib/commands/slate/create.js +17 -7
  45. package/lib/commands/slate/link.js +17 -7
  46. package/lib/commands/token/generate.js +17 -7
  47. package/lib/commands/token/list.js +17 -7
  48. package/lib/commands/token/revoke.js +17 -7
  49. package/lib/commands/zest/generate/index.js +21 -11
  50. package/lib/deploy/features/appsail/index.js +2 -3
  51. package/lib/deploy/features/appsail/pack.d.ts +0 -1
  52. package/lib/deploy/features/appsail/pack.js +2 -3
  53. package/lib/deploy/features/appsail/utils.js +7 -8
  54. package/lib/deploy/features/functions/languages/index.js +3 -4
  55. package/lib/deploy/features/index.js +17 -7
  56. package/lib/deploy/features/slate.js +11 -8
  57. package/lib/deploy/index.js +2 -2
  58. package/lib/deploy/util.d.ts +2 -0
  59. package/lib/deploy/util.js +3 -1
  60. package/lib/docs/commands/signals/generate/generate.toml +19 -0
  61. package/lib/docs/commands/slate/unlink.toml +9 -0
  62. package/lib/docs/fn-utils/lib/node.toml +4 -0
  63. package/lib/docs/init/dependencies/python/ensure-python.toml +4 -0
  64. package/lib/docs/serve/server/lib/slate/index.toml +20 -0
  65. package/lib/docs/slate-utils.toml +9 -0
  66. package/lib/endpoints/index.d.ts +2 -1
  67. package/lib/endpoints/index.js +88 -79
  68. package/lib/endpoints/lib/apig.d.ts +0 -1
  69. package/lib/endpoints/lib/apig.js +2 -2
  70. package/lib/endpoints/lib/applogic.d.ts +0 -1
  71. package/lib/endpoints/lib/applogic.js +2 -2
  72. package/lib/endpoints/lib/appsail.d.ts +1 -4
  73. package/lib/endpoints/lib/appsail.js +7 -7
  74. package/lib/endpoints/lib/client.d.ts +0 -1
  75. package/lib/endpoints/lib/code-deck.js +1 -1
  76. package/lib/endpoints/lib/common.d.ts +0 -2
  77. package/lib/endpoints/lib/ds-bulk.js +2 -2
  78. package/lib/endpoints/lib/env.js +2 -2
  79. package/lib/endpoints/lib/filestore.d.ts +0 -1
  80. package/lib/endpoints/lib/functions.d.ts +0 -1
  81. package/lib/endpoints/lib/functions.js +2 -2
  82. package/lib/endpoints/lib/git-hub.d.ts +0 -2
  83. package/lib/endpoints/lib/iac.d.ts +0 -3
  84. package/lib/endpoints/lib/iac.js +2 -2
  85. package/lib/endpoints/lib/project.d.ts +0 -1
  86. package/lib/endpoints/lib/project.js +2 -2
  87. package/lib/endpoints/lib/sdk.d.ts +0 -2
  88. package/lib/endpoints/lib/sdk.js +1 -1
  89. package/lib/endpoints/lib/slate.d.ts +0 -1
  90. package/lib/endpoints/lib/stratus.d.ts +0 -1
  91. package/lib/endpoints/lib/user.d.ts +0 -2
  92. package/lib/endpoints/lib/user.js +2 -1
  93. package/lib/error/context-help.js +1 -1
  94. package/lib/error/index.js +2 -2
  95. package/lib/event_generate/cache.js +4 -4
  96. package/lib/event_generate/custom.js +1 -2
  97. package/lib/event_generate/datastore.js +4 -4
  98. package/lib/event_generate/filestore.js +4 -4
  99. package/lib/event_generate/github.js +2 -2
  100. package/lib/event_generate/index.js +19 -11
  101. package/lib/event_generate/stratus.js +2 -2
  102. package/lib/event_generate/user.js +2 -2
  103. package/lib/event_generate/webapp.js +2 -2
  104. package/lib/execute/caller.d.ts +0 -1
  105. package/lib/execute/caller.js +20 -7
  106. package/lib/execute/index.js +27 -4
  107. package/lib/execute-script.js +22 -13
  108. package/lib/express_middlewares/auth-checker.js +2 -3
  109. package/lib/express_middlewares/project.d.ts +1 -1
  110. package/lib/fn-utils/index.js +17 -7
  111. package/lib/fn-utils/lib/browserLogic.js +4 -5
  112. package/lib/fn-utils/lib/common.d.ts +0 -1
  113. package/lib/fn-utils/lib/common.js +25 -26
  114. package/lib/fn-utils/lib/integ.js +2 -3
  115. package/lib/fn-utils/lib/java/classpath.js +2 -3
  116. package/lib/fn-utils/lib/java/compile.js +4 -4
  117. package/lib/fn-utils/lib/java/ensure-java-userconfig.d.ts +10 -0
  118. package/lib/fn-utils/lib/java/ensure-java-userconfig.js +45 -23
  119. package/lib/fn-utils/lib/java/index.d.ts +0 -1
  120. package/lib/fn-utils/lib/java/index.js +11 -11
  121. package/lib/fn-utils/lib/java/keywords.js +2 -2
  122. package/lib/fn-utils/lib/node.d.ts +1 -1
  123. package/lib/fn-utils/lib/node.js +67 -15
  124. package/lib/fn-utils/lib/python.js +29 -19
  125. package/lib/iac/status/util/index.d.ts +1 -1
  126. package/lib/init/dependencies/npm-install.js +2 -2
  127. package/lib/init/dependencies/python/ensure-python.d.ts +2 -2
  128. package/lib/init/dependencies/python/ensure-python.js +65 -58
  129. package/lib/init/dependencies/python/pip-install.d.ts +3 -5
  130. package/lib/init/dependencies/python/pip-install.js +14 -53
  131. package/lib/init/features/appsail/utils.js +21 -12
  132. package/lib/init/features/client/index.js +18 -9
  133. package/lib/init/features/client/initializers/angular.js +17 -7
  134. package/lib/init/features/client/initializers/basic.js +17 -7
  135. package/lib/init/features/client/initializers/lyte.js +17 -7
  136. package/lib/init/features/client/initializers/react.js +17 -7
  137. package/lib/init/features/index.js +29 -20
  138. package/lib/init/features/project.js +5 -5
  139. package/lib/init/features/slate/index.js +23 -11
  140. package/lib/init/util/client.js +23 -13
  141. package/lib/init/util/common.js +5 -6
  142. package/lib/init/util/project.js +1 -1
  143. package/lib/internal/api.d.ts +0 -3
  144. package/lib/internal/api.js +19 -9
  145. package/lib/internal/command.js +18 -9
  146. package/lib/migration/global/1.25.0.d.ts +2 -0
  147. package/lib/migration/global/1.25.0.js +28 -0
  148. package/lib/migration/index.js +20 -12
  149. package/lib/option-filter.js +19 -10
  150. package/lib/optional-import.js +19 -10
  151. package/lib/plugin-loader.d.ts +0 -2
  152. package/lib/plugin-loader.js +18 -8
  153. package/lib/port-resolver.js +10 -10
  154. package/lib/prompt/index.d.ts +3 -3
  155. package/lib/prompt/index.js +17 -7
  156. package/lib/prompt/types/file-path.d.ts +0 -1
  157. package/lib/prompt/types/search-box.d.ts +0 -1
  158. package/lib/prompt/types/tree.d.ts +1 -2
  159. package/lib/prompt/types/tree.js +10 -10
  160. package/lib/prompt/types/with-description.d.ts +0 -1
  161. package/lib/pull/features/functions/index.js +71 -52
  162. package/lib/pull/features/functions/languages.js +3 -4
  163. package/lib/pull/features/index.js +17 -7
  164. package/lib/repl-server.d.ts +0 -1
  165. package/lib/repl-server.js +9 -1
  166. package/lib/serve/features/apig.js +7 -1
  167. package/lib/serve/features/appsail.d.ts +1 -0
  168. package/lib/serve/features/appsail.js +51 -7
  169. package/lib/serve/features/index.js +22 -13
  170. package/lib/serve/index.js +17 -7
  171. package/lib/serve/server/index.d.ts +0 -2
  172. package/lib/serve/server/index.js +26 -12
  173. package/lib/serve/server/lib/appsail/index.js +27 -34
  174. package/lib/serve/server/lib/appsail/util.d.ts +11 -0
  175. package/lib/serve/server/lib/appsail/util.js +69 -0
  176. package/lib/serve/server/lib/java/index.js +18 -7
  177. package/lib/serve/server/lib/master/appsail.js +3 -4
  178. package/lib/serve/server/lib/master/functions.js +1 -2
  179. package/lib/serve/server/lib/master/index.d.ts +0 -1
  180. package/lib/serve/server/lib/master/index.js +5 -5
  181. package/lib/serve/server/lib/master/slate.js +1 -2
  182. package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
  183. package/lib/serve/server/lib/master/utils.d.ts +4 -8
  184. package/lib/serve/server/lib/master/utils.js +4 -6
  185. package/lib/serve/server/lib/master/web-client.js +1 -2
  186. package/lib/serve/server/lib/node/index.js +22 -11
  187. package/lib/serve/server/lib/node/server/browserlogic/utils/playwright-handler.js +1 -1
  188. package/lib/serve/server/lib/node/server/browserlogic/utils/puppeteer-handler.js +1 -1
  189. package/lib/serve/server/lib/node/server/browserlogic/utils/selenium-handler.js +2 -0
  190. package/lib/serve/server/lib/python/index.js +23 -14
  191. package/lib/serve/server/lib/slate/index.js +7 -0
  192. package/lib/serve/server/lib/slate/static-server.d.ts +0 -1
  193. package/lib/serve/server/lib/slate/static-server.js +5 -4
  194. package/lib/serve/server/lib/web_client/server.d.ts +0 -1
  195. package/lib/serve/server/lib/web_client/server.js +5 -4
  196. package/lib/shell/dependencies/http-functions.d.ts +0 -2
  197. package/lib/shell/dependencies/http-functions.js +7 -7
  198. package/lib/shell/dependencies/non-http-function/fn-execution-handler.d.ts +0 -2
  199. package/lib/shell/dependencies/non-http-function/fn-execution-handler.js +55 -24
  200. package/lib/shell/dependencies/non-http-function/fn-handler.d.ts +3 -3
  201. package/lib/shell/dependencies/non-http-function/fn-handler.js +54 -20
  202. package/lib/shell/dependencies/non-http-function/node.js +4 -4
  203. package/lib/shell/dependencies/non-http-function/python.d.ts +1 -1
  204. package/lib/shell/dependencies/non-http-function/python.js +11 -13
  205. package/lib/shell/dependencies/non-http-function/slave-manager.d.ts +0 -2
  206. package/lib/shell/dependencies/non-http-function/slave-manager.js +11 -7
  207. package/lib/shell/dependencies/tunnel-server.js +4 -4
  208. package/lib/shell/index.js +50 -3
  209. package/lib/shell/prepare/index.js +4 -3
  210. package/lib/shell/prepare/languages/index.js +18 -9
  211. package/lib/shell/prepare/languages/node.js +29 -19
  212. package/lib/shell/prepare/languages/python.js +6 -12
  213. package/lib/signals/index.js +19 -11
  214. package/lib/slate-utils.js +25 -16
  215. package/lib/throbber/index.d.ts +1 -2
  216. package/lib/throbber/index.js +5 -2
  217. package/lib/throbber/utils.d.ts +0 -1
  218. package/lib/throbber/utils.js +4 -5
  219. package/lib/userConfig.d.ts +14 -0
  220. package/lib/userConfig.js +15 -1
  221. package/lib/util_modules/config/index.js +17 -7
  222. package/lib/util_modules/config/lib/apig.d.ts +1 -0
  223. package/lib/util_modules/config/lib/apig.js +10 -5
  224. package/lib/util_modules/config/lib/appsail.js +7 -7
  225. package/lib/util_modules/config/lib/client.js +5 -6
  226. package/lib/util_modules/config/lib/functions.js +5 -6
  227. package/lib/util_modules/config/lib/slate.d.ts +2 -1
  228. package/lib/util_modules/config/lib/slate.js +27 -13
  229. package/lib/util_modules/config-store.d.ts +1 -1
  230. package/lib/util_modules/config-store.js +30 -13
  231. package/lib/util_modules/constants/lib/apig-rules.d.ts +1 -1
  232. package/lib/util_modules/constants/lib/dc-type.js +3 -3
  233. package/lib/util_modules/constants/lib/placeholders.d.ts +1 -1
  234. package/lib/util_modules/constants/lib/placeholders.js +1 -1
  235. package/lib/util_modules/constants/lib/urls.js +2 -9
  236. package/lib/util_modules/container.js +23 -14
  237. package/lib/util_modules/dc.js +3 -4
  238. package/lib/util_modules/env.d.ts +3 -0
  239. package/lib/util_modules/env.js +64 -4
  240. package/lib/util_modules/event-emitter.d.ts +9 -0
  241. package/lib/util_modules/event-emitter.js +68 -0
  242. package/lib/util_modules/fs/index.js +17 -7
  243. package/lib/util_modules/fs/lib/async.d.ts +0 -4
  244. package/lib/util_modules/fs/lib/async.js +46 -46
  245. package/lib/util_modules/fs/lib/sync.d.ts +1 -3
  246. package/lib/util_modules/fs/lib/sync.js +40 -30
  247. package/lib/util_modules/logger/index.js +12 -12
  248. package/lib/util_modules/logger/utils.d.ts +0 -4
  249. package/lib/util_modules/logger/utils.js +1 -1
  250. package/lib/util_modules/logger/winston.js +2 -2
  251. package/lib/util_modules/option.js +5 -6
  252. package/lib/util_modules/project.js +22 -23
  253. package/lib/util_modules/runtime-store.d.ts +2 -2
  254. package/lib/util_modules/server.d.ts +1 -2
  255. package/lib/util_modules/server.js +54 -15
  256. package/lib/util_modules/shell.d.ts +0 -3
  257. package/lib/util_modules/shell.js +5 -6
  258. package/lib/util_modules/toml.js +2 -3
  259. package/package.json +13 -13
  260. package/templates/init/functions/java/event/sample.java +5 -2
  261. package/templates/web-socket.txt +1 -1
  262. /package/lib/docs/{commands/event/generate → event_generate}/index.toml +0 -0
  263. /package/templates/init/functions/java/integ/convokraft/{Sample.java → sample.java} +0 -0
@@ -21,8 +21,8 @@ class AppSail {
21
21
  this.opts = opts;
22
22
  this.projectId = projectId;
23
23
  }
24
- deploy(sourceFsStream, { stack, name, contentLength, command, memory, platform, envVariables = {}, catalystAuth, loginRedirect, port }) {
25
- return __awaiter(this, void 0, void 0, function* () {
24
+ deploy(sourceFsStream_1, _a) {
25
+ return __awaiter(this, arguments, void 0, function* (sourceFsStream, { stack, name, contentLength, command, memory, platform, envVariables = {}, catalystAuth, loginRedirect, port }) {
26
26
  const formData = {
27
27
  stack,
28
28
  name,
@@ -107,14 +107,14 @@ class AppSail {
107
107
  });
108
108
  });
109
109
  }
110
- downloadJetty() {
110
+ downloadJetty(url) {
111
111
  return __awaiter(this, void 0, void 0, function* () {
112
112
  const res = yield new api_1.default({
113
113
  origin: constants_1.ORIGIN.zohoCDNUS,
114
114
  authNeeded: false,
115
115
  json: false,
116
116
  isExternal: true
117
- }).get('/catalyst/appsail/1.0.0/jetty_runtime_dependency.zip', { encoding: null });
117
+ }).get(url, { encoding: null });
118
118
  if (res.body) {
119
119
  return res.body;
120
120
  }
@@ -136,8 +136,8 @@ class AppSail {
136
136
  });
137
137
  });
138
138
  }
139
- uploadToBucket({ signedUrl, length, stream, name }) {
140
- return __awaiter(this, void 0, void 0, function* () {
139
+ uploadToBucket(_a) {
140
+ return __awaiter(this, arguments, void 0, function* ({ signedUrl, length, stream, name }) {
141
141
  const url = new URL(signedUrl);
142
142
  const res = yield new api_1.default(Object.assign(Object.assign({}, this.opts), { isExternal: true, origin: url.origin, authNeeded: false, json: false })).put(url.pathname + '?' + url.searchParams, {
143
143
  log: {
@@ -165,8 +165,8 @@ class AppSail {
165
165
  });
166
166
  }
167
167
  customAppSailCallback(target, objectId) {
168
- var _a, _b, _c, _d, _e;
169
168
  return __awaiter(this, void 0, void 0, function* () {
169
+ var _a, _b, _c, _d, _e;
170
170
  const configuration = {};
171
171
  if (typeof ((_a = target.config) === null || _a === void 0 ? void 0 : _a.command) === 'string') {
172
172
  configuration.startup_command = target.config.command;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ReadStream } from 'fs-extra';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  declare class Client {
@@ -50,7 +50,6 @@ class CodeDeck {
50
50
  });
51
51
  }
52
52
  }
53
- exports.default = CodeDeck;
54
53
  _CodeDeck_instances = new WeakSet(), _CodeDeck_manifest = function _CodeDeck_manifest() {
55
54
  return __awaiter(this, void 0, void 0, function* () {
56
55
  const res = yield new api_1.default(this.opts).get('/catalyst-library/codelib/config.json', {
@@ -69,3 +68,4 @@ _CodeDeck_instances = new WeakSet(), _CodeDeck_manifest = function _CodeDeck_man
69
68
  });
70
69
  });
71
70
  };
71
+ exports.default = CodeDeck;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export default class Common {
4
2
  download(url: string, title?: string): Promise<Buffer>;
5
3
  }
@@ -60,8 +60,8 @@ class BulkDS {
60
60
  });
61
61
  });
62
62
  }
63
- getStatus(operation, jobid, prev = false) {
64
- return __awaiter(this, void 0, void 0, function* () {
63
+ getStatus(operation_1, jobid_1) {
64
+ return __awaiter(this, arguments, void 0, function* (operation, jobid, prev = false) {
65
65
  const res = yield new api_1.default(this.opts).get(`/baas/v1/project/${this.projectId}/bulk/${operation}/${jobid}/report`, {
66
66
  qs: {
67
67
  prev
@@ -22,8 +22,8 @@ class Env {
22
22
  this.opts = opts;
23
23
  this.opts.envId = org;
24
24
  }
25
- getEnvs(projectId, throwErr = true) {
26
- return __awaiter(this, void 0, void 0, function* () {
25
+ getEnvs(projectId_1) {
26
+ return __awaiter(this, arguments, void 0, function* (projectId, throwErr = true) {
27
27
  const res = yield new api_1.default(this.opts).get('/baas/v1/project/' + projectId + '/environment');
28
28
  if (res.body && res.body.data) {
29
29
  const data = res.body.data;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ReadStream } from 'fs-extra';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  declare class Filestore {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ReadStream } from 'fs-extra';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  declare class Functions {
@@ -73,8 +73,8 @@ class Functions {
73
73
  });
74
74
  });
75
75
  }
76
- deploy(sourceFsStream, { stack, name, type, memory, envVariables, contentLength }) {
77
- return __awaiter(this, void 0, void 0, function* () {
76
+ deploy(sourceFsStream_1, _a) {
77
+ return __awaiter(this, arguments, void 0, function* (sourceFsStream, { stack, name, type, memory, envVariables, contentLength }) {
78
78
  const formData = {
79
79
  stack,
80
80
  name,
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { IAPIOptions } from '../../internal/api';
4
2
  export default class GitHub {
5
3
  opts: IAPIOptions & {
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import { ReadStream } from 'fs-extra';
5
2
  import { IAPIOptions } from '../../internal/api';
6
3
  interface IIacLog {
@@ -21,8 +21,8 @@ class IacAPI {
21
21
  this.opts = opts || { env: (0, project_1.getEnvName)() };
22
22
  this.projectId = projectId || (0, project_1.getProjectId)('');
23
23
  }
24
- deploy(projectName, format, file, schedule = false) {
25
- return __awaiter(this, void 0, void 0, function* () {
24
+ deploy(projectName_1, format_1, file_1) {
25
+ return __awaiter(this, arguments, void 0, function* (projectName, format, file, schedule = false) {
26
26
  const res = yield new api_1.default(this.opts).post('/baas/v1/project/import', {
27
27
  formData: {
28
28
  project_name: projectName,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingHttpHeaders } from 'http';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  import { IProjectServerObj } from '../../util_modules/project';
@@ -60,8 +60,8 @@ class ProjectAPI {
60
60
  });
61
61
  });
62
62
  }
63
- getCurrentProjectUser(projectId, headers = {}) {
64
- return __awaiter(this, void 0, void 0, function* () {
63
+ getCurrentProjectUser(projectId_1) {
64
+ return __awaiter(this, arguments, void 0, function* (projectId, headers = {}) {
65
65
  const res = yield new api_1.default(Object.assign(Object.assign({}, this.opts), { headers, authNeeded: false, resolveOnError: true, printError: false })).get(`/baas/v1/project/${projectId}/project-user/current`);
66
66
  if (res.body && res.body.data) {
67
67
  if (typeof res.body.data.email_id === 'undefined') {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { IAPIOptions } from '../../internal/api';
4
2
  declare class SDK {
5
3
  opts: IAPIOptions;
@@ -37,8 +37,8 @@ class SDK {
37
37
  }
38
38
  }
39
39
  java(fnType, service) {
40
- var _a;
41
40
  return __awaiter(this, void 0, void 0, function* () {
41
+ var _a;
42
42
  const targetSDK = this.getSdkUrl(fnType, service);
43
43
  const res = yield new api_1.default(this.opts).get(targetSDK, {
44
44
  json: false,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ReadStream } from 'fs-extra';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  import { FrameworkType, ISlateAppInfo } from '../../util_modules/config/lib/slate';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ReadStream } from 'fs-extra';
3
2
  import { IAPIOptions } from '../../internal/api';
4
3
  declare class Stratus {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { IAPIOptions } from '../../internal/api';
4
2
  export default class Project {
5
3
  opts: IAPIOptions;
@@ -19,7 +19,8 @@ const urls_js_1 = __importDefault(require("../../util_modules/constants/lib/urls
19
19
  class Project {
20
20
  constructor() {
21
21
  this.opts = {
22
- authNeeded: true
22
+ authNeeded: true,
23
+ printError: false
23
24
  };
24
25
  }
25
26
  getUserThumb(id) {
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = help;
3
4
  const utils_js_1 = require("./utils.js");
4
5
  const ansi_colors_1 = require("ansi-colors");
5
6
  const index_js_1 = require("../util_modules/fs/index.js");
@@ -69,7 +70,6 @@ function help() {
69
70
  utils_js_1.runtime.set('context.log', {});
70
71
  return exitCode;
71
72
  }
72
- exports.default = help;
73
73
  function outputError(err, errQueue) {
74
74
  (0, logger_1.error)(err.message);
75
75
  debugLog(err);
@@ -27,8 +27,8 @@ class CatalystError extends Error {
27
27
  }
28
28
  options.docPath = options.docPath || DEFAULT_DOC;
29
29
  this.filePath = errorPath.replace((0, path_1.dirname)(options.docPath), options.docPath);
30
- utils_js_1.runtime.set(`context.log["${this.filePath}"]`, utils_js_1.runtime
31
- .get(`[context][log]["${this.filePath}"]`, [])
30
+ utils_js_1.runtime.set(['context.log', this.filePath], utils_js_1.runtime
31
+ .get(['context.log', this.filePath], [])
32
32
  .concat(this));
33
33
  }
34
34
  }
@@ -12,15 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const ansi_colors_1 = require("ansi-colors");
17
18
  const moment_1 = __importDefault(require("moment"));
18
19
  const endpoints_1 = require("../endpoints");
19
20
  const index_js_1 = __importDefault(require("../error/index.js"));
20
21
  const js_1 = require("../util_modules/js");
21
22
  exports.sourceId = 'NULL';
22
- function getData(options = {}) {
23
- return __awaiter(this, void 0, void 0, function* () {
23
+ function getData() {
24
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
24
25
  const segmentId = options.segment;
25
26
  const allSegments = (yield (yield (0, endpoints_1.cacheAPI)()).getAllSegments());
26
27
  const selectedSegment = segmentId !== undefined
@@ -52,4 +53,3 @@ function getData(options = {}) {
52
53
  };
53
54
  });
54
55
  }
55
- exports.getData = getData;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getRuleId = void 0;
15
+ exports.getRuleId = getRuleId;
16
16
  const ansi_colors_1 = require("ansi-colors");
17
17
  const index_js_1 = __importDefault(require("../error/index.js"));
18
18
  const option_1 = require("../util_modules/option");
@@ -29,4 +29,3 @@ function getRuleId() {
29
29
  return ruleId;
30
30
  });
31
31
  }
32
- exports.getRuleId = getRuleId;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const ansi_colors_1 = require("ansi-colors");
17
18
  const moment_1 = __importDefault(require("moment"));
18
19
  const endpoints_1 = require("../endpoints");
@@ -21,8 +22,8 @@ const constants_1 = require("../util_modules/constants");
21
22
  const js_1 = require("../util_modules/js");
22
23
  const index_1 = require("../util_modules/logger/index");
23
24
  exports.sourceId = 'NULL';
24
- function getData(options = {}) {
25
- return __awaiter(this, void 0, void 0, function* () {
25
+ function getData() {
26
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
26
27
  const tableId = options.table;
27
28
  let columnDetails = constants_1.DEFAULT.datastore.column_details;
28
29
  if (tableId !== undefined) {
@@ -82,4 +83,3 @@ function getData(options = {}) {
82
83
  }, [{}])[0];
83
84
  });
84
85
  }
85
- exports.getData = getData;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const ansi_colors_1 = require("ansi-colors");
17
18
  const moment_1 = __importDefault(require("moment"));
18
19
  const endpoints_1 = require("../endpoints");
@@ -21,8 +22,8 @@ const runtime_store_1 = __importDefault(require("../runtime-store"));
21
22
  const js_1 = require("../util_modules/js");
22
23
  const project_1 = require("../util_modules/project");
23
24
  exports.sourceId = 'NULL';
24
- function getData(options = {}) {
25
- return __awaiter(this, void 0, void 0, function* () {
25
+ function getData() {
26
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
26
27
  const folderId = options.folder;
27
28
  const allFolders = (yield (yield (0, endpoints_1.filestoreAPI)()).getAllFolders());
28
29
  const selectedFolder = folderId !== undefined
@@ -70,4 +71,3 @@ function getData(options = {}) {
70
71
  };
71
72
  });
72
73
  }
73
- exports.getData = getData;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const runtime_store_1 = __importDefault(require("../runtime-store"));
17
18
  const js_1 = require("../util_modules/js");
18
19
  exports.sourceId = 'NULL';
@@ -32,4 +33,3 @@ function getData() {
32
33
  };
33
34
  });
34
35
  }
35
- exports.getData = getData;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.generate = void 0;
48
+ exports.generate = generate;
39
49
  const ansi_colors_1 = require("ansi-colors");
40
50
  const error_1 = __importDefault(require("../error"));
41
51
  const option_1 = require("../util_modules/option");
@@ -46,7 +56,6 @@ const project_1 = require("../util_modules/project");
46
56
  const logger_1 = require("../util_modules/logger");
47
57
  function generate(source, action) {
48
58
  return __awaiter(this, void 0, void 0, function* () {
49
- var _a;
50
59
  (0, logger_1.warning)('The "event:generate" command is deprecated and will be removed in upcoming releases. Please use the signals:generate instead.');
51
60
  const unknownArgs = (0, option_1.getUnknownOpts)([]).filter((arg) => arg !== '--verbose');
52
61
  if (unknownArgs.length % 2 !== 0) {
@@ -177,7 +186,7 @@ function generate(source, action) {
177
186
  }
178
187
  });
179
188
  const isCustomSource = source === 'custom';
180
- const sourceModule = yield (_a = `./${source}`, Promise.resolve().then(() => __importStar(require(_a))));
189
+ const sourceModule = yield Promise.resolve(`${`./${source}`}`).then(s => __importStar(require(s)));
181
190
  eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), isCustomSource ? yield sourceModule.getRuleId() : 'NULL');
182
191
  const evenData = !isCustomSource ? yield sourceModule.getData(optionMap) : optionMap.payload;
183
192
  eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(evenData));
@@ -193,4 +202,3 @@ function generate(source, action) {
193
202
  return jsonContent;
194
203
  });
195
204
  }
196
- exports.generate = generate;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const runtime_store_1 = __importDefault(require("../runtime-store"));
18
19
  const js_1 = require("../util_modules/js");
@@ -60,7 +61,6 @@ function getData() {
60
61
  };
61
62
  });
62
63
  }
63
- exports.getData = getData;
64
64
  function getRandomBoolean() {
65
65
  return js_1.JS.random(0, 1) === 1;
66
66
  }
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const runtime_store_1 = __importDefault(require("../runtime-store"));
18
19
  const js_1 = require("../util_modules/js");
@@ -48,4 +49,3 @@ function getData() {
48
49
  };
49
50
  });
50
51
  }
51
- exports.getData = getData;
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getData = exports.sourceId = void 0;
15
+ exports.sourceId = void 0;
16
+ exports.getData = getData;
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const endpoints_1 = require("../endpoints");
18
19
  const runtime_store_1 = __importDefault(require("../runtime-store"));
@@ -50,4 +51,3 @@ function getData() {
50
51
  };
51
52
  });
52
53
  }
53
- exports.getData = getData;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { IFnTarget } from '../fn-utils/lib/common';
3
2
  import { EventEmitter } from 'stream';
4
3
  import { IServerDetails } from '../serve/server';
@@ -26,6 +26,7 @@ const port_resolver_1 = __importDefault(require("../port-resolver"));
26
26
  const project_1 = require("../util_modules/project");
27
27
  const container_1 = require("../util_modules/container");
28
28
  const fn_execution_handler_1 = require("../shell/dependencies/non-http-function/fn-execution-handler");
29
+ const child_process_1 = require("child_process");
29
30
  class Caller extends fn_execution_handler_1.FnExecutionHandler {
30
31
  constructor(serverDetails, localFnEvents) {
31
32
  var _a, _b;
@@ -40,8 +41,8 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
40
41
  };
41
42
  }
42
43
  call(data) {
43
- var _a, _b, _c, _d, _e, _f, _g, _h;
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
+ var _a, _b, _c, _d, _e, _f, _g, _h;
45
46
  if (typeof data !== 'object') {
46
47
  throw new error_1.default('Data is not a valid JSON object', { exit: 1 });
47
48
  }
@@ -63,6 +64,9 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
63
64
  if (this.fn.target.type === constants_1.FN_TYPE.cron) {
64
65
  data = { data };
65
66
  }
67
+ if (this.fn.target.type === constants_1.FN_TYPE.integration) {
68
+ data.timestamp = Date.now();
69
+ }
66
70
  const accessToken = yield credential_1.default.getAccessToken();
67
71
  yield fs_1.ASYNC.ensureFile(this.responseFile, true);
68
72
  yield fs_1.ASYNC.ensureFile(this.metaFile, true);
@@ -124,14 +128,25 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
124
128
  (0, shell_1.clearLine)(process.stdout);
125
129
  (0, index_1.info)(message.toString());
126
130
  });
127
- this.slave.on('error', (err) => {
128
- this.localFnEvents.listenerCount('error') > 0 && this.localFnEvents.emit('error', err);
129
- });
130
131
  return new Promise((resolve, reject) => {
131
132
  if (!this.slave) {
132
133
  return reject(new error_1.default('Invalid slave'));
133
134
  }
134
- this.slave.on('exit', (code, sig) => __awaiter(this, void 0, void 0, function* () {
135
+ if (this.slave instanceof child_process_1.ChildProcess && this.slave.exitCode) {
136
+ (0, index_1.debug)('Slave process exited prematurely');
137
+ this.slave.exitCode > 0
138
+ ? reject(new error_1.default('Slave exited with code: ' + this.slave.exitCode))
139
+ : resolve();
140
+ return;
141
+ }
142
+ this.slave.once('error', (err) => {
143
+ var _a, _b;
144
+ (0, index_1.debug)('Slave error in executing function ' + ((_b = (_a = this.fn) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.name), err);
145
+ this.localFnEvents.listenerCount('error') > 0 &&
146
+ this.localFnEvents.emit('error', err);
147
+ reject(err);
148
+ });
149
+ this.slave.once('exit', (code, sig) => __awaiter(this, void 0, void 0, function* () {
135
150
  (0, index_1.debug)(`caller fn slave exit: ${code}, ${sig}`);
136
151
  if (this.isContainer && code === 143) {
137
152
  code = 0;
@@ -151,8 +166,6 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
151
166
  kill: { get: () => super.kill }
152
167
  });
153
168
  return __awaiter(this, void 0, void 0, function* () {
154
- (0, index_1.info)();
155
- (0, index_1.info)('Terminating Function');
156
169
  _super.kill.call(this);
157
170
  });
158
171
  }
@@ -26,6 +26,8 @@ const caller_js_1 = require("./caller.js");
26
26
  const runtime_store_1 = __importDefault(require("../runtime-store"));
27
27
  const stream_1 = require("stream");
28
28
  const throbber_1 = __importDefault(require("../throbber"));
29
+ const util_1 = require("util");
30
+ const pip_install_1 = require("../init/dependencies/python/pip-install");
29
31
  exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function* () {
30
32
  const buildFolder = (0, project_js_1.resolveProjectPath)(index_js_3.FOLDERNAME.build);
31
33
  try {
@@ -42,8 +44,7 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
42
44
  throw new index_js_2.default('Error running pre cleanup', {
43
45
  original: err,
44
46
  exit: 1,
45
- errorId: 'SERVE-2',
46
- arg: [(0, ansi_colors_1.bold)(index_js_3.FOLDERNAME.build), ansi_colors_1.italic.red(buildFolder)]
47
+ skipHelp: true
47
48
  });
48
49
  }
49
50
  }
@@ -54,7 +55,26 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
54
55
  });
55
56
  const [_nodeFns, javaFns, _pythonFns] = yield (0, index_js_5.prepareFunctions)([target]);
56
57
  javaFns && (0, compile_js_1.printCompilationLog)(javaFns);
58
+ const pyStacks = [];
59
+ _pythonFns === null || _pythonFns === void 0 ? void 0 : _pythonFns.forEach((target) => {
60
+ if (!pyStacks.includes(target.stack + '') && target.valid) {
61
+ pyStacks.push(target.stack + '');
62
+ }
63
+ });
64
+ yield Promise.all(pyStacks.map((stack) => __awaiter(void 0, void 0, void 0, function* () {
65
+ var _a, _b;
66
+ yield (0, pip_install_1.ensurePyRuntime)(index_js_3.ENVPATH.runtimes.data, stack, (_b = (_a = _pythonFns === null || _pythonFns === void 0 ? void 0 : _pythonFns.at(0)) === null || _a === void 0 ? void 0 : _a.additionalInfo) === null || _b === void 0 ? void 0 : _b.binPath);
67
+ })));
57
68
  const debugPort = runtime_store_1.default.get(`context.port.debug.${target.type}.${target.name}`, -1);
69
+ const preparedFn = [_nodeFns, javaFns, _pythonFns]
70
+ .flat()
71
+ .find((fn) => (fn === null || fn === void 0 ? void 0 : fn.name) === target.name);
72
+ if ((preparedFn === null || preparedFn === void 0 ? void 0 : preparedFn.valid) === false) {
73
+ throw new index_js_2.default(`Error preparing function ${(0, ansi_colors_1.bold)(target.name)} for execution because ${target.failure_reason}`, {
74
+ exit: 1,
75
+ skipHelp: true
76
+ });
77
+ }
58
78
  const caller = new caller_js_1.Caller({
59
79
  type: 'functions',
60
80
  target,
@@ -72,14 +92,17 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
72
92
  (0, index_1.info)();
73
93
  }
74
94
  catch (e) {
95
+ utils_1.serverEvent.emit('error', e);
75
96
  index_js_4.ASYNC.deleteDir(buildFolder).catch();
76
- utils_1.serverEvent.emit('stop');
77
97
  if (typeof e === 'number') {
78
98
  (0, index_1.debug)('Execute function program termination by code: ', 130);
79
99
  }
80
100
  else {
81
- throw e;
101
+ (0, index_1.info)();
102
+ (0, index_1.info)(ansi_colors_1.bold.red('Function execution failed'));
103
+ (0, index_1.info)(ansi_colors_1.italic.red('Reason: ') + (e instanceof Error ? e.message : (0, util_1.inspect)(e)));
82
104
  }
105
+ utils_1.serverEvent.emit('stop');
83
106
  }
84
107
  finally {
85
108
  utils_1.serverEvent.emit('close');