zcatalyst-cli 1.18.0-beta.9 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +11 -6
  2. package/docs/commands/signals/generate/index.toml +19 -0
  3. package/docs/commands/slate/unlink.toml +9 -0
  4. package/docs/endpoints/lib/env.toml +3 -1
  5. package/docs/endpoints/lib/slate.toml +3 -0
  6. package/docs/serve/server/lib/slate/index.toml +14 -0
  7. package/docs/slate-utils.toml +4 -0
  8. package/docs/util_modules/config/lib/slate.toml +4 -0
  9. package/lib/archiver.js +18 -9
  10. package/lib/authentication/login.js +6 -5
  11. package/lib/code-deck.js +5 -6
  12. package/lib/command_needs/auth.js +1 -1
  13. package/lib/command_needs/rc.js +40 -3
  14. package/lib/commands/codelib/install.js +1 -0
  15. package/lib/commands/deploy/index.js +4 -0
  16. package/lib/commands/deploy/slate.js +58 -0
  17. package/lib/commands/event/generate/index.js +8 -2
  18. package/lib/commands/index.js +3 -3
  19. package/lib/commands/init.js +0 -10
  20. package/lib/commands/signals/generate/index.js +214 -0
  21. package/lib/commands/slate/create.js +59 -0
  22. package/lib/commands/slate/link.js +59 -0
  23. package/lib/commands/slate/unlink.js +75 -0
  24. package/lib/commands/zest/generate/index.js +1 -6
  25. package/lib/config-store.js +2 -1
  26. package/lib/deploy/features/index.js +3 -0
  27. package/lib/deploy/features/slate.js +123 -0
  28. package/lib/endpoints/index.js +8 -1
  29. package/lib/endpoints/lib/env.js +2 -1
  30. package/lib/endpoints/lib/sdk.js +2 -2
  31. package/lib/endpoints/lib/slate.js +107 -0
  32. package/lib/event_generate/cache.js +35 -33
  33. package/lib/event_generate/custom.js +15 -19
  34. package/lib/event_generate/datastore.js +60 -56
  35. package/lib/event_generate/filestore.js +51 -47
  36. package/lib/event_generate/github.js +19 -18
  37. package/lib/event_generate/stratus.js +52 -38
  38. package/lib/event_generate/user.js +33 -29
  39. package/lib/event_generate/webapp.js +33 -32
  40. package/lib/fn-utils/lib/common.js +1 -1
  41. package/lib/iac/status/deploy.js +1 -5
  42. package/lib/index.js +1 -1
  43. package/lib/init/features/appsail/index.js +3 -4
  44. package/lib/init/features/index.js +13 -1
  45. package/lib/init/features/project.js +1 -1
  46. package/lib/init/features/slate/index.js +313 -0
  47. package/lib/internal/api.js +1 -1
  48. package/lib/internal/command.js +10 -6
  49. package/lib/port-resolver.js +7 -0
  50. package/lib/prompt/index.js +22 -6
  51. package/lib/prompt/types/file-path.js +10 -7
  52. package/lib/serve/features/index.js +8 -1
  53. package/lib/serve/features/slate.js +47 -0
  54. package/lib/serve/server/index.js +61 -1
  55. package/lib/serve/server/lib/appsail/index.js +1 -1
  56. package/lib/serve/server/lib/master/appsail.js +7 -2
  57. package/lib/serve/server/lib/master/index.js +25 -21
  58. package/lib/serve/server/lib/master/slate.js +45 -0
  59. package/lib/serve/server/lib/master/utils.js +9 -3
  60. package/lib/serve/server/lib/slate/index.js +115 -0
  61. package/lib/serve/server/lib/slate/static-server.js +194 -0
  62. package/lib/serve/server/lib/web_client/server.js +2 -1
  63. package/lib/shell/dependencies/local-function.js +1 -1
  64. package/lib/slate-utils.js +212 -0
  65. package/lib/util_modules/config/index.js +3 -1
  66. package/lib/util_modules/config/lib/slate.js +98 -0
  67. package/lib/util_modules/constants/index.js +7 -1
  68. package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
  69. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  70. package/lib/util_modules/constants/lib/default.js +4 -0
  71. package/lib/util_modules/constants/lib/file-names.js +7 -1
  72. package/lib/util_modules/constants/lib/folder-names.js +1 -0
  73. package/lib/util_modules/constants/lib/placeholders.js +18 -1
  74. package/lib/util_modules/constants/lib/scopes.js +1 -6
  75. package/lib/util_modules/constants/lib/signals-api-names.js +19 -0
  76. package/lib/util_modules/constants/lib/signals-publishers-type.js +27 -0
  77. package/lib/util_modules/constants/lib/signals-publishers.js +10 -0
  78. package/lib/util_modules/constants/lib/template.js +1 -0
  79. package/lib/util_modules/context-help.js +2 -2
  80. package/lib/util_modules/fs/lib/async.js +14 -3
  81. package/lib/util_modules/fs/lib/sync.js +6 -1
  82. package/lib/util_modules/parser/toml.js +20 -5
  83. package/package.json +3 -3
  84. package/templates/event/integ/cliq/bot/action_handler.json +13 -4
  85. package/templates/event/integ/cliq/bot/call_handler.json +41 -0
  86. package/templates/event/integ/cliq/bot/context_handler.json +11 -3
  87. package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
  88. package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
  89. package/templates/event/integ/cliq/bot/message_handler.json +13 -4
  90. package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
  91. package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
  92. package/templates/event/integ/cliq/command/execution_handler.json +12 -3
  93. package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
  94. package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
  95. package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
  96. package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
  97. package/templates/event/integ/cliq/function/button_handler.json +13 -5
  98. package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
  99. package/templates/event/integ/cliq/function/form_handler.json +11 -3
  100. package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
  101. package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
  102. package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
  103. package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
  104. package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
  105. package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
  106. package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
  107. package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
  108. package/templates/event/integ/cliq/widget/view_handler.json +12 -4
  109. package/templates/event/signals.json +26 -0
  110. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  111. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  112. package/templates/init/client/react/react_ts/template.json +3 -3
  113. package/templates/init/functions/java/event/sample.java +4 -0
  114. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
  115. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
  116. package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
  117. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
  118. package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
  119. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
  120. package/templates/init/functions/java/integ/cliq/sample.java +10 -0
  121. package/templates/init/functions/node/aio/package.json +1 -1
  122. package/templates/init/functions/node/bio/package.json +1 -1
  123. package/templates/init/functions/node/cron/package.json +1 -1
  124. package/templates/init/functions/node/event/package.json +1 -1
  125. package/templates/init/functions/node/event/sample.js +1 -0
  126. package/templates/init/functions/node/event/types/event.d.ts +7 -0
  127. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
  128. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
  129. package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
  130. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
  131. package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
  132. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  133. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  134. package/templates/init/functions/node/job/package.json +1 -1
  135. package/templates/init/functions/python/event/sample.py +9 -5
  136. package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
  137. package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
  138. package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
  139. package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
  140. package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
  141. package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
  142. package/templates/init/functions/python/integ/cliq/sample.py +2 -2
  143. package/templates/init.txt +2 -1
  144. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
  145. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
  146. package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
  147. package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
  148. package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
@@ -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 = 'PyFnWidgetButton' # ** ENTER YOUR WIDGET FUNCTION 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 = 'PyFnWidgetButton'
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 = 'PyFnWidgetButton'
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 = 'PyFnWidgetButton'
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 = 'PyFnWidgetButton'
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 = 'PyFnWidgetButton'
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 = 'PyFnWidgetButton'
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': 'PyFnWidgetButton',
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': 'PyFnWidgetButton',
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
- "installation_validator": "handlers/installation_validator.py",
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
- "installation_handler": "handlers/installation_handler.py"
12
+ "link_preview_handler": "handlers/link_preview_handler.py"
13
13
  }
14
14
  },
15
15
  }
@@ -7,7 +7,8 @@ catalyst.initApp({
7
7
  zaid : "{{__ZAID__}}", //No I18N
8
8
  auth_domain : "{{__AUTH_DOMAIN__}}",
9
9
  is_appsail : "true",
10
- api_domain : ""
10
+ api_domain : "",
11
+ stratus_domain: "{{_STRATUS_DOMAIN__}}"
11
12
  },{
12
13
  org_id: "{{__ORG_ID__}}" //No I18N
13
14
  });
@@ -1,20 +0,0 @@
1
- //$Id$
2
- package com.handlers;
3
-
4
- import com.zc.cliq.enums.STATUS;
5
- import com.zc.cliq.objects.InstallationResponse;
6
- import com.zc.cliq.requests.InstallationRequest;
7
-
8
- public class InstallationHandler implements com.zc.cliq.interfaces.InstallationHandler {
9
- @Override
10
- public InstallationResponse handleInstallation(InstallationRequest req) throws Exception {
11
- InstallationResponse resp = InstallationResponse.getInstance();
12
- /*
13
- * // Logic for installation post handling {
14
- *
15
- * }
16
- */
17
- resp.setStatus(STATUS.SUCCESS);
18
- return resp;
19
- }
20
- }
@@ -1,22 +0,0 @@
1
- //$Id$
2
- package com.handlers;
3
-
4
- import com.zc.cliq.enums.EXTENSION_TYPE;
5
- import com.zc.cliq.enums.STATUS;
6
- import com.zc.cliq.objects.InstallationResponse;
7
- import com.zc.cliq.requests.InstallationRequest;
8
-
9
- public class InstallationValidator implements com.zc.cliq.interfaces.InstallationValidator {
10
- @Override
11
- public InstallationResponse validateInstallation(InstallationRequest req) throws Exception {
12
- InstallationResponse resp = InstallationResponse.getInstance();
13
- if (req.getUser().getFirstName().equals("**INVALID_USER**") && req.getAppInfo().getType().equals(EXTENSION_TYPE.UPGRADE)) {
14
- resp.setStatus(STATUS.FAILURE);
15
- resp.setTitle("Update not allowed !");
16
- resp.setMessage("Sorry. Update not allowed for the current app. Please contact admin.");
17
- } else {
18
- resp.setStatus(STATUS.SUCCESS);
19
- }
20
- return resp;
21
- }
22
- }
@@ -1,15 +0,0 @@
1
- 'use strict';
2
- import Cliq from 'zcatalyst-integ-cliq';
3
- const installationHandler = Cliq.installationHandler();
4
-
5
- installationHandler.handleInstallation(async (req, res) => {
6
- /*
7
- // Logic for installation post handling
8
- *{
9
- *
10
- *}
11
- */
12
-
13
- res.status = 200;
14
- return res;
15
- });
@@ -1,12 +0,0 @@
1
- from zcatalyst_cliq.installation_handler import (
2
- handle_installation,
3
- InstallationRequest,
4
- InstallationResponse
5
- )
6
-
7
-
8
- @handle_installation
9
- def installation_handler(req: InstallationRequest, res: InstallationResponse, *args):
10
- '''Logic for installation post handling'''
11
- res.status = 200
12
- return res
@@ -1,16 +0,0 @@
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