zcatalyst-cli 1.18.0-beta.1 → 1.18.0-beta.11
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/docs/command_needs/rc.toml +8 -8
- package/docs/commands/ds/import.toml +5 -5
- package/docs/commands/zest/generate/index.toml +4 -0
- package/docs/serve/server/lib/appsail/index.toml +22 -1
- package/lib/authentication/login.js +8 -4
- package/lib/code-deck.js +7 -7
- package/lib/command_needs/rc.js +7 -7
- package/lib/commands/appsail/add.js +2 -2
- package/lib/commands/client/setup.js +1 -1
- package/lib/commands/codelib/install.js +6 -2
- package/lib/commands/ds/import.js +37 -21
- package/lib/commands/event/generate/index.js +14 -2
- package/lib/commands/functions/add.js +1 -1
- package/lib/commands/functions/setup.js +1 -1
- package/lib/commands/iac/export.js +5 -1
- package/lib/commands/iac/import.js +4 -1
- package/lib/commands/index.js +1 -0
- package/lib/commands/init.js +8 -1
- package/lib/commands/zest/generate/index.js +304 -0
- package/lib/deploy/features/appsail/index.js +25 -10
- package/lib/endpoints/index.js +17 -3
- package/lib/endpoints/lib/ds-bulk.js +1 -0
- package/lib/endpoints/lib/stratus.js +63 -0
- package/lib/endpoints/lib/tunnel.js +18 -0
- package/lib/endpoints/lib/zest.js +124 -0
- package/lib/event_generate/stratus.js +52 -0
- package/lib/fn-utils/lib/common.js +6 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/init/features/appsail/index.js +34 -27
- package/lib/init/features/project.js +6 -15
- package/lib/internal/api.js +14 -6
- package/lib/internal/command.js +1 -1
- package/lib/prompt/index.js +5 -2
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/prompt/types/search-box.js +281 -0
- package/lib/serve/features/appsail.js +1 -1
- package/lib/serve/server/index.js +44 -14
- package/lib/serve/server/lib/appsail/index.js +73 -13
- package/lib/serve/server/lib/appsail/start.js +9 -1
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- 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
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/index.js +1 -1
- package/lib/serve/server/lib/master/appsail.js +3 -3
- package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
- package/lib/serve/server/lib/master/utils.js +27 -15
- package/lib/serve/server/lib/node/index.js +1 -1
- package/lib/serve/server/lib/node/server/package-lock.json +12 -0
- package/lib/serve/server/lib/python/index.js +1 -1
- package/lib/shell/dependencies/http-functions.js +1 -1
- package/lib/shell/dependencies/invoker/bio/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
- package/lib/shell/dependencies/invoker/event/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +15 -0
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
- package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +15 -1
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/local-function.js +24 -23
- package/lib/shell/dependencies/tunnel-server.js +52 -23
- package/lib/shell/index.js +22 -28
- package/lib/util_modules/config/lib/appsail.js +10 -8
- 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/event-action.js +1 -0
- package/lib/util_modules/constants/lib/event-source.js +1 -0
- package/lib/util_modules/constants/lib/placeholders.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +14 -3
- package/lib/util_modules/constants/lib/urls.js +8 -0
- package/lib/util_modules/fs/lib/async.js +7 -2
- package/package.json +4 -2
- 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/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/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/java/job/sample.java +1 -1
- package/templates/init/functions/node/aio/sample.js +7 -0
- package/templates/init/functions/node/bio/sample.js +5 -0
- package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
- package/templates/init/functions/node/cron/sample.js +5 -0
- package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
- package/templates/init/functions/node/event/sample.js +11 -8
- package/templates/init/functions/node/event/types/event.d.ts +82 -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/job/sample.js +0 -1
- package/templates/init/functions/node/job/types/job.d.ts +0 -4
- 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/functions/python/job/sample.py +0 -1
- package/templates/init.txt +2 -1
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- 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
|
@@ -51,8 +51,8 @@ command.suggestionHandler(async (req, res) => {
|
|
|
51
51
|
suggestion3.imageurl = 'https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png';
|
|
52
52
|
|
|
53
53
|
res.push(suggestion1,suggestion2,suggestion3);
|
|
54
|
-
return res;
|
|
55
54
|
}
|
|
55
|
+
return res;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
function getForm() {
|
|
@@ -63,10 +63,8 @@ function getForm() {
|
|
|
63
63
|
form.button_label = 'Raise Request';
|
|
64
64
|
form.version = 1;
|
|
65
65
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
form.actions = actions;
|
|
66
|
+
const action = form.newFormAction('formFunctionLatest');// ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
67
|
+
form.action = action;
|
|
70
68
|
|
|
71
69
|
const userName = form.newFormInput();
|
|
72
70
|
userName.type = 'text';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict';
|
|
2
2
|
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
-
const
|
|
3
|
+
const extensionHandler = Cliq.extensionHandler();
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
extensionHandler.validateInstallation(async (req, res) => {
|
|
6
6
|
if(comp(req.user.first_name, '**INVALID_USER**') && comp(req.app_info.type, 'upgrade')) {
|
|
7
7
|
res.status = 400;
|
|
8
8
|
res.title = 'Update not allowed !';
|
|
@@ -13,6 +13,23 @@ installationValidator.validateInstallation(async (req, res) => {
|
|
|
13
13
|
return res;
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
extensionHandler.handleInstallation(async (req, res) => {
|
|
17
|
+
/*
|
|
18
|
+
// Logic for installation post handling
|
|
19
|
+
*{
|
|
20
|
+
*
|
|
21
|
+
*}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
res.status = 200;
|
|
25
|
+
return res;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
extensionHandler.handleUninstallation(async (req, res) => {
|
|
29
|
+
|
|
30
|
+
// Logic for uninstallation post handling
|
|
31
|
+
});
|
|
32
|
+
|
|
16
33
|
function comp(var1, var2) {
|
|
17
34
|
return var1.toUpperCase() === var2.toUpperCase();
|
|
18
35
|
}
|
|
@@ -218,6 +218,48 @@ functionHandler.formDynamicFieldHandler(async (req, res) => {
|
|
|
218
218
|
return res;
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
+
functionHandler.formViewHandler(async (req, res) => {
|
|
222
|
+
res.title = 'Asset Request';
|
|
223
|
+
res.hint = 'Raise your asset request';
|
|
224
|
+
res.name = 'ID';
|
|
225
|
+
res.button_label = 'Raise Request';
|
|
226
|
+
res.version = 1;
|
|
227
|
+
|
|
228
|
+
const userName = res.newFormInput();
|
|
229
|
+
userName.type = 'text';
|
|
230
|
+
userName.name = 'username';
|
|
231
|
+
userName.label = 'Name';
|
|
232
|
+
userName.hint = 'Please enter your name';
|
|
233
|
+
userName.placeholder = 'John Reese';
|
|
234
|
+
userName.mandatory = true;
|
|
235
|
+
userName.value = 'Harold Finch';
|
|
236
|
+
res.addInputs(userName);
|
|
237
|
+
|
|
238
|
+
const email = res.newFormInput();
|
|
239
|
+
email.type = 'text';
|
|
240
|
+
email.format = 'email';
|
|
241
|
+
email.name = 'email';
|
|
242
|
+
email.label = 'Email';
|
|
243
|
+
email.hint = 'Enter your email address';
|
|
244
|
+
email.placeholder = "johnreese@poi.com";
|
|
245
|
+
email.mandatory = true;
|
|
246
|
+
email.value = "haroldfinch@samaritan.com";
|
|
247
|
+
|
|
248
|
+
const assetType = res.newFormInput();
|
|
249
|
+
assetType.type = 'select';
|
|
250
|
+
assetType.trigger_on_change = true;
|
|
251
|
+
assetType.name = 'asset-type';
|
|
252
|
+
assetType.label = "Asset Type";
|
|
253
|
+
assetType.hint = "Choose your request asset type";
|
|
254
|
+
assetType.placeholder = "Mobile";
|
|
255
|
+
assetType.mandatory = true;
|
|
256
|
+
assetType.addOption(assetType.newFormValue('Laptop', 'laptop'));
|
|
257
|
+
assetType.addOption(assetType.newFormValue('Mobile', 'mobile'));
|
|
258
|
+
|
|
259
|
+
res.addInputs(email, assetType);
|
|
260
|
+
return res;
|
|
261
|
+
});
|
|
262
|
+
|
|
221
263
|
functionHandler.widgetButtonHandler(async (req, res) => {
|
|
222
264
|
const id = req.target.id;
|
|
223
265
|
switch(id) {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
+
const linkPreviewHandler = Cliq.linkPreviewHandler();
|
|
4
|
+
|
|
5
|
+
linkPreviewHandler.previewHandler(async (req, res) => {
|
|
6
|
+
res.title = 'Release checklist | Zoho Cliq';
|
|
7
|
+
res.type = 'link';
|
|
8
|
+
res.provider_url = 'https://www.zoho.com/cliq/';
|
|
9
|
+
res.description = 'Release checklist for Cliq 5.0 (Focused on Enterprise and Intelligence)';
|
|
10
|
+
res.dynamic_actions = true;
|
|
11
|
+
|
|
12
|
+
let fields = res.newOembedFields();
|
|
13
|
+
let fieldsData = [];
|
|
14
|
+
fieldsData.push(fields.newOembedFieldData('Created By','Scott fisher'));
|
|
15
|
+
fieldsData.push(fields.newOembedFieldData('Created On', '10 Aug, 2023'));
|
|
16
|
+
fieldsData.push(fields.newOembedFieldData('Last Modified On', '11 Aug, 2023'));
|
|
17
|
+
fieldsData.push(fields.newOembedFieldData('Tags', '#unfurling_via_extensions #images_and_cards #cliq_360 #Cliq_5.0'));
|
|
18
|
+
fields.data = fieldsData;
|
|
19
|
+
res.fields = fields;
|
|
20
|
+
|
|
21
|
+
let actions = [];
|
|
22
|
+
const action = res.newOembedActions();
|
|
23
|
+
action.type = 'button';
|
|
24
|
+
action.label = 'Add Comment';
|
|
25
|
+
const confirm = action.newConfirm();
|
|
26
|
+
confirm.title = 'Comment';
|
|
27
|
+
confirm.description = 'Add your comment to the notes';
|
|
28
|
+
confirm.input = 'Type here...';
|
|
29
|
+
action.confirm = confirm;
|
|
30
|
+
let params = {'action': 'add_comment'};
|
|
31
|
+
action.params = params;
|
|
32
|
+
actions.push(action);
|
|
33
|
+
res.actions = actions;
|
|
34
|
+
|
|
35
|
+
return res;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
linkPreviewHandler.actionHandler(async (req, res) => {
|
|
39
|
+
const action = req.target.params.action;
|
|
40
|
+
let text;
|
|
41
|
+
if(action === "add_comment")
|
|
42
|
+
{
|
|
43
|
+
text = "Your comment has been added successfully";
|
|
44
|
+
}
|
|
45
|
+
else if(action === "delete_note")
|
|
46
|
+
{
|
|
47
|
+
text = "Release checklist | Zoho Cliq note has been deleted";
|
|
48
|
+
}
|
|
49
|
+
else if(action === "mark_as_favorite")
|
|
50
|
+
{
|
|
51
|
+
text = "Release checklist | Zoho Cliq note has been marked as favorite";
|
|
52
|
+
}
|
|
53
|
+
return res.newBanner(text,'success');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
linkPreviewHandler.menuHandler(async (req, res) => {
|
|
57
|
+
|
|
58
|
+
let action1 = linkPreviewHandler.newOembedActions('button');
|
|
59
|
+
action1.label = 'Delete';
|
|
60
|
+
action1.params = {'action': 'delete_note'};
|
|
61
|
+
res.push(action1);
|
|
62
|
+
|
|
63
|
+
let action2 = linkPreviewHandler.newOembedActions('button');
|
|
64
|
+
action2.label = 'Mark as Favorite';
|
|
65
|
+
action2.params = {'action': 'mark_as_favorite'};
|
|
66
|
+
res.push(action2);
|
|
67
|
+
|
|
68
|
+
return res;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
linkPreviewHandler.afterSendHandler(async (req, res) => {
|
|
72
|
+
return res.newBanner('Release checklist | Zoho Cliq 5.0','success');
|
|
73
|
+
});
|
|
@@ -15,7 +15,6 @@ module.exports = (jobRequest, context) => {
|
|
|
15
15
|
const projectDetails = jobRequest.getProjectDetails(); // to get the current project details
|
|
16
16
|
const jobDetails = jobRequest.getJobDetails(); // to get the current job details
|
|
17
17
|
const jobMetaDetails = jobRequest.getJobMetaDetails(); // to get the current job's meta details
|
|
18
|
-
const jobpoolDetails = jobRequest.getJobpoolDetails(); // to get the current function job pool's details
|
|
19
18
|
const getJobCapacityAttributes = jobRequest.getJobCapacityAttributes(); // to get the current jobs capacity
|
|
20
19
|
const allJobParams = jobRequest.getAllJobParams(); // to get all the parameters supplied to the job function
|
|
21
20
|
const jobParam = jobRequest.getJobParam('key'); // to get the value of a particular parameter supplied to the job function
|
|
@@ -18,10 +18,6 @@ export interface JobRequest {
|
|
|
18
18
|
* @returns Meta details of the current job
|
|
19
19
|
*/
|
|
20
20
|
getJobMetaDetails: () => Record<string, unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* @returns Job pool details of the current job
|
|
23
|
-
*/
|
|
24
|
-
getJobpoolDetails: () => Record<string, unknown>;
|
|
25
21
|
/**
|
|
26
22
|
* @returns Capacity attributes of the current job
|
|
27
23
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import logging
|
|
3
|
+
|
|
2
4
|
from zcatalyst_cliq.bot_handler import (
|
|
3
5
|
welcome_handler,
|
|
4
6
|
message_handler,
|
|
@@ -7,6 +9,7 @@ from zcatalyst_cliq.bot_handler import (
|
|
|
7
9
|
menu_action_handler,
|
|
8
10
|
webhook_handler,
|
|
9
11
|
participation_handler,
|
|
12
|
+
call_handler,
|
|
10
13
|
BotWelcomeHandlerRequest,
|
|
11
14
|
BotMessageHandlerRequest,
|
|
12
15
|
BotContextHandlerRequest,
|
|
@@ -14,10 +17,12 @@ from zcatalyst_cliq.bot_handler import (
|
|
|
14
17
|
BotMenuActionHandlerRequest,
|
|
15
18
|
BotParticipationHandlerRequest,
|
|
16
19
|
BotWebHookHandlerRequest,
|
|
17
|
-
HandlerResponse
|
|
20
|
+
HandlerResponse,
|
|
21
|
+
BotCallHandlerRequest
|
|
18
22
|
)
|
|
19
|
-
from
|
|
20
|
-
import
|
|
23
|
+
from zcatalyst_cliq.response_types import VoidResponse
|
|
24
|
+
from zcatalyst_sdk import CatalystApp
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
@welcome_handler
|
|
23
28
|
def welcome_handler_fn(req: BotWelcomeHandlerRequest, res: HandlerResponse, *args):
|
|
@@ -172,3 +177,8 @@ def webhook_fn(req: BotWebHookHandlerRequest, res: HandlerResponse, *args):
|
|
|
172
177
|
res.add_slides(gif_slide)
|
|
173
178
|
|
|
174
179
|
return res
|
|
180
|
+
|
|
181
|
+
@call_handler
|
|
182
|
+
def call(req: BotCallHandlerRequest, res:VoidResponse):
|
|
183
|
+
# Logic for bot call post handling
|
|
184
|
+
return res
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import List
|
|
2
|
+
|
|
2
3
|
import zcatalyst_cliq.command_handler as command
|
|
3
4
|
from zcatalyst_cliq.command_handler import (
|
|
4
5
|
execution_handler,
|
|
@@ -12,7 +13,7 @@ from zcatalyst_cliq.command_handler import (
|
|
|
12
13
|
def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
13
14
|
text = ''
|
|
14
15
|
cmd = req.name
|
|
15
|
-
if cmd == '
|
|
16
|
+
if cmd == 'catalystresource':
|
|
16
17
|
suggestions = req.selections
|
|
17
18
|
if not suggestions:
|
|
18
19
|
text = 'Please select a suggestion from the command'
|
|
@@ -24,7 +25,7 @@ def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
|
24
25
|
text = prefix + '[CLI Documentation](https://www.zoho.com/catalyst/help/cli-command-reference.html)'
|
|
25
26
|
else:
|
|
26
27
|
text = prefix + '[help documentation](https://www.zoho.com/catalyst/help/)'
|
|
27
|
-
elif cmd == '
|
|
28
|
+
elif cmd == 'getform':
|
|
28
29
|
return get_form()
|
|
29
30
|
else:
|
|
30
31
|
text = 'Command executed successfully!'
|
|
@@ -34,7 +35,7 @@ def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
|
34
35
|
|
|
35
36
|
@suggestion_handler
|
|
36
37
|
def suggester(req: CommandHandlerRequest, res: List[CommandSuggestion], *args):
|
|
37
|
-
if req.name == '
|
|
38
|
+
if req.name == 'catalystresource':
|
|
38
39
|
suggestion1 = command.new_command_suggestion()
|
|
39
40
|
suggestion1.title = 'API doc'
|
|
40
41
|
suggestion1.description = 'Catalyst API documentation'
|
|
@@ -52,6 +53,7 @@ def suggester(req: CommandHandlerRequest, res: List[CommandSuggestion], *args):
|
|
|
52
53
|
|
|
53
54
|
res.extend([suggestion1,suggestion2,suggestion3])
|
|
54
55
|
return res
|
|
56
|
+
return [command.new_command_suggestion()]
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def get_form():
|
|
@@ -62,10 +64,8 @@ def get_form():
|
|
|
62
64
|
form.button_label = 'Raise Request'
|
|
63
65
|
form.version = 1
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
form.actions = actions
|
|
67
|
+
action = form.new_form_action('formFunctionLatest') # ENTER YOUR FORM FUNCTION NAME HERE
|
|
68
|
+
form.action = action
|
|
69
69
|
|
|
70
70
|
user_name = form.new_form_input()
|
|
71
71
|
user_name.type = 'text'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from zcatalyst_cliq.extension_handler import validate_installation, ExtensionHandlerRequest, handle_installation, \
|
|
2
|
+
handle_uninstallation
|
|
3
|
+
from zcatalyst_cliq.response_types import InstallationResponse, VoidResponse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@validate_installation
|
|
7
|
+
def validate_installation(req: ExtensionHandlerRequest,res: InstallationResponse, *args):
|
|
8
|
+
if req.user.first_name == '**INVALID_USER**' and req.app_info.type == 'upgrade':
|
|
9
|
+
res.status = 400
|
|
10
|
+
res.title = 'Update not allowed !'
|
|
11
|
+
res.message = 'Sorry. Update not allowed for the current app. Please contact admin.'
|
|
12
|
+
else:
|
|
13
|
+
res.status = 200
|
|
14
|
+
return res
|
|
15
|
+
|
|
16
|
+
@handle_installation
|
|
17
|
+
def installation_handler(req: ExtensionHandlerRequest, res: InstallationResponse, *args):
|
|
18
|
+
'''Logic for installation post handling'''
|
|
19
|
+
res.status = 200
|
|
20
|
+
return res
|
|
21
|
+
|
|
22
|
+
@handle_uninstallation
|
|
23
|
+
def handle_uninstallation(req: ExtensionHandlerRequest, res: VoidResponse, *args):
|
|
24
|
+
# Logic for uninstallation post handling
|
|
25
|
+
return res
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
+
|
|
2
3
|
from zcatalyst_cliq import function_handler
|
|
3
4
|
from zcatalyst_cliq.function_handler import (
|
|
4
5
|
button_function_handler,
|
|
@@ -12,8 +13,10 @@ from zcatalyst_cliq.function_handler import (
|
|
|
12
13
|
HandlerResponse,
|
|
13
14
|
FormChangeResponse,
|
|
14
15
|
FormDynamicFieldResponse,
|
|
15
|
-
WidgetResponse
|
|
16
|
+
WidgetResponse,
|
|
17
|
+
form_view_handler
|
|
16
18
|
)
|
|
19
|
+
from zcatalyst_cliq.response_types import Form
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
@button_function_handler
|
|
@@ -221,6 +224,47 @@ def handle_dynamic_field(req: FormFunctionRequest, res: FormDynamicFieldResponse
|
|
|
221
224
|
res.add_options(res.new_form_value(mobile,mobile.lower().replace(' ','_')))
|
|
222
225
|
return res
|
|
223
226
|
|
|
227
|
+
@form_view_handler
|
|
228
|
+
def form_view_handler(req: FormFunctionRequest, res: Form):
|
|
229
|
+
res.title = 'Asset Request'
|
|
230
|
+
res.hint = 'Raise your asset request'
|
|
231
|
+
res.name = 'ID'
|
|
232
|
+
res.button_label = 'Raise Request'
|
|
233
|
+
res.version = 1
|
|
234
|
+
|
|
235
|
+
user_name = res.new_form_input()
|
|
236
|
+
user_name.type = 'text'
|
|
237
|
+
user_name.name = 'username'
|
|
238
|
+
user_name.label = 'Name'
|
|
239
|
+
user_name.hint = 'Please enter your name'
|
|
240
|
+
user_name.placeholder = 'John Reese'
|
|
241
|
+
user_name.mandatory = True
|
|
242
|
+
user_name.value = 'Harold Finch'
|
|
243
|
+
res.add_inputs(user_name)
|
|
244
|
+
|
|
245
|
+
email = res.new_form_input()
|
|
246
|
+
email.type = 'text'
|
|
247
|
+
email.format = 'email'
|
|
248
|
+
email.name = 'email'
|
|
249
|
+
email.label = 'Email'
|
|
250
|
+
email.hint = 'Enter your email address'
|
|
251
|
+
email.placeholder = "johnreese@poi.com"
|
|
252
|
+
email.mandatory = True
|
|
253
|
+
email.value = "haroldfinch@samaritan.com"
|
|
254
|
+
|
|
255
|
+
asset_type = res.new_form_input()
|
|
256
|
+
asset_type.type = 'select'
|
|
257
|
+
asset_type.trigger_on_change = True
|
|
258
|
+
asset_type.name = 'asset_type'
|
|
259
|
+
asset_type.label = "Asset Type"
|
|
260
|
+
asset_type.hint = "Choose your request asset type"
|
|
261
|
+
asset_type.placeholder = "Mobile"
|
|
262
|
+
asset_type.mandatory = True
|
|
263
|
+
asset_type.add_options(asset_type.new_form_value('Laptop', 'laptop'))
|
|
264
|
+
asset_type.add_options(asset_type.new_form_value('Mobile', 'mobile'))
|
|
265
|
+
|
|
266
|
+
res.add_inputs(email, asset_type)
|
|
267
|
+
return res
|
|
224
268
|
|
|
225
269
|
@widget_button_handler
|
|
226
270
|
def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
@@ -274,7 +318,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
274
318
|
input2.value = id
|
|
275
319
|
|
|
276
320
|
form.add_inputs(input1, input2)
|
|
277
|
-
form.action = form.new_form_action('
|
|
321
|
+
form.action = form.new_form_action('appletForm') # ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
278
322
|
return form
|
|
279
323
|
|
|
280
324
|
elif id == 'breadcrumbs':
|
|
@@ -293,7 +337,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
293
337
|
first_nav = {
|
|
294
338
|
'label': 'Page : ' + page,
|
|
295
339
|
'type': 'invoke.function',
|
|
296
|
-
'name': '
|
|
340
|
+
'name': 'appletFunction',
|
|
297
341
|
'id': 'breadcrumbs'
|
|
298
342
|
}
|
|
299
343
|
|
|
@@ -306,7 +350,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
306
350
|
banner_button = {
|
|
307
351
|
'label': 'Banner',
|
|
308
352
|
'type': 'invoke.function',
|
|
309
|
-
'name': '
|
|
353
|
+
'name': 'appletFunction',
|
|
310
354
|
'id': 'banner'
|
|
311
355
|
}
|
|
312
356
|
|
|
@@ -352,7 +396,7 @@ def get_button_section():
|
|
|
352
396
|
button2 = button_element1.new_widget_button()
|
|
353
397
|
button2.label = 'Banner'
|
|
354
398
|
button2.type = 'invoke.function'
|
|
355
|
-
button2.name = '
|
|
399
|
+
button2.name = 'appletFunction'
|
|
356
400
|
button2.id = 'banner'
|
|
357
401
|
|
|
358
402
|
button3 = button_element1.new_widget_button()
|
|
@@ -374,31 +418,31 @@ def get_button_section():
|
|
|
374
418
|
button5 = button_element2.new_widget_button()
|
|
375
419
|
button5.label = 'Edit Section'
|
|
376
420
|
button5.type = 'invoke.function'
|
|
377
|
-
button5.name = '
|
|
421
|
+
button5.name = 'appletFunction'
|
|
378
422
|
button5.id = 'section'
|
|
379
423
|
|
|
380
424
|
button6 = button_element2.new_widget_button()
|
|
381
425
|
button6.label = 'Form Edit Section'
|
|
382
426
|
button6.type = 'invoke.function'
|
|
383
|
-
button6.name = '
|
|
427
|
+
button6.name = 'appletFunction'
|
|
384
428
|
button6.id = 'formsection'
|
|
385
429
|
|
|
386
430
|
button7 = button_element2.new_widget_button()
|
|
387
431
|
button7.label = 'Banner'
|
|
388
432
|
button7.type = 'invoke.function'
|
|
389
|
-
button7.name = '
|
|
433
|
+
button7.name = 'appletFunction'
|
|
390
434
|
button7.id = 'banner'
|
|
391
435
|
|
|
392
436
|
button8 = button_element2.new_widget_button()
|
|
393
437
|
button8.label = 'Edit Whole Tab'
|
|
394
438
|
button8.type = 'invoke.function'
|
|
395
|
-
button8.name = '
|
|
439
|
+
button8.name = 'appletFunction'
|
|
396
440
|
button8.id = 'tab'
|
|
397
441
|
|
|
398
442
|
button9 = button_element2.new_widget_button()
|
|
399
443
|
button9.label = 'Form Edit Tab'
|
|
400
444
|
button9.type = 'invoke.function'
|
|
401
|
-
button9.name = '
|
|
445
|
+
button9.name = 'appletFunction'
|
|
402
446
|
button9.id = 'formTab'
|
|
403
447
|
|
|
404
448
|
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from zcatalyst_cliq.handler_response import HandlerResponse
|
|
4
|
+
from zcatalyst_cliq.link_preview_handler import (preview_handler, LinkPreviewHandlerRequest, action_handler,
|
|
5
|
+
menu_handler, after_send_handler, new_oembed_actions)
|
|
6
|
+
from zcatalyst_cliq.response_types import UnfurlResponse, OembedActions, OembedFieldData
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@preview_handler
|
|
10
|
+
def preview_handler(req: LinkPreviewHandlerRequest,res: UnfurlResponse):
|
|
11
|
+
res.type = 'link'
|
|
12
|
+
res.title = 'Release checklist | Zoho Cliq'
|
|
13
|
+
res.provider_url = 'https://www.zoho.com/cliq/'
|
|
14
|
+
res.description = 'Release checklist for Cliq 5.0 (Focused on Enterprise and Intelligence)'
|
|
15
|
+
res.dynamic_actions = True
|
|
16
|
+
|
|
17
|
+
fields = res.new_oembed_fields()
|
|
18
|
+
fieldsData: List[OembedFieldData] = list()
|
|
19
|
+
fieldsData.append(fields.new_oembed_field_data('Created By', 'Scott fisher'))
|
|
20
|
+
fieldsData.append(fields.new_oembed_field_data('Created On', '10 Aug, 2023'))
|
|
21
|
+
fieldsData.append(fields.new_oembed_field_data('Last Modified On', '11 Aug, 2023'))
|
|
22
|
+
fieldsData.append(fields.new_oembed_field_data('Tags', '#unfurling_via_extensions #images_and_cards #cliq_360 #Cliq_5.0'))
|
|
23
|
+
fields.data = fieldsData
|
|
24
|
+
res.fields = fields
|
|
25
|
+
|
|
26
|
+
actions: List[OembedActions] = list()
|
|
27
|
+
action = res.new_oembed_actions()
|
|
28
|
+
action.type = 'button'
|
|
29
|
+
action.label = 'Add Comment'
|
|
30
|
+
|
|
31
|
+
confirm = action.new_confirm()
|
|
32
|
+
confirm.title = 'Comment'
|
|
33
|
+
confirm.description = 'Add your comment to the notes'
|
|
34
|
+
confirm.input = 'Type here...'
|
|
35
|
+
action.confirm = confirm
|
|
36
|
+
|
|
37
|
+
params = {'action': 'add_comment'}
|
|
38
|
+
action.params = params
|
|
39
|
+
actions.append(action)
|
|
40
|
+
res.actions = actions
|
|
41
|
+
|
|
42
|
+
return res
|
|
43
|
+
|
|
44
|
+
@action_handler
|
|
45
|
+
def action_handler(req: LinkPreviewHandlerRequest,res: HandlerResponse):
|
|
46
|
+
target: dict = vars(req.target)
|
|
47
|
+
params = vars(target.get('params'))
|
|
48
|
+
action = params.get('action')
|
|
49
|
+
text = ""
|
|
50
|
+
if action == "add_comment":
|
|
51
|
+
text = "Your comment has been added successfully"
|
|
52
|
+
elif action == "delete_note":
|
|
53
|
+
text = "Release checklist | Zoho Cliq note has been deleted"
|
|
54
|
+
elif action == "mark_as_favorite":
|
|
55
|
+
text = "Release checklist | Zoho Cliq note has been marked as favorite"
|
|
56
|
+
return res.new_banner(text,'success')
|
|
57
|
+
|
|
58
|
+
@menu_handler
|
|
59
|
+
def menu_handler(req: LinkPreviewHandlerRequest,res: List[OembedActions]):
|
|
60
|
+
action1 = new_oembed_actions()
|
|
61
|
+
action1.type = 'button'
|
|
62
|
+
action1.label = 'Delete'
|
|
63
|
+
action1.params = {'action': 'delete_note'}
|
|
64
|
+
|
|
65
|
+
action2 = new_oembed_actions()
|
|
66
|
+
action2.type = 'button'
|
|
67
|
+
action2.label = 'Mark as Favorite'
|
|
68
|
+
action2.params = {'action': 'mark_as_favorite'}
|
|
69
|
+
res.extend([action1,action2])
|
|
70
|
+
|
|
71
|
+
return res
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@after_send_handler
|
|
75
|
+
def after_send_handler(req: LinkPreviewHandlerRequest,res: HandlerResponse):
|
|
76
|
+
return res.new_banner("Release checklist | Zoho Cliq 5.0','success")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
|
|
2
3
|
from zcatalyst_cliq.widget_handler import (
|
|
3
4
|
view_handler,
|
|
4
5
|
WidgetExecutionHandlerRequest,
|
|
@@ -52,7 +53,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
52
53
|
fn_button = fn_title.new_widget_button()
|
|
53
54
|
fn_button.type = 'invoke.function'
|
|
54
55
|
fn_button.label = 'Click here'
|
|
55
|
-
fn_button.name = '
|
|
56
|
+
fn_button.name = 'appletFunction' # ** ENTER YOUR WIDGET FUNCTION NAME **
|
|
56
57
|
fn_button.id = 'widgetFn'
|
|
57
58
|
fn_title.add_widget_buttons(fn_button)
|
|
58
59
|
|
|
@@ -179,7 +180,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
179
180
|
button2 = button_element1.new_widget_button()
|
|
180
181
|
button2.label = 'Applet Button'
|
|
181
182
|
button2.type = 'invoke.function'
|
|
182
|
-
button2.name = '
|
|
183
|
+
button2.name = 'appletFunction'
|
|
183
184
|
button2.id = 'banner'
|
|
184
185
|
|
|
185
186
|
button3 = button_element1.new_widget_button()
|
|
@@ -202,31 +203,31 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
202
203
|
button5 = button_element2.new_widget_button()
|
|
203
204
|
button5.label = 'Edit Section'
|
|
204
205
|
button5.type = 'invoke.function'
|
|
205
|
-
button5.name = '
|
|
206
|
+
button5.name = 'appletFunction'
|
|
206
207
|
button5.id = 'section'
|
|
207
208
|
|
|
208
209
|
button6 = button_element2.new_button_object()
|
|
209
210
|
button6.label = 'Form Edit Section'
|
|
210
211
|
button6.type = 'invoke.function'
|
|
211
|
-
button6.name = '
|
|
212
|
+
button6.name = 'appletFunction'
|
|
212
213
|
button6.id = 'formsection'
|
|
213
214
|
|
|
214
215
|
button7 = button_element2.new_button_object()
|
|
215
216
|
button7.label = 'Banner'
|
|
216
217
|
button7.type = 'invoke.function'
|
|
217
|
-
button7.name = '
|
|
218
|
+
button7.name = 'appletFunction'
|
|
218
219
|
button7.id = 'banner'
|
|
219
220
|
|
|
220
221
|
button8 = button_element2.new_button_object()
|
|
221
222
|
button8.label = 'Edit Whole Tab'
|
|
222
223
|
button8.type = 'invoke.function'
|
|
223
|
-
button8.name = '
|
|
224
|
+
button8.name = 'appletFunction'
|
|
224
225
|
button8.id = 'tab'
|
|
225
226
|
|
|
226
227
|
button9 = button_element2.new_button_object()
|
|
227
228
|
button9.label = 'Form Edit Tab'
|
|
228
229
|
button9.type = 'invoke.function'
|
|
229
|
-
button9.name = '
|
|
230
|
+
button9.name = 'appletFunction'
|
|
230
231
|
button9.id = 'formTab'
|
|
231
232
|
|
|
232
233
|
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
@@ -239,7 +240,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
239
240
|
first_nav = {
|
|
240
241
|
'label': 'Page : 1',
|
|
241
242
|
'type': 'invoke.function',
|
|
242
|
-
'name': '
|
|
243
|
+
'name': 'appletFunction',
|
|
243
244
|
'id': 'breadcrumbs'
|
|
244
245
|
}
|
|
245
246
|
|
|
@@ -252,7 +253,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
252
253
|
banner_button = {
|
|
253
254
|
'label': 'Banner',
|
|
254
255
|
'type': 'invoke.function',
|
|
255
|
-
'name': '
|
|
256
|
+
'name': 'appletFunction',
|
|
256
257
|
'id': 'banner'
|
|
257
258
|
}
|
|
258
259
|
|
|
@@ -5,11 +5,11 @@ config = {
|
|
|
5
5
|
"handlers": {
|
|
6
6
|
"bot_handler": "handlers/bot_handler.py",
|
|
7
7
|
"function_handler": "handlers/function_handler.py",
|
|
8
|
-
"
|
|
8
|
+
"extension_handler": "handlers/extension_handler.py",
|
|
9
9
|
"command_handler": "handlers/command_handler.py",
|
|
10
10
|
"widget_handler": "handlers/widget_handler.py",
|
|
11
11
|
"messageaction_handler": "handlers/message_action_handler.py",
|
|
12
|
-
"
|
|
12
|
+
"link_preview_handler": "handlers/link_preview_handler.py"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
}
|
|
@@ -11,7 +11,6 @@ def handler(job_request, context):
|
|
|
11
11
|
job_details = job_request.get_job_details() # get the details of the current job
|
|
12
12
|
project_details = job_request.get_project_details() # get the details of the current project
|
|
13
13
|
job_meta_details = job_request.get_job_meta_details() # get the job meta of the current job
|
|
14
|
-
job_pool_details = job_request.get_job_pool_details() # get the current functions job pool details
|
|
15
14
|
job_capacity_attributes = job_request.get_job_capacity_attributes() # get the current jobs capacity
|
|
16
15
|
all_job_params = job_request.get_all_job_params() # get all the parameters supplied to the job function
|
|
17
16
|
job_param = job_request.get_job_param('key') # get the value of a particular parameter supplied to the job function
|
package/templates/init.txt
CHANGED
|
Binary file
|