zcatalyst-cli 1.14.0 → 1.15.0-beta.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/lib/endpoints/index.js +8 -1
- package/lib/endpoints/lib/catalyst-details.js +8 -4
- package/lib/endpoints/lib/common.js +46 -0
- package/lib/endpoints/lib/env.js +2 -4
- package/lib/endpoints/lib/project.js +3 -6
- package/lib/endpoints/lib/sdk.js +20 -11
- package/lib/errorResponse.js +2 -1
- package/lib/fn-utils/lib/browserLogic.js +70 -0
- package/lib/fn-utils/lib/common.js +9 -2
- package/lib/fn-utils/lib/java.js +11 -3
- package/lib/init/dependencies/package-json.js +2 -18
- package/lib/init/dependencies/python/pip-install.js +38 -4
- package/lib/init/features/functions/index.js +6 -3
- package/lib/init/features/functions/languages/java.js +22 -3
- package/lib/init/features/functions/languages/node.js +25 -7
- package/lib/init/features/index.js +1 -1
- package/lib/internal/api.js +26 -13
- package/lib/progress.js +6 -1
- package/lib/serve/features/index.js +1 -1
- package/lib/serve/index.js +4 -1
- package/lib/serve/server/index.js +6 -3
- package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/master.js +16 -14
- package/lib/serve/server/lib/node/browserlogic/browserlogic-playwright.js +25 -0
- package/lib/serve/server/lib/node/browserlogic/browserlogic-puppeteer.js +22 -0
- package/lib/serve/server/lib/node/browserlogic/browserlogic-selenium.js +44 -0
- package/lib/serve/server/lib/node/browserlogic/index.js +24 -0
- package/lib/serve/server/lib/node/browserlogic/utils/deferred_promise.js +21 -0
- package/lib/serve/server/lib/node/browserlogic/utils/playwright-handler.js +34 -0
- package/lib/serve/server/lib/node/browserlogic/utils/puppeteer-handler.js +35 -0
- package/lib/serve/server/lib/node/browserlogic/utils/selenium-handler.js +59 -0
- package/lib/serve/server/lib/node/index.js +75 -0
- package/lib/serve/server/lib/node/package.json +7 -0
- package/lib/shell/dependencies/local-function.js +2 -1
- package/lib/shell/index.js +7 -1
- package/lib/shell/prepare/languages/java.js +3 -1
- package/lib/util_modules/constants/lib/browserLogic.js +14 -0
- package/lib/util_modules/constants/lib/default.js +4 -2
- package/lib/util_modules/constants/lib/fn-type.js +2 -1
- package/lib/util_modules/constants/lib/placeholders.js +2 -1
- package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
- package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
- package/lib/util_modules/constants/lib/template.js +9 -0
- package/lib/util_modules/context-help.js +5 -2
- package/package.json +1 -1
- package/templates/init/functions/java/browserLogic/playwright/.classpath +6 -0
- package/templates/init/functions/java/browserLogic/playwright/.project +17 -0
- package/templates/init/functions/java/browserLogic/playwright/catalyst-config.json +11 -0
- package/templates/init/functions/java/browserLogic/playwright/sample.java +38 -0
- package/templates/init/functions/java/browserLogic/selenium/.classpath +6 -0
- package/templates/init/functions/java/browserLogic/selenium/.project +17 -0
- package/templates/init/functions/java/browserLogic/selenium/catalyst-config.json +11 -0
- package/templates/init/functions/java/browserLogic/selenium/sample.java +38 -0
- package/templates/init/functions/node/browserlogic/playwright/catalyst-config.json +11 -0
- package/templates/init/functions/node/browserlogic/playwright/package.json +7 -0
- package/templates/init/functions/node/browserlogic/playwright/sample.js +10 -0
- package/templates/init/functions/node/browserlogic/puppeteer/catalyst-config.json +11 -0
- package/templates/init/functions/node/browserlogic/puppeteer/package.json +7 -0
- package/templates/init/functions/node/browserlogic/puppeteer/sample.js +10 -0
- package/templates/init/functions/node/browserlogic/selenium/catalyst-config.json +11 -0
- package/templates/init/functions/node/browserlogic/selenium/package.json +7 -0
- package/templates/init/functions/node/browserlogic/selenium/sample.js +10 -0
- package/templates/init/functions/python/aio/sample.py +5 -2
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +4 -4
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +2 -2
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +5 -5
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +15 -15
- package/lib/serve/server/lib/node.mjs +0 -41
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Object.freeze({
|
|
4
|
+
nodejs: {
|
|
5
|
+
Puppeteer: { 'puppeteer-core': 'latest', 'zcatalyst-sdk-node': 'beta' },
|
|
6
|
+
Playwright: { 'playwright-core': 'latest', 'zcatalyst-sdk-node': 'beta' },
|
|
7
|
+
Selenium: { 'selenium-webdriver': 'latest', 'zcatalyst-sdk-node': 'beta' }
|
|
8
|
+
},
|
|
9
|
+
java: {
|
|
10
|
+
Selenium: [
|
|
11
|
+
'https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.8.0/selenium-server-4.8.3.jar'
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -14,13 +14,15 @@ exports.default = Object.freeze({
|
|
|
14
14
|
master: 3000,
|
|
15
15
|
advancedio: 3010,
|
|
16
16
|
basicio: 3040,
|
|
17
|
-
client:
|
|
17
|
+
client: 3070,
|
|
18
|
+
browser_logic: 3100
|
|
18
19
|
},
|
|
19
20
|
debug: {
|
|
20
21
|
master: -1,
|
|
21
22
|
advancedio: 8000,
|
|
22
23
|
basicio: 8010,
|
|
23
|
-
client: -1
|
|
24
|
+
client: -1,
|
|
25
|
+
browser_logic: 8020
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
event_bus: {
|
|
@@ -12,7 +12,8 @@ exports.default = Object.freeze({
|
|
|
12
12
|
cron: fn_type_1.default.cron,
|
|
13
13
|
applogic: fn_type_1.default.applogic,
|
|
14
14
|
advancedio: fn_type_1.default.advanced,
|
|
15
|
-
integration: fn_type_1.default.integration
|
|
15
|
+
integration: fn_type_1.default.integration,
|
|
16
|
+
browser_logic: fn_type_1.default.browserLogic
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
});
|
|
@@ -12,7 +12,8 @@ exports.default = Object.freeze({
|
|
|
12
12
|
[fn_type_1.default.cron]: 'cron',
|
|
13
13
|
[fn_type_1.default.applogic]: 'applogic',
|
|
14
14
|
[fn_type_1.default.advanced]: 'advancedio',
|
|
15
|
-
[fn_type_1.default.integration]: 'integration'
|
|
15
|
+
[fn_type_1.default.integration]: 'integration',
|
|
16
|
+
[fn_type_1.default.browserLogic]: 'browser_logic'
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
});
|
|
@@ -29,6 +29,11 @@ exports.default = Object.freeze({
|
|
|
29
29
|
aio: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node', 'aio'),
|
|
30
30
|
integ: {
|
|
31
31
|
[constants_1.INTEG.services.cliq]: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node', 'integ', 'cliq')
|
|
32
|
+
},
|
|
33
|
+
browserlogic: {
|
|
34
|
+
playwright: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node', 'browserlogic', 'playwright'),
|
|
35
|
+
puppeteer: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node', 'browserlogic', 'puppeteer'),
|
|
36
|
+
selenium: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node', 'browserlogic', 'selenium')
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
java: {
|
|
@@ -38,6 +43,10 @@ exports.default = Object.freeze({
|
|
|
38
43
|
aio: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java', 'aio'),
|
|
39
44
|
integ: {
|
|
40
45
|
[constants_1.INTEG.services.cliq]: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java', 'integ', 'cliq')
|
|
46
|
+
},
|
|
47
|
+
browserlogic: {
|
|
48
|
+
selenium: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java', 'browserlogic', 'selenium'),
|
|
49
|
+
playwright: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java', 'browserlogic', 'playwright')
|
|
41
50
|
}
|
|
42
51
|
},
|
|
43
52
|
python: {
|
|
@@ -26,6 +26,7 @@ function help() {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
logKeys.forEach((key) => {
|
|
29
|
+
var _a;
|
|
29
30
|
const errQueue = logs[key];
|
|
30
31
|
if (key === 'faultyError') {
|
|
31
32
|
errQueue.forEach((err) => {
|
|
@@ -34,12 +35,14 @@ function help() {
|
|
|
34
35
|
return;
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
const docPath =
|
|
38
|
+
const docPath = ((_a = errQueue[0].fileName) === null || _a === void 0 ? void 0 : _a.replace((0, path_1.join)(__dirname, '../../lib'), (0, path_1.join)(__dirname, '../../docs'))) + '.toml';
|
|
38
39
|
const doc = fs_1.SYNC.readFile(docPath) || '';
|
|
39
40
|
const catHelp = (0, toml_1.default)(doc);
|
|
40
41
|
errQueue.forEach((err) => {
|
|
41
42
|
exitCode = err.exit > exitCode ? err.exit : exitCode;
|
|
42
|
-
if (err.errorId === undefined ||
|
|
43
|
+
if (err.errorId === undefined ||
|
|
44
|
+
catHelp === undefined ||
|
|
45
|
+
Object.keys(catHelp).length === 0) {
|
|
43
46
|
outputError(err, errQueue);
|
|
44
47
|
return;
|
|
45
48
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>{{_NAME_}}</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
16
|
+
</natures>
|
|
17
|
+
</projectDescription>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import java.util.logging.Level;
|
|
2
|
+
import java.util.logging.Logger;
|
|
3
|
+
|
|
4
|
+
import javax.servlet.http.HttpServletRequest;
|
|
5
|
+
import javax.servlet.http.HttpServletResponse;
|
|
6
|
+
|
|
7
|
+
import com.microsoft.playwright.Page;
|
|
8
|
+
import com.catalyst.browserlogic.PlaywrightHandler;
|
|
9
|
+
|
|
10
|
+
import org.json.simple.JSONObject;
|
|
11
|
+
|
|
12
|
+
public class {{_CLASS_}} implements PlaywrightHandler {
|
|
13
|
+
private static final Logger LOGGER = Logger.getLogger({{_CLASS_}}.class.getName());
|
|
14
|
+
|
|
15
|
+
JSONObject responseData = new JSONObject();
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
@SuppressWarnings("unchecked")
|
|
19
|
+
public void runner(HttpServletRequest request, HttpServletResponse response,Page page) throws Exception {
|
|
20
|
+
try {
|
|
21
|
+
//Fetches the endpoint and method to which the call was made
|
|
22
|
+
page.navigate("https://www.example.com");
|
|
23
|
+
responseData.put("message", "Title of the page "+page.title());
|
|
24
|
+
|
|
25
|
+
//Sends the response back to the Client
|
|
26
|
+
response.setContentType("application/json");
|
|
27
|
+
response.getWriter().write(responseData.toString());
|
|
28
|
+
response.setStatus(200);
|
|
29
|
+
} catch (Exception e) {
|
|
30
|
+
//The actions are logged. You can check the logs from Catalyst Logs.
|
|
31
|
+
LOGGER.log(Level.SEVERE, "Exception in {{_CLASS_}}", e);
|
|
32
|
+
responseData.put("error", "Internal server error occurred. Please try again in some time.");
|
|
33
|
+
response.getWriter().write(responseData.toString());
|
|
34
|
+
response.setStatus(500);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>{{_NAME_}}</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
16
|
+
</natures>
|
|
17
|
+
</projectDescription>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import java.util.logging.Level;
|
|
2
|
+
import java.util.logging.Logger;
|
|
3
|
+
|
|
4
|
+
import javax.servlet.http.HttpServletRequest;
|
|
5
|
+
import javax.servlet.http.HttpServletResponse;
|
|
6
|
+
|
|
7
|
+
import org.openqa.selenium.chrome.ChromeDriver;
|
|
8
|
+
import com.catalyst.browserlogic.SeleniumHandler;
|
|
9
|
+
|
|
10
|
+
import org.json.simple.JSONObject;
|
|
11
|
+
|
|
12
|
+
public class {{_CLASS_}} implements SeleniumHandler {
|
|
13
|
+
private static final Logger LOGGER = Logger.getLogger({{_CLASS_}}.class.getName());
|
|
14
|
+
|
|
15
|
+
JSONObject responseData = new JSONObject();
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
@SuppressWarnings("unchecked")
|
|
19
|
+
public void runner(HttpServletRequest request, HttpServletResponse response,ChromeDriver driver) throws Exception {
|
|
20
|
+
try {
|
|
21
|
+
//Fetches the endpoint and method to which the call was made
|
|
22
|
+
driver.get("https://www.example.com");
|
|
23
|
+
responseData.put("message", "Title of the page "+driver.getTitle());
|
|
24
|
+
|
|
25
|
+
//Sends the response back to the Client
|
|
26
|
+
response.setContentType("application/json");
|
|
27
|
+
response.getWriter().write(responseData.toString());
|
|
28
|
+
response.setStatus(200);
|
|
29
|
+
} catch (Exception e) {
|
|
30
|
+
//The actions are logged. You can check the logs from Catalyst Logs.
|
|
31
|
+
LOGGER.log(Level.SEVERE, "Exception in {{_CLASS_}}", e);
|
|
32
|
+
responseData.put("error", "Internal server error occurred. Please try again in some time.");
|
|
33
|
+
response.getWriter().write(responseData.toString());
|
|
34
|
+
response.setStatus(500);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
// Read the `url` from request, goto the page, extract title and return the results
|
|
3
|
+
|
|
4
|
+
module.exports.playwright = async (request, response, page) => {
|
|
5
|
+
await page.goto('https://example.com/');
|
|
6
|
+
const pageTitle = await page.title();
|
|
7
|
+
response.setHeader('Content-Type', 'application/json');
|
|
8
|
+
response.write(JSON.stringify({ output: pageTitle }));
|
|
9
|
+
response.end();
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
// Read the `url` from request, goto the page, extract title and return the results
|
|
3
|
+
|
|
4
|
+
module.exports.puppeteer = async (request, response, page) => {
|
|
5
|
+
await page.goto('https://example.com/',{waitUntil: "domcontentloaded"});
|
|
6
|
+
const pageTitle = await page.title();
|
|
7
|
+
response.setHeader('Content-Type', 'application/json');
|
|
8
|
+
response.write(JSON.stringify({ output: pageTitle }));
|
|
9
|
+
response.end();
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
// Read the `url` from request, goto the page, extract title and return the results
|
|
3
|
+
|
|
4
|
+
module.exports.selenium = async (request, response, driver) => {
|
|
5
|
+
await driver.get('https://example.com/');
|
|
6
|
+
const pageTitle = await driver.getTitle();
|
|
7
|
+
response.setHeader('Content-Type', 'application/json');
|
|
8
|
+
response.write(JSON.stringify({ output: pageTitle }));
|
|
9
|
+
response.end();
|
|
10
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import zcatalyst_sdk
|
|
3
1
|
import logging
|
|
4
2
|
from flask import Request, make_response, jsonify
|
|
3
|
+
import zcatalyst_sdk
|
|
4
|
+
'''
|
|
5
|
+
Execute below command to install SDK in global for enabling code suggestions
|
|
6
|
+
-> python3 -m pip install zcatalyst-sdk
|
|
7
|
+
'''
|
|
5
8
|
|
|
6
9
|
def handler(request: Request):
|
|
7
10
|
app = zcatalyst_sdk.initialize()
|
|
@@ -16,7 +16,7 @@ from zcatalyst_cliq.bot_handler import (
|
|
|
16
16
|
BotWebHookHandlerRequest,
|
|
17
17
|
HandlerResponse
|
|
18
18
|
)
|
|
19
|
-
from
|
|
19
|
+
from zcatalyst_sdk.catalyst_app import CatalystApp
|
|
20
20
|
import logging
|
|
21
21
|
|
|
22
22
|
@welcome_handler
|
|
@@ -106,13 +106,13 @@ def ctx_handler(req: BotContextHandlerRequest, res: HandlerResponse, *args):
|
|
|
106
106
|
@mention_handler
|
|
107
107
|
def mention_handler(req: BotMentionHandlerRequest, res: HandlerResponse, *args):
|
|
108
108
|
text = f"Hey *{req.user.first_name}*, thanks for mentioning me here. I'm from Catalyst city"
|
|
109
|
-
res.set_text(text)
|
|
109
|
+
res.set_text(text)
|
|
110
110
|
return res
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
@menu_action_handler
|
|
114
114
|
def action(req: BotMenuActionHandlerRequest, res: HandlerResponse, *args):
|
|
115
|
-
text = ''
|
|
115
|
+
text = ''
|
|
116
116
|
if req.action_name == 'Say Hi':
|
|
117
117
|
text = 'Hi'
|
|
118
118
|
elif req.action_name == 'Look Angry':
|
|
@@ -126,7 +126,7 @@ def action(req: BotMenuActionHandlerRequest, res: HandlerResponse, *args):
|
|
|
126
126
|
|
|
127
127
|
@participation_handler
|
|
128
128
|
def participation(req: BotParticipationHandlerRequest, res: HandlerResponse, *args):
|
|
129
|
-
text = ''
|
|
129
|
+
text = ''
|
|
130
130
|
if req.operation == 'added':
|
|
131
131
|
text = 'Hi. Thanks for adding me to the channel :smile:'
|
|
132
132
|
elif req.operation == 'removed':
|
|
@@ -17,7 +17,7 @@ def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
|
17
17
|
if not suggestions:
|
|
18
18
|
text = 'Please select a suggestion from the command'
|
|
19
19
|
else:
|
|
20
|
-
prefix = 'Take a look at our '
|
|
20
|
+
prefix = 'Take a look at our '
|
|
21
21
|
if suggestions[0].title == 'API doc':
|
|
22
22
|
text = prefix + '[API Documentation](https://www.zoho.com/catalyst/help/api/introduction/overview.html)'
|
|
23
23
|
elif suggestions[0].title == 'CLI doc':
|
|
@@ -63,7 +63,7 @@ def get_form():
|
|
|
63
63
|
form.version = 1
|
|
64
64
|
|
|
65
65
|
actions = form.new_form_actions_obj()
|
|
66
|
-
actions.submit = actions.new_form_action('PyFnForm')
|
|
66
|
+
actions.submit = actions.new_form_action('PyFnForm') # ENTER YOUR FORM FUNCTION NAME HERE
|
|
67
67
|
|
|
68
68
|
form.actions = actions
|
|
69
69
|
|
|
@@ -196,7 +196,7 @@ def change_form(req: FormFunctionRequest, res: FormChangeResponse, *args):
|
|
|
196
196
|
res.add_actions(mobile_list_action)
|
|
197
197
|
else:
|
|
198
198
|
remove_mobile_list_action = res.new_form_modification_action()
|
|
199
|
-
remove_mobile_list_action.type = 'remove'
|
|
199
|
+
remove_mobile_list_action.type = 'remove'
|
|
200
200
|
remove_mobile_list_action.name = 'mobile_list'
|
|
201
201
|
|
|
202
202
|
res.add_actions(remove_mobile_list_action)
|
|
@@ -274,7 +274,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
274
274
|
input2.value = id
|
|
275
275
|
|
|
276
276
|
form.add_inputs(input1, input2)
|
|
277
|
-
form.action = form.new_form_action('PyFnForm')
|
|
277
|
+
form.action = form.new_form_action('PyFnForm') # ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
278
278
|
return form
|
|
279
279
|
|
|
280
280
|
elif id == 'breadcrumbs':
|
|
@@ -285,7 +285,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
285
285
|
section.id = '12345'
|
|
286
286
|
|
|
287
287
|
elem = section.new_widget_element()
|
|
288
|
-
elem.type = 'subtext'
|
|
288
|
+
elem.type = 'subtext'
|
|
289
289
|
elem.text = 'Page : ' + page
|
|
290
290
|
section.add_elements(elem)
|
|
291
291
|
res.add_sections(section)
|
|
@@ -358,7 +358,7 @@ def get_button_section():
|
|
|
358
358
|
button3 = button_element1.new_widget_button()
|
|
359
359
|
button3.label = 'Open Channel'
|
|
360
360
|
button3.type = 'system.api'
|
|
361
|
-
button3.set_api('joinchannel/{{id}}', 'CT_1407724818712687474_72317143')
|
|
361
|
+
button3.set_api('joinchannel/{{id}}', 'CT_1407724818712687474_72317143') # ** ENTER YOUR CHANNEL ID HERE **
|
|
362
362
|
|
|
363
363
|
button4 = button_element1.new_widget_button()
|
|
364
364
|
button4.label = 'Preview'
|
|
@@ -403,7 +403,7 @@ def get_button_section():
|
|
|
403
403
|
|
|
404
404
|
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
405
405
|
|
|
406
|
-
button_section.add_elements(title, button_element1, button_element2)
|
|
406
|
+
button_section.add_elements(title, button_element1, button_element2)
|
|
407
407
|
button_section.id = '101'
|
|
408
408
|
|
|
409
409
|
return button_section
|
|
@@ -23,7 +23,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
23
23
|
datastore_section = res.new_widget_section()
|
|
24
24
|
datastore_section.id = '1'
|
|
25
25
|
|
|
26
|
-
divider = datastore_section.new_widget_element()
|
|
26
|
+
divider = datastore_section.new_widget_element() #common divider
|
|
27
27
|
divider.type = 'divider'
|
|
28
28
|
|
|
29
29
|
ds_title = datastore_section.new_widget_element()
|
|
@@ -31,10 +31,10 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
31
31
|
ds_title.text = 'Datastore'
|
|
32
32
|
|
|
33
33
|
ds_button = ds_title.new_widget_button()
|
|
34
|
-
ds_button.type = 'open.url'
|
|
35
|
-
ds_button.label = 'Link'
|
|
36
|
-
ds_button.url = 'https://www.zoho.com/catalyst/help/data-store.html'
|
|
37
|
-
ds_title.add_widget_buttons(ds_button)
|
|
34
|
+
ds_button.type = 'open.url'
|
|
35
|
+
ds_button.label = 'Link'
|
|
36
|
+
ds_button.url = 'https://www.zoho.com/catalyst/help/data-store.html'
|
|
37
|
+
ds_title.add_widget_buttons(ds_button)
|
|
38
38
|
|
|
39
39
|
ds_text = datastore_section.new_widget_element()
|
|
40
40
|
ds_text.type = 'text'
|
|
@@ -52,7 +52,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
52
52
|
fn_button = fn_title.new_widget_button()
|
|
53
53
|
fn_button.type = 'invoke.function'
|
|
54
54
|
fn_button.label = 'Click here'
|
|
55
|
-
fn_button.name = 'PyFnWidgetButton'
|
|
55
|
+
fn_button.name = 'PyFnWidgetButton' # ** ENTER YOUR WIDGET FUNCTION NAME **
|
|
56
56
|
fn_button.id = 'widgetFn'
|
|
57
57
|
fn_title.add_widget_buttons(fn_button)
|
|
58
58
|
|
|
@@ -71,7 +71,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
71
71
|
auto_ml_title.text = 'AutoML'
|
|
72
72
|
|
|
73
73
|
auto_ml_text = auto_ml_Section.new_widget_element()
|
|
74
|
-
auto_ml_text.type = 'text'
|
|
74
|
+
auto_ml_text.type = 'text'
|
|
75
75
|
auto_ml_text.text = 'AutoML (Automated Machine Learning) is the process of automating the end-to-end traditional machine learning model and' \
|
|
76
76
|
+' applying it to solve the real-world problems.'
|
|
77
77
|
|
|
@@ -104,7 +104,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
104
104
|
bot_section = res.new_widget_section()
|
|
105
105
|
bot_section.id = '4'
|
|
106
106
|
|
|
107
|
-
divider = bot_section.new_widget_element()
|
|
107
|
+
divider = bot_section.new_widget_element() # common divider
|
|
108
108
|
divider.type = 'divider'
|
|
109
109
|
|
|
110
110
|
bot_title = bot_section.new_widget_element()
|
|
@@ -114,7 +114,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
114
114
|
bot_text = bot_section.new_widget_element()
|
|
115
115
|
bot_text.type = 'text'
|
|
116
116
|
bot_text.text = 'Bot is your system powered contact or your colleague with which you can interact with as you do with any other person.' \
|
|
117
|
-
+' The bot can be programmed to respond to your queries, to perform action on your behalf and to notify you for any important event.'
|
|
117
|
+
+' The bot can be programmed to respond to your queries, to perform action on your behalf and to notify you for any important event.'
|
|
118
118
|
|
|
119
119
|
bot_section.add_elements(bot_title, bot_text, divider)
|
|
120
120
|
|
|
@@ -130,7 +130,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
130
130
|
widget_text.type = 'text'
|
|
131
131
|
widget_text.text = 'Widgets are a great way to customize your Cliq home screen. Imagine having a custom view of all the important data and functionality from the different apps that you use every day.'
|
|
132
132
|
|
|
133
|
-
widget_section.add_elements(widget_title, widget_text, divider)
|
|
133
|
+
widget_section.add_elements(widget_title, widget_text, divider)
|
|
134
134
|
|
|
135
135
|
# Connections
|
|
136
136
|
connection_section = res.new_widget_section()
|
|
@@ -141,10 +141,10 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
141
141
|
connectionTitle.text = 'Connections'
|
|
142
142
|
|
|
143
143
|
connectionText = connection_section.new_widget_element()
|
|
144
|
-
connectionText.type = 'text'
|
|
144
|
+
connectionText.type = 'text'
|
|
145
145
|
connectionText.text = 'Connections is an interface to integrate third party services with your Zoho Service, in this case, Cliq.' \
|
|
146
146
|
+' These connections are used in an URL invocation task to access authenticated data.' \
|
|
147
|
-
+' To establish a connection, it is necessary to provide a Connection Name, Authentication Type amongst other details.'
|
|
147
|
+
+' To establish a connection, it is necessary to provide a Connection Name, Authentication Type amongst other details.'
|
|
148
148
|
|
|
149
149
|
connection_section.add_elements(connectionTitle, connectionText, divider)
|
|
150
150
|
|
|
@@ -155,8 +155,8 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
155
155
|
title_section = res.new_widget_section()
|
|
156
156
|
title_section.id = '100'
|
|
157
157
|
|
|
158
|
-
time = title_section.new_widget_element()
|
|
159
|
-
time.type = 'subtext'
|
|
158
|
+
time = title_section.new_widget_element()
|
|
159
|
+
time.type = 'subtext'
|
|
160
160
|
time.text = 'Target:buttons\nTime : ' + str(datetime.datetime.now())
|
|
161
161
|
|
|
162
162
|
title_section.add_elements(time)
|
|
@@ -185,7 +185,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
185
185
|
button3 = button_element1.new_widget_button()
|
|
186
186
|
button3.label = 'Open Channel'
|
|
187
187
|
button3.type = 'system.api'
|
|
188
|
-
button3.set_api('joinchannel/{{id}}', 'CT_1407724818712687474_72317143')
|
|
188
|
+
button3.set_api('joinchannel/{{id}}', 'CT_1407724818712687474_72317143') # ** ENTER YOUR CHANNEL ID HERE **
|
|
189
189
|
|
|
190
190
|
button4 = button_element1.new_widget_button()
|
|
191
191
|
button4.label = 'Preview'
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import express from 'express';
|
|
4
|
-
import { inspect } from 'util';
|
|
5
|
-
import { pathToFileURL } from 'url';
|
|
6
|
-
|
|
7
|
-
const args = process.argv.slice(2);
|
|
8
|
-
const listenPort = parseInt(args[0], 10);
|
|
9
|
-
const fnDetails = JSON.parse(args[1]);
|
|
10
|
-
|
|
11
|
-
const app = express();
|
|
12
|
-
|
|
13
|
-
const targetName = fnDetails.name;
|
|
14
|
-
const index = pathToFileURL(fnDetails.index);
|
|
15
|
-
|
|
16
|
-
app.use('/', async (req, res) => {
|
|
17
|
-
try {
|
|
18
|
-
if (index === undefined) {
|
|
19
|
-
throw new Error('index of AIO function is undefined');
|
|
20
|
-
}
|
|
21
|
-
const userModule = await import(index);
|
|
22
|
-
if (!('default' in userModule)) {
|
|
23
|
-
throw new Error('Could not find any default export');
|
|
24
|
-
}
|
|
25
|
-
if (typeof userModule.default !== 'function') {
|
|
26
|
-
throw new Error('The default export is not a function');
|
|
27
|
-
}
|
|
28
|
-
userModule.default(req, res);
|
|
29
|
-
} catch (e) {
|
|
30
|
-
const errorString = inspect(e);
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
console.error('[' + targetName + '] ' + errorString);
|
|
33
|
-
res.writeHead(500);
|
|
34
|
-
res.end(errorString);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
app.listen(listenPort).on('error', (err) => {
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
|
-
console.error(err);
|
|
41
|
-
});
|