zcatalyst-cli 1.18.0-beta.8 → 1.18.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 (145) hide show
  1. package/README.md +11 -6
  2. package/docs/commands/slate/unlink.toml +9 -0
  3. package/docs/endpoints/lib/env.toml +3 -1
  4. package/docs/endpoints/lib/slate.toml +3 -0
  5. package/docs/serve/server/lib/slate/index.toml +14 -0
  6. package/docs/slate-utils.toml +4 -0
  7. package/docs/util_modules/config/lib/slate.toml +4 -0
  8. package/lib/archiver.js +18 -9
  9. package/lib/authentication/login.js +6 -5
  10. package/lib/code-deck.js +5 -6
  11. package/lib/command_needs/auth.js +1 -1
  12. package/lib/command_needs/rc.js +40 -3
  13. package/lib/commands/codelib/install.js +1 -0
  14. package/lib/commands/deploy/index.js +4 -0
  15. package/lib/commands/deploy/slate.js +58 -0
  16. package/lib/commands/index.js +2 -3
  17. package/lib/commands/init.js +0 -10
  18. package/lib/commands/slate/create.js +59 -0
  19. package/lib/commands/slate/link.js +59 -0
  20. package/lib/commands/slate/unlink.js +75 -0
  21. package/lib/commands/zest/generate/index.js +1 -6
  22. package/lib/config-store.js +2 -1
  23. package/lib/deploy/features/index.js +3 -0
  24. package/lib/deploy/features/slate.js +123 -0
  25. package/lib/endpoints/index.js +8 -1
  26. package/lib/endpoints/lib/env.js +2 -1
  27. package/lib/endpoints/lib/sdk.js +2 -2
  28. package/lib/endpoints/lib/slate.js +107 -0
  29. package/lib/fn-utils/lib/common.js +1 -1
  30. package/lib/iac/status/deploy.js +1 -5
  31. package/lib/index.js +1 -1
  32. package/lib/init/features/appsail/index.js +2 -3
  33. package/lib/init/features/index.js +13 -1
  34. package/lib/init/features/project.js +1 -1
  35. package/lib/init/features/slate/index.js +313 -0
  36. package/lib/internal/api.js +1 -1
  37. package/lib/internal/command.js +10 -6
  38. package/lib/port-resolver.js +7 -0
  39. package/lib/prompt/index.js +22 -6
  40. package/lib/prompt/types/file-path.js +10 -7
  41. package/lib/serve/features/index.js +8 -1
  42. package/lib/serve/features/slate.js +47 -0
  43. package/lib/serve/server/index.js +61 -1
  44. package/lib/serve/server/lib/appsail/index.js +2 -2
  45. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  46. package/lib/serve/server/lib/java/aio_server/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  47. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  48. package/lib/serve/server/lib/java/index.js +1 -1
  49. package/lib/serve/server/lib/master/index.js +25 -21
  50. package/lib/serve/server/lib/master/slate.js +45 -0
  51. package/lib/serve/server/lib/master/unknown-req-proxy.js +1 -1
  52. package/lib/serve/server/lib/master/utils.js +9 -3
  53. package/lib/serve/server/lib/node/index.js +1 -1
  54. package/lib/serve/server/lib/python/index.js +1 -1
  55. package/lib/serve/server/lib/slate/index.js +115 -0
  56. package/lib/serve/server/lib/slate/static-server.js +194 -0
  57. package/lib/serve/server/lib/web_client/server.js +2 -1
  58. package/lib/shell/dependencies/http-functions.js +1 -1
  59. package/lib/shell/dependencies/invoker/bio/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  60. package/lib/shell/dependencies/invoker/cron/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  61. package/lib/shell/dependencies/invoker/event/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  62. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  63. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  64. package/lib/shell/dependencies/local-function.js +3 -3
  65. package/lib/slate-utils.js +212 -0
  66. package/lib/util_modules/config/index.js +3 -1
  67. package/lib/util_modules/config/lib/slate.js +98 -0
  68. package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
  69. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  70. package/lib/util_modules/constants/lib/default.js +4 -0
  71. package/lib/util_modules/constants/lib/file-names.js +7 -1
  72. package/lib/util_modules/constants/lib/folder-names.js +1 -0
  73. package/lib/util_modules/constants/lib/placeholders.js +2 -1
  74. package/lib/util_modules/constants/lib/scopes.js +1 -6
  75. package/lib/util_modules/context-help.js +2 -2
  76. package/lib/util_modules/fs/lib/async.js +14 -3
  77. package/lib/util_modules/fs/lib/sync.js +6 -1
  78. package/lib/util_modules/parser/toml.js +20 -5
  79. package/package.json +3 -3
  80. package/templates/event/integ/cliq/bot/action_handler.json +13 -4
  81. package/templates/event/integ/cliq/bot/call_handler.json +41 -0
  82. package/templates/event/integ/cliq/bot/context_handler.json +11 -3
  83. package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
  84. package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
  85. package/templates/event/integ/cliq/bot/message_handler.json +13 -4
  86. package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
  87. package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
  88. package/templates/event/integ/cliq/command/execution_handler.json +12 -3
  89. package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
  90. package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
  91. package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
  92. package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
  93. package/templates/event/integ/cliq/function/button_handler.json +13 -5
  94. package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
  95. package/templates/event/integ/cliq/function/form_handler.json +11 -3
  96. package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
  97. package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
  98. package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
  99. package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
  100. package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
  101. package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
  102. package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
  103. package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
  104. package/templates/event/integ/cliq/widget/view_handler.json +12 -4
  105. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  106. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  107. package/templates/init/client/react/react_ts/template.json +3 -3
  108. package/templates/init/functions/java/event/sample.java +4 -0
  109. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
  110. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
  111. package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
  112. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
  113. package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
  114. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
  115. package/templates/init/functions/java/integ/cliq/sample.java +10 -0
  116. package/templates/init/functions/node/aio/package.json +1 -1
  117. package/templates/init/functions/node/bio/package.json +1 -1
  118. package/templates/init/functions/node/cron/package.json +1 -1
  119. package/templates/init/functions/node/event/package.json +1 -1
  120. package/templates/init/functions/node/event/sample.js +1 -0
  121. package/templates/init/functions/node/event/types/event.d.ts +7 -0
  122. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
  123. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
  124. package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
  125. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
  126. package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
  127. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  128. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  129. package/templates/init/functions/node/job/package.json +1 -1
  130. package/templates/init/functions/python/event/sample.py +9 -5
  131. package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
  132. package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
  133. package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
  134. package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
  135. package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
  136. package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
  137. package/templates/init/functions/python/integ/cliq/sample.py +2 -2
  138. package/templates/init.txt +2 -1
  139. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  140. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  141. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
  142. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
  143. package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
  144. package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
  145. package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <center>
2
- <a href="https://www.zoho.com/catalyst/">
2
+ <a href="https://catalyst.zoho.com/
3
3
  <img width="200" height="200" src="https://www.zohowebstatic.com/sites/default/files/catalyst/catalyst-logo.svg">
4
4
  </a>
5
5
  </center>
@@ -25,7 +25,7 @@ This is the Catalyst Command Line Interface (CLI) Tool. They can be used to:
25
25
  - Interact with data in your Catalyst projects via console
26
26
  - Deploy code and assets to your Catalyst projects
27
27
 
28
- To get started with the Catalyst CLI, you can go through our documentation [CLI documentation](https://www.zoho.com/catalyst/help/cli-command-reference.html).
28
+ To get started with the Catalyst CLI, you can go through our documentation [CLI documentation](https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/).
29
29
 
30
30
  ## Installation
31
31
 
@@ -37,7 +37,7 @@ Then you need to install [Node.js](http://nodejs.org/) and [npm](https://npmjs.o
37
37
  **NOTE**
38
38
 
39
39
  1. Installing Node.js should install npm as well.
40
- 2. The ZCatalyst-CLI is compatible only with node versions >=12.
40
+ 2. The ZCatalyst-CLI is compatible only with node versions >=14.
41
41
 
42
42
  ---
43
43
 
@@ -55,7 +55,7 @@ This will provide you with the globally accessible `catalyst` command.
55
55
 
56
56
  1. If you need to setup the cli in current directory alone use the same command without `-g` option.
57
57
 
58
- 2. Alternatively you can visit [CLI Installation Documentation](https://www.zoho.com/catalyst/help/installing-catalyst-cli.html) for installation instructions.
58
+ 2. Alternatively you can visit [CLI Installation Documentation](https://docs.catalyst.zoho.com/en/getting-started/installing-catalyst-cli/) for installation instructions.
59
59
 
60
60
  ---
61
61
 
@@ -69,6 +69,7 @@ Certain command are project specific and for it to work you must be inside a pro
69
69
 
70
70
  Command | Description
71
71
  ------- | -----------
72
+ **help** | Display the command reference or help for a specific command.
72
73
  **login** | Log the CLI in to your Catalyst account. *Requires access to a web browser*.
73
74
  **whoami** | Print the email address of the user currently logged in.
74
75
  **token:generate** | Generate a token to authenticate accessing the CLI from a remote system.
@@ -96,13 +97,13 @@ Command | Description
96
97
  **functions:shell** | Launch a node shell to test emulated functions of any stack or type, other than Advanced I/O functions.
97
98
  **functions:config** | Perform advanced configurations such as memory allocation on a function in your project.
98
99
  **functions:delete** | Delete a function from the remote console or the local directory.
99
- **appsail:add** | Link an already existing AppSail service to Catalyst Project.
100
+ **appsail:add** | Link an already existing AppSail app to Catalyst Project.
100
101
  **codelib:install** | Install the code library functionalities into your project.
101
102
  **event:generate \| generate:event** | Generate sample payloads from different components or custom event sources to test Event functions.
102
103
  **event:generate:integ** | Generate sample payloads for the required integration service to test Integration functions.
104
+ **event:generate:job** | Generate sample payloads to test the job functions.
103
105
  **serve** | Serve Basic I/O and Advanced I/O functions, and the client, to test them locally.
104
106
  **deploy** | Deploy the Catalyst project and project resources to the remote console from the local directory.
105
- **help** | Display the command reference or help for a specific command.
106
107
  **run-script \| run** | Run a particular command script defined in *catalyst.json*.
107
108
  **config:set** | Set catalyst configuration as a key value pair.
108
109
  **config:get** | Get catalyst config value for the specified key.
@@ -122,3 +123,7 @@ This is to make sure your local project is upto date with the CLI version that i
122
123
  ### **v1.4.0**
123
124
 
124
125
  - Global configuration file (zcatalyst-cli-nodejs/zcatalyst-cli.json) structure change.
126
+
127
+ ### **v1.6.2**
128
+
129
+ - Global configuration file (zcatalyst-cli-nodejs/zcatalyst-cli.json) structure change.
@@ -0,0 +1,9 @@
1
+ [SLULK-1]
2
+ context = '''No app linked to the Catalyst Slate service.'''
3
+ aid = '''Please link your existing slate app by running the command ${arg[0]}.'''
4
+ link = ''
5
+
6
+ [SLULK-2]
7
+ context = '''No slate app linked with the given name.'''
8
+ aid = '''Please check the available slate apps by running the command ${arg[0]} without any options.'''
9
+ link = ''
@@ -1,3 +1,5 @@
1
1
  [ENV-1]
2
- context = '''The ${arg[0]} environment for the project ${arg[1]} has been ${arg[2]}.'''
2
+ context = '''The ${arg[0]} environment for the project ${arg[1]} has been ${arg[2]}.
3
+
4
+ Reason: ${arg[4]}'''
3
5
  aid = '''Please contact catalyst support at ${arg[3]}'''
@@ -0,0 +1,3 @@
1
+ [SLDC-1]
2
+ context = '''Slate is not enabled for the data center: ${arg[0]}'''
3
+ aid = '''Please contact Catalyst Support at ${arg[1]} for assistance.'''
@@ -0,0 +1,14 @@
1
+ [SERVE-SLATE-1]
2
+ context = '''The given app is not configured with catalyst project.'''
3
+ aid = '''Please run the command ${arg[1]} to link your app with catalyst project.'''
4
+ link = ''
5
+
6
+ [SERVE-SLATE-2]
7
+ context = '''Not able to start the server using the given development command ${arg[1]}.'''
8
+ aid = '''Please provide a valid development command'''
9
+ link = ''
10
+
11
+ [SERVE-SLATE-3]
12
+ context = '''Error when installing the dependencies.'''
13
+ aid = '''Please install the necessary packages before running the command ${arg[1]}'''
14
+ link = ''
@@ -0,0 +1,4 @@
1
+ [SLATE-UTILS-1]
2
+ context = '''The slate source directory ${arg[0]} does not exist.'''
3
+ aid = '''Please specify a valid source directory for the slate.'''
4
+ link = 'https://www.zoho.com/catalyst/help/slate-client.html'
@@ -0,0 +1,4 @@
1
+ [SLTARG-UTIL-1]
2
+ context = '''No slates are currently configured for this Catalyst project.'''
3
+ aid = '''Please add a Slate app by running the following command: ${arg[0]}'''
4
+ link = ''
package/lib/archiver.js CHANGED
@@ -55,25 +55,34 @@ class Archiver {
55
55
  this.jszip = (0, jszip_1.loadAsync)(content, { createFolders });
56
56
  return this;
57
57
  }
58
- _writeFolder(folder, to, recursive = false, ignoreInitial = false) {
58
+ _writeFolder(folder, to, recursive = false, ignoreLevel = 1) {
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
- return this._writeAllFile(folder.filter((_relPath, file) => !file.dir), to, recursive, ignoreInitial);
60
+ return this._writeAllFile(folder.filter((_relPath, file) => !file.dir), to, recursive, ignoreLevel);
61
61
  });
62
62
  }
63
- _writeAllFile(files, to, recursive = false, ignoreInitial = false) {
63
+ _writeAllFile(files, to, recursive = false, ignoreLevel = 0) {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
65
  while (files.length > 0) {
66
66
  const limit = files.length < Archiver.maxWriteLimit ? files.length : Archiver.maxWriteLimit;
67
67
  yield Promise.all(files.splice(0, limit).map((file) => __awaiter(this, void 0, void 0, function* () {
68
- const filePath = (0, path_1.join)(to, (0, path_1.dirname)(ignoreInitial ? file.name.substr(file.name.indexOf('/') + 1) : file.name));
68
+ const findIgnoreIndex = () => {
69
+ let index = 0, level = ignoreLevel;
70
+ while (level > 0) {
71
+ index = file.name.indexOf('/', index + 1);
72
+ level--;
73
+ }
74
+ return index;
75
+ };
76
+ const filePath = (0, path_1.join)(to, (0, path_1.dirname)(ignoreLevel !== 0
77
+ ? file.name.substring(findIgnoreIndex() + 1)
78
+ : file.name));
69
79
  yield fs_1.ASYNC.ensureDir(filePath);
70
80
  if (file.name.endsWith('.zip') && recursive) {
71
81
  const zipContent = yield file.async('nodebuffer');
72
82
  return new Archiver()
73
83
  .load(zipContent)
74
84
  .extract((0, path_1.join)(filePath, (0, path_1.basename)(file.name).replace('.zip', '')), '/', {
75
- recursive,
76
- ignoreInitial
85
+ recursive
77
86
  })
78
87
  .finalize();
79
88
  }
@@ -127,7 +136,7 @@ class Archiver {
127
136
  return fileObjArr[0].async('string');
128
137
  });
129
138
  }
130
- extract(to, from = '/', { isFolder = true, recursive = false, ignoreInitial = false } = {}) {
139
+ extract(to, from = '/', { isFolder = true, recursive = false, ignoreLevel = 0 } = {}) {
131
140
  const extractPromise = this.jszip.then((zip) => __awaiter(this, void 0, void 0, function* () {
132
141
  if (isFolder) {
133
142
  let folder = null;
@@ -152,7 +161,7 @@ class Archiver {
152
161
  exit: 2
153
162
  });
154
163
  }
155
- yield this._writeFolder(folder, to, recursive, ignoreInitial);
164
+ yield this._writeFolder(folder, to, recursive, ignoreLevel);
156
165
  return true;
157
166
  }
158
167
  const fromFileObj = [];
@@ -170,7 +179,7 @@ class Archiver {
170
179
  exit: 2
171
180
  });
172
181
  }
173
- yield this._writeAllFile(fromFileObj, to, recursive, ignoreInitial);
182
+ yield this._writeAllFile(fromFileObj, to, recursive, ignoreLevel);
174
183
  return true;
175
184
  }));
176
185
  this.promiseArr.push(extractPromise);
@@ -33,11 +33,12 @@ const logger_1 = require("../util_modules/logger");
33
33
  const option_1 = require("../util_modules/option");
34
34
  const crypto_1 = require("crypto");
35
35
  exports.missingScopes = {
36
- [constants_1.DC_TYPE.in.value]: getScopes(['zest', 'dataverse']),
37
- [constants_1.DC_TYPE.eu.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
38
- [constants_1.DC_TYPE.au.value]: getScopes(['zest', 'dataverse']),
39
- [constants_1.DC_TYPE.ca.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
40
- [constants_1.DC_TYPE.sa.value]: getScopes(['zest', 'quick_ml', 'dataverse'])
36
+ [constants_1.DC_TYPE.in.value]: getScopes(['dataverse']),
37
+ [constants_1.DC_TYPE.eu.value]: getScopes(['dataverse']),
38
+ [constants_1.DC_TYPE.au.value]: getScopes(['dataverse']),
39
+ [constants_1.DC_TYPE.ca.value]: getScopes(['quick_ml', 'dataverse']),
40
+ [constants_1.DC_TYPE.sa.value]: getScopes(['quick_ml', 'dataverse']),
41
+ [constants_1.DC_TYPE.jp.value]: getScopes(['dataverse'])
41
42
  };
42
43
  function getScopes(keys) {
43
44
  return Object.keys(constants_1.SCOPE).filter((scope) => keys.some((prefix) => scope.startsWith(prefix)));
package/lib/code-deck.js CHANGED
@@ -28,21 +28,20 @@ function listenDeploy(id, gitUrl) {
28
28
  const allGlobalOpts = runtime_store_1.default.get('opts.globalOpts', {});
29
29
  const optsArr = Object.keys(allGlobalOpts).reduce((arr, key) => {
30
30
  arr.push('--' + key);
31
- if (allGlobalOpts[key]) {
31
+ if (typeof allGlobalOpts[key] === 'string') {
32
32
  arr.push(allGlobalOpts[key]);
33
33
  }
34
34
  return arr;
35
35
  }, ['--id', id, '--org', (0, project_1.getEnvId)() || '']);
36
- const childRes = yield (0, shell_1.spawn)('catalyst', ['iac:status', 'import', ...optsArr], {
36
+ yield (0, shell_1.spawn)('catalyst', ['iac:status', 'import', ...optsArr], {
37
37
  shell: true,
38
38
  stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
39
39
  env: { PARENT_COMMAND: 'codedeck', GIT_URL: gitUrl }
40
- })
41
- .ASYNC()
42
- .catch((err) => (0, logger_1.debug)(err));
43
- return (childRes === null || childRes === void 0 ? void 0 : childRes.message) === 'success';
40
+ }).ASYNC();
41
+ return true;
44
42
  }
45
43
  catch (err) {
44
+ (0, logger_1.debug)('Error when listening for iac:status ', err);
46
45
  return false;
47
46
  }
48
47
  });
@@ -23,7 +23,7 @@ exports.default = (inScopes = []) => {
23
23
  },
24
24
  {
25
25
  option: 'CATALYST_TOKEN env',
26
- token: (0, env_1.getEnvVariable)('CATALYST_TOKEN'),
26
+ token: (0, env_1.getEnvVariable)('CATALYST_TOKEN', (0, env_1.getEnvVariable)('ZC_TOKEN')),
27
27
  temp: true
28
28
  },
29
29
  {
@@ -27,13 +27,26 @@ const project_2 = require("../util_modules/project");
27
27
  const config_store_1 = __importDefault(require("../config-store"));
28
28
  const dc_1 = require("../dc");
29
29
  const env_1 = require("../util_modules/env");
30
- exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck = true } = {}) => __awaiter(void 0, void 0, void 0, function* () {
30
+ const features_1 = require("../init/features");
31
+ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck = true, skipProjectCheck = true, generateRc = false } = {}) => __awaiter(void 0, void 0, void 0, function* () {
31
32
  const globOrgOpt = (0, option_1.getGlobalOptionValue)('org', null);
32
- const orgOpt = globOrgOpt ? globOrgOpt : (0, env_1.getEnvVariable)('CATALYST_ORG', null);
33
+ const orgOpt = globOrgOpt
34
+ ? globOrgOpt
35
+ : (0, env_1.getEnvVariable)('CATALYST_ORG', (0, env_1.getEnvVariable)('ZC_ORG_ID', null));
33
36
  const globProjectOpt = (0, option_1.getGlobalOptionValue)('project', null);
34
37
  const projectOpt = globProjectOpt
35
38
  ? globProjectOpt
36
- : (0, env_1.getEnvVariable)('CATALYST_PROJECT_ID', (0, env_1.getEnvVariable)('CATALYST_PROJECT', null));
39
+ : (0, env_1.getEnvVariable)('CATALYST_PROJECT_ID', (0, env_1.getEnvVariable)('CATALYST_PROJECT', (0, env_1.getEnvVariable)('ZC_PROJECT_ID', null)));
40
+ if (env_1.isCI) {
41
+ if (orgOpt && projectOpt) {
42
+ runtime_store_1.default.set('project.id', projectOpt);
43
+ runtime_store_1.default.set('project.env.id', orgOpt + '');
44
+ return;
45
+ }
46
+ throw new error_1.default('Org and Project Id cannot be empty.', {
47
+ exit: 1
48
+ });
49
+ }
37
50
  const orgApi = yield (0, endpoints_1.orgAPI)();
38
51
  if (orgOpt !== null) {
39
52
  const orgList = yield orgApi.getAllOrgs();
@@ -139,6 +152,30 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
139
152
  const selectedOrg = orgAns.org || orgList[0];
140
153
  runtime_store_1.default.set('project.env.id', selectedOrg.id);
141
154
  }
155
+ if (!skipProjectCheck) {
156
+ const projectList = yield (yield (0, endpoints_1.projectAPI)()).getAllProjects();
157
+ const projectChoice = projectList.map((project) => prompt_1.default.choice(project.project_name + ' (' + project.id + ')', {
158
+ value: project,
159
+ short: project.project_name
160
+ }));
161
+ const projectAns = yield prompt_1.default.ask(prompt_1.default.question('project', 'Select a Catalyst Project to continue: ', {
162
+ type: 'list',
163
+ choices: js_1.JS.reverse(projectChoice),
164
+ when: projectChoice.length > 0
165
+ }));
166
+ const selectedProject = projectAns.project || projectList[0];
167
+ runtime_store_1.default.set('project.id', selectedProject.id);
168
+ }
169
+ if (generateRc) {
170
+ (0, logger_1.warning)('Not in Catalyst app directory!!!');
171
+ const stagedAns = yield prompt_1.default.ask(prompt_1.default.question('consent', 'Do you wish to initialize the catalyst project in this directory?', {
172
+ type: 'confirm',
173
+ defaultAns: true
174
+ }));
175
+ if (stagedAns.consent) {
176
+ yield (0, features_1.project)();
177
+ }
178
+ }
142
179
  if (optional || ignoreRC) {
143
180
  return;
144
181
  }
@@ -137,6 +137,7 @@ exports.default = new command_1.default('codelib:install [git-url]')
137
137
  }
138
138
  const templateFns = (((_a = templateJson.components) === null || _a === void 0 ? void 0 : _a.Functions) || []);
139
139
  if (templateFns.length > 0) {
140
+ yield new Promise((res) => setTimeout(res, 5000));
140
141
  yield (0, functions_1.default)(templateFns.map((fn) => fn.name));
141
142
  (0, features_1.setCatalystConfig)('functions', true);
142
143
  const config = runtime_store_1.default.get('config');
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  const utils_1 = require("../../deploy/features/appsail/utils");
39
+ const slate_1 = require("../../deploy/features/slate");
39
40
  const command_1 = __importDefault(require("../../internal/command"));
40
41
  const runtime_store_1 = __importDefault(require("../../runtime-store"));
41
42
  const constants_1 = require("../../util_modules/constants");
@@ -74,6 +75,9 @@ exports.default = new command_1.default('deploy')
74
75
  (0, logger_1.labeled)(deploytarget, 'URL => ' + runtime_store_1.default.get('payload.client.url')).MESSAGE();
75
76
  (0, logger_1.info)();
76
77
  break;
78
+ case 'slate':
79
+ (0, slate_1.slateLogger)();
80
+ break;
77
81
  case 'apig':
78
82
  (0, logger_1.labeled)(deploytarget, 'deploy scheduled successfully').SUCCESS();
79
83
  (0, logger_1.info)();
@@ -0,0 +1,58 @@
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 (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
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const slate_1 = require("../../deploy/features/slate");
39
+ const command_1 = __importDefault(require("../../internal/command"));
40
+ const logger_1 = require("../../util_modules/logger");
41
+ exports.default = new command_1.default('slate')
42
+ .description('Deploy your Catalyst Slate service to Catalyst Development environment')
43
+ .option('-m <msg>', 'Please provide the description for your app deployment.')
44
+ .option('--production', 'Deploy the slate app to production environment.')
45
+ .needs('auth')
46
+ .needs('config', { optional: true })
47
+ .needs('rc', { optional: true })
48
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
49
+ yield (yield Promise.resolve().then(() => __importStar(require('../../deploy')))).default('slate');
50
+ (0, logger_1.info)();
51
+ const deployTargets = (0, slate_1.slateLogger)();
52
+ if (deployTargets.length === 0) {
53
+ (0, logger_1.error)('Slate Deploy failed');
54
+ }
55
+ else {
56
+ (0, logger_1.success)('Catalyst Slate Deploy completed successfully');
57
+ }
58
+ }));
@@ -49,6 +49,7 @@ exports.default = (client) => {
49
49
  });
50
50
  }
51
51
  return Promise.all([
52
+ loadCommand('help'),
52
53
  loadCommand('login'),
53
54
  loadCommand('whoami'),
54
55
  loadCommand('token:generate'),
@@ -72,19 +73,17 @@ exports.default = (client) => {
72
73
  loadCommand('client:setup'),
73
74
  loadCommand('client:delete'),
74
75
  loadCommand('functions:setup'),
75
- loadCommand('functions:delete'),
76
76
  loadCommand('functions:add'),
77
77
  loadCommand('functions:shell'),
78
78
  loadCommand('functions:config'),
79
+ loadCommand('functions:delete'),
79
80
  loadCommand('appsail:add'),
80
81
  loadCommand('codelib:install'),
81
82
  loadCommand('event:generate'),
82
83
  loadCommand('event:generate:integ'),
83
- loadCommand('zest:generate'),
84
84
  loadCommand('event:generate:job'),
85
85
  loadCommand('serve'),
86
86
  loadCommand('deploy'),
87
- loadCommand('help'),
88
87
  loadCommand('run'),
89
88
  loadCommand('config:set'),
90
89
  loadCommand('config:get'),
@@ -41,7 +41,6 @@ const command_1 = __importDefault(require("../internal/command"));
41
41
  const prompt_1 = __importDefault(require("../prompt"));
42
42
  const runtime_store_1 = __importDefault(require("../runtime-store"));
43
43
  const constants_1 = require("../util_modules/constants");
44
- const env_1 = require("../util_modules/env");
45
44
  const fs_1 = require("../util_modules/fs");
46
45
  const js_1 = require("../util_modules/js");
47
46
  const logger_1 = require("../util_modules/logger");
@@ -90,15 +89,6 @@ exports.default = new command_1.default('init [feature]')
90
89
  (0, ansi_colors_1.bold)(runtime_store_1.default.get('project.root')) +
91
90
  '\n' +
92
91
  warningText);
93
- const windownConfirmation = env_1.isWindows
94
- ? yield prompt_1.default.ask(prompt_1.default.question('confirmation', 'Are you ready to proceed?', {
95
- type: 'confirm'
96
- }))
97
- : { confirmation: true };
98
- if (!windownConfirmation.confirmation) {
99
- (0, logger_1.message)('Aborted by user.');
100
- return;
101
- }
102
92
  if (feature !== 'project') {
103
93
  try {
104
94
  yield (0, features_1.project)();
@@ -0,0 +1,59 @@
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 (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
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const ansi_colors_1 = require("ansi-colors");
39
+ const command_1 = __importDefault(require("../../internal/command"));
40
+ const runtime_store_1 = __importDefault(require("../../runtime-store"));
41
+ const constants_1 = require("../../util_modules/constants");
42
+ const logger_1 = require("../../util_modules/logger");
43
+ exports.default = new command_1.default('slate:create')
44
+ .description('Configure a new slate app in catalyst')
45
+ .option('--name <app_name>', 'Please provide name for your slate')
46
+ .option('--framework <framework_name>', 'Specify framework name for your slate')
47
+ .option('--template <template_url>', 'Provide template url for your slate')
48
+ .option('--default', 'Set default app configurations')
49
+ .needs('auth')
50
+ .needs('config', { optional: true })
51
+ .needs('rc', { optional: true, generateRc: true })
52
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
53
+ const config = runtime_store_1.default.get('config');
54
+ yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).slate();
55
+ yield config.save();
56
+ (0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.config) + ' file has been successfully updated with slate details.');
57
+ (0, logger_1.info)();
58
+ (0, logger_1.success)('Slate created successfully');
59
+ }));
@@ -0,0 +1,59 @@
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 (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
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const ansi_colors_1 = require("ansi-colors");
39
+ const command_1 = __importDefault(require("../../internal/command"));
40
+ const runtime_store_1 = __importDefault(require("../../runtime-store"));
41
+ const constants_1 = require("../../util_modules/constants");
42
+ const logger_1 = require("../../util_modules/logger");
43
+ exports.default = new command_1.default('slate:link')
44
+ .description('Configure your existing app in slate service')
45
+ .option('--name <app_name>', 'Please provide name for your slate')
46
+ .option('--framework <framework_name>', 'Specify frame work name for your slate')
47
+ .option('--template <template_url>', 'Provide template url for your slate')
48
+ .option('--default', 'Set default app configurations')
49
+ .needs('auth')
50
+ .needs('config', { optional: true })
51
+ .needs('rc', { optional: true, generateRc: true })
52
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
53
+ const config = runtime_store_1.default.get('config');
54
+ yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).slate(true);
55
+ yield config.save();
56
+ (0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.config) + ' file has been successfully updated with slate details.');
57
+ (0, logger_1.info)();
58
+ (0, logger_1.success)('Slate linked successfully');
59
+ }));
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const ansi_colors_1 = require("ansi-colors");
16
+ const command_1 = __importDefault(require("../../internal/command"));
17
+ const runtime_store_1 = __importDefault(require("../../runtime-store"));
18
+ const constants_1 = require("../../util_modules/constants");
19
+ const logger_1 = require("../../util_modules/logger");
20
+ const option_1 = require("../../util_modules/option");
21
+ const prompt_1 = __importDefault(require("../../prompt"));
22
+ const config_1 = require("../../util_modules/config");
23
+ const fs_1 = require("../../util_modules/fs");
24
+ const error_1 = __importDefault(require("../../error"));
25
+ const path_1 = require("path");
26
+ exports.default = new command_1.default('slate:unlink')
27
+ .description('Unlink your existing slate app')
28
+ .option('--name <app_name>', 'Please provide name for your slate app')
29
+ .needs('auth')
30
+ .needs('config')
31
+ .needs('rc')
32
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
33
+ const config = runtime_store_1.default.get('config');
34
+ let appName = (0, option_1.getOptionValue)('name', false);
35
+ const slateServices = config_1.slateConfig.raw();
36
+ if ((slateServices === null || slateServices === void 0 ? void 0 : slateServices.length) === 0 || !slateServices) {
37
+ throw new error_1.default('No slates found.', {
38
+ exit: 1,
39
+ errorId: 'SLULK-1',
40
+ arg: [(0, ansi_colors_1.bold)('catalyst slate:link')]
41
+ });
42
+ }
43
+ if (!appName) {
44
+ const { name } = yield prompt_1.default.ask(prompt_1.default.question('name', 'Please select the slate app you want to delete', {
45
+ type: 'list',
46
+ choices: slateServices
47
+ }));
48
+ appName = name;
49
+ }
50
+ const slateDetails = slateServices.find((slate) => slate.name === appName);
51
+ if (!slateDetails) {
52
+ throw new error_1.default(`No slates match the given name ${appName}.`, {
53
+ exit: 1,
54
+ errorId: 'SLULK-2',
55
+ arg: [(0, ansi_colors_1.bold)('catalyst slate:unlink')]
56
+ });
57
+ }
58
+ const { removeSource } = yield prompt_1.default.ask(prompt_1.default.question('removeSource', `Do you want to delete the source?`, {
59
+ type: 'confirm',
60
+ default: false
61
+ }));
62
+ yield fs_1.ASYNC.deleteDir((0, path_1.join)(slateDetails.source, constants_1.FILENAME.cli_config));
63
+ if (removeSource) {
64
+ yield fs_1.ASYNC.deleteDir(slateDetails.source);
65
+ }
66
+ else {
67
+ yield fs_1.ASYNC.deleteDir((0, path_1.join)(slateDetails.source, '.catalyst'));
68
+ }
69
+ config.unset('slate');
70
+ config.set('slate', slateServices.filter((slateCon) => slateCon.name !== appName));
71
+ yield config.save();
72
+ (0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.config) + ' file has been updated.');
73
+ (0, logger_1.info)();
74
+ (0, logger_1.success)('Slate unlinked successfully');
75
+ }));