zcatalyst-cli 1.13.2 → 1.14.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/docs/client-utils.toml +6 -1
- package/docs/commands/ds/import.toml +5 -0
- package/docs/fn-utils/lib/python.toml +4 -0
- package/docs/init/dependencies/python/ensure-python.toml +12 -0
- package/docs/init/dependencies/python/pip-install.toml +4 -0
- package/docs/serve/index.toml +5 -0
- package/lib/authentication/login.js +2 -1
- package/lib/cli_table/index.js +26 -2
- package/lib/cli_table/src/cell.js +359 -267
- package/lib/cli_table/src/layout-manager.js +231 -209
- package/lib/cli_table/src/table.js +76 -60
- package/lib/cli_table/src/utils.js +259 -224
- package/lib/client-utils.js +18 -4
- package/lib/command_needs/rc.js +57 -8
- package/lib/commands/config/delete.js +23 -0
- package/lib/commands/config/get.js +23 -0
- package/lib/commands/config/list.js +23 -0
- package/lib/commands/config/set.js +29 -0
- package/lib/commands/console/cache.js +31 -1
- package/lib/commands/console/queue.js +31 -1
- package/lib/commands/console/zcql.js +27 -1
- package/lib/commands/ds/export.js +2 -2
- package/lib/commands/ds/import.js +25 -5
- package/lib/commands/ds/status.js +2 -2
- package/lib/commands/iac/export.js +1 -1
- package/lib/commands/iac/import.js +1 -1
- package/lib/commands/iac/pack.js +16 -5
- package/lib/commands/iac/status.js +1 -1
- package/lib/commands/index.js +4 -0
- package/lib/commands/project/list.js +1 -1
- package/lib/commands/project/use.js +1 -1
- package/lib/deploy/features/client.js +2 -2
- package/lib/deploy/features/functions/index.js +13 -3
- package/lib/deploy/features/functions/languages/index.js +19 -2
- package/lib/endpoints/index.js +12 -5
- package/lib/endpoints/lib/env.js +5 -2
- package/lib/endpoints/lib/functions.js +30 -0
- package/lib/endpoints/lib/org.js +35 -0
- package/lib/endpoints/lib/project.js +7 -3
- package/lib/express_middlewares/unknownReqProxy.js +4 -1
- package/lib/fn-utils/index.js +2 -0
- package/lib/fn-utils/lib/common.js +68 -7
- package/lib/fn-utils/lib/integ.js +15 -11
- package/lib/fn-utils/lib/java.js +7 -3
- package/lib/fn-utils/lib/python.js +121 -0
- package/lib/fn-watcher.js +10 -2
- package/lib/index.js +2 -1
- package/lib/init/dependencies/python/ensure-python.js +151 -0
- package/lib/init/dependencies/python/pip-install.js +175 -0
- package/lib/init/features/functions/index.js +50 -29
- package/lib/init/features/functions/languages/index.js +3 -1
- package/lib/init/features/functions/languages/python.js +115 -0
- package/lib/init/features/index.js +2 -2
- package/lib/init/features/project.js +26 -6
- package/lib/init/util/project.js +2 -2
- package/lib/internal/api.js +2 -0
- package/lib/internal/command.js +1 -1
- package/lib/internal/rc.js +2 -0
- package/lib/port-resolver.js +4 -3
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/functions/index.js +35 -2
- package/lib/pull/features/functions/languages.js +8 -1
- package/lib/readLineUtils.js +37 -1
- package/lib/readline/features/cache.js +175 -1
- package/lib/readline/features/index.js +7 -1
- package/lib/readline/features/queue.js +209 -1
- package/lib/readline/features/zcql.js +237 -1
- package/lib/readline/index.js +30 -1
- package/lib/serve/index.js +48 -7
- package/lib/serve/server/index.js +118 -44
- 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 +18 -5
- package/lib/serve/server/lib/node.mjs +41 -0
- package/lib/serve/server/lib/web_client/index.js +7 -3
- package/lib/serve/server/lib/web_client/server.js +31 -15
- package/lib/shell/dependencies/http-functions.js +57 -21
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +1 -2
- package/lib/shell/dependencies/invoker/bio/node.mjs +127 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/node.mjs +87 -0
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +3 -3
- package/lib/shell/dependencies/invoker/event/node.mjs +84 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/integ/node.mjs +88 -0
- package/lib/shell/dependencies/local-function.js +74 -22
- package/lib/shell/index.js +11 -2
- package/lib/shell/prepare/index.js +21 -0
- package/lib/shell/prepare/languages/index.js +8 -2
- package/lib/shell/prepare/languages/java.js +39 -2
- package/lib/shell/prepare/languages/node.js +21 -2
- package/lib/shell/prepare/languages/python.js +65 -0
- package/lib/throbber/index.js +3 -1
- package/lib/userConfig.js +48 -0
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/apig-rules.js +8 -0
- package/lib/util_modules/constants/lib/cliq-handlers.js +17 -1
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +2 -2
- package/lib/util_modules/constants/lib/env-path.js +12 -0
- package/lib/util_modules/constants/lib/file-names.js +4 -1
- package/lib/util_modules/constants/lib/folder-names.js +3 -1
- package/lib/util_modules/constants/lib/placeholders.js +6 -1
- package/lib/util_modules/constants/lib/runtime.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -0
- package/lib/util_modules/constants/lib/template.js +9 -0
- package/lib/util_modules/constants/lib/urls.js +2 -6
- package/lib/util_modules/context-help.js +2 -0
- package/lib/util_modules/fs/lib/async.js +35 -11
- package/lib/util_modules/project.js +20 -1
- package/package.json +2 -1
- package/templates/init/functions/java/aio/catalyst-config.json +3 -2
- package/templates/init/functions/java/bio/catalyst-config.json +3 -2
- package/templates/init/functions/java/cron/catalyst-config.json +3 -2
- package/templates/init/functions/java/event/catalyst-config.json +3 -2
- package/templates/init/functions/java/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/aio/catalyst-config.json +3 -2
- package/templates/init/functions/node/bio/catalyst-config.json +3 -2
- package/templates/init/functions/node/cron/catalyst-config.json +3 -2
- package/templates/init/functions/node/event/catalyst-config.json +3 -2
- package/templates/init/functions/node/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +2 -2
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +1 -2
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-validator.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/message-action-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/sample.js +4 -4
- package/templates/init/functions/python/aio/catalyst-config.json +11 -0
- package/templates/init/functions/python/aio/requirements.txt +1 -0
- package/templates/init/functions/python/aio/sample.py +26 -0
- package/templates/init/functions/python/bio/catalyst-config.json +11 -0
- package/templates/init/functions/python/bio/requirements.txt +1 -0
- package/templates/init/functions/python/bio/sample.py +6 -0
- package/templates/init/functions/python/cron/catalyst-config.json +11 -0
- package/templates/init/functions/python/cron/requirements.txt +1 -0
- package/templates/init/functions/python/cron/sample.py +18 -0
- package/templates/init/functions/python/event/catalyst-config.json +11 -0
- package/templates/init/functions/python/event/requirements.txt +1 -0
- package/templates/init/functions/python/event/sample.py +21 -0
- package/templates/init/functions/python/integ/cliq/catalyst-config.json +11 -0
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +174 -0
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +102 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +409 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +12 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +16 -0
- package/templates/init/functions/python/integ/cliq/handlers/message_action_handler.py +18 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +269 -0
- package/templates/init/functions/python/integ/cliq/requirements.txt +1 -0
- package/templates/init/functions/python/integ/cliq/sample.py +21 -0
- package/lib/serve/server/lib/node.js +0 -62
- package/lib/shell/dependencies/invoker/bio/node.js +0 -80
- package/lib/shell/dependencies/invoker/cron/node.js +0 -54
- package/lib/shell/dependencies/invoker/event/node.js +0 -56
- package/lib/shell/dependencies/invoker/integ/node.js +0 -79
- package/templates/.DS_Store +0 -0
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/.DS_Store +0 -0
- package/templates/init/client/react/.DS_Store +0 -0
- package/templates/init/functions/node/integ/cliq/.DS_Store +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from zcatalyst_cliq.installation_validator import (
|
|
2
|
+
validate_installation,
|
|
3
|
+
InstallationRequest,
|
|
4
|
+
InstallationResponse
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@validate_installation
|
|
9
|
+
def validate_installation(req: InstallationRequest, res: InstallationResponse, *args):
|
|
10
|
+
if req.user.first_name == '**INVALID_USER**' and req.app_info.type == 'upgrade':
|
|
11
|
+
res.status = 400
|
|
12
|
+
res.title = 'Update not allowed !'
|
|
13
|
+
res.message = 'Sorry. Update not allowed for the current app. Please contact admin.'
|
|
14
|
+
else:
|
|
15
|
+
res.status = 200
|
|
16
|
+
return res
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from zcatalyst_cliq.message_action_handler import (
|
|
2
|
+
execution_handler,
|
|
3
|
+
MessageActionHandlerRequest,
|
|
4
|
+
HandlerResponse
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@execution_handler
|
|
9
|
+
def msg_action(req: MessageActionHandlerRequest, res: HandlerResponse, *args):
|
|
10
|
+
text = ''
|
|
11
|
+
msg_type = req.message.type
|
|
12
|
+
name = 'user'
|
|
13
|
+
if hasattr(req,'user'):
|
|
14
|
+
name = req.user.first_name
|
|
15
|
+
text = f"Hey {name}, You have performed an action on a *{msg_type}*." \
|
|
16
|
+
+ "Manipulate the message variable and perform your own action."
|
|
17
|
+
res.set_text(text)
|
|
18
|
+
return res
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from zcatalyst_cliq.widget_handler import (
|
|
3
|
+
view_handler,
|
|
4
|
+
WidgetExecutionHandlerRequest,
|
|
5
|
+
WidgetResponse
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@view_handler
|
|
10
|
+
def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args):
|
|
11
|
+
res.type = 'applet'
|
|
12
|
+
|
|
13
|
+
catalyst_tab = res.new_widget_tab('catalystTab', 'Zoho Catalyst')
|
|
14
|
+
cliq_tab = res.new_widget_tab('cliqTab', 'Zoho Cliq')
|
|
15
|
+
info_tab = res.new_widget_tab('infoTab', 'Empty view')
|
|
16
|
+
button_tab = res.new_widget_tab('buttonTab', 'Button types')
|
|
17
|
+
|
|
18
|
+
res.add_tab(catalyst_tab, cliq_tab, info_tab, button_tab)
|
|
19
|
+
res.active_tab = catalyst_tab.id
|
|
20
|
+
|
|
21
|
+
if req.event == 'load' or req.event == 'tab_click' and req.target.id == 'catalystTab' or req.event == 'refresh' and req.target.id == 'catalystTab':
|
|
22
|
+
#Datastore
|
|
23
|
+
datastore_section = res.new_widget_section()
|
|
24
|
+
datastore_section.id = '1'
|
|
25
|
+
|
|
26
|
+
divider = datastore_section.new_widget_element(); #common divider
|
|
27
|
+
divider.type = 'divider'
|
|
28
|
+
|
|
29
|
+
ds_title = datastore_section.new_widget_element()
|
|
30
|
+
ds_title.type = 'title'
|
|
31
|
+
ds_title.text = 'Datastore'
|
|
32
|
+
|
|
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);
|
|
38
|
+
|
|
39
|
+
ds_text = datastore_section.new_widget_element()
|
|
40
|
+
ds_text.type = 'text'
|
|
41
|
+
ds_text.text = 'The Data Store in Catalyst is a cloud-based relational database management system which stores the persistent data of your application.'
|
|
42
|
+
|
|
43
|
+
datastore_section.add_elements(ds_title, ds_text, divider)
|
|
44
|
+
|
|
45
|
+
#Functions
|
|
46
|
+
function_section = res.new_widget_section()
|
|
47
|
+
function_section.id = '2'
|
|
48
|
+
|
|
49
|
+
fn_title = function_section.new_widget_element()
|
|
50
|
+
fn_title.type = 'title'
|
|
51
|
+
fn_title.text = 'Functions'
|
|
52
|
+
fn_button = fn_title.new_widget_button()
|
|
53
|
+
fn_button.type = 'invoke.function'
|
|
54
|
+
fn_button.label = 'Click here'
|
|
55
|
+
fn_button.name = 'PyFnWidgetButton'; # ** ENTER YOUR WIDGET FUNCTION NAME **
|
|
56
|
+
fn_button.id = 'widgetFn'
|
|
57
|
+
fn_title.add_widget_buttons(fn_button)
|
|
58
|
+
|
|
59
|
+
fn_text = function_section.new_widget_element()
|
|
60
|
+
fn_text.type = 'text'
|
|
61
|
+
fn_text.text = 'Catalyst Functions are custom-built coding structures which contain the intense business logic of your application.'
|
|
62
|
+
|
|
63
|
+
function_section.add_elements(fn_title, fn_text, divider)
|
|
64
|
+
|
|
65
|
+
#AutoML
|
|
66
|
+
auto_ml_Section = res.new_widget_section()
|
|
67
|
+
auto_ml_Section.id = '3'
|
|
68
|
+
|
|
69
|
+
auto_ml_title = auto_ml_Section.new_widget_element()
|
|
70
|
+
auto_ml_title.type = 'title'
|
|
71
|
+
auto_ml_title.text = 'AutoML'
|
|
72
|
+
|
|
73
|
+
auto_ml_text = auto_ml_Section.new_widget_element()
|
|
74
|
+
auto_ml_text.type = 'text';
|
|
75
|
+
auto_ml_text.text = 'AutoML (Automated Machine Learning) is the process of automating the end-to-end traditional machine learning model and' \
|
|
76
|
+
+' applying it to solve the real-world problems.'
|
|
77
|
+
|
|
78
|
+
auto_ml_Section.add_elements(auto_ml_title, auto_ml_text)
|
|
79
|
+
|
|
80
|
+
res.add_sections(datastore_section, function_section, auto_ml_Section)
|
|
81
|
+
|
|
82
|
+
elif req.event == 'tab_click' or req.event == 'refresh':
|
|
83
|
+
target = req.target.id
|
|
84
|
+
|
|
85
|
+
res.active_tab = target
|
|
86
|
+
if target == 'infoTab':
|
|
87
|
+
res.data_type = 'info'
|
|
88
|
+
info = res.new_widget_info()
|
|
89
|
+
info.title = 'Sorry! No tables found.'
|
|
90
|
+
info.description = 'Catalyst Datastore can be used to create and manage tables to store persistent data of your applications!'
|
|
91
|
+
info.image_url = 'https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png'
|
|
92
|
+
|
|
93
|
+
link_btn = info.new_widget_button()
|
|
94
|
+
link_btn.label = 'Visit Zoho Catalyst'
|
|
95
|
+
link_btn.type = 'open.url'
|
|
96
|
+
link_btn.url = 'https://console.catalyst.zoho.com'
|
|
97
|
+
info.button = link_btn
|
|
98
|
+
res.info = info
|
|
99
|
+
return res
|
|
100
|
+
|
|
101
|
+
elif target == 'cliqTab':
|
|
102
|
+
|
|
103
|
+
# Bot
|
|
104
|
+
bot_section = res.new_widget_section()
|
|
105
|
+
bot_section.id = '4'
|
|
106
|
+
|
|
107
|
+
divider = bot_section.new_widget_element(); # common divider
|
|
108
|
+
divider.type = 'divider'
|
|
109
|
+
|
|
110
|
+
bot_title = bot_section.new_widget_element()
|
|
111
|
+
bot_title.type = 'title'
|
|
112
|
+
bot_title.text = 'Bot'
|
|
113
|
+
|
|
114
|
+
bot_text = bot_section.new_widget_element()
|
|
115
|
+
bot_text.type = 'text'
|
|
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.';
|
|
118
|
+
|
|
119
|
+
bot_section.add_elements(bot_title, bot_text, divider)
|
|
120
|
+
|
|
121
|
+
# widget
|
|
122
|
+
widget_section = res.new_widget_section()
|
|
123
|
+
widget_section.id = '5'
|
|
124
|
+
|
|
125
|
+
widget_title = widget_section.new_widget_element()
|
|
126
|
+
widget_title.type = 'title'
|
|
127
|
+
widget_title.text = 'Widgets'
|
|
128
|
+
|
|
129
|
+
widget_text = widget_section.new_widget_element()
|
|
130
|
+
widget_text.type = 'text'
|
|
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
|
+
|
|
133
|
+
widget_section.add_elements(widget_title, widget_text, divider);
|
|
134
|
+
|
|
135
|
+
# Connections
|
|
136
|
+
connection_section = res.new_widget_section()
|
|
137
|
+
connection_section.id = '6'
|
|
138
|
+
|
|
139
|
+
connectionTitle = connection_section.new_widget_element()
|
|
140
|
+
connectionTitle.type = 'title'
|
|
141
|
+
connectionTitle.text = 'Connections'
|
|
142
|
+
|
|
143
|
+
connectionText = connection_section.new_widget_element()
|
|
144
|
+
connectionText.type = 'text';
|
|
145
|
+
connectionText.text = 'Connections is an interface to integrate third party services with your Zoho Service, in this case, Cliq.' \
|
|
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.';
|
|
148
|
+
|
|
149
|
+
connection_section.add_elements(connectionTitle, connectionText, divider)
|
|
150
|
+
|
|
151
|
+
res.add_sections(bot_section, widget_section, connection_section)
|
|
152
|
+
|
|
153
|
+
elif target == 'buttonTab':
|
|
154
|
+
# Time
|
|
155
|
+
title_section = res.new_widget_section()
|
|
156
|
+
title_section.id = '100'
|
|
157
|
+
|
|
158
|
+
time = title_section.new_widget_element();
|
|
159
|
+
time.type = 'subtext';
|
|
160
|
+
time.text = 'Target:buttons\nTime : ' + str(datetime.datetime.now())
|
|
161
|
+
|
|
162
|
+
title_section.add_elements(time)
|
|
163
|
+
|
|
164
|
+
# Buttons - Row1
|
|
165
|
+
button_section = res.new_widget_section()
|
|
166
|
+
|
|
167
|
+
title = button_section.new_widget_element()
|
|
168
|
+
title.type = 'title'
|
|
169
|
+
title.text = 'Buttons'
|
|
170
|
+
|
|
171
|
+
button_element1 = button_section.new_widget_element()
|
|
172
|
+
button_element1.type = 'buttons'
|
|
173
|
+
|
|
174
|
+
button1 = button_element1.new_widget_button()
|
|
175
|
+
button1.label = 'link'
|
|
176
|
+
button1.type = 'open.url'
|
|
177
|
+
button1.url = 'https://www.zoho.com'
|
|
178
|
+
|
|
179
|
+
button2 = button_element1.new_widget_button()
|
|
180
|
+
button2.label = 'Applet Button'
|
|
181
|
+
button2.type = 'invoke.function'
|
|
182
|
+
button2.name = 'PyFnWidgetButton'
|
|
183
|
+
button2.id = 'banner'
|
|
184
|
+
|
|
185
|
+
button3 = button_element1.new_widget_button()
|
|
186
|
+
button3.label = 'Open Channel'
|
|
187
|
+
button3.type = 'system.api'
|
|
188
|
+
button3.set_api('joinchannel/{{id}}', 'CT_1407724818712687474_72317143'); # ** ENTER YOUR CHANNEL ID HERE **
|
|
189
|
+
|
|
190
|
+
button4 = button_element1.new_widget_button()
|
|
191
|
+
button4.label = 'Preview'
|
|
192
|
+
button4.type = 'preview.url'
|
|
193
|
+
button4.url = 'https://www.zoho.com/catalyst/features.html'
|
|
194
|
+
|
|
195
|
+
button_element1.add_widget_buttons(button1, button2, button3, button4)
|
|
196
|
+
|
|
197
|
+
# Buttons - Row2
|
|
198
|
+
|
|
199
|
+
button_element2 = button_section.new_widget_element()
|
|
200
|
+
button_element2.type = 'buttons'
|
|
201
|
+
|
|
202
|
+
button5 = button_element2.new_widget_button()
|
|
203
|
+
button5.label = 'Edit Section'
|
|
204
|
+
button5.type = 'invoke.function'
|
|
205
|
+
button5.name = 'PyFnWidgetButton'
|
|
206
|
+
button5.id = 'section'
|
|
207
|
+
|
|
208
|
+
button6 = button_element2.new_button_object()
|
|
209
|
+
button6.label = 'Form Edit Section'
|
|
210
|
+
button6.type = 'invoke.function'
|
|
211
|
+
button6.name = 'PyFnWidgetButton'
|
|
212
|
+
button6.id = 'formsection'
|
|
213
|
+
|
|
214
|
+
button7 = button_element2.new_button_object()
|
|
215
|
+
button7.label = 'Banner'
|
|
216
|
+
button7.type = 'invoke.function'
|
|
217
|
+
button7.name = 'PyFnWidgetButton'
|
|
218
|
+
button7.id = 'banner'
|
|
219
|
+
|
|
220
|
+
button8 = button_element2.new_button_object()
|
|
221
|
+
button8.label = 'Edit Whole Tab'
|
|
222
|
+
button8.type = 'invoke.function'
|
|
223
|
+
button8.name = 'PyFnWidgetButton'
|
|
224
|
+
button8.id = 'tab'
|
|
225
|
+
|
|
226
|
+
button9 = button_element2.new_button_object()
|
|
227
|
+
button9.label = 'Form Edit Tab'
|
|
228
|
+
button9.type = 'invoke.function'
|
|
229
|
+
button9.name = 'PyFnWidgetButton'
|
|
230
|
+
button9.id = 'formTab'
|
|
231
|
+
|
|
232
|
+
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
233
|
+
|
|
234
|
+
button_section.add_elements(title, button_element1, button_element2)
|
|
235
|
+
button_section.id = '101'
|
|
236
|
+
|
|
237
|
+
res.add_sections(title_section, button_section)
|
|
238
|
+
|
|
239
|
+
first_nav = {
|
|
240
|
+
'label': 'Page : 1',
|
|
241
|
+
'type': 'invoke.function',
|
|
242
|
+
'name': 'PyFnWidgetButton',
|
|
243
|
+
'id': 'breadcrumbs'
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
link_button = {
|
|
247
|
+
'label': 'Link',
|
|
248
|
+
'type': 'open.url',
|
|
249
|
+
'url': 'https://www.zoho.com'
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
banner_button = {
|
|
253
|
+
'label': 'Banner',
|
|
254
|
+
'type': 'invoke.function',
|
|
255
|
+
'name': 'PyFnWidgetButton',
|
|
256
|
+
'id': 'banner'
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
res.header = {
|
|
260
|
+
'title' : 'Header 1',
|
|
261
|
+
'navigation' : 'new',
|
|
262
|
+
'buttons' : [first_nav, link_button, banner_button]
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
res.footer = {
|
|
266
|
+
'text' : 'Footer text',
|
|
267
|
+
'buttons' : [link_button, banner_button]
|
|
268
|
+
}
|
|
269
|
+
return res
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zcatalyst-cliq=={{_VERSION_}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import zcatalyst_cliq
|
|
2
|
+
|
|
3
|
+
config = {
|
|
4
|
+
"ZohoCliq": {
|
|
5
|
+
"handlers": {
|
|
6
|
+
"bot_handler": "handlers/bot_handler.py",
|
|
7
|
+
"function_handler": "handlers/function_handler.py",
|
|
8
|
+
"installation_validator": "handlers/installation_validator.py",
|
|
9
|
+
"command_handler": "handlers/command_handler.py",
|
|
10
|
+
"widget_handler": "handlers/widget_handler.py",
|
|
11
|
+
"messageaction_handler": "handlers/message_action_handler.py",
|
|
12
|
+
"installation_handler": "handlers/installation_handler.py"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def handler(request, response):
|
|
19
|
+
handler_resp = zcatalyst_cliq.execute(request, config)
|
|
20
|
+
response.set_content_type('application/json')
|
|
21
|
+
response.send(handler_resp)
|
|
@@ -1,62 +0,0 @@
|
|
|
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 express_1 = __importDefault(require("express"));
|
|
39
|
-
const util_1 = require("util");
|
|
40
|
-
const args = process.argv.slice(2);
|
|
41
|
-
const listenPort = parseInt(args[0], 10);
|
|
42
|
-
const fnDetails = JSON.parse(args[1]);
|
|
43
|
-
const app = (0, express_1.default)();
|
|
44
|
-
const targetName = fnDetails.name;
|
|
45
|
-
const index = fnDetails.index;
|
|
46
|
-
app.use('/', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
try {
|
|
48
|
-
if (index === undefined) {
|
|
49
|
-
throw new Error('index of applogic is undefined');
|
|
50
|
-
}
|
|
51
|
-
(yield Promise.resolve().then(() => __importStar(require(index)))).default(req, res);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
const errorString = (0, util_1.inspect)(e);
|
|
55
|
-
console.error('[' + targetName + '] ' + errorString);
|
|
56
|
-
res.writeHead(500);
|
|
57
|
-
res.end(errorString);
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
app.listen(listenPort).on('error', (err) => {
|
|
61
|
-
console.error(err);
|
|
62
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const util = require('util');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const target = JSON.parse(args[0]);
|
|
7
|
-
const userData = JSON.parse(args[1]);
|
|
8
|
-
const projectJson = JSON.parse(args[2]);
|
|
9
|
-
const authJson = JSON.parse(args[3]);
|
|
10
|
-
const buildDir = JSON.parse(args[4]);
|
|
11
|
-
const requestFile = path.join(buildDir, '.catalyst', 'user_req_body');
|
|
12
|
-
const responseFile = path.join(buildDir, '.catalyst', 'user_res_body');
|
|
13
|
-
const metaFile = path.join(buildDir, '.catalyst', 'user_meta.json');
|
|
14
|
-
const writeToFile = (respJson, metaJson) => {
|
|
15
|
-
const respStr = JSON.stringify(respJson);
|
|
16
|
-
fs.writeFileSync(responseFile, respStr);
|
|
17
|
-
metaJson.response['Content-Type'] = 'application/json';
|
|
18
|
-
metaJson.response['Content-Length'] = respStr.length;
|
|
19
|
-
fs.writeFileSync(metaFile, JSON.stringify(metaJson));
|
|
20
|
-
};
|
|
21
|
-
let body = {};
|
|
22
|
-
let finalResponse = '';
|
|
23
|
-
let userStatus = 200;
|
|
24
|
-
if (fs.existsSync(requestFile)) {
|
|
25
|
-
const content = fs.readFileSync(requestFile);
|
|
26
|
-
try {
|
|
27
|
-
body = JSON.parse(content.toString());
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
body = {};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const endTime = 30 * 1000 + Date.now();
|
|
34
|
-
const context = {
|
|
35
|
-
catalystHeaders: Object.assign(projectJson, authJson),
|
|
36
|
-
getMaxExecutionTimeMs: () => 30 * 1000,
|
|
37
|
-
getRemainingExecutionTimeMs: () => endTime - Date.now(),
|
|
38
|
-
close: () => {
|
|
39
|
-
writeToFile({
|
|
40
|
-
output: finalResponse
|
|
41
|
-
}, { response: { statusCode: userStatus } });
|
|
42
|
-
process.exit(0);
|
|
43
|
-
},
|
|
44
|
-
log: (...params) => console.log(...params)
|
|
45
|
-
};
|
|
46
|
-
const basicIO = {
|
|
47
|
-
write: (VALUE) => {
|
|
48
|
-
if (!typeof VALUE === 'string') {
|
|
49
|
-
console.error(`Expected string but ${typeof VALUE} found!.`);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
const res = VALUE.substring(0, 1 * 1024);
|
|
53
|
-
console.log(res);
|
|
54
|
-
finalResponse += res;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
getArgument: (KEY) => userData[KEY] || body[KEY],
|
|
58
|
-
getAllArguments: () => (userData && Object.keys(userData).length > 0 ? userData : body),
|
|
59
|
-
getParameter: (KEY) => {
|
|
60
|
-
console.error('CatalystDeprecationWarning: basicIO.getParameter() is deprecated due to usability issues. Please use basicIO.getArgument() method instead.');
|
|
61
|
-
return basicIO.getArgument(KEY);
|
|
62
|
-
},
|
|
63
|
-
getAllParameters: () => {
|
|
64
|
-
console.error('CatalystDeprecationWarning: basicIO.getAllParameters() is deprecated due to usability issues. Please use basicIO.getAllArgument() method instead.');
|
|
65
|
-
return basicIO.getAllArgument();
|
|
66
|
-
},
|
|
67
|
-
setStatus: (status) => {
|
|
68
|
-
userStatus = status;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
try {
|
|
72
|
-
require(target.index)(context, basicIO);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.error(e);
|
|
76
|
-
writeToFile({
|
|
77
|
-
error: util.inspect(e)
|
|
78
|
-
}, { response: { statusCode: 500 } });
|
|
79
|
-
process.exit(2);
|
|
80
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const util = require('util');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const target = JSON.parse(args[0]);
|
|
7
|
-
const userData = JSON.parse(args[1]);
|
|
8
|
-
const projectJson = JSON.parse(args[2]);
|
|
9
|
-
const authJson = JSON.parse(args[3]);
|
|
10
|
-
const buildDir = JSON.parse(args[4]);
|
|
11
|
-
const requestFile = path.join(buildDir, '.catalyst', 'user_req_body');
|
|
12
|
-
const responseFile = path.join(buildDir, '.catalyst', 'user_res_body');
|
|
13
|
-
const writeToFile = (resp) => {
|
|
14
|
-
fs.writeFileSync(responseFile, resp);
|
|
15
|
-
};
|
|
16
|
-
let body = {};
|
|
17
|
-
if (fs.existsSync(requestFile)) {
|
|
18
|
-
const content = fs.readFileSync(requestFile);
|
|
19
|
-
try {
|
|
20
|
-
body = JSON.parse(content.toString());
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
body = {};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const endTime = 15 * 60 * 1000 + Date.now();
|
|
27
|
-
const context = {
|
|
28
|
-
catalystHeaders: Object.assign(projectJson, authJson),
|
|
29
|
-
getMaxExecutionTimeMs: () => 15 * 60 * 1000,
|
|
30
|
-
getRemainingExecutionTimeMs: () => endTime - Date.now(),
|
|
31
|
-
closeWithSuccess: () => {
|
|
32
|
-
writeToFile('SUCCESS');
|
|
33
|
-
process.exit(0);
|
|
34
|
-
},
|
|
35
|
-
closeWithFailure: () => {
|
|
36
|
-
writeToFile('FAILURE');
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const cronReq = {
|
|
41
|
-
getCronParam: (KEY) => userData[KEY] || body[KEY],
|
|
42
|
-
getAllCronParam: () => (userData && Object.keys(userData).length > 0 ? userData : body),
|
|
43
|
-
getRemainingExecutionCount: () => -1,
|
|
44
|
-
getCronDetails: () => null,
|
|
45
|
-
getProjectDetails: () => projectJson
|
|
46
|
-
};
|
|
47
|
-
try {
|
|
48
|
-
require(target.index)(cronReq, context);
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
console.error(e);
|
|
52
|
-
writeToFile('FAILURE');
|
|
53
|
-
process.exit(2);
|
|
54
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const util = require('util');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const target = JSON.parse(args[0]);
|
|
7
|
-
const userData = JSON.parse(args[1]);
|
|
8
|
-
const projectJson = JSON.parse(args[2]);
|
|
9
|
-
const authJson = JSON.parse(args[3]);
|
|
10
|
-
const buildDir = JSON.parse(args[4]);
|
|
11
|
-
const responseFile = path.join(buildDir, '.catalyst', 'user_res_body');
|
|
12
|
-
const writeToFile = (resp) => {
|
|
13
|
-
fs.writeFileSync(responseFile, resp);
|
|
14
|
-
};
|
|
15
|
-
const endTime = 15 * 60 * 1000 + Date.now();
|
|
16
|
-
const context = {
|
|
17
|
-
catalystHeaders: Object.assign(projectJson, authJson),
|
|
18
|
-
getMaxExecutionTimeMs: () => 15 * 60 * 1000,
|
|
19
|
-
getRemainingExecutionTimeMs: () => endTime - Date.now(),
|
|
20
|
-
closeWithSuccess: () => {
|
|
21
|
-
writeToFile('SUCCESS');
|
|
22
|
-
process.exit(0);
|
|
23
|
-
},
|
|
24
|
-
closeWithFailure: () => {
|
|
25
|
-
writeToFile('FAILURE');
|
|
26
|
-
process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const eventReq = {
|
|
30
|
-
data: userData.data,
|
|
31
|
-
time: userData.event_time,
|
|
32
|
-
getData: () => userData.data,
|
|
33
|
-
getTime: () => userData.event_time,
|
|
34
|
-
getAction: () => userData.action,
|
|
35
|
-
getSource: () => userData.source,
|
|
36
|
-
getSourceEntityId: () => userData.source_entity_id,
|
|
37
|
-
getEventBusDetails: () => userData.event_bus_details,
|
|
38
|
-
getProjectDetails: () => userData.project_details,
|
|
39
|
-
getSourceDetails: () => {
|
|
40
|
-
console.error('CatalystDeprecationWarning: eventReq.getSourceDetails() is deprecated due to usability issues. Please use individual get methods instead.');
|
|
41
|
-
return {
|
|
42
|
-
action: userData.action,
|
|
43
|
-
type: userData.source,
|
|
44
|
-
entityId: userData.source_entity_id,
|
|
45
|
-
getBusDetails: () => userData.event_bus_details
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
try {
|
|
50
|
-
require(target.index)(eventReq, context);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
console.error(e);
|
|
54
|
-
writeToFile('FAILURE');
|
|
55
|
-
process.exit(2);
|
|
56
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const util_1 = require("util");
|
|
27
|
-
const path_1 = require("path");
|
|
28
|
-
const fs_1 = require("fs");
|
|
29
|
-
const args = process.argv.slice(2);
|
|
30
|
-
const target = JSON.parse(args[0]);
|
|
31
|
-
const data = JSON.parse(args[1]);
|
|
32
|
-
const projectJson = JSON.parse(args[2]);
|
|
33
|
-
const authJson = JSON.parse(args[3]);
|
|
34
|
-
const buildDir = JSON.parse(args[4]);
|
|
35
|
-
const responseFile = (0, path_1.join)(buildDir, '.catalyst', 'user_res_body');
|
|
36
|
-
const writeAndExit = (resp, exitCode = 0) => {
|
|
37
|
-
(0, fs_1.writeFileSync)(responseFile, JSON.stringify(resp));
|
|
38
|
-
process.exit(exitCode);
|
|
39
|
-
};
|
|
40
|
-
const integrationRequest = data || {};
|
|
41
|
-
integrationRequest.catalystHeaders = Object.assign(projectJson, authJson);
|
|
42
|
-
integrationRequest.timestamp = Date.now();
|
|
43
|
-
const integrationResponse = {
|
|
44
|
-
end: (response) => {
|
|
45
|
-
if (response === undefined) {
|
|
46
|
-
return writeAndExit({ Status: 204 });
|
|
47
|
-
}
|
|
48
|
-
if (response.constructor.name !== 'IntegResponse' ||
|
|
49
|
-
response.buildResponse === undefined ||
|
|
50
|
-
typeof response.buildResponse !== 'function') {
|
|
51
|
-
console.error('Invalid response object: ', response);
|
|
52
|
-
return writeAndExit({ Status: 500 }, 2);
|
|
53
|
-
}
|
|
54
|
-
const clean_response = response.buildResponse();
|
|
55
|
-
if (clean_response === undefined ||
|
|
56
|
-
clean_response.status === undefined ||
|
|
57
|
-
typeof clean_response.status !== 'number' ||
|
|
58
|
-
clean_response.contentType === undefined ||
|
|
59
|
-
typeof clean_response.contentType !== 'string' ||
|
|
60
|
-
clean_response.responseBody === undefined) {
|
|
61
|
-
console.error("Invalid value returned from function 'buildResponse()': ", clean_response);
|
|
62
|
-
return writeAndExit({ Status: 500 }, 2);
|
|
63
|
-
}
|
|
64
|
-
return writeAndExit({
|
|
65
|
-
Status: clean_response.status,
|
|
66
|
-
ContentType: clean_response.contentType,
|
|
67
|
-
responseBody: clean_response.responseBody
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
try {
|
|
72
|
-
Promise.resolve().then(() => __importStar(require(target.index))).then((fn) => {
|
|
73
|
-
fn.default(integrationRequest, integrationResponse);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
console.error(e);
|
|
78
|
-
writeAndExit({ error: (0, util_1.inspect)(e) }, 2);
|
|
79
|
-
}
|
package/templates/.DS_Store
DELETED
|
Binary file
|
package/templates/init/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|