zcatalyst-cli 1.18.0-beta.9 → 1.19.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.
- package/README.md +11 -6
- package/docs/commands/signals/generate/index.toml +19 -0
- package/docs/commands/slate/unlink.toml +9 -0
- package/docs/endpoints/lib/env.toml +3 -1
- package/docs/endpoints/lib/slate.toml +3 -0
- package/docs/serve/server/lib/slate/index.toml +14 -0
- package/docs/slate-utils.toml +4 -0
- package/docs/util_modules/config/lib/slate.toml +4 -0
- package/lib/archiver.js +18 -9
- package/lib/authentication/login.js +6 -5
- package/lib/code-deck.js +5 -6
- package/lib/command_needs/auth.js +1 -1
- package/lib/command_needs/rc.js +40 -3
- package/lib/commands/codelib/install.js +1 -0
- package/lib/commands/deploy/index.js +4 -0
- package/lib/commands/deploy/slate.js +58 -0
- package/lib/commands/event/generate/index.js +8 -2
- package/lib/commands/index.js +3 -3
- package/lib/commands/init.js +0 -10
- package/lib/commands/signals/generate/index.js +214 -0
- package/lib/commands/slate/create.js +59 -0
- package/lib/commands/slate/link.js +59 -0
- package/lib/commands/slate/unlink.js +75 -0
- package/lib/commands/zest/generate/index.js +1 -6
- package/lib/config-store.js +2 -1
- package/lib/deploy/features/index.js +3 -0
- package/lib/deploy/features/slate.js +123 -0
- package/lib/endpoints/index.js +8 -1
- package/lib/endpoints/lib/env.js +2 -1
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/endpoints/lib/slate.js +107 -0
- package/lib/event_generate/cache.js +35 -33
- package/lib/event_generate/custom.js +15 -19
- package/lib/event_generate/datastore.js +60 -56
- package/lib/event_generate/filestore.js +51 -47
- package/lib/event_generate/github.js +19 -18
- package/lib/event_generate/stratus.js +52 -38
- package/lib/event_generate/user.js +33 -29
- package/lib/event_generate/webapp.js +33 -32
- package/lib/fn-utils/lib/common.js +1 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/index.js +1 -1
- package/lib/init/features/appsail/index.js +3 -4
- package/lib/init/features/index.js +13 -1
- package/lib/init/features/project.js +1 -1
- package/lib/init/features/slate/index.js +313 -0
- package/lib/internal/api.js +1 -1
- package/lib/internal/command.js +10 -6
- package/lib/port-resolver.js +7 -0
- package/lib/prompt/index.js +22 -6
- package/lib/prompt/types/file-path.js +10 -7
- package/lib/serve/features/index.js +8 -1
- package/lib/serve/features/slate.js +47 -0
- package/lib/serve/server/index.js +61 -1
- package/lib/serve/server/lib/appsail/index.js +1 -1
- package/lib/serve/server/lib/master/appsail.js +7 -2
- package/lib/serve/server/lib/master/index.js +25 -21
- package/lib/serve/server/lib/master/slate.js +45 -0
- package/lib/serve/server/lib/master/utils.js +9 -3
- package/lib/serve/server/lib/slate/index.js +115 -0
- package/lib/serve/server/lib/slate/static-server.js +194 -0
- package/lib/serve/server/lib/web_client/server.js +2 -1
- package/lib/shell/dependencies/local-function.js +1 -1
- package/lib/slate-utils.js +212 -0
- package/lib/util_modules/config/index.js +3 -1
- package/lib/util_modules/config/lib/slate.js +98 -0
- package/lib/util_modules/constants/index.js +7 -1
- package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +4 -0
- package/lib/util_modules/constants/lib/file-names.js +7 -1
- package/lib/util_modules/constants/lib/folder-names.js +1 -0
- package/lib/util_modules/constants/lib/placeholders.js +18 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -6
- package/lib/util_modules/constants/lib/signals-api-names.js +19 -0
- package/lib/util_modules/constants/lib/signals-publishers-type.js +27 -0
- package/lib/util_modules/constants/lib/signals-publishers.js +10 -0
- package/lib/util_modules/constants/lib/template.js +1 -0
- package/lib/util_modules/context-help.js +2 -2
- package/lib/util_modules/fs/lib/async.js +14 -3
- package/lib/util_modules/fs/lib/sync.js +6 -1
- package/lib/util_modules/parser/toml.js +20 -5
- package/package.json +3 -3
- package/templates/event/integ/cliq/bot/action_handler.json +13 -4
- package/templates/event/integ/cliq/bot/call_handler.json +41 -0
- package/templates/event/integ/cliq/bot/context_handler.json +11 -3
- package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
- package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
- package/templates/event/integ/cliq/bot/message_handler.json +13 -4
- package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
- package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
- package/templates/event/integ/cliq/command/execution_handler.json +12 -3
- package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
- package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
- package/templates/event/integ/cliq/function/button_handler.json +13 -5
- package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_handler.json +11 -3
- package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
- package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
- package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
- package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
- package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
- package/templates/event/integ/cliq/widget/view_handler.json +12 -4
- package/templates/event/signals.json +26 -0
- package/templates/init/client/react/react_js/template/src/index.js +3 -3
- package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
- package/templates/init/client/react/react_ts/template.json +3 -3
- package/templates/init/functions/java/event/sample.java +4 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
- package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
- package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
- package/templates/init/functions/java/integ/cliq/sample.java +10 -0
- package/templates/init/functions/node/aio/package.json +1 -1
- package/templates/init/functions/node/bio/package.json +1 -1
- package/templates/init/functions/node/cron/package.json +1 -1
- package/templates/init/functions/node/event/package.json +1 -1
- package/templates/init/functions/node/event/sample.js +1 -0
- package/templates/init/functions/node/event/types/event.d.ts +7 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
- package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
- package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
- package/templates/init/functions/node/integ/cliq/package.json +1 -1
- package/templates/init/functions/node/integ/convokraft/package.json +1 -1
- package/templates/init/functions/node/job/package.json +1 -1
- package/templates/init/functions/python/event/sample.py +9 -5
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
- package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
- package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
- package/templates/init/functions/python/integ/cliq/sample.py +2 -2
- package/templates/init.txt +2 -1
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
- 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://
|
|
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://
|
|
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 >=
|
|
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://
|
|
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
|
|
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,19 @@
|
|
|
1
|
+
[IDX-1]
|
|
2
|
+
context = '''The options provided ${arg[0]}(publisher_service) ${arg[1]}(event_name) are not in a pair.'''
|
|
3
|
+
aid = '''Please provide the options as key values in this format: ${arg[2]}'''
|
|
4
|
+
link = ''
|
|
5
|
+
|
|
6
|
+
[IDX-2]
|
|
7
|
+
context = '''The provided input for publisher service is invalid.'''
|
|
8
|
+
aid = '''The publisher service must be one of the following: \n${arg[0]}'''
|
|
9
|
+
link = ''
|
|
10
|
+
|
|
11
|
+
[IDX-3]
|
|
12
|
+
context = '''The options are provided in an invalid format: ${arg[0]}'''
|
|
13
|
+
aid = '''Please provide the options only in this format: ${arg[1]}'''
|
|
14
|
+
link = ''
|
|
15
|
+
|
|
16
|
+
[IDX-4]
|
|
17
|
+
context = '''The provided event is not compatible with the publisher service: ${arg[0]} ${arg[1]} ${arg[2]} '''
|
|
18
|
+
aid = '''The compatible events with the publisher service ${arg[2]} are: \n${arg[3]}'''
|
|
19
|
+
link = ''
|
|
@@ -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 = ''
|
|
@@ -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 = ''
|
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,
|
|
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,
|
|
60
|
+
return this._writeAllFile(folder.filter((_relPath, file) => !file.dir), to, recursive, ignoreLevel);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
_writeAllFile(files, to, recursive = 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
|
|
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,
|
|
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,
|
|
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,
|
|
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(['
|
|
37
|
-
[constants_1.DC_TYPE.eu.value]: getScopes(['
|
|
38
|
-
[constants_1.DC_TYPE.au.value]: getScopes(['
|
|
39
|
-
[constants_1.DC_TYPE.ca.value]: getScopes(['
|
|
40
|
-
[constants_1.DC_TYPE.sa.value]: getScopes(['
|
|
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
|
-
|
|
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
|
-
|
|
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
|
});
|
package/lib/command_needs/rc.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
+
}));
|
|
@@ -188,8 +188,14 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const isCustomSource = source === 'custom';
|
|
192
|
+
const sourceModule = yield (_a = `../../../event_generate/${source}`, Promise.resolve().then(() => __importStar(require(_a))));
|
|
193
|
+
eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), isCustomSource ? yield sourceModule.getRuleId() : 'NULL');
|
|
194
|
+
const evenData = !isCustomSource
|
|
195
|
+
? yield sourceModule.getData(optionMap)
|
|
196
|
+
: optionMap.payload;
|
|
197
|
+
eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(evenData));
|
|
198
|
+
eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), sourceModule.sourceId);
|
|
193
199
|
const jsonContent = JSON.parse(eventJsonContent);
|
|
194
200
|
Object.keys(jsonContent).forEach((key) => {
|
|
195
201
|
if (jsonContent[key] === 'NULL') {
|
package/lib/commands/index.js
CHANGED
|
@@ -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,18 @@ 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('
|
|
84
|
+
loadCommand('signals:generate'),
|
|
84
85
|
loadCommand('event:generate:job'),
|
|
85
86
|
loadCommand('serve'),
|
|
86
87
|
loadCommand('deploy'),
|
|
87
|
-
loadCommand('help'),
|
|
88
88
|
loadCommand('run'),
|
|
89
89
|
loadCommand('config:set'),
|
|
90
90
|
loadCommand('config:get'),
|
package/lib/commands/init.js
CHANGED
|
@@ -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)();
|