zcatalyst-cli 1.25.3 → 1.26.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 (262) 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 +2 -3
  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 +15 -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 +19 -9
  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/start.js +12 -5
  175. package/lib/serve/server/lib/appsail/util.d.ts +11 -0
  176. package/lib/serve/server/lib/appsail/util.js +69 -0
  177. package/lib/serve/server/lib/java/index.js +18 -7
  178. package/lib/serve/server/lib/master/appsail.js +3 -4
  179. package/lib/serve/server/lib/master/functions.js +1 -2
  180. package/lib/serve/server/lib/master/index.d.ts +0 -1
  181. package/lib/serve/server/lib/master/index.js +5 -5
  182. package/lib/serve/server/lib/master/slate.js +1 -2
  183. package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
  184. package/lib/serve/server/lib/master/utils.d.ts +4 -8
  185. package/lib/serve/server/lib/master/utils.js +4 -6
  186. package/lib/serve/server/lib/master/web-client.js +1 -2
  187. package/lib/serve/server/lib/node/index.js +22 -11
  188. package/lib/serve/server/lib/node/server/browserlogic/utils/playwright-handler.js +1 -1
  189. package/lib/serve/server/lib/node/server/browserlogic/utils/puppeteer-handler.js +1 -1
  190. package/lib/serve/server/lib/node/server/browserlogic/utils/selenium-handler.js +2 -0
  191. package/lib/serve/server/lib/python/index.js +23 -14
  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 +2 -2
  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.js +5 -6
  228. package/lib/util_modules/config-store.d.ts +1 -1
  229. package/lib/util_modules/config-store.js +30 -13
  230. package/lib/util_modules/constants/lib/apig-rules.d.ts +1 -1
  231. package/lib/util_modules/constants/lib/dc-type.js +3 -3
  232. package/lib/util_modules/constants/lib/placeholders.d.ts +1 -1
  233. package/lib/util_modules/constants/lib/placeholders.js +1 -1
  234. package/lib/util_modules/constants/lib/urls.js +2 -9
  235. package/lib/util_modules/container.js +23 -14
  236. package/lib/util_modules/dc.js +3 -4
  237. package/lib/util_modules/env.d.ts +3 -0
  238. package/lib/util_modules/env.js +64 -4
  239. package/lib/util_modules/event-emitter.d.ts +9 -0
  240. package/lib/util_modules/event-emitter.js +68 -0
  241. package/lib/util_modules/fs/index.js +17 -7
  242. package/lib/util_modules/fs/lib/async.d.ts +0 -4
  243. package/lib/util_modules/fs/lib/async.js +46 -46
  244. package/lib/util_modules/fs/lib/sync.d.ts +1 -3
  245. package/lib/util_modules/fs/lib/sync.js +40 -30
  246. package/lib/util_modules/logger/index.js +12 -12
  247. package/lib/util_modules/logger/utils.d.ts +0 -4
  248. package/lib/util_modules/logger/utils.js +1 -1
  249. package/lib/util_modules/logger/winston.js +2 -2
  250. package/lib/util_modules/option.js +5 -6
  251. package/lib/util_modules/project.js +22 -23
  252. package/lib/util_modules/runtime-store.d.ts +2 -2
  253. package/lib/util_modules/server.d.ts +1 -2
  254. package/lib/util_modules/server.js +54 -15
  255. package/lib/util_modules/shell.d.ts +0 -3
  256. package/lib/util_modules/shell.js +5 -6
  257. package/lib/util_modules/toml.js +2 -3
  258. package/package.json +13 -13
  259. package/templates/init/functions/java/event/sample.java +5 -2
  260. package/templates/web-socket.txt +1 -1
  261. /package/lib/docs/{commands/event/generate → event_generate}/index.toml +0 -0
  262. /package/templates/init/functions/java/integ/convokraft/{Sample.java → sample.java} +0 -0
@@ -1,6 +1,6 @@
1
1
  export default class Store {
2
2
  private static _store;
3
- static changeStore(store: 'cli' | 'vscode', path?: string): void;
3
+ static changeStore(store: 'cli' | 'vscode' | 'zcode', path?: string): void;
4
4
  private static get istore();
5
5
  static get path(): string | undefined;
6
6
  static get store(): Record<string, unknown>;
@@ -5,22 +5,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const conf_1 = __importDefault(require("conf"));
7
7
  const path_1 = require("path");
8
+ const error_1 = __importDefault(require("../error"));
8
9
  const path = process.env['X_ZC_CREDENTIAL_PATH'];
9
10
  class Store {
10
11
  static changeStore(store, path) {
11
- if (store === 'cli') {
12
- Store._store = new conf_1.default({
13
- configName: 'zcatalyst-cli',
14
- projectName: 'zcatalyst-cli',
15
- cwd: path
16
- });
17
- return;
12
+ switch (store) {
13
+ case 'cli': {
14
+ Store._store = new conf_1.default({
15
+ configName: 'zcatalyst-cli',
16
+ projectName: 'zcatalyst-cli',
17
+ cwd: path
18
+ });
19
+ return;
20
+ }
21
+ case 'vscode': {
22
+ Store._store = new conf_1.default({
23
+ configName: 'auth',
24
+ projectName: 'zcatalyst-vscode',
25
+ cwd: path ? (0, path_1.join)(path, 'zcatalyst-vscode') : undefined
26
+ });
27
+ return;
28
+ }
29
+ case 'zcode': {
30
+ Store._store = new conf_1.default({
31
+ configName: 'auth',
32
+ projectName: 'zcatalyst-zcode',
33
+ cwd: path ? (0, path_1.join)(path, 'zcatalyst-code') : undefined
34
+ });
35
+ return;
36
+ }
37
+ default: {
38
+ throw new error_1.default('Invalid Store type: ' + store, { exit: 2 });
39
+ }
18
40
  }
19
- Store._store = new conf_1.default({
20
- configName: 'auth',
21
- projectName: 'zcatalyst-vscode',
22
- cwd: path ? (0, path_1.join)(path, 'zcatalyst-vscode') : undefined
23
- });
24
41
  }
25
42
  static get istore() {
26
43
  return Store._store;
@@ -47,9 +64,9 @@ class Store {
47
64
  return Store.istore.has(key);
48
65
  }
49
66
  }
50
- exports.default = Store;
51
67
  Store._store = new conf_1.default({
52
68
  configName: 'zcatalyst-cli',
53
69
  projectName: 'zcatalyst-cli',
54
70
  cwd: path
55
71
  });
72
+ exports.default = Store;
@@ -1,3 +1,3 @@
1
1
  import { IAPIGRules } from '../../../apig-utils';
2
- declare const _default: IAPIGRules[];
2
+ declare const _default: Array<IAPIGRules>;
3
3
  export default _default;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = Object.freeze({
4
4
  us: {
5
- loc: 'UnitedStates',
5
+ loc: 'United States',
6
6
  ref: 'us',
7
7
  value: 'com',
8
8
  w_auth: 'us',
@@ -42,7 +42,7 @@ exports.default = Object.freeze({
42
42
  ext: '.ca'
43
43
  },
44
44
  sa: {
45
- loc: 'SaudiArabia',
45
+ loc: 'Saudi Arabia',
46
46
  ref: 'sa',
47
47
  value: 'sa',
48
48
  w_auth: 'us',
@@ -58,7 +58,7 @@ exports.default = Object.freeze({
58
58
  ext: '.jp'
59
59
  },
60
60
  uae: {
61
- loc: 'UnitedArabEmirates',
61
+ loc: 'United Arab Emirates',
62
62
  ref: 'ae',
63
63
  value: 'ae',
64
64
  w_auth: 'us',
@@ -1,6 +1,6 @@
1
1
  declare const _default: Readonly<{
2
2
  client: {
3
- port: string;
3
+ domain: string;
4
4
  package: {
5
5
  name: string;
6
6
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = Object.freeze({
4
4
  client: {
5
- port: '{{_PORT_}}',
5
+ domain: '{{_DOMAIN_}}',
6
6
  package: {
7
7
  name: '{{_NAME_}}'
8
8
  }
@@ -35,20 +35,12 @@ class URL {
35
35
  return (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', mapDataCenterUrl(URL._consoleBase));
36
36
  }
37
37
  static get contacts() {
38
- const dc = (0, dc_js_1.getActiveDCType)();
39
- if (dc === undefined) {
40
- return URL._contacts;
41
- }
42
- if (dc.value === dc_type_js_1.default.ca.value) {
43
- return URL._contacts.replace('.zoho.com', '.zohocloud.ca');
44
- }
45
- return URL._contacts.replace('.com', dc.ext);
38
+ return (0, env_js_1.envOverride)('ZOHO_CONTACTS', mapDataCenterUrl(URL._contacts));
46
39
  }
47
40
  static get stratusSuffix() {
48
41
  return (0, env_js_1.envOverride)('CATALYST_STRATUS_RESOURCE_SUFFIX', mapDataCenterUrl(URL._stratusSuffixBase));
49
42
  }
50
43
  }
51
- exports.default = URL;
52
44
  URL._authBase = 'https://accounts.zoho.com';
53
45
  URL._portalBase = 'https://accounts.zohoportal.com';
54
46
  URL._adminBase = 'https://api.catalyst.zoho.com';
@@ -63,6 +55,7 @@ URL.external = Object.freeze({
63
55
  gitHubAPI: 'https://api.github.com',
64
56
  gitHubWeb: 'https://github.com'
65
57
  });
58
+ exports.default = URL;
66
59
  function mapDataCenterUrl(url) {
67
60
  const dc = (0, dc_js_1.getActiveDCType)();
68
61
  if (dc === undefined) {
@@ -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,9 @@ 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.isContainer = exports.isSocketAccessible = exports.showContainerUsagePrompt = void 0;
48
+ exports.showContainerUsagePrompt = showContainerUsagePrompt;
49
+ exports.isSocketAccessible = isSocketAccessible;
50
+ exports.isContainer = isContainer;
39
51
  const ansi_colors_1 = require("ansi-colors");
40
52
  const logger_1 = require("./logger");
41
53
  const cli_table_1 = require("../cli_table");
@@ -45,8 +57,8 @@ const error_1 = __importDefault(require("@zcatalyst/container-plugin/out/error")
45
57
  const userConfig_1 = __importStar(require("../userConfig"));
46
58
  const error_2 = __importDefault(require("../error"));
47
59
  function showContainerUsagePrompt() {
48
- var _a, _b;
49
60
  return __awaiter(this, void 0, void 0, function* () {
61
+ var _a, _b;
50
62
  const headerText = 'Attention Developer !!!';
51
63
  const padding = Math.round((process.stdout.columns - headerText.length) / 2) - 2;
52
64
  const fillLen = padding + headerText.length + padding - 2;
@@ -152,9 +164,8 @@ function showContainerUsagePrompt() {
152
164
  (0, logger_1.info)('\n' + table.toString());
153
165
  });
154
166
  }
155
- exports.showContainerUsagePrompt = showContainerUsagePrompt;
156
- function isSocketAccessible(throwErr = true) {
157
- return __awaiter(this, void 0, void 0, function* () {
167
+ function isSocketAccessible() {
168
+ return __awaiter(this, arguments, void 0, function* (throwErr = true) {
158
169
  if (!(yield (0, container_plugin_1.ping)(false))) {
159
170
  const error = new error_2.default('Docker socket not accessible', {
160
171
  exit: 1,
@@ -169,8 +180,6 @@ function isSocketAccessible(throwErr = true) {
169
180
  return true;
170
181
  });
171
182
  }
172
- exports.isSocketAccessible = isSocketAccessible;
173
183
  function isContainer() {
174
184
  return false;
175
185
  }
176
- exports.isContainer = isContainer;
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateActiveDC = exports.getActiveDCType = exports.getActiveDC = void 0;
6
+ exports.getActiveDC = getActiveDC;
7
+ exports.getActiveDCType = getActiveDCType;
8
+ exports.updateActiveDC = updateActiveDC;
7
9
  const ansi_colors_1 = require("ansi-colors");
8
10
  const path_1 = require("path");
9
11
  const config_store_js_1 = __importDefault(require("./config-store.js"));
@@ -35,13 +37,10 @@ function getActiveDC(dcOption) {
35
37
  }
36
38
  return config_store_js_1.default.get('active_dc', dc_type_js_1.default.us.value);
37
39
  }
38
- exports.getActiveDC = getActiveDC;
39
40
  function getActiveDCType() {
40
41
  const activeDC = getActiveDC();
41
42
  return Object.values(dc_type_js_1.default).find((type) => type.value === activeDC);
42
43
  }
43
- exports.getActiveDCType = getActiveDCType;
44
44
  function updateActiveDC(dc) {
45
45
  config_store_js_1.default.set('active_dc', dc);
46
46
  }
47
- exports.updateActiveDC = updateActiveDC;
@@ -2,6 +2,9 @@ export declare const isCI: boolean;
2
2
  export declare const isMac: boolean;
3
3
  export declare const isWindows: boolean;
4
4
  export declare const isVsCode: boolean;
5
+ export declare const isZCode: boolean;
6
+ export declare const isExtension: boolean;
5
7
  export declare function isPrimaryShell(): boolean;
6
8
  export declare function envOverride(envname: string, value: string): string;
7
9
  export declare function getEnvVariable(variable: string, fallback?: unknown): unknown;
10
+ export declare const getLocalAccessDomain: (port: number, protocol?: "http" | "ws") => string;
@@ -1,6 +1,42 @@
1
1
  'use strict';
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = 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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEnvVariable = exports.envOverride = exports.isPrimaryShell = exports.isVsCode = exports.isWindows = exports.isMac = exports.isCI = void 0;
36
+ exports.getLocalAccessDomain = exports.isExtension = exports.isZCode = exports.isVsCode = exports.isWindows = exports.isMac = exports.isCI = void 0;
37
+ exports.isPrimaryShell = isPrimaryShell;
38
+ exports.envOverride = envOverride;
39
+ exports.getEnvVariable = getEnvVariable;
4
40
  exports.isCI = process &&
5
41
  !!(process.env.CI ||
6
42
  process.env.CONTINUOUS_INTEGRATION ||
@@ -13,6 +49,8 @@ exports.isWindows = process &&
13
49
  (process.platform === 'win32' ||
14
50
  (process.env.OSTYPE !== undefined && /^(msys|cygwin)$/.test(process.env.OSTYPE)));
15
51
  exports.isVsCode = process.env.ZCATALYST_VSCODE === 'true';
52
+ exports.isZCode = process.env.ZCODE === 'true';
53
+ exports.isExtension = exports.isVsCode || exports.isZCode;
16
54
  function isPrimaryShell() {
17
55
  if (!process || process.env.CATALYST_SUB_PROCESS) {
18
56
  return false;
@@ -22,7 +60,6 @@ function isPrimaryShell() {
22
60
  }
23
61
  return true;
24
62
  }
25
- exports.isPrimaryShell = isPrimaryShell;
26
63
  function envOverride(envname, value) {
27
64
  var _a;
28
65
  if (process.env[envname] !== undefined && ((_a = process.env[envname]) === null || _a === void 0 ? void 0 : _a.length)) {
@@ -30,8 +67,31 @@ function envOverride(envname, value) {
30
67
  }
31
68
  return value;
32
69
  }
33
- exports.envOverride = envOverride;
34
70
  function getEnvVariable(variable, fallback) {
35
71
  return process.env[variable] || fallback;
36
72
  }
37
- exports.getEnvVariable = getEnvVariable;
73
+ let zcode;
74
+ if (exports.isZCode) {
75
+ const moduleName = 'zcode';
76
+ Promise.resolve(`${moduleName}`).then(s => __importStar(require(s))).then((_code) => {
77
+ zcode = _code;
78
+ })
79
+ .catch((er) => {
80
+ console.error('Unable to import ZCode: ', er);
81
+ });
82
+ }
83
+ const getLocalAccessDomain = (port, protocol = 'http') => {
84
+ var _a;
85
+ if (zcode) {
86
+ try {
87
+ const previewUrl = (_a = zcode.workspace) === null || _a === void 0 ? void 0 : _a.previewURL(port);
88
+ if (previewUrl)
89
+ return protocol === 'http' ? previewUrl : previewUrl.replace(/^http/, 'ws');
90
+ }
91
+ catch (er) {
92
+ console.error('Error getting previewURL from ZCode: ', er);
93
+ }
94
+ }
95
+ return protocol === 'http' ? `http://localhost:${port}` : `ws://localhost:${port}`;
96
+ };
97
+ exports.getLocalAccessDomain = getLocalAccessDomain;
@@ -0,0 +1,9 @@
1
+ import EventEmitter from 'events';
2
+ export declare class CatalystEventEmitter extends EventEmitter {
3
+ private listenerMap;
4
+ on(event: string, listener: Parameters<EventEmitter['on']>[1]): this;
5
+ once(event: string, listener: Parameters<EventEmitter['once']>[1]): this;
6
+ removeListener(event: string, listener: Parameters<EventEmitter['on']>[1]): this;
7
+ off(event: string, listener: Parameters<EventEmitter['off']>[1]): this;
8
+ emit(...args: Parameters<EventEmitter['emit']>): boolean;
9
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CatalystEventEmitter = void 0;
7
+ const events_1 = __importDefault(require("events"));
8
+ const error_1 = __importDefault(require("../error"));
9
+ const logger_1 = require("./logger");
10
+ class CatalystEventEmitter extends events_1.default {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.listenerMap = new WeakMap();
14
+ }
15
+ on(event, listener) {
16
+ const wrappedListener = (...args) => {
17
+ try {
18
+ listener(...args);
19
+ }
20
+ catch (er) {
21
+ throw error_1.default.getErrorInstance(er, {
22
+ message: 'Error when processing the <on> listener of ServerEvent: ' + event,
23
+ skipHelp: true
24
+ });
25
+ }
26
+ };
27
+ this.listenerMap.set(listener, wrappedListener);
28
+ super.on(event, wrappedListener);
29
+ return this;
30
+ }
31
+ once(event, listener) {
32
+ const wrappedListener = (...args) => {
33
+ try {
34
+ listener(...args);
35
+ }
36
+ catch (er) {
37
+ throw error_1.default.getErrorInstance(er, {
38
+ message: 'Error when processing the <once> listener of ServerEvent: ' + event,
39
+ skipHelp: true
40
+ });
41
+ }
42
+ this.listenerMap.delete(listener);
43
+ };
44
+ this.listenerMap.set(listener, wrappedListener);
45
+ super.once(event, wrappedListener);
46
+ return this;
47
+ }
48
+ removeListener(event, listener) {
49
+ const wrappedListener = this.listenerMap.get(listener);
50
+ if (wrappedListener) {
51
+ super.removeListener(event, wrappedListener);
52
+ this.listenerMap.delete(listener);
53
+ }
54
+ return this;
55
+ }
56
+ off(event, listener) {
57
+ return this.removeListener(event, listener);
58
+ }
59
+ emit(...args) {
60
+ const [event] = args;
61
+ if (event === 'error' && this.listenerCount('error') === 0) {
62
+ (0, logger_1.debug)('Unable to emit "error" event as no listeners are attached');
63
+ return false;
64
+ }
65
+ return super.emit(...args);
66
+ }
67
+ }
68
+ exports.CatalystEventEmitter = CatalystEventEmitter;
@@ -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
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ASYNC = exports.SYNC = void 0;
27
37
  const ASYNC = __importStar(require("./lib/async"));
@@ -1,7 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
1
  import fs, { CopyFilterAsync, Stats } from 'fs-extra';
6
2
  type OutputType = 'buffer' | 'utf8' | undefined;
7
3
  type OutputByType<T> = T extends 'buffer' ? Buffer : string;