zcatalyst-cli 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/docs/.DS_Store +0 -0
  2. package/lib/client-utils.js +0 -27
  3. package/lib/commands/iac/import.js +26 -5
  4. package/lib/endpoints/lib/sdk.js +2 -2
  5. package/lib/init/features/client/initializers/angular.js +23 -5
  6. package/lib/init/features/client/initializers/basic.js +36 -13
  7. package/lib/init/features/client/initializers/lyte.js +43 -26
  8. package/lib/init/features/client/initializers/react.js +50 -26
  9. package/lib/init/util/client.js +88 -4
  10. package/lib/serve/server/lib/master.js +2 -6
  11. package/lib/serve/server/lib/web_client/server.js +2 -2
  12. package/lib/util_modules/constants/lib/placeholders.js +1 -2
  13. package/lib/util_modules/constants/lib/urls.js +4 -4
  14. package/lib/util_modules/fs/index.js +1 -9
  15. package/lib/util_modules/fs/lib/async.js +3 -3
  16. package/lib/util_modules/fs/utils.js +8 -0
  17. package/package.json +2 -2
  18. package/templates/.DS_Store +0 -0
  19. package/templates/init/.DS_Store +0 -0
  20. package/templates/init/client/lyte/package.json +1 -1
  21. package/templates/init/client/react/react_js/template.json +1 -1
  22. package/templates/init/client/react/react_ts/template.json +1 -1
  23. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +94 -109
  24. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
  25. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
  26. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
  27. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
  28. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
  29. package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
  30. package/templates/init/functions/java/integ/cliq/sample.java +5 -7
  31. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +0 -1
  32. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
  33. package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
  34. package/lib/serve/server/lib/web_client/utils.js +0 -10
@@ -12,38 +12,39 @@ import com.zc.cliq.enums.SYSTEM_API_ACTION;
12
12
  import com.zc.cliq.enums.WIDGET_DATATYPE;
13
13
  import com.zc.cliq.enums.WIDGET_ELEMENT_TYPE;
14
14
  import com.zc.cliq.enums.WIDGET_EVENT;
15
+ import com.zc.cliq.enums.WIDGET_NAVIGATION;
15
16
  import com.zc.cliq.enums.WIDGET_TYPE;
16
17
  import com.zc.cliq.objects.WidgetButton;
17
18
  import com.zc.cliq.objects.WidgetElement;
19
+ import com.zc.cliq.objects.WidgetFooter;
20
+ import com.zc.cliq.objects.WidgetHeader;
18
21
  import com.zc.cliq.objects.WidgetInfo;
19
22
  import com.zc.cliq.objects.WidgetResponse;
20
23
  import com.zc.cliq.objects.WidgetSection;
21
24
  import com.zc.cliq.objects.WidgetTab;
22
25
  import com.zc.cliq.requests.WidgetExecutionHandlerRequest;
23
26
 
24
- public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
25
- {
27
+ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler {
26
28
  Logger LOGGER = Logger.getLogger(WidgetHandler.class.getName());
27
-
29
+
28
30
  @Override
29
- public WidgetResponse viewHandler(WidgetExecutionHandlerRequest req) throws Exception
30
- {
31
-
31
+ public WidgetResponse viewHandler(WidgetExecutionHandlerRequest req) throws Exception {
32
+
32
33
  WidgetResponse widgetResp = WidgetResponse.getInstance();
33
34
  widgetResp.setType(WIDGET_TYPE.APPLET);
34
35
  WidgetTab catalystTab = WidgetTab.getInstance("catalystTab", "Zoho Catalyst");
35
36
  WidgetTab cliqTab = WidgetTab.getInstance("cliqTab", "Zoho Cliq");
36
37
  WidgetTab infotab = WidgetTab.getInstance("infoTab", "Empty view");
37
38
  WidgetTab buttonTab = WidgetTab.getInstance("buttonTab", "Button types");
38
-
39
- widgetResp.addTabs(catalystTab,cliqTab,infotab,buttonTab);
39
+
40
+ widgetResp.addTabs(catalystTab, cliqTab, infotab, buttonTab);
40
41
  widgetResp.setActiveTab(catalystTab);
41
-
42
- if(req.getEvent().equals(WIDGET_EVENT.LOAD) || (req.getEvent().equals(WIDGET_EVENT.TAB_CLICK) && req.getTarget().getId().equals("catalystTab")) || (req.getEvent().equals(WIDGET_EVENT.REFRESH) && req.getTarget().getId().equals("catalystTab"))){
43
-
42
+
43
+ if (req.getEvent().equals(WIDGET_EVENT.LOAD) || (req.getEvent().equals(WIDGET_EVENT.TAB_CLICK) && req.getTarget().getId().equals("catalystTab")) || (req.getEvent().equals(WIDGET_EVENT.REFRESH) && req.getTarget().getId().equals("catalystTab"))) {
44
+
44
45
  WidgetElement divider = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.DIVIDER);
45
-
46
- //Datastore
46
+
47
+ // Datastore
47
48
  WidgetElement dsTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
48
49
  dsTitle.setText("Datastore");
49
50
  WidgetButton dsButton = new WidgetButton();
@@ -55,10 +56,10 @@ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
55
56
  dsText.setText("The Data Store in Catalyst is a cloud-based relational database management system which stores the persistent data of your application.");
56
57
  WidgetSection datastoreSection = WidgetSection.getInstance();
57
58
  datastoreSection.setId("1");
58
- datastoreSection.addElements(dsTitle,dsText,divider);
59
+ datastoreSection.addElements(dsTitle, dsText, divider);
59
60
  widgetResp.addSection(datastoreSection);
60
-
61
- //Functions
61
+
62
+ // Functions
62
63
  WidgetElement fnTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
63
64
  fnTitle.setText("Functions");
64
65
  WidgetButton fnButton = new WidgetButton();
@@ -70,28 +71,27 @@ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
70
71
  WidgetElement fnText = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TEXT);
71
72
  fnText.setText("Catalyst Functions are custom-built coding structures which contain the intense business logic of your application.");
72
73
  WidgetSection functionsSection = WidgetSection.getInstance();
73
- functionsSection.addElements(fnTitle,fnText,divider);
74
+ functionsSection.addElements(fnTitle, fnText, divider);
74
75
  functionsSection.setId("2");
75
76
  widgetResp.addSection(functionsSection);
76
-
77
- //AutoML
77
+
78
+ // AutoML
78
79
  WidgetElement automlTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
79
80
  WidgetElement automlText = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TEXT);
80
81
  automlTitle.setText("AutoML");
81
82
  automlText.setText("AutoML (Automated Machine Learning) is the process of automating the end-to-end traditional machine learning model and applying it to solve the real-world problems.");
82
83
  WidgetSection autoMLSection = WidgetSection.getInstance();
83
- autoMLSection.addElements(automlTitle,automlText);
84
+ autoMLSection.addElements(automlTitle, automlText);
84
85
  autoMLSection.setId("3");
85
86
  widgetResp.addSection(autoMLSection);
86
-
87
- }
88
- else if(req.getEvent().equals(WIDGET_EVENT.REFRESH) || req.getEvent().equals(WIDGET_EVENT.TAB_CLICK)){
89
-
87
+
88
+ } else if (req.getEvent().equals(WIDGET_EVENT.REFRESH) || req.getEvent().equals(WIDGET_EVENT.TAB_CLICK)) {
89
+
90
90
  String target = req.getTarget().getId();
91
-
91
+
92
92
  widgetResp.setActiveTab(target);
93
- if(target.equals("infoTab")){
94
-
93
+ if (target.equals("infoTab")) {
94
+
95
95
  widgetResp.setDataType(WIDGET_DATATYPE.INFO);
96
96
  WidgetInfo info = new WidgetInfo();
97
97
  info.setTitle("Sorry! No tables found.");
@@ -103,46 +103,45 @@ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
103
103
  linkBtn.setUrl("https://console.catalyst.zoho.com");
104
104
  info.setButton(linkBtn);
105
105
  widgetResp.setInfo(info);
106
-
107
- }
108
- else if(target.equals("cliqTab")){
109
-
106
+
107
+ return widgetResp;
108
+ } else if (target.equals("cliqTab")) {
109
+
110
110
  WidgetElement divider = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.DIVIDER);
111
-
112
- //Bot
111
+
112
+ // Bot
113
113
  WidgetElement botTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
114
114
  WidgetElement botText = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TEXT);
115
115
  botTitle.setText("Bot");
116
116
  botText.setText("Bot is your system powered contact or your colleague with which you can interact with as you do with any other person. 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
117
  WidgetSection botSection = WidgetSection.getInstance();
118
- botSection.addElements(botTitle,botText,divider);
118
+ botSection.addElements(botTitle, botText, divider);
119
119
  botSection.setId("4");
120
120
  widgetResp.addSection(botSection);
121
-
122
- //Widgets
121
+
122
+ // Widgets
123
123
  WidgetElement widgetTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
124
124
  WidgetElement widgetText = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TEXT);
125
125
  widgetTitle.setText("Widgets");
126
126
  widgetText.setText("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.");
127
127
  WidgetSection widgetsSection = WidgetSection.getInstance();
128
- widgetsSection.addElements(widgetTitle,widgetText,divider);
128
+ widgetsSection.addElements(widgetTitle, widgetText, divider);
129
129
  widgetsSection.setId("5");
130
130
  widgetResp.addSection(widgetsSection);
131
-
132
- //Connections
131
+
132
+ // Connections
133
133
  WidgetElement connTitle = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
134
134
  WidgetElement connText = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TEXT);
135
135
  connTitle.setText("Connections");
136
136
  connText.setText("Connections is an interface to integrate third party services with your Zoho Service, in this case, Cliq. These connections are used in an URL invocation task to access authenticated data. To establish a connection, it is necessary to provide a Connection Name, Authentication Type amongst other details.");
137
137
  WidgetSection connectionsSection = WidgetSection.getInstance();
138
- connectionsSection.addElements(connTitle,connText);
138
+ connectionsSection.addElements(connTitle, connText);
139
139
  connectionsSection.setId("6");
140
140
  widgetResp.addSection(connectionsSection);
141
-
142
- }
143
- else if(target.equals("buttonTab")){
144
-
145
- //Time
141
+
142
+ } else if (target.equals("buttonTab")) {
143
+
144
+ // Time
146
145
  WidgetElement time = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.SUBTEXT);
147
146
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
148
147
  time.setText("Target:buttons\nTime : " + sdf.format(new Date()));
@@ -150,44 +149,44 @@ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
150
149
  titleSection.setId("100");
151
150
  titleSection.addElement(time);
152
151
  widgetResp.addSection(titleSection);
153
-
152
+
154
153
  WidgetSection buttonSection = WidgetSection.getInstance();
155
-
156
- //Buttons - Row1
154
+
155
+ // Buttons - Row1
157
156
  WidgetElement title = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
158
157
  title.setText("Buttons");
159
-
158
+
160
159
  WidgetElement buttonElement1 = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.BUTTONS);
161
160
  List<WidgetButton> buttonsList1 = new ArrayList<WidgetButton>();
162
161
  WidgetButton button1 = new WidgetButton();
163
162
  button1.setLabel("Link");
164
163
  button1.setType(ACTION_TYPE.OPEN_URL);
165
164
  button1.setUrl("https://www.zoho.com");
166
-
165
+
167
166
  WidgetButton button2 = new WidgetButton();
168
167
  button2.setLabel("Applet Button");
169
168
  button2.setType(ACTION_TYPE.INVOKE_FUNCTION);
170
169
  button2.setName("appletFunction");
171
170
  button2.setId("banner");
172
-
171
+
173
172
  WidgetButton button3 = new WidgetButton();
174
173
  button3.setLabel("Open Channel");
175
174
  button3.setType(ACTION_TYPE.SYSTEM_API);
176
175
  button3.setApi(SYSTEM_API_ACTION.JOIN_CHANNEL, "CD_1283959962893705602_14598233");// ** ENTER YOUR CHANNEL ID HERE **
177
-
176
+
178
177
  WidgetButton button4 = new WidgetButton();
179
178
  button4.setLabel("Preview");
180
179
  button4.setType(ACTION_TYPE.PREVIEW_URL);
181
180
  button4.setUrl("https://www.zoho.com/catalyst/features.html");
182
-
181
+
183
182
  buttonsList1.add(button1);
184
183
  buttonsList1.add(button2);
185
184
  buttonsList1.add(button3);
186
185
  buttonsList1.add(button4);
187
-
186
+
188
187
  buttonElement1.setButtons(buttonsList1);
189
-
190
- //Buttons - Row2
188
+
189
+ // Buttons - Row2
191
190
  WidgetElement buttonElement2 = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.BUTTONS);
192
191
  List<WidgetButton> buttonsList2 = new ArrayList<WidgetButton>();
193
192
  WidgetButton button5 = new WidgetButton();
@@ -195,49 +194,84 @@ public class WidgetHandler implements com.zc.cliq.interfaces.WidgetHandler
195
194
  button5.setType(ACTION_TYPE.INVOKE_FUNCTION);
196
195
  button5.setName("appletFunction");
197
196
  button5.setId("section");
198
-
197
+
199
198
  WidgetButton button6 = new WidgetButton();
200
199
  button6.setLabel("Form Edit Section");
201
200
  button6.setType(ACTION_TYPE.INVOKE_FUNCTION);
202
201
  button6.setName("appletFunction");
203
202
  button6.setId("formsection");
204
-
203
+
205
204
  WidgetButton button7 = new WidgetButton();
206
205
  button7.setLabel("Banner");
207
206
  button7.setType(ACTION_TYPE.INVOKE_FUNCTION);
208
207
  button7.setName("appletFunction");
209
208
  button7.setId("banner");
210
-
209
+
211
210
  WidgetButton button8 = new WidgetButton();
212
211
  button8.setLabel("Edit Whole Tab");
213
212
  button8.setType(ACTION_TYPE.INVOKE_FUNCTION);
214
213
  button8.setName("appletFunction");
215
214
  button8.setId("tab");
216
-
215
+
217
216
  WidgetButton button9 = new WidgetButton();
218
217
  button9.setLabel("Form Edit Tab");
219
218
  button9.setType(ACTION_TYPE.INVOKE_FUNCTION);
220
219
  button9.setName("appletFunction");
221
220
  button9.setId("formtab");
222
-
221
+
223
222
  buttonsList2.add(button5);
224
223
  buttonsList2.add(button6);
225
224
  buttonsList2.add(button7);
226
225
  buttonsList2.add(button8);
227
226
  buttonsList2.add(button9);
228
-
227
+
229
228
  buttonElement2.setButtons(buttonsList2);
230
-
229
+
231
230
  buttonSection.addElement(title);
232
231
  buttonSection.addElement(buttonElement1);
233
232
  buttonSection.addElement(buttonElement2);
234
233
  buttonSection.setId("101");
235
-
234
+
236
235
  widgetResp.addSection(buttonSection);
237
236
  }
238
-
237
+
239
238
  }
240
-
239
+
240
+ WidgetButton fistNav = new WidgetButton();
241
+ fistNav.setLabel("Page : 1");
242
+ fistNav.setType(ACTION_TYPE.INVOKE_FUNCTION);
243
+ fistNav.setName("appletFunction");
244
+ fistNav.setId("breadcrumbs");
245
+
246
+ WidgetButton linkButton = new WidgetButton();
247
+ linkButton.setLabel("Link");
248
+ linkButton.setType(ACTION_TYPE.OPEN_URL);
249
+ linkButton.setUrl("https://www.zoho.com");
250
+
251
+ WidgetButton bannerBtn = new WidgetButton();
252
+ bannerBtn.setLabel("Banner");
253
+ bannerBtn.setType(ACTION_TYPE.INVOKE_FUNCTION);
254
+ bannerBtn.setName("appletFunction");
255
+ bannerBtn.setId("banner");
256
+
257
+ WidgetHeader header = WidgetHeader.getInstance();
258
+ header.setTitle("Header 1");
259
+ header.setNavigation(WIDGET_NAVIGATION.NEW);
260
+ List<WidgetButton> headerButtons = new ArrayList<WidgetButton>();
261
+ headerButtons.add(fistNav);
262
+ headerButtons.add(bannerBtn);
263
+ headerButtons.add(linkButton);
264
+ header.setButtons(headerButtons);
265
+ widgetResp.setHeader(header);
266
+
267
+ WidgetFooter footer = WidgetFooter.getInstance();
268
+ footer.setText("Footer Text");
269
+ List<WidgetButton> footerButtons = new ArrayList<WidgetButton>();
270
+ footerButtons.add(bannerBtn);
271
+ footerButtons.add(linkButton);
272
+ footer.setButtons(footerButtons);
273
+ widgetResp.setFooter(footer);
274
+
241
275
  return widgetResp;
242
276
  }
243
277
  }
@@ -5,17 +5,15 @@ import com.catalyst.integ.ZCIntegRequest;
5
5
  import com.catalyst.integ.ZCIntegResponse;
6
6
  import com.zc.cliq.util.ZCCliqUtil;
7
7
 
8
- public class {{_CLASS_}} implements CatalystIntegFunctionHandler
9
- {
8
+ public class {{_CLASS_}} implements CatalystIntegFunctionHandler {
10
9
  Logger LOGGER = Logger.getLogger({{_CLASS_}}.class.getName());
10
+
11
11
  @Override
12
- public ZCIntegResponse runner(ZCIntegRequest req) throws Exception
13
- {
14
- try{
12
+ public ZCIntegResponse runner(ZCIntegRequest req) throws Exception {
13
+ try {
15
14
  ZCIntegResponse resp = ZCCliqUtil.executeHandler(req);
16
15
  return resp;
17
- }
18
- catch(Exception ex){
16
+ } catch(Exception ex) {
19
17
  LOGGER.severe("Exception while executing handler.");
20
18
  throw ex;
21
19
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  const cliq = require('zcatalyst-integ-cliq');
4
4
  const command = cliq.command();
5
- const https = require('https');
6
5
 
7
6
  command.executionHandler(async (req, res) => {
8
7
  let text;
@@ -273,6 +273,52 @@ functionHandler.widgetButtonHandler(async (req, res) => {
273
273
  form.action = form.newFormAction('appletForm');// ** ENTER YOUR FORM FUNCTION NAME HERE **
274
274
  return form;
275
275
  }
276
+ case 'breadcrumbs': {
277
+ const page = parseInt(req.target.label.split("Page : ")[1].trim()) + 1;
278
+
279
+ const section = res.newWidgetSection();
280
+ section.id = '12345';
281
+
282
+ const elem = section.newWidgetElement();
283
+ elem.type = 'subtext';
284
+ elem.text = 'Page : ' + page;
285
+ section.addElement(elem);
286
+ res.addSection(section);
287
+
288
+ const firstNav = {
289
+ label: 'Page : ' + page,
290
+ type: 'invoke.function',
291
+ name: 'appletFunction',
292
+ id: 'breadcrumbs'
293
+ };
294
+
295
+ const linkButton = {
296
+ label: 'Link',
297
+ type: 'open.url',
298
+ url: 'https://www.zoho.com'
299
+ };
300
+
301
+ const bannerButton = {
302
+ label: 'Banner',
303
+ type: 'invoke.function',
304
+ name: 'appletFunction',
305
+ id: 'banner'
306
+ };
307
+
308
+ res.header = {
309
+ title : 'Header ' + page,
310
+ navigation : 'continue',
311
+ buttons : [firstNav, linkButton, bannerButton]
312
+ };
313
+
314
+ res.footer = {
315
+ text : 'Footer text',
316
+ buttons : [linkButton, bannerButton]
317
+ };
318
+
319
+ res.type = 'applet';
320
+ return res;
321
+ }
276
322
  default: {
277
323
  const msg = functionHandler.newHandlerResponse().newMessage();
278
324
  msg.text = 'Applet Button executed successfully';
@@ -93,6 +93,7 @@ widget.viewHandler(async (req, res) => {
93
93
  linkBtn.url = 'https://console.catalyst.zoho.com';
94
94
  info.button = linkBtn;
95
95
  res.info = info;
96
+ return res;
96
97
  }
97
98
  else if (comp(target, 'cliqTab')) {
98
99
 
@@ -238,6 +239,36 @@ widget.viewHandler(async (req, res) => {
238
239
  }
239
240
  }
240
241
 
242
+ const firstNav = {
243
+ label: 'Page : 1',
244
+ type: 'invoke.function',
245
+ name: 'appletFunction',
246
+ id: 'breadcrumbs'
247
+ };
248
+
249
+ const linkButton = {
250
+ label: 'Link',
251
+ type: 'open.url',
252
+ url: 'https://www.zoho.com'
253
+ };
254
+
255
+ const bannerButton = {
256
+ label: 'Banner',
257
+ type: 'invoke.function',
258
+ name: 'appletFunction',
259
+ id: 'banner'
260
+ };
261
+
262
+ res.header = {
263
+ title : 'Header 1',
264
+ navigation : 'new',
265
+ buttons : [firstNav, linkButton, bannerButton]
266
+ };
267
+
268
+ res.footer = {
269
+ text : 'Footer text',
270
+ buttons : [linkButton, bannerButton]
271
+ };
241
272
  return res;
242
273
  });
243
274
 
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WebClientEvent = void 0;
7
- const events_1 = __importDefault(require("events"));
8
- class WebClientEvent extends events_1.default {
9
- }
10
- exports.WebClientEvent = WebClientEvent;