@kumologica/sdk 3.0.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 (540) hide show
  1. package/README.md +1 -0
  2. package/bin/kl.js +3 -0
  3. package/cli/cli.js +6 -0
  4. package/cli/commands/build-commands/aws.js +49 -0
  5. package/cli/commands/build-commands/azure.js +43 -0
  6. package/cli/commands/build-commands/kumohub.js +7 -0
  7. package/cli/commands/build.js +6 -0
  8. package/cli/commands/create.js +32 -0
  9. package/cli/commands/deploy-commands/kumohub.js +114 -0
  10. package/cli/commands/deploy.js +6 -0
  11. package/cli/commands/doc-commands/html.js +61 -0
  12. package/cli/commands/doc.js +6 -0
  13. package/cli/commands/export-commands/cloudformation.js +338 -0
  14. package/cli/commands/export-commands/serverless.js +164 -0
  15. package/cli/commands/export-commands/terraform-commands/aws.js +193 -0
  16. package/cli/commands/export-commands/terraform-commands/azure.js +148 -0
  17. package/cli/commands/export-commands/terraform.js +6 -0
  18. package/cli/commands/export-commands/utils/validator.js +152 -0
  19. package/cli/commands/export.js +6 -0
  20. package/cli/commands/import-commands/mulesoft.js +61 -0
  21. package/cli/commands/import.js +6 -0
  22. package/cli/commands/open.js +46 -0
  23. package/cli/commands/test-utils/TestSuiteController.js +359 -0
  24. package/cli/commands/test-utils/TestSuiteController.test.js +171 -0
  25. package/cli/commands/test-utils/fixtures/example3-flow.json +148 -0
  26. package/cli/commands/test-utils/fixtures/package.json +6 -0
  27. package/cli/commands/test-utils/fixtures/s3-event.js +43 -0
  28. package/cli/commands/test-utils/util/output.js +14 -0
  29. package/cli/commands/test-utils/util/updates/index.js +17 -0
  30. package/cli/commands/test-utils/util/updates/pkg.js +13 -0
  31. package/cli/commands/test-utils/util/updates/templates/default-settings.js +209 -0
  32. package/cli/commands/test.js +66 -0
  33. package/cli/commands/utils.js +14 -0
  34. package/package.json +158 -0
  35. package/src/app/lib/aws/aws-profile.js +43 -0
  36. package/src/app/lib/aws/ca-alexa-api.js +29 -0
  37. package/src/app/lib/aws/ca-apigw-api.js +216 -0
  38. package/src/app/lib/aws/ca-cloudwatch-api.js +78 -0
  39. package/src/app/lib/aws/ca-codecommit-api.js +63 -0
  40. package/src/app/lib/aws/ca-dynamodb-api.js +27 -0
  41. package/src/app/lib/aws/ca-elb-api.js +44 -0
  42. package/src/app/lib/aws/ca-events-api.js +27 -0
  43. package/src/app/lib/aws/ca-iot-api.js +105 -0
  44. package/src/app/lib/aws/ca-s3-api.js +115 -0
  45. package/src/app/lib/aws/ca-sns-api.js +38 -0
  46. package/src/app/lib/aws/ca-sqs-api.js +51 -0
  47. package/src/app/lib/aws/cf.js +439 -0
  48. package/src/app/lib/aws/index.js +970 -0
  49. package/src/app/lib/aws/kl-iam-api.js +27 -0
  50. package/src/app/lib/aws/kl-rekognition-api.js +66 -0
  51. package/src/app/lib/aws/kl-ssm-api.js +24 -0
  52. package/src/app/lib/azure/index.js +80 -0
  53. package/src/app/lib/dependencies.js +50 -0
  54. package/src/app/lib/kumohub/index.js +201 -0
  55. package/src/app/lib/runtime-loader/index.js +42 -0
  56. package/src/app/lib/serverless/index.js +318 -0
  57. package/src/app/lib/stores/aws-cloud-config-store.js +35 -0
  58. package/src/app/lib/stores/azure-config-store.js +24 -0
  59. package/src/app/lib/stores/kumohub-config-store.js +24 -0
  60. package/src/app/lib/stores/project-info-config-store.js +26 -0
  61. package/src/app/lib/stores/settings-cloud-store.js +117 -0
  62. package/src/app/lib/stores/settings-cloud-store.spec.js +26 -0
  63. package/src/app/lib/stores/settings-network-store.js +119 -0
  64. package/src/app/lib/stores/settings-network-store.spec.js +27 -0
  65. package/src/app/lib/stores/store.js +97 -0
  66. package/src/app/lib/stores/test-config-store.js +26 -0
  67. package/src/app/lib/stores/user-preference-store.js +44 -0
  68. package/src/app/lib/utils/editor.js +98 -0
  69. package/src/app/lib/utils/fix-path.js +15 -0
  70. package/src/app/main-process/favicon.ico +0 -0
  71. package/src/app/main-process/main-window.js +209 -0
  72. package/src/app/main-process/menu.js +219 -0
  73. package/src/app/main-process/modal-home.js +118 -0
  74. package/src/app/main-process/modal-newproject.js +119 -0
  75. package/src/app/main-process/modal-nodelibrary.js +90 -0
  76. package/src/app/main-process/modal-welcome.js +114 -0
  77. package/src/app/main-process/runtime-manager.js +141 -0
  78. package/src/app/main.js +590 -0
  79. package/src/app/preload.js +633 -0
  80. package/src/app/ui/editor-api/lib/admin/context.js +42 -0
  81. package/src/app/ui/editor-api/lib/admin/flow.js +55 -0
  82. package/src/app/ui/editor-api/lib/admin/flows.js +53 -0
  83. package/src/app/ui/editor-api/lib/admin/index.js +155 -0
  84. package/src/app/ui/editor-api/lib/admin/nodes.js +164 -0
  85. package/src/app/ui/editor-api/lib/auth/clients.js +17 -0
  86. package/src/app/ui/editor-api/lib/auth/index.js +267 -0
  87. package/src/app/ui/editor-api/lib/auth/permissions.js +51 -0
  88. package/src/app/ui/editor-api/lib/auth/strategies.js +144 -0
  89. package/src/app/ui/editor-api/lib/auth/tokens.js +138 -0
  90. package/src/app/ui/editor-api/lib/auth/users.js +122 -0
  91. package/src/app/ui/editor-api/lib/editor/comms.js +247 -0
  92. package/src/app/ui/editor-api/lib/editor/credentials.js +22 -0
  93. package/src/app/ui/editor-api/lib/editor/index.js +234 -0
  94. package/src/app/ui/editor-api/lib/editor/library.js +69 -0
  95. package/src/app/ui/editor-api/lib/editor/locales.js +37 -0
  96. package/src/app/ui/editor-api/lib/editor/projects.js +497 -0
  97. package/src/app/ui/editor-api/lib/editor/settings.js +118 -0
  98. package/src/app/ui/editor-api/lib/editor/sshkeys.js +87 -0
  99. package/src/app/ui/editor-api/lib/editor/theme.js +184 -0
  100. package/src/app/ui/editor-api/lib/editor/ui.js +149 -0
  101. package/src/app/ui/editor-api/lib/index.js +149 -0
  102. package/src/app/ui/editor-api/lib/runner/index.js +81 -0
  103. package/src/app/ui/editor-api/lib/util.js +51 -0
  104. package/src/app/ui/editor-client/README.md +10 -0
  105. package/src/app/ui/editor-client/constants.js +5 -0
  106. package/src/app/ui/editor-client/index.js +3 -0
  107. package/src/app/ui/editor-client/public/favicon.ico +0 -0
  108. package/src/app/ui/editor-client/public/red/images/bolt.png +0 -0
  109. package/src/app/ui/editor-client/public/red/images/debugger/continue-full.png +0 -0
  110. package/src/app/ui/editor-client/public/red/images/debugger/continue-outline.png +0 -0
  111. package/src/app/ui/editor-client/public/red/images/debugger/pause.png +0 -0
  112. package/src/app/ui/editor-client/public/red/images/debugger/restart.png +0 -0
  113. package/src/app/ui/editor-client/public/red/images/debugger/stepover.png +0 -0
  114. package/src/app/ui/editor-client/public/red/images/debugger/stop.png +0 -0
  115. package/src/app/ui/editor-client/public/red/images/deploy-flows-o.png +0 -0
  116. package/src/app/ui/editor-client/public/red/images/deploy-flows.png +0 -0
  117. package/src/app/ui/editor-client/public/red/images/deploy-full-o.png +0 -0
  118. package/src/app/ui/editor-client/public/red/images/deploy-full.png +0 -0
  119. package/src/app/ui/editor-client/public/red/images/deploy-nodes-o.png +0 -0
  120. package/src/app/ui/editor-client/public/red/images/deploy-nodes.png +0 -0
  121. package/src/app/ui/editor-client/public/red/images/deploy-reload.png +0 -0
  122. package/src/app/ui/editor-client/public/red/images/grip.png +0 -0
  123. package/src/app/ui/editor-client/public/red/images/icons/arrow-in.png +0 -0
  124. package/src/app/ui/editor-client/public/red/images/icons/bolt.png +0 -0
  125. package/src/app/ui/editor-client/public/red/images/icons/node-changed.png +0 -0
  126. package/src/app/ui/editor-client/public/red/images/icons/node-error.png +0 -0
  127. package/src/app/ui/editor-client/public/red/images/icons/node-play.png +0 -0
  128. package/src/app/ui/editor-client/public/red/images/kumologica-app.png +0 -0
  129. package/src/app/ui/editor-client/public/red/images/node-red-256.png +0 -0
  130. package/src/app/ui/editor-client/public/red/images/node-red-icon-black.svg +9 -0
  131. package/src/app/ui/editor-client/public/red/images/node-red-icon.svg +33 -0
  132. package/src/app/ui/editor-client/public/red/images/node-red.png +0 -0
  133. package/src/app/ui/editor-client/public/red/images/pw_maze_white.png +0 -0
  134. package/src/app/ui/editor-client/public/red/images/spin.svg +41 -0
  135. package/src/app/ui/editor-client/public/red/images/spinner.gif +0 -0
  136. package/src/app/ui/editor-client/public/red/images/subflow_tab.png +0 -0
  137. package/src/app/ui/editor-client/public/red/images/test-icon.png +0 -0
  138. package/src/app/ui/editor-client/public/red/images/typedInput/09.png +0 -0
  139. package/src/app/ui/editor-client/public/red/images/typedInput/az.png +0 -0
  140. package/src/app/ui/editor-client/public/red/images/typedInput/bin.png +0 -0
  141. package/src/app/ui/editor-client/public/red/images/typedInput/bool.png +0 -0
  142. package/src/app/ui/editor-client/public/red/images/typedInput/env.png +0 -0
  143. package/src/app/ui/editor-client/public/red/images/typedInput/expr.png +0 -0
  144. package/src/app/ui/editor-client/public/red/images/typedInput/json.png +0 -0
  145. package/src/app/ui/editor-client/public/red/images/typedInput/re.png +0 -0
  146. package/src/app/ui/editor-client/public/red/keymap.json +54 -0
  147. package/src/app/ui/editor-client/public/red/main-modals.js +14 -0
  148. package/src/app/ui/editor-client/public/red/main-modals.min.js +16 -0
  149. package/src/app/ui/editor-client/public/red/main.js +10 -0
  150. package/src/app/ui/editor-client/public/red/main.min.js +16 -0
  151. package/src/app/ui/editor-client/public/red/red.js +44903 -0
  152. package/src/app/ui/editor-client/public/red/red.min.js +16 -0
  153. package/src/app/ui/editor-client/public/red/style.min.css +24 -0
  154. package/src/app/ui/editor-client/public/vendor/ace/LICENSE +24 -0
  155. package/src/app/ui/editor-client/public/vendor/ace/ace.js +17 -0
  156. package/src/app/ui/editor-client/public/vendor/ace/ext-language_tools.js +8 -0
  157. package/src/app/ui/editor-client/public/vendor/ace/ext-searchbox.js +8 -0
  158. package/src/app/ui/editor-client/public/vendor/ace/mode-css.js +8 -0
  159. package/src/app/ui/editor-client/public/vendor/ace/mode-handlebars.js +8 -0
  160. package/src/app/ui/editor-client/public/vendor/ace/mode-html.js +8 -0
  161. package/src/app/ui/editor-client/public/vendor/ace/mode-javascript.js +8 -0
  162. package/src/app/ui/editor-client/public/vendor/ace/mode-json.js +8 -0
  163. package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +1 -0
  164. package/src/app/ui/editor-client/public/vendor/ace/mode-markdown.js +8 -0
  165. package/src/app/ui/editor-client/public/vendor/ace/mode-properties.js +8 -0
  166. package/src/app/ui/editor-client/public/vendor/ace/mode-python.js +8 -0
  167. package/src/app/ui/editor-client/public/vendor/ace/mode-sql.js +8 -0
  168. package/src/app/ui/editor-client/public/vendor/ace/mode-swift.js +8 -0
  169. package/src/app/ui/editor-client/public/vendor/ace/mode-text.js +8 -0
  170. package/src/app/ui/editor-client/public/vendor/ace/mode-xml.js +8 -0
  171. package/src/app/ui/editor-client/public/vendor/ace/mode-yaml.js +8 -0
  172. package/src/app/ui/editor-client/public/vendor/ace/snippets/css.js +8 -0
  173. package/src/app/ui/editor-client/public/vendor/ace/snippets/handlebars.js +8 -0
  174. package/src/app/ui/editor-client/public/vendor/ace/snippets/html.js +8 -0
  175. package/src/app/ui/editor-client/public/vendor/ace/snippets/javascript.js +8 -0
  176. package/src/app/ui/editor-client/public/vendor/ace/snippets/json.js +8 -0
  177. package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +1 -0
  178. package/src/app/ui/editor-client/public/vendor/ace/snippets/markdown.js +8 -0
  179. package/src/app/ui/editor-client/public/vendor/ace/snippets/properties.js +8 -0
  180. package/src/app/ui/editor-client/public/vendor/ace/snippets/python.js +8 -0
  181. package/src/app/ui/editor-client/public/vendor/ace/snippets/sql.js +8 -0
  182. package/src/app/ui/editor-client/public/vendor/ace/snippets/swift.js +8 -0
  183. package/src/app/ui/editor-client/public/vendor/ace/snippets/text.js +8 -0
  184. package/src/app/ui/editor-client/public/vendor/ace/snippets/xml.js +8 -0
  185. package/src/app/ui/editor-client/public/vendor/ace/snippets/yaml.js +8 -0
  186. package/src/app/ui/editor-client/public/vendor/ace/theme-chrome.js +8 -0
  187. package/src/app/ui/editor-client/public/vendor/ace/theme-tomorrow.js +8 -0
  188. package/src/app/ui/editor-client/public/vendor/ace/worker-css.js +1 -0
  189. package/src/app/ui/editor-client/public/vendor/ace/worker-html.js +1 -0
  190. package/src/app/ui/editor-client/public/vendor/ace/worker-javascript.js +1 -0
  191. package/src/app/ui/editor-client/public/vendor/ace/worker-json.js +1 -0
  192. package/src/app/ui/editor-client/public/vendor/ace/worker-jsonata.js +2140 -0
  193. package/src/app/ui/editor-client/public/vendor/ace/worker-xml.js +1 -0
  194. package/src/app/ui/editor-client/public/vendor/beautifyjs/beautify.min.js +1 -0
  195. package/src/app/ui/editor-client/public/vendor/bootstrap/css/bootstrap.min.css +9 -0
  196. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  197. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  198. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/active-line.js +72 -0
  199. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  200. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-hint.js +157 -0
  201. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-lint.js +63 -0
  202. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/jshint.js +29591 -0
  203. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.css +73 -0
  204. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.js +252 -0
  205. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.css +36 -0
  206. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.js +460 -0
  207. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/sql-hint.js +304 -0
  208. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.css +350 -0
  209. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.js +9800 -0
  210. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/javascript.js +927 -0
  211. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/sql.js +494 -0
  212. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/base16-dark.css +38 -0
  213. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/monokai.css +42 -0
  214. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/solarized.css +168 -0
  215. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.css +43 -0
  216. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.js +87 -0
  217. package/src/app/ui/editor-client/public/vendor/easy-json-schema/index.js +88 -0
  218. package/src/app/ui/editor-client/public/vendor/font-awesome/css/font-awesome.min.css +4 -0
  219. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  220. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  221. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  222. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  223. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  224. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  225. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.eot +0 -0
  226. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.svg +2105 -0
  227. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.ttf +0 -0
  228. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff +0 -0
  229. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff2 +0 -0
  230. package/src/app/ui/editor-client/public/vendor/icofont/icofont.min.css +7 -0
  231. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  232. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  233. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  234. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  235. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  236. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  237. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  238. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  239. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  240. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  241. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  242. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  243. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  244. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  245. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  246. package/src/app/ui/editor-client/public/vendor/jsonata/jsonata.min.js +183 -0
  247. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.css +181 -0
  248. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.js +48 -0
  249. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +7 -0
  250. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +15 -0
  251. package/src/app/ui/editor-client/public/vendor/vendor.css +0 -0
  252. package/src/app/ui/editor-client/public/vendor/vendor.js +125 -0
  253. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +2 -0
  254. package/src/app/ui/editor-client/src/ace/README.md +50 -0
  255. package/src/app/ui/editor-client/src/ace/mode/nrjavascript.js +35 -0
  256. package/src/app/ui/editor-client/src/ace/mode/nrjavascript_worker.js +189 -0
  257. package/src/app/ui/editor-client/src/favicon.ico +0 -0
  258. package/src/app/ui/editor-client/src/images/bolt.png +0 -0
  259. package/src/app/ui/editor-client/src/images/debugger/continue-full.png +0 -0
  260. package/src/app/ui/editor-client/src/images/debugger/continue-outline.png +0 -0
  261. package/src/app/ui/editor-client/src/images/debugger/pause.png +0 -0
  262. package/src/app/ui/editor-client/src/images/debugger/restart.png +0 -0
  263. package/src/app/ui/editor-client/src/images/debugger/stepover.png +0 -0
  264. package/src/app/ui/editor-client/src/images/debugger/stop.png +0 -0
  265. package/src/app/ui/editor-client/src/images/deploy-flows-o.png +0 -0
  266. package/src/app/ui/editor-client/src/images/deploy-flows.png +0 -0
  267. package/src/app/ui/editor-client/src/images/deploy-full-o.png +0 -0
  268. package/src/app/ui/editor-client/src/images/deploy-full.png +0 -0
  269. package/src/app/ui/editor-client/src/images/deploy-nodes-o.png +0 -0
  270. package/src/app/ui/editor-client/src/images/deploy-nodes.png +0 -0
  271. package/src/app/ui/editor-client/src/images/deploy-reload.png +0 -0
  272. package/src/app/ui/editor-client/src/images/grip.png +0 -0
  273. package/src/app/ui/editor-client/src/images/icons/arrow-in.png +0 -0
  274. package/src/app/ui/editor-client/src/images/icons/bolt.png +0 -0
  275. package/src/app/ui/editor-client/src/images/icons/node-changed.png +0 -0
  276. package/src/app/ui/editor-client/src/images/icons/node-error.png +0 -0
  277. package/src/app/ui/editor-client/src/images/icons/node-play.png +0 -0
  278. package/src/app/ui/editor-client/src/images/kumologica-app.png +0 -0
  279. package/src/app/ui/editor-client/src/images/node-red-256.png +0 -0
  280. package/src/app/ui/editor-client/src/images/node-red-icon-black.svg +9 -0
  281. package/src/app/ui/editor-client/src/images/node-red-icon.svg +33 -0
  282. package/src/app/ui/editor-client/src/images/node-red.png +0 -0
  283. package/src/app/ui/editor-client/src/images/pw_maze_white.png +0 -0
  284. package/src/app/ui/editor-client/src/images/spin.svg +41 -0
  285. package/src/app/ui/editor-client/src/images/spinner.gif +0 -0
  286. package/src/app/ui/editor-client/src/images/subflow_tab.png +0 -0
  287. package/src/app/ui/editor-client/src/images/test-icon.png +0 -0
  288. package/src/app/ui/editor-client/src/images/typedInput/09.png +0 -0
  289. package/src/app/ui/editor-client/src/images/typedInput/az.png +0 -0
  290. package/src/app/ui/editor-client/src/images/typedInput/bin.png +0 -0
  291. package/src/app/ui/editor-client/src/images/typedInput/bool.png +0 -0
  292. package/src/app/ui/editor-client/src/images/typedInput/env.png +0 -0
  293. package/src/app/ui/editor-client/src/images/typedInput/expr.png +0 -0
  294. package/src/app/ui/editor-client/src/images/typedInput/json.png +0 -0
  295. package/src/app/ui/editor-client/src/images/typedInput/re.png +0 -0
  296. package/src/app/ui/editor-client/src/js/comms.js +174 -0
  297. package/src/app/ui/editor-client/src/js/events.js +39 -0
  298. package/src/app/ui/editor-client/src/js/font-awesome.js +818 -0
  299. package/src/app/ui/editor-client/src/js/history.js +337 -0
  300. package/src/app/ui/editor-client/src/js/i18n.js +81 -0
  301. package/src/app/ui/editor-client/src/js/jquery-addons.js +21 -0
  302. package/src/app/ui/editor-client/src/js/keymap.json +54 -0
  303. package/src/app/ui/editor-client/src/js/main-modals.js +14 -0
  304. package/src/app/ui/editor-client/src/js/main.js +10 -0
  305. package/src/app/ui/editor-client/src/js/modals/modal-home.js +162 -0
  306. package/src/app/ui/editor-client/src/js/modals/modal-new-project.js +86 -0
  307. package/src/app/ui/editor-client/src/js/modals/modal-node-library.js +255 -0
  308. package/src/app/ui/editor-client/src/js/modals/modal-welcome.js +102 -0
  309. package/src/app/ui/editor-client/src/js/nodes.js +1736 -0
  310. package/src/app/ui/editor-client/src/js/red.js +704 -0
  311. package/src/app/ui/editor-client/src/js/settings.js +275 -0
  312. package/src/app/ui/editor-client/src/js/text/bidi.js +116 -0
  313. package/src/app/ui/editor-client/src/js/text/format.js +1316 -0
  314. package/src/app/ui/editor-client/src/js/ui/actions.js +39 -0
  315. package/src/app/ui/editor-client/src/js/ui/clipboard.js +510 -0
  316. package/src/app/ui/editor-client/src/js/ui/common/checkboxSet.js +117 -0
  317. package/src/app/ui/editor-client/src/js/ui/common/editableList.js +322 -0
  318. package/src/app/ui/editor-client/src/js/ui/common/menu.js +277 -0
  319. package/src/app/ui/editor-client/src/js/ui/common/panels.js +104 -0
  320. package/src/app/ui/editor-client/src/js/ui/common/popover.js +268 -0
  321. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +98 -0
  322. package/src/app/ui/editor-client/src/js/ui/common/stack.js +184 -0
  323. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +730 -0
  324. package/src/app/ui/editor-client/src/js/ui/common/treeList.js +170 -0
  325. package/src/app/ui/editor-client/src/js/ui/common/typedInput.js +819 -0
  326. package/src/app/ui/editor-client/src/js/ui/common/typedInputLong.js +829 -0
  327. package/src/app/ui/editor-client/src/js/ui/deploy.js +422 -0
  328. package/src/app/ui/editor-client/src/js/ui/diff.js +2225 -0
  329. package/src/app/ui/editor-client/src/js/ui/editor.js +3020 -0
  330. package/src/app/ui/editor-client/src/js/ui/editors/buffer.js +195 -0
  331. package/src/app/ui/editor-client/src/js/ui/editors/expression.js +627 -0
  332. package/src/app/ui/editor-client/src/js/ui/editors/js.js +89 -0
  333. package/src/app/ui/editor-client/src/js/ui/editors/json.js +107 -0
  334. package/src/app/ui/editor-client/src/js/ui/editors/markdown.js +267 -0
  335. package/src/app/ui/editor-client/src/js/ui/editors/string.js +75 -0
  336. package/src/app/ui/editor-client/src/js/ui/event-log.js +107 -0
  337. package/src/app/ui/editor-client/src/js/ui/header.js +372 -0
  338. package/src/app/ui/editor-client/src/js/ui/keyboard.js +565 -0
  339. package/src/app/ui/editor-client/src/js/ui/library.js +570 -0
  340. package/src/app/ui/editor-client/src/js/ui/logviewer.js +116 -0
  341. package/src/app/ui/editor-client/src/js/ui/notifications.js +282 -0
  342. package/src/app/ui/editor-client/src/js/ui/palette-editor.js +1061 -0
  343. package/src/app/ui/editor-client/src/js/ui/palette.js +788 -0
  344. package/src/app/ui/editor-client/src/js/ui/project-info.js +232 -0
  345. package/src/app/ui/editor-client/src/js/ui/projects/projectSettings.js +1651 -0
  346. package/src/app/ui/editor-client/src/js/ui/projects/projectUserSettings.js +404 -0
  347. package/src/app/ui/editor-client/src/js/ui/projects/projects.js +2395 -0
  348. package/src/app/ui/editor-client/src/js/ui/projects/tab-versionControl.js +1383 -0
  349. package/src/app/ui/editor-client/src/js/ui/search.js +366 -0
  350. package/src/app/ui/editor-client/src/js/ui/sidebar.js +409 -0
  351. package/src/app/ui/editor-client/src/js/ui/state.js +14 -0
  352. package/src/app/ui/editor-client/src/js/ui/subflow.js +748 -0
  353. package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1427 -0
  354. package/src/app/ui/editor-client/src/js/ui/tab-azure.js +852 -0
  355. package/src/app/ui/editor-client/src/js/ui/tab-config.js +452 -0
  356. package/src/app/ui/editor-client/src/js/ui/tab-context.js +406 -0
  357. package/src/app/ui/editor-client/src/js/ui/tab-info.js +661 -0
  358. package/src/app/ui/editor-client/src/js/ui/tab-kumohub.js +800 -0
  359. package/src/app/ui/editor-client/src/js/ui/tab-nodeInfo.js +60 -0
  360. package/src/app/ui/editor-client/src/js/ui/tab-test.js +915 -0
  361. package/src/app/ui/editor-client/src/js/ui/terminal.js +240 -0
  362. package/src/app/ui/editor-client/src/js/ui/touch/radialMenu.js +170 -0
  363. package/src/app/ui/editor-client/src/js/ui/tray.js +411 -0
  364. package/src/app/ui/editor-client/src/js/ui/typeSearch.js +411 -0
  365. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +422 -0
  366. package/src/app/ui/editor-client/src/js/ui/update-panel.js +84 -0
  367. package/src/app/ui/editor-client/src/js/ui/userSettings.js +673 -0
  368. package/src/app/ui/editor-client/src/js/ui/utils.js +1287 -0
  369. package/src/app/ui/editor-client/src/js/ui/view-navigator.js +169 -0
  370. package/src/app/ui/editor-client/src/js/ui/view-tools.js +123 -0
  371. package/src/app/ui/editor-client/src/js/ui/view.js +5333 -0
  372. package/src/app/ui/editor-client/src/js/ui/workspaces.js +498 -0
  373. package/src/app/ui/editor-client/src/js/user.js +282 -0
  374. package/src/app/ui/editor-client/src/js/validators.js +54 -0
  375. package/src/app/ui/editor-client/src/kumologica-app.png +0 -0
  376. package/src/app/ui/editor-client/src/sass/ace.scss +29 -0
  377. package/src/app/ui/editor-client/src/sass/bootstrap.scss +21 -0
  378. package/src/app/ui/editor-client/src/sass/colors.scss +76 -0
  379. package/src/app/ui/editor-client/src/sass/debug.scss +383 -0
  380. package/src/app/ui/editor-client/src/sass/diff.scss +695 -0
  381. package/src/app/ui/editor-client/src/sass/dragdrop.scss +37 -0
  382. package/src/app/ui/editor-client/src/sass/dropdownMenu.scss +93 -0
  383. package/src/app/ui/editor-client/src/sass/editor.scss +683 -0
  384. package/src/app/ui/editor-client/src/sass/flow.scss +330 -0
  385. package/src/app/ui/editor-client/src/sass/forms.scss +1093 -0
  386. package/src/app/ui/editor-client/src/sass/header.scss +502 -0
  387. package/src/app/ui/editor-client/src/sass/jquery.scss +152 -0
  388. package/src/app/ui/editor-client/src/sass/keyboard.scss +136 -0
  389. package/src/app/ui/editor-client/src/sass/library.scss +54 -0
  390. package/src/app/ui/editor-client/src/sass/mixins.scss +283 -0
  391. package/src/app/ui/editor-client/src/sass/modals/modalHome.scss +138 -0
  392. package/src/app/ui/editor-client/src/sass/modals/modalNewProject.scss +96 -0
  393. package/src/app/ui/editor-client/src/sass/modals/modalNodeLibrary.scss +131 -0
  394. package/src/app/ui/editor-client/src/sass/modals/modalWelcome.scss +102 -0
  395. package/src/app/ui/editor-client/src/sass/notifications.scss +118 -0
  396. package/src/app/ui/editor-client/src/sass/palette-editor.scss +275 -0
  397. package/src/app/ui/editor-client/src/sass/palette.scss +279 -0
  398. package/src/app/ui/editor-client/src/sass/panels.scss +61 -0
  399. package/src/app/ui/editor-client/src/sass/popover.scss +166 -0
  400. package/src/app/ui/editor-client/src/sass/project-info.scss +74 -0
  401. package/src/app/ui/editor-client/src/sass/projects.scss +875 -0
  402. package/src/app/ui/editor-client/src/sass/search.scss +201 -0
  403. package/src/app/ui/editor-client/src/sass/sidebar.scss +201 -0
  404. package/src/app/ui/editor-client/src/sass/style.scss +170 -0
  405. package/src/app/ui/editor-client/src/sass/tab-azure.scss +68 -0
  406. package/src/app/ui/editor-client/src/sass/tab-cloud.scss +67 -0
  407. package/src/app/ui/editor-client/src/sass/tab-config.scss +100 -0
  408. package/src/app/ui/editor-client/src/sass/tab-context.scss +54 -0
  409. package/src/app/ui/editor-client/src/sass/tab-info.scss +307 -0
  410. package/src/app/ui/editor-client/src/sass/tab-kumohub.scss +68 -0
  411. package/src/app/ui/editor-client/src/sass/tab-test.scss +257 -0
  412. package/src/app/ui/editor-client/src/sass/tabs.scss +395 -0
  413. package/src/app/ui/editor-client/src/sass/terminal.scss +246 -0
  414. package/src/app/ui/editor-client/src/sass/ui/common/checkboxSet.scss +29 -0
  415. package/src/app/ui/editor-client/src/sass/ui/common/editableList.scss +81 -0
  416. package/src/app/ui/editor-client/src/sass/ui/common/nodeList.scss +65 -0
  417. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +77 -0
  418. package/src/app/ui/editor-client/src/sass/ui/common/stack.scss +26 -0
  419. package/src/app/ui/editor-client/src/sass/ui/common/treeList.scss +108 -0
  420. package/src/app/ui/editor-client/src/sass/ui/common/typedInput.scss +181 -0
  421. package/src/app/ui/editor-client/src/sass/ui/common/typedInputLong.scss +183 -0
  422. package/src/app/ui/editor-client/src/sass/ui-settings.scss +119 -0
  423. package/src/app/ui/editor-client/src/sass/update-panel.scss +18 -0
  424. package/src/app/ui/editor-client/src/sass/userSettings.scss +93 -0
  425. package/src/app/ui/editor-client/src/sass/widgetStyle.scss +23 -0
  426. package/src/app/ui/editor-client/src/sass/workspace.scss +123 -0
  427. package/src/app/ui/editor-client/src/sass/workspaceToolbar.scss +85 -0
  428. package/src/app/ui/editor-client/src/vendor/ace/LICENSE +24 -0
  429. package/src/app/ui/editor-client/src/vendor/ace/ace.js +17 -0
  430. package/src/app/ui/editor-client/src/vendor/ace/ext-language_tools.js +8 -0
  431. package/src/app/ui/editor-client/src/vendor/ace/ext-searchbox.js +8 -0
  432. package/src/app/ui/editor-client/src/vendor/ace/mode-css.js +8 -0
  433. package/src/app/ui/editor-client/src/vendor/ace/mode-handlebars.js +8 -0
  434. package/src/app/ui/editor-client/src/vendor/ace/mode-html.js +8 -0
  435. package/src/app/ui/editor-client/src/vendor/ace/mode-javascript.js +8 -0
  436. package/src/app/ui/editor-client/src/vendor/ace/mode-json.js +8 -0
  437. package/src/app/ui/editor-client/src/vendor/ace/mode-markdown.js +8 -0
  438. package/src/app/ui/editor-client/src/vendor/ace/mode-properties.js +8 -0
  439. package/src/app/ui/editor-client/src/vendor/ace/mode-python.js +8 -0
  440. package/src/app/ui/editor-client/src/vendor/ace/mode-sql.js +8 -0
  441. package/src/app/ui/editor-client/src/vendor/ace/mode-swift.js +8 -0
  442. package/src/app/ui/editor-client/src/vendor/ace/mode-text.js +8 -0
  443. package/src/app/ui/editor-client/src/vendor/ace/mode-xml.js +8 -0
  444. package/src/app/ui/editor-client/src/vendor/ace/mode-yaml.js +8 -0
  445. package/src/app/ui/editor-client/src/vendor/ace/snippets/css.js +8 -0
  446. package/src/app/ui/editor-client/src/vendor/ace/snippets/handlebars.js +8 -0
  447. package/src/app/ui/editor-client/src/vendor/ace/snippets/html.js +8 -0
  448. package/src/app/ui/editor-client/src/vendor/ace/snippets/javascript.js +8 -0
  449. package/src/app/ui/editor-client/src/vendor/ace/snippets/json.js +8 -0
  450. package/src/app/ui/editor-client/src/vendor/ace/snippets/markdown.js +8 -0
  451. package/src/app/ui/editor-client/src/vendor/ace/snippets/properties.js +8 -0
  452. package/src/app/ui/editor-client/src/vendor/ace/snippets/python.js +8 -0
  453. package/src/app/ui/editor-client/src/vendor/ace/snippets/sql.js +8 -0
  454. package/src/app/ui/editor-client/src/vendor/ace/snippets/swift.js +8 -0
  455. package/src/app/ui/editor-client/src/vendor/ace/snippets/text.js +8 -0
  456. package/src/app/ui/editor-client/src/vendor/ace/snippets/xml.js +8 -0
  457. package/src/app/ui/editor-client/src/vendor/ace/snippets/yaml.js +8 -0
  458. package/src/app/ui/editor-client/src/vendor/ace/theme-chrome.js +8 -0
  459. package/src/app/ui/editor-client/src/vendor/ace/theme-tomorrow.js +8 -0
  460. package/src/app/ui/editor-client/src/vendor/ace/worker-css.js +1 -0
  461. package/src/app/ui/editor-client/src/vendor/ace/worker-html.js +1 -0
  462. package/src/app/ui/editor-client/src/vendor/ace/worker-javascript.js +1 -0
  463. package/src/app/ui/editor-client/src/vendor/ace/worker-json.js +1 -0
  464. package/src/app/ui/editor-client/src/vendor/ace/worker-xml.js +1 -0
  465. package/src/app/ui/editor-client/src/vendor/beautifyjs/beautify.min.js +1 -0
  466. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.css +5406 -0
  467. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.min.css +9 -0
  468. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  469. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  470. package/src/app/ui/editor-client/src/vendor/bootstrap/js/bootstrap.min.js +6 -0
  471. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/active-line.js +72 -0
  472. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  473. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-hint.js +157 -0
  474. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-lint.js +63 -0
  475. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/jshint.js +29591 -0
  476. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.css +73 -0
  477. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.js +252 -0
  478. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.css +36 -0
  479. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.js +460 -0
  480. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/sql-hint.js +304 -0
  481. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.css +350 -0
  482. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.js +9800 -0
  483. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/javascript.js +927 -0
  484. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/sql.js +494 -0
  485. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/base16-dark.css +38 -0
  486. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/monokai.css +42 -0
  487. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/solarized.css +168 -0
  488. package/src/app/ui/editor-client/src/vendor/d3/d3.v3.min.js +4 -0
  489. package/src/app/ui/editor-client/src/vendor/d3/d3.v4.min.js +2 -0
  490. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.css +43 -0
  491. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.js +87 -0
  492. package/src/app/ui/editor-client/src/vendor/easy-json-schema/index.js +88 -0
  493. package/src/app/ui/editor-client/src/vendor/font-awesome/css/font-awesome.min.css +4 -0
  494. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  495. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  496. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  497. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  498. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  499. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  500. package/src/app/ui/editor-client/src/vendor/i18next/i18next.min.js +5 -0
  501. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.eot +0 -0
  502. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.svg +2105 -0
  503. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.ttf +0 -0
  504. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff +0 -0
  505. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff2 +0 -0
  506. package/src/app/ui/editor-client/src/vendor/icofont/icofont.min.css +7 -0
  507. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  508. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  509. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  510. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  511. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  512. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  513. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  514. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  515. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  516. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  517. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  518. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  519. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  520. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  521. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  522. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js +5 -0
  523. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js +7 -0
  524. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js +11 -0
  525. package/src/app/ui/editor-client/src/vendor/jsonata/formatter.js +183 -0
  526. package/src/app/ui/editor-client/src/vendor/jsonata/mode-jsonata.js +134 -0
  527. package/src/app/ui/editor-client/src/vendor/jsonata/snippets-jsonata.js +11 -0
  528. package/src/app/ui/editor-client/src/vendor/jsonata/worker-jsonata.js +2140 -0
  529. package/src/app/ui/editor-client/src/vendor/marked/marked.min.js +6 -0
  530. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.css +181 -0
  531. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.js +48 -0
  532. package/src/app/ui/editor-client/templates/index.mst +314 -0
  533. package/src/app/ui/editor-client/templates/modals/modalHome.mst +107 -0
  534. package/src/app/ui/editor-client/templates/modals/modalNewProject.mst +104 -0
  535. package/src/app/ui/editor-client/templates/modals/modalNodeLibrary.mst +72 -0
  536. package/src/app/ui/editor-client/templates/modals/modalWelcome.mst +111 -0
  537. package/src/assets/eula.txt +170 -0
  538. package/src/assets/icon.icns +0 -0
  539. package/src/assets/kumologica-app.png +0 -0
  540. package/src/assets/license_en.txt +170 -0
@@ -0,0 +1,1287 @@
1
+ RED.utils = (function () {
2
+ function formatString(str) {
3
+ return str.replace(/\r?\n/g, '↵').replace(/\t/g, '→');
4
+ }
5
+ function sanitize(m) {
6
+ return m.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
7
+ }
8
+
9
+ function buildMessageSummaryValue(value) {
10
+ var result;
11
+ if (Array.isArray(value)) {
12
+ result = $(
13
+ '<span class="debug-message-object-value debug-message-type-meta"></span>'
14
+ ).text('array[' + value.length + ']');
15
+ } else if (value === null) {
16
+ result = $(
17
+ '<span class="debug-message-object-value debug-message-type-null">null</span>'
18
+ );
19
+ } else if (typeof value === 'object') {
20
+ if (
21
+ value.hasOwnProperty('type') &&
22
+ value.type === 'Buffer' &&
23
+ value.hasOwnProperty('data')
24
+ ) {
25
+ result = $(
26
+ '<span class="debug-message-object-value debug-message-type-meta"></span>'
27
+ ).text('buffer[' + value.length + ']');
28
+ } else if (
29
+ value.hasOwnProperty('type') &&
30
+ value.type === 'array' &&
31
+ value.hasOwnProperty('data')
32
+ ) {
33
+ result = $(
34
+ '<span class="debug-message-object-value debug-message-type-meta"></span>'
35
+ ).text('array[' + value.length + ']');
36
+ } else if (value.hasOwnProperty('type') && value.type === 'function') {
37
+ result = $(
38
+ '<span class="debug-message-object-value debug-message-type-meta"></span>'
39
+ ).text('function');
40
+ } else if (value.hasOwnProperty('type') && value.type === 'number') {
41
+ result = $(
42
+ '<span class="debug-message-object-value debug-message-type-number"></span>'
43
+ ).text(value.data);
44
+ } else {
45
+ result = $(
46
+ '<span class="debug-message-object-value debug-message-type-meta">object</span>'
47
+ );
48
+ }
49
+ } else if (typeof value === 'string') {
50
+ var subvalue;
51
+ if (value.length > 30) {
52
+ subvalue = sanitize(value.substring(0, 30)) + '&hellip;';
53
+ } else {
54
+ subvalue = sanitize(value);
55
+ }
56
+ result = $(
57
+ '<span class="debug-message-object-value debug-message-type-string"></span>'
58
+ ).html('"' + formatString(subvalue) + '"');
59
+ } else if (typeof value === 'number') {
60
+ result = $(
61
+ '<span class="debug-message-object-value debug-message-type-number"></span>'
62
+ ).text('' + value);
63
+ } else {
64
+ result = $(
65
+ '<span class="debug-message-object-value debug-message-type-other"></span>'
66
+ ).text('' + value);
67
+ }
68
+ return result;
69
+ }
70
+ function makeExpandable(el, onbuild, ontoggle, expand) {
71
+ el.addClass('debug-message-expandable');
72
+ el.prop('toggle', function () {
73
+ return function (state) {
74
+ var parent = el.parent();
75
+ if (parent.hasClass('collapsed')) {
76
+ if (state) {
77
+ if (onbuild && !parent.hasClass('built')) {
78
+ onbuild();
79
+ parent.addClass('built');
80
+ }
81
+ parent.removeClass('collapsed');
82
+ return true;
83
+ }
84
+ } else {
85
+ if (!state) {
86
+ parent.addClass('collapsed');
87
+ return true;
88
+ }
89
+ }
90
+ return false;
91
+ };
92
+ });
93
+ el.click(function (e) {
94
+ var parent = $(this).parent();
95
+ var currentState = !parent.hasClass('collapsed');
96
+ if ($(this).prop('toggle')(!currentState)) {
97
+ if (ontoggle) {
98
+ ontoggle(!currentState);
99
+ }
100
+ }
101
+ // if (parent.hasClass('collapsed')) {
102
+ // if (onbuild && !parent.hasClass('built')) {
103
+ // onbuild();
104
+ // parent.addClass('built');
105
+ // }
106
+ // if (ontoggle) {
107
+ // ontoggle(true);
108
+ // }
109
+ // parent.removeClass('collapsed');
110
+ // } else {
111
+ // parent.addClass('collapsed');
112
+ // if (ontoggle) {
113
+ // ontoggle(false);
114
+ // }
115
+ // }
116
+ e.preventDefault();
117
+ });
118
+ if (expand) {
119
+ el.click();
120
+ }
121
+ }
122
+
123
+ var pinnedPaths = {};
124
+ var formattedPaths = {};
125
+
126
+ function addMessageControls(
127
+ obj,
128
+ sourceId,
129
+ key,
130
+ msg,
131
+ rootPath,
132
+ strippedKey,
133
+ extraTools
134
+ ) {
135
+ if (!pinnedPaths.hasOwnProperty(sourceId)) {
136
+ pinnedPaths[sourceId] = {};
137
+ }
138
+ var tools = $('<span class="debug-message-tools"></span>').appendTo(obj);
139
+ var copyTools = $(
140
+ '<span class="debug-message-tools-copy button-group"></span>'
141
+ ).appendTo(tools);
142
+ if (!!key) {
143
+ var copyPath = $(
144
+ '<button class="editor-button editor-button-small"><i class="fa fa-terminal"></i></button>'
145
+ )
146
+ .appendTo(copyTools)
147
+ .click(function (e) {
148
+ e.preventDefault();
149
+ e.stopPropagation();
150
+ RED.clipboard.copyText(key, copyPath, 'Path copied to clipboard');
151
+ });
152
+ }
153
+ var copyPayload = $(
154
+ '<button class="editor-button editor-button-small"><i class="fa fa-clipboard"></i></button>'
155
+ )
156
+ .appendTo(copyTools)
157
+ .click(function (e) {
158
+ e.preventDefault();
159
+ e.stopPropagation();
160
+ RED.clipboard.copyText(msg, copyPayload, 'Message copied to clipboard');
161
+ });
162
+ if (strippedKey !== undefined && strippedKey !== '') {
163
+ var isPinned = pinnedPaths[sourceId].hasOwnProperty(strippedKey);
164
+
165
+ var pinPath = $(
166
+ '<button class="editor-button editor-button-small debug-message-tools-pin"><i class="fa fa-map-pin"></i></button>'
167
+ )
168
+ .appendTo(tools)
169
+ .click(function (e) {
170
+ e.preventDefault();
171
+ e.stopPropagation();
172
+ if (pinnedPaths[sourceId].hasOwnProperty(strippedKey)) {
173
+ delete pinnedPaths[sourceId][strippedKey];
174
+ $(this).removeClass('selected');
175
+ obj.removeClass('debug-message-row-pinned');
176
+ } else {
177
+ var rootedPath =
178
+ '$' + (strippedKey[0] === '[' ? '' : '.') + strippedKey;
179
+ pinnedPaths[sourceId][strippedKey] = normalisePropertyExpression(
180
+ rootedPath
181
+ );
182
+ $(this).addClass('selected');
183
+ obj.addClass('debug-message-row-pinned');
184
+ }
185
+ })
186
+ .toggleClass('selected', isPinned);
187
+ obj.toggleClass('debug-message-row-pinned', isPinned);
188
+ }
189
+ if (extraTools) {
190
+ extraTools.addClass('debug-message-tools-other');
191
+ extraTools.appendTo(tools);
192
+ }
193
+ }
194
+ function checkExpanded(strippedKey, expandPaths, minRange, maxRange) {
195
+ if (expandPaths && expandPaths.length > 0) {
196
+ if (strippedKey === '' && minRange === undefined) {
197
+ return true;
198
+ }
199
+ for (var i = 0; i < expandPaths.length; i++) {
200
+ var p = expandPaths[i];
201
+ if (
202
+ p.indexOf(strippedKey) === 0 &&
203
+ (p[strippedKey.length] === '.' || p[strippedKey.length] === '[')
204
+ ) {
205
+ if (minRange !== undefined && p[strippedKey.length] === '[') {
206
+ var subkey = p.substring(strippedKey.length);
207
+ var m = /\[(\d+)\]/.exec(subkey);
208
+ if (m) {
209
+ var index = parseInt(m[1]);
210
+ return minRange <= index && index <= maxRange;
211
+ }
212
+ } else {
213
+ return true;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ return false;
219
+ }
220
+
221
+ function formatNumber(element, obj, sourceId, path, cycle, initialFormat) {
222
+ var format =
223
+ (formattedPaths[sourceId] &&
224
+ formattedPaths[sourceId][path] &&
225
+ formattedPaths[sourceId][path]['number']) ||
226
+ initialFormat ||
227
+ 'dec';
228
+ if (cycle) {
229
+ if (format === 'dec') {
230
+ if (obj.toString().length === 13 && obj <= 2147483647000) {
231
+ format = 'dateMS';
232
+ } else if (obj.toString().length === 10 && obj <= 2147483647) {
233
+ format = 'dateS';
234
+ } else {
235
+ format = 'hex';
236
+ }
237
+ } else if (format === 'dateMS' || format == 'dateS') {
238
+ if (obj.toString().length === 13 && obj <= 2147483647000) {
239
+ format = 'dateML';
240
+ } else if (obj.toString().length === 10 && obj <= 2147483647) {
241
+ format = 'dateL';
242
+ } else {
243
+ format = 'hex';
244
+ }
245
+ } else if (format === 'dateML' || format == 'dateL') {
246
+ format = 'hex';
247
+ } else {
248
+ format = 'dec';
249
+ }
250
+ formattedPaths[sourceId] = formattedPaths[sourceId] || {};
251
+ formattedPaths[sourceId][path] = formattedPaths[sourceId][path] || {};
252
+ formattedPaths[sourceId][path]['number'] = format;
253
+ } else if (initialFormat !== undefined) {
254
+ formattedPaths[sourceId] = formattedPaths[sourceId] || {};
255
+ formattedPaths[sourceId][path] = formattedPaths[sourceId][path] || {};
256
+ formattedPaths[sourceId][path]['number'] = format;
257
+ }
258
+ if (format === 'dec') {
259
+ element.text('' + obj);
260
+ } else if (format === 'dateMS') {
261
+ element.text(new Date(obj).toISOString());
262
+ } else if (format === 'dateS') {
263
+ element.text(new Date(obj * 1000).toISOString());
264
+ } else if (format === 'dateML') {
265
+ var dd = new Date(obj);
266
+ element.text(
267
+ dd.toLocaleString() +
268
+ ' [UTC' +
269
+ (dd.getTimezoneOffset() / -60 <= 0 ? '' : '+') +
270
+ dd.getTimezoneOffset() / -60 +
271
+ ']'
272
+ );
273
+ } else if (format === 'dateL') {
274
+ var ddl = new Date(obj * 1000);
275
+ element.text(
276
+ ddl.toLocaleString() +
277
+ ' [UTC' +
278
+ (ddl.getTimezoneOffset() / -60 <= 0 ? '' : '+') +
279
+ ddl.getTimezoneOffset() / -60 +
280
+ ']'
281
+ );
282
+ } else if (format === 'hex') {
283
+ element.text('0x' + obj.toString(16));
284
+ }
285
+ }
286
+
287
+ function formatBuffer(element, button, sourceId, path, cycle) {
288
+ var format =
289
+ (formattedPaths[sourceId] &&
290
+ formattedPaths[sourceId][path] &&
291
+ formattedPaths[sourceId][path]['buffer']) ||
292
+ 'raw';
293
+ if (cycle) {
294
+ if (format === 'raw') {
295
+ format = 'string';
296
+ } else {
297
+ format = 'raw';
298
+ }
299
+ formattedPaths[sourceId] = formattedPaths[sourceId] || {};
300
+ formattedPaths[sourceId][path] = formattedPaths[sourceId][path] || {};
301
+ formattedPaths[sourceId][path]['buffer'] = format;
302
+ }
303
+ if (format === 'raw') {
304
+ button.text('raw');
305
+ element
306
+ .removeClass('debug-message-buffer-string')
307
+ .addClass('debug-message-buffer-raw');
308
+ } else if (format === 'string') {
309
+ button.text('string');
310
+ element
311
+ .addClass('debug-message-buffer-string')
312
+ .removeClass('debug-message-buffer-raw');
313
+ }
314
+ }
315
+
316
+ function buildMessageElement(obj, options) {
317
+ options = options || {};
318
+ var key = options.key;
319
+ var typeHint = options.typeHint;
320
+ var hideKey = options.hideKey;
321
+ var path = options.path;
322
+ var sourceId = options.sourceId;
323
+ var rootPath = options.rootPath;
324
+ var expandPaths = options.expandPaths;
325
+ var ontoggle = options.ontoggle;
326
+ var exposeApi = options.exposeApi;
327
+ var tools = options.tools;
328
+
329
+ var subElements = {};
330
+ var i;
331
+ var e;
332
+ var entryObj;
333
+ var expandableHeader;
334
+ var header;
335
+ var headerHead;
336
+ var value;
337
+ var strippedKey;
338
+ if (path !== undefined && rootPath !== undefined) {
339
+ strippedKey = path.substring(
340
+ rootPath.length + (path[rootPath.length] === '.' ? 1 : 0)
341
+ );
342
+ }
343
+ var element = $('<span class="debug-message-element"></span>');
344
+ element.collapse = function () {
345
+ element.find('.debug-message-expandable').parent().addClass('collapsed');
346
+ };
347
+ header = $('<span class="debug-message-row"></span>').appendTo(element);
348
+ if (sourceId) {
349
+ addMessageControls(
350
+ header,
351
+ sourceId,
352
+ path,
353
+ obj,
354
+ rootPath,
355
+ strippedKey,
356
+ tools
357
+ );
358
+ }
359
+ if (!key) {
360
+ element.addClass('debug-message-top-level');
361
+ if (sourceId) {
362
+ var pinned = pinnedPaths[sourceId];
363
+ expandPaths = [];
364
+ if (pinned) {
365
+ for (var pinnedPath in pinned) {
366
+ if (pinned.hasOwnProperty(pinnedPath)) {
367
+ try {
368
+ var res = getMessageProperty({ $: obj }, pinned[pinnedPath]);
369
+ if (res !== undefined) {
370
+ expandPaths.push(pinnedPath);
371
+ }
372
+ } catch (err) {}
373
+ }
374
+ }
375
+ expandPaths.sort();
376
+ }
377
+ element.clearPinned = function () {
378
+ element
379
+ .find('.debug-message-row-pinned')
380
+ .removeClass('debug-message-row-pinned');
381
+ pinnedPaths[sourceId] = {};
382
+ };
383
+ }
384
+ } else {
385
+ if (!hideKey) {
386
+ $('<span class="debug-message-object-key"></span>')
387
+ .text(key)
388
+ .appendTo(header);
389
+ $('<span>: </span>').appendTo(header);
390
+ }
391
+ }
392
+ entryObj = $('<span class="debug-message-object-value"></span>').appendTo(
393
+ header
394
+ );
395
+
396
+ var isArray = Array.isArray(obj);
397
+ var isArrayObject = false;
398
+ if (
399
+ obj &&
400
+ typeof obj === 'object' &&
401
+ obj.hasOwnProperty('type') &&
402
+ obj.hasOwnProperty('data') &&
403
+ ((obj.__enc__ && obj.type === 'array') || obj.type === 'Buffer')
404
+ ) {
405
+ isArray = true;
406
+ isArrayObject = true;
407
+ }
408
+ if (obj === null || obj === undefined) {
409
+ $('<span class="debug-message-type-null">' + obj + '</span>').appendTo(
410
+ entryObj
411
+ );
412
+ } else if (obj.__enc__ && obj.type === 'number') {
413
+ e = $(
414
+ '<span class="debug-message-type-number debug-message-object-header"></span>'
415
+ )
416
+ .text(obj.data)
417
+ .appendTo(entryObj);
418
+ } else if (
419
+ typeHint === 'function' ||
420
+ (obj.__enc__ && obj.type === 'function')
421
+ ) {
422
+ e = $(
423
+ '<span class="debug-message-type-meta debug-message-object-header"></span>'
424
+ )
425
+ .text('function')
426
+ .appendTo(entryObj);
427
+ } else if (
428
+ typeHint === 'internal' ||
429
+ (obj.__enc__ && obj.type === 'internal')
430
+ ) {
431
+ e = $(
432
+ '<span class="debug-message-type-meta debug-message-object-header"></span>'
433
+ )
434
+ .text('[internal]')
435
+ .appendTo(entryObj);
436
+ } else if (typeof obj === 'string') {
437
+ if (/[\t\n\r]/.test(obj)) {
438
+ element.addClass('collapsed');
439
+ $(
440
+ '<i class="fa fa-caret-right debug-message-object-handle"></i> '
441
+ ).prependTo(header);
442
+ makeExpandable(
443
+ header,
444
+ function () {
445
+ $(
446
+ '<span class="debug-message-type-meta debug-message-object-type-header"></span>'
447
+ )
448
+ .text(typeHint || 'string')
449
+ .appendTo(header);
450
+ var row = $(
451
+ '<div class="debug-message-object-entry collapsed"></div>'
452
+ ).appendTo(element);
453
+ $('<pre class="debug-message-type-string"></pre>')
454
+ .text(obj)
455
+ .appendTo(row);
456
+ },
457
+ function (state) {
458
+ if (ontoggle) {
459
+ ontoggle(path, state);
460
+ }
461
+ },
462
+ checkExpanded(strippedKey, expandPaths)
463
+ );
464
+ }
465
+ e = $(
466
+ '<span class="debug-message-type-string debug-message-object-header"></span>'
467
+ )
468
+ .html('"' + formatString(sanitize(obj)) + '"')
469
+ .appendTo(entryObj);
470
+ if (/^#[0-9a-f]{6}$/i.test(obj)) {
471
+ $('<span class="debug-message-type-string-swatch"></span>')
472
+ .css('backgroundColor', obj)
473
+ .appendTo(e);
474
+ }
475
+ } else if (typeof obj === 'number') {
476
+ e = $('<span class="debug-message-type-number"></span>').appendTo(
477
+ entryObj
478
+ );
479
+
480
+ if (Number.isInteger(obj) && obj >= 0) {
481
+ // if it's a +ve integer
482
+ e.addClass('debug-message-type-number-toggle');
483
+ e.click(function (evt) {
484
+ evt.preventDefault();
485
+ formatNumber($(this), obj, sourceId, path, true);
486
+ });
487
+ }
488
+ formatNumber(
489
+ e,
490
+ obj,
491
+ sourceId,
492
+ path,
493
+ false,
494
+ typeHint === 'hex' ? 'hex' : undefined
495
+ );
496
+ } else if (isArray) {
497
+ element.addClass('collapsed');
498
+
499
+ var originalLength = obj.length;
500
+ if (typeHint) {
501
+ var m = /\[(\d+)\]/.exec(typeHint);
502
+ if (m) {
503
+ originalLength = parseInt(m[1]);
504
+ }
505
+ }
506
+ var data = obj;
507
+ var type = 'array';
508
+ if (isArrayObject) {
509
+ data = obj.data;
510
+ if (originalLength === undefined) {
511
+ originalLength = data.length;
512
+ }
513
+ if (data.__enc__) {
514
+ data = data.data;
515
+ }
516
+ type = obj.type.toLowerCase();
517
+ } else if (/buffer/.test(typeHint)) {
518
+ type = 'buffer';
519
+ }
520
+ var fullLength = data.length;
521
+
522
+ if (originalLength > 0) {
523
+ $(
524
+ '<i class="fa fa-caret-right debug-message-object-handle"></i> '
525
+ ).prependTo(header);
526
+ var arrayRows = $(
527
+ '<div class="debug-message-array-rows"></div>'
528
+ ).appendTo(element);
529
+ element.addClass('debug-message-buffer-raw');
530
+ }
531
+ if (key) {
532
+ headerHead = $('<span class="debug-message-type-meta"></span>')
533
+ .text(typeHint || type + '[' + originalLength + ']')
534
+ .appendTo(entryObj);
535
+ } else {
536
+ headerHead = $(
537
+ '<span class="debug-message-object-header"></span>'
538
+ ).appendTo(entryObj);
539
+ $('<span>[ </span>').appendTo(headerHead);
540
+ var arrayLength = Math.min(originalLength, 10);
541
+ for (i = 0; i < arrayLength; i++) {
542
+ buildMessageSummaryValue(data[i]).appendTo(headerHead);
543
+ if (i < arrayLength - 1) {
544
+ $('<span>, </span>').appendTo(headerHead);
545
+ }
546
+ }
547
+ if (originalLength > arrayLength) {
548
+ $('<span> &hellip;</span>').appendTo(headerHead);
549
+ }
550
+ if (arrayLength === 0) {
551
+ $('<span class="debug-message-type-meta">empty</span>').appendTo(
552
+ headerHead
553
+ );
554
+ }
555
+ $('<span> ]</span>').appendTo(headerHead);
556
+ }
557
+ if (originalLength > 0) {
558
+ makeExpandable(
559
+ header,
560
+ function () {
561
+ if (!key) {
562
+ headerHead = $(
563
+ '<span class="debug-message-type-meta debug-message-object-type-header"></span>'
564
+ )
565
+ .text(typeHint || type + '[' + originalLength + ']')
566
+ .appendTo(header);
567
+ }
568
+ if (type === 'buffer') {
569
+ var stringRow = $(
570
+ '<div class="debug-message-string-rows"></div>'
571
+ ).appendTo(element);
572
+ var sr = $(
573
+ '<div class="debug-message-object-entry collapsed"></div>'
574
+ ).appendTo(stringRow);
575
+ var stringEncoding = '';
576
+ try {
577
+ stringEncoding = String.fromCharCode.apply(
578
+ null,
579
+ new Uint16Array(data)
580
+ );
581
+ } catch (err) {
582
+ console.log(err);
583
+ }
584
+ $('<pre class="debug-message-type-string"></pre>')
585
+ .text(stringEncoding)
586
+ .appendTo(sr);
587
+ var bufferOpts = $(
588
+ '<span class="debug-message-buffer-opts"></span>'
589
+ ).appendTo(headerHead);
590
+ var switchFormat = $('<a href="#"></a>')
591
+ .addClass('selected')
592
+ .text('raw')
593
+ .appendTo(bufferOpts)
594
+ .click(function (e) {
595
+ e.preventDefault();
596
+ e.stopPropagation();
597
+ formatBuffer(element, $(this), sourceId, path, true);
598
+ });
599
+ formatBuffer(element, switchFormat, sourceId, path, false);
600
+ }
601
+ var row;
602
+ if (fullLength <= 10) {
603
+ for (i = 0; i < fullLength; i++) {
604
+ row = $(
605
+ '<div class="debug-message-object-entry collapsed"></div>'
606
+ ).appendTo(arrayRows);
607
+ subElements[path + '[' + i + ']'] = buildMessageElement(
608
+ data[i],
609
+ {
610
+ key: '' + i,
611
+ typeHint: type === 'buffer' ? 'hex' : false,
612
+ hideKey: false,
613
+ path: path + '[' + i + ']',
614
+ sourceId: sourceId,
615
+ rootPath: rootPath,
616
+ expandPaths: expandPaths,
617
+ ontoggle: ontoggle,
618
+ exposeApi: exposeApi,
619
+ }
620
+ ).appendTo(row);
621
+ }
622
+ } else {
623
+ for (i = 0; i < fullLength; i += 10) {
624
+ var minRange = i;
625
+ row = $(
626
+ '<div class="debug-message-object-entry collapsed"></div>'
627
+ ).appendTo(arrayRows);
628
+ header = $('<span></span>').appendTo(row);
629
+ $(
630
+ '<i class="fa fa-caret-right debug-message-object-handle"></i> '
631
+ ).appendTo(header);
632
+ makeExpandable(
633
+ header,
634
+ (function () {
635
+ var min = minRange;
636
+ var max = Math.min(fullLength - 1, minRange + 9);
637
+ var parent = row;
638
+ return function () {
639
+ for (var i = min; i <= max; i++) {
640
+ var row = $(
641
+ '<div class="debug-message-object-entry collapsed"></div>'
642
+ ).appendTo(parent);
643
+ subElements[path + '[' + i + ']'] = buildMessageElement(
644
+ data[i],
645
+ {
646
+ key: '' + i,
647
+ typeHint: type === 'buffer' ? 'hex' : false,
648
+ hideKey: false,
649
+ path: path + '[' + i + ']',
650
+ sourceId: sourceId,
651
+ rootPath: rootPath,
652
+ expandPaths: expandPaths,
653
+ ontoggle: ontoggle,
654
+ exposeApi: exposeApi,
655
+ }
656
+ ).appendTo(row);
657
+ }
658
+ };
659
+ })(),
660
+ (function () {
661
+ var path = path + '[' + i + ']';
662
+ return function (state) {
663
+ if (ontoggle) {
664
+ ontoggle(path, state);
665
+ }
666
+ };
667
+ })(),
668
+ checkExpanded(
669
+ strippedKey,
670
+ expandPaths,
671
+ minRange,
672
+ Math.min(fullLength - 1, minRange + 9)
673
+ )
674
+ );
675
+ $('<span class="debug-message-object-key"></span>')
676
+ .html(
677
+ '[' +
678
+ minRange +
679
+ ' &hellip; ' +
680
+ Math.min(fullLength - 1, minRange + 9) +
681
+ ']'
682
+ )
683
+ .appendTo(header);
684
+ }
685
+ if (fullLength < originalLength) {
686
+ $(
687
+ '<div class="debug-message-object-entry collapsed"><span class="debug-message-object-key">[' +
688
+ fullLength +
689
+ ' &hellip; ' +
690
+ originalLength +
691
+ ']</span></div>'
692
+ ).appendTo(arrayRows);
693
+ }
694
+ }
695
+ },
696
+ function (state) {
697
+ if (ontoggle) {
698
+ ontoggle(path, state);
699
+ }
700
+ },
701
+ checkExpanded(strippedKey, expandPaths)
702
+ );
703
+ }
704
+ } else if (typeof obj === 'object') {
705
+ element.addClass('collapsed');
706
+ var keys = Object.keys(obj);
707
+ if (key || keys.length > 0) {
708
+ $(
709
+ '<i class="fa fa-caret-right debug-message-object-handle"></i> '
710
+ ).prependTo(header);
711
+ makeExpandable(
712
+ header,
713
+ function () {
714
+ if (!key) {
715
+ $(
716
+ '<span class="debug-message-type-meta debug-message-object-type-header"></span>'
717
+ )
718
+ .text('object')
719
+ .appendTo(header);
720
+ }
721
+ for (i = 0; i < keys.length; i++) {
722
+ var row = $(
723
+ '<div class="debug-message-object-entry collapsed"></div>'
724
+ ).appendTo(element);
725
+ var newPath = path;
726
+ if (newPath !== undefined) {
727
+ if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) {
728
+ newPath += (newPath.length > 0 ? '.' : '') + keys[i];
729
+ } else {
730
+ newPath += '["' + keys[i].replace(/"/, '\\"') + '"]';
731
+ }
732
+ }
733
+ subElements[newPath] = buildMessageElement(obj[keys[i]], {
734
+ key: keys[i],
735
+ typeHint: false,
736
+ hideKey: false,
737
+ path: newPath,
738
+ sourceId: sourceId,
739
+ rootPath: rootPath,
740
+ expandPaths: expandPaths,
741
+ ontoggle: ontoggle,
742
+ exposeApi: exposeApi,
743
+ }).appendTo(row);
744
+ }
745
+ if (keys.length === 0) {
746
+ $(
747
+ '<div class="debug-message-object-entry debug-message-type-meta collapsed"></div>'
748
+ )
749
+ .text('empty')
750
+ .appendTo(element);
751
+ }
752
+ },
753
+ function (state) {
754
+ if (ontoggle) {
755
+ ontoggle(path, state);
756
+ }
757
+ },
758
+ checkExpanded(strippedKey, expandPaths)
759
+ );
760
+ }
761
+ if (key) {
762
+ $('<span class="debug-message-type-meta"></span>')
763
+ .text('object')
764
+ .appendTo(entryObj);
765
+ } else {
766
+ headerHead = $(
767
+ '<span class="debug-message-object-header"></span>'
768
+ ).appendTo(entryObj);
769
+ $('<span>{ </span>').appendTo(headerHead);
770
+ var keysLength = Math.min(keys.length, 5);
771
+ for (i = 0; i < keysLength; i++) {
772
+ $('<span class="debug-message-object-key"></span>')
773
+ .text(keys[i])
774
+ .appendTo(headerHead);
775
+ $('<span>: </span>').appendTo(headerHead);
776
+ buildMessageSummaryValue(obj[keys[i]]).appendTo(headerHead);
777
+ if (i < keysLength - 1) {
778
+ $('<span>, </span>').appendTo(headerHead);
779
+ }
780
+ }
781
+ if (keys.length > keysLength) {
782
+ $('<span> &hellip;</span>').appendTo(headerHead);
783
+ }
784
+ if (keysLength === 0) {
785
+ $('<span class="debug-message-type-meta">empty</span>').appendTo(
786
+ headerHead
787
+ );
788
+ }
789
+ $('<span> }</span>').appendTo(headerHead);
790
+ }
791
+ } else {
792
+ $('<span class="debug-message-type-other"></span>')
793
+ .text('' + obj)
794
+ .appendTo(entryObj);
795
+ }
796
+ if (exposeApi) {
797
+ element.prop('expand', function () {
798
+ return function (targetPath, state) {
799
+ if (path === targetPath) {
800
+ if (header.prop('toggle')) {
801
+ header.prop('toggle')(state);
802
+ }
803
+ } else if (
804
+ subElements[targetPath] &&
805
+ subElements[targetPath].prop('expand')
806
+ ) {
807
+ subElements[targetPath].prop('expand')(targetPath, state);
808
+ } else {
809
+ for (var p in subElements) {
810
+ if (subElements.hasOwnProperty(p)) {
811
+ if (targetPath.indexOf(p) === 0) {
812
+ if (subElements[p].prop('expand')) {
813
+ subElements[p].prop('expand')(targetPath, state);
814
+ }
815
+ break;
816
+ }
817
+ }
818
+ }
819
+ }
820
+ };
821
+ });
822
+ }
823
+ return element;
824
+ }
825
+
826
+ function normalisePropertyExpression(str) {
827
+ // This must be kept in sync with validatePropertyExpression
828
+ // in editor/js/ui/utils.js
829
+
830
+ var length = str.length;
831
+ if (length === 0) {
832
+ throw new Error('Invalid property expression: zero-length');
833
+ }
834
+ var parts = [];
835
+ var start = 0;
836
+ var inString = false;
837
+ var inBox = false;
838
+ var quoteChar;
839
+ var v;
840
+ for (var i = 0; i < length; i++) {
841
+ var c = str[i];
842
+ if (!inString) {
843
+ if (c === "'" || c === '"') {
844
+ if (i != start) {
845
+ throw new Error(
846
+ 'Invalid property expression: unexpected ' +
847
+ c +
848
+ ' at position ' +
849
+ i
850
+ );
851
+ }
852
+ inString = true;
853
+ quoteChar = c;
854
+ start = i + 1;
855
+ } else if (c === '.') {
856
+ if (i === 0) {
857
+ throw new Error(
858
+ 'Invalid property expression: unexpected . at position 0'
859
+ );
860
+ }
861
+ if (start != i) {
862
+ v = str.substring(start, i);
863
+ if (/^\d+$/.test(v)) {
864
+ parts.push(parseInt(v));
865
+ } else {
866
+ parts.push(v);
867
+ }
868
+ }
869
+ if (i === length - 1) {
870
+ throw new Error(
871
+ 'Invalid property expression: unterminated expression'
872
+ );
873
+ }
874
+ // Next char is first char of an identifier: a-z 0-9 $ _
875
+ if (!/[a-z0-9\$\_]/i.test(str[i + 1])) {
876
+ throw new Error(
877
+ 'Invalid property expression: unexpected ' +
878
+ str[i + 1] +
879
+ ' at position ' +
880
+ (i + 1)
881
+ );
882
+ }
883
+ start = i + 1;
884
+ } else if (c === '[') {
885
+ if (i === 0) {
886
+ throw new Error(
887
+ 'Invalid property expression: unexpected ' +
888
+ c +
889
+ ' at position ' +
890
+ i
891
+ );
892
+ }
893
+ if (start != i) {
894
+ parts.push(str.substring(start, i));
895
+ }
896
+ if (i === length - 1) {
897
+ throw new Error(
898
+ 'Invalid property expression: unterminated expression'
899
+ );
900
+ }
901
+ // Next char is either a quote or a number
902
+ if (!/["'\d]/.test(str[i + 1])) {
903
+ throw new Error(
904
+ 'Invalid property expression: unexpected ' +
905
+ str[i + 1] +
906
+ ' at position ' +
907
+ (i + 1)
908
+ );
909
+ }
910
+ start = i + 1;
911
+ inBox = true;
912
+ } else if (c === ']') {
913
+ if (!inBox) {
914
+ throw new Error(
915
+ 'Invalid property expression: unexpected ' +
916
+ c +
917
+ ' at position ' +
918
+ i
919
+ );
920
+ }
921
+ if (start != i) {
922
+ v = str.substring(start, i);
923
+ if (/^\d+$/.test(v)) {
924
+ parts.push(parseInt(v));
925
+ } else {
926
+ throw new Error(
927
+ 'Invalid property expression: unexpected array expression at position ' +
928
+ start
929
+ );
930
+ }
931
+ }
932
+ start = i + 1;
933
+ inBox = false;
934
+ } else if (c === ' ') {
935
+ throw new Error(
936
+ "Invalid property expression: unexpected ' ' at position " + i
937
+ );
938
+ }
939
+ } else {
940
+ if (c === quoteChar) {
941
+ if (i - start === 0) {
942
+ throw new Error(
943
+ 'Invalid property expression: zero-length string at position ' +
944
+ start
945
+ );
946
+ }
947
+ parts.push(str.substring(start, i));
948
+ // If inBox, next char must be a ]. Otherwise it may be [ or .
949
+ if (inBox && !/\]/.test(str[i + 1])) {
950
+ throw new Error(
951
+ 'Invalid property expression: unexpected array expression at position ' +
952
+ start
953
+ );
954
+ } else if (!inBox && i + 1 !== length && !/[\[\.]/.test(str[i + 1])) {
955
+ throw new Error(
956
+ 'Invalid property expression: unexpected ' +
957
+ str[i + 1] +
958
+ ' expression at position ' +
959
+ (i + 1)
960
+ );
961
+ }
962
+ start = i + 1;
963
+ inString = false;
964
+ }
965
+ }
966
+ }
967
+ if (inBox || inString) {
968
+ throw new Error('Invalid property expression: unterminated expression');
969
+ }
970
+ if (start < length) {
971
+ parts.push(str.substring(start));
972
+ }
973
+ return parts;
974
+ }
975
+
976
+ function validatePropertyExpression(str) {
977
+ try {
978
+ var parts = normalisePropertyExpression(str);
979
+ return true;
980
+ } catch (err) {
981
+ return false;
982
+ }
983
+ }
984
+
985
+ function getMessageProperty(msg, expr) {
986
+ var result = null;
987
+ var msgPropParts;
988
+
989
+ if (typeof expr === 'string') {
990
+ if (expr.indexOf('msg.') === 0) {
991
+ expr = expr.substring(4);
992
+ }
993
+ msgPropParts = normalisePropertyExpression(expr);
994
+ } else {
995
+ msgPropParts = expr;
996
+ }
997
+ var m;
998
+ msgPropParts.reduce(function (obj, key) {
999
+ result = typeof obj[key] !== 'undefined' ? obj[key] : undefined;
1000
+ if (
1001
+ result === undefined &&
1002
+ obj.hasOwnProperty('type') &&
1003
+ obj.hasOwnProperty('data') &&
1004
+ obj.hasOwnProperty('length')
1005
+ ) {
1006
+ result =
1007
+ typeof obj.data[key] !== 'undefined' ? obj.data[key] : undefined;
1008
+ }
1009
+ return result;
1010
+ }, msg);
1011
+ return result;
1012
+ }
1013
+
1014
+ function separateIconPath(icon) {
1015
+ var result = { module: '', file: '' };
1016
+ if (icon) {
1017
+ var index = icon.indexOf('icons/');
1018
+ if (index !== -1) {
1019
+ icon = icon.substring(index + 6);
1020
+ }
1021
+ index = icon.indexOf('/');
1022
+ if (index !== -1) {
1023
+ result.module = icon.slice(0, index);
1024
+ result.file = icon.slice(index + 1);
1025
+ } else {
1026
+ result.file = icon;
1027
+ }
1028
+ }
1029
+ return result;
1030
+ }
1031
+
1032
+ function getDefaultNodeIcon(def, node) {
1033
+ var icon_url;
1034
+ if (node && node.type === 'subflow') {
1035
+ icon_url = 'kumologica-core/subflow.png';
1036
+ } else if (typeof def.icon === 'function') {
1037
+ try {
1038
+ icon_url = def.icon.call(node);
1039
+ } catch (err) {
1040
+ console.log('Definition error: ' + def.type + '.icon', err);
1041
+ icon_url = 'arrow-in.png';
1042
+ }
1043
+ } else {
1044
+ icon_url = def.icon;
1045
+ }
1046
+
1047
+ var iconPath = separateIconPath(icon_url);
1048
+ if (!iconPath.module) {
1049
+ if (def.set) {
1050
+ iconPath.module = def.set.module;
1051
+ } else {
1052
+ // Handle subflow instance nodes that don't have def.set
1053
+ iconPath.module = 'kumologica-core';
1054
+ }
1055
+ }
1056
+ return iconPath;
1057
+ }
1058
+
1059
+ function isIconExists(iconPath) {
1060
+ var iconSets = RED.nodes.getIconSets();
1061
+ var iconFileList = iconSets[iconPath.module];
1062
+ if (iconFileList && iconFileList.indexOf(iconPath.file) !== -1) {
1063
+ return true;
1064
+ } else {
1065
+ return false;
1066
+ }
1067
+ }
1068
+
1069
+ function getNodeIcon(def, node) {
1070
+ if (def.category === 'config') {
1071
+ return RED.settings.apiRootUrl + 'icons/kumologica-core/cog.png';
1072
+ } else if (node && node.type === 'tab') {
1073
+ return RED.settings.apiRootUrl + 'icons/kumologica-core/subflow.png';
1074
+ } else if (node && node.type === 'unknown') {
1075
+ return RED.settings.apiRootUrl + 'icons/kumologica-core/alert.png';
1076
+ } else if (node && node.icon) {
1077
+ var iconPath = separateIconPath(node.icon);
1078
+ if (isIconExists(iconPath)) {
1079
+ if (iconPath.module === 'font-awesome') {
1080
+ return node.icon;
1081
+ } else {
1082
+ return RED.settings.apiRootUrl + 'icons/' + node.icon;
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ var iconPath = getDefaultNodeIcon(def, node);
1088
+ if (isIconExists(iconPath)) {
1089
+ if (iconPath.module === 'font-awesome') {
1090
+ return iconPath.module + '/' + iconPath.file;
1091
+ } else {
1092
+ return (
1093
+ RED.settings.apiRootUrl +
1094
+ 'icons/' +
1095
+ iconPath.module +
1096
+ '/' +
1097
+ iconPath.file
1098
+ );
1099
+ }
1100
+ } else {
1101
+ // This could be a non-core node trying to use a core icon.
1102
+ iconPath.module = 'kumologica-core';
1103
+ if (isIconExists(iconPath)) {
1104
+ return (
1105
+ RED.settings.apiRootUrl +
1106
+ 'icons/' +
1107
+ iconPath.module +
1108
+ '/' +
1109
+ iconPath.file
1110
+ );
1111
+ } else if (def.category === 'subflows') {
1112
+ return RED.settings.apiRootUrl + 'icons/kumologica-core/subflow.png';
1113
+ } else {
1114
+ return RED.settings.apiRootUrl + 'icons/kumologica-core/arrow-in.png';
1115
+ }
1116
+ }
1117
+ }
1118
+
1119
+ function getNodeLabel(node, defaultLabel) {
1120
+ defaultLabel = defaultLabel || '';
1121
+ var l;
1122
+ if (node.type === 'tab') {
1123
+ l = node.label || defaultLabel;
1124
+ } else {
1125
+ l = node._def.label;
1126
+ try {
1127
+ l = (typeof l === 'function' ? l.call(node) : l) || defaultLabel;
1128
+ } catch (err) {
1129
+ console.log('Definition error: ' + node.type + '.label', err);
1130
+ l = defaultLabel;
1131
+ }
1132
+ }
1133
+ return RED.text.bidi.enforceTextDirectionWithUCC(l);
1134
+ }
1135
+
1136
+ var nodeColorCache = {};
1137
+ function getNodeColor(type, def) {
1138
+ var result = def.color;
1139
+ var paletteTheme = RED.settings.theme('palette.theme') || [];
1140
+ if (paletteTheme.length > 0) {
1141
+ if (!nodeColorCache.hasOwnProperty(type)) {
1142
+ nodeColorCache[type] = def.color;
1143
+ var l = paletteTheme.length;
1144
+ for (var i = 0; i < l; i++) {
1145
+ var themeRule = paletteTheme[i];
1146
+ if (themeRule.hasOwnProperty('category')) {
1147
+ if (!themeRule.hasOwnProperty('_category')) {
1148
+ themeRule._category = new RegExp(themeRule.category);
1149
+ }
1150
+ if (!themeRule._category.test(def.category)) {
1151
+ continue;
1152
+ }
1153
+ }
1154
+ if (themeRule.hasOwnProperty('type')) {
1155
+ if (!themeRule.hasOwnProperty('_type')) {
1156
+ themeRule._type = new RegExp(themeRule.type);
1157
+ }
1158
+ if (!themeRule._type.test(type)) {
1159
+ continue;
1160
+ }
1161
+ }
1162
+ nodeColorCache[type] = themeRule.color || def.color;
1163
+ break;
1164
+ }
1165
+ }
1166
+ result = nodeColorCache[type];
1167
+ }
1168
+ if (result) {
1169
+ return result;
1170
+ } else {
1171
+ return '#ddd';
1172
+ }
1173
+ }
1174
+
1175
+ function addSpinnerOverlay(container, contain) {
1176
+ var spinner = $(
1177
+ '<div class="projects-dialog-spinner "><img src="red/images/spin.svg"/></div>'
1178
+ ).appendTo(container);
1179
+ if (contain) {
1180
+ spinner.addClass('projects-dialog-spinner-contain');
1181
+ }
1182
+ return spinner;
1183
+ }
1184
+
1185
+ function decodeObject(payload, format) {
1186
+ if (format === 'number' && payload === 'NaN') {
1187
+ payload = Number.NaN;
1188
+ } else if (format === 'number' && payload === 'Infinity') {
1189
+ payload = Infinity;
1190
+ } else if (format === 'number' && payload === '-Infinity') {
1191
+ payload = -Infinity;
1192
+ } else if (
1193
+ format === 'Object' ||
1194
+ /^array/.test(format) ||
1195
+ format === 'boolean' ||
1196
+ format === 'number'
1197
+ ) {
1198
+ payload = JSON.parse(payload);
1199
+ } else if (/error/i.test(format)) {
1200
+ payload = JSON.parse(payload);
1201
+ payload = (payload.name ? payload.name + ': ' : '') + payload.message;
1202
+ } else if (format === 'null') {
1203
+ payload = null;
1204
+ } else if (format === 'undefined') {
1205
+ payload = undefined;
1206
+ } else if (/^buffer/.test(format)) {
1207
+ var buffer = payload;
1208
+ payload = [];
1209
+ for (var c = 0; c < buffer.length; c += 2) {
1210
+ payload.push(parseInt(buffer.substr(c, 2), 16));
1211
+ }
1212
+ }
1213
+ return payload;
1214
+ }
1215
+
1216
+ function parseContextKey(key) {
1217
+ var parts = {};
1218
+ var m = /^#:\((\S+?)\)::(.*)$/.exec(key);
1219
+ if (m) {
1220
+ parts.store = m[1];
1221
+ parts.key = m[2];
1222
+ } else {
1223
+ parts.key = key;
1224
+ if (RED.settings.context) {
1225
+ parts.store = RED.settings.context.default;
1226
+ }
1227
+ }
1228
+ return parts;
1229
+ }
1230
+
1231
+ /**
1232
+ * Create or update an icon element and append it to iconContainer.
1233
+ * @param iconUrl - Url of icon.
1234
+ * @param iconContainer - Icon container element with palette_icon_container class.
1235
+ * @param isLarge - Whether the icon size is large.
1236
+ */
1237
+ function createIconElement(iconUrl, iconContainer, isLarge) {
1238
+ // Removes the previous icon when icon was changed.
1239
+ var iconElement = iconContainer.find('.palette_icon');
1240
+ if (iconElement.length !== 0) {
1241
+ iconElement.remove();
1242
+ }
1243
+ var faIconElement = iconContainer.find('i');
1244
+ if (faIconElement.length !== 0) {
1245
+ faIconElement.remove();
1246
+ }
1247
+
1248
+ // Show either icon image or font-awesome icon
1249
+ var iconPath = separateIconPath(iconUrl);
1250
+ if (iconPath.module === 'font-awesome') {
1251
+ var fontAwesomeUnicode = RED.nodes.fontAwesome.getIconUnicode(
1252
+ iconPath.file
1253
+ );
1254
+ if (fontAwesomeUnicode) {
1255
+ var faIconElement = $('<i/>').appendTo(iconContainer);
1256
+ var faLarge = isLarge ? 'fa-lg ' : '';
1257
+ faIconElement.addClass(
1258
+ 'palette_icon_fa fa fa-fw ' + faLarge + iconPath.file
1259
+ );
1260
+ return;
1261
+ }
1262
+ // If the specified name is not defined in font-awesome, show arrow-in icon.
1263
+ iconUrl = RED.settings.apiRootUrl + 'icons/kumologica-core/arrow-in.png';
1264
+ }
1265
+ var imageIconElement = $('<div/>', { class: 'palette_icon' }).appendTo(
1266
+ iconContainer
1267
+ );
1268
+ imageIconElement.css('backgroundImage', 'url(' + iconUrl + ')');
1269
+ }
1270
+
1271
+ return {
1272
+ createObjectElement: buildMessageElement,
1273
+ getMessageProperty: getMessageProperty,
1274
+ normalisePropertyExpression: normalisePropertyExpression,
1275
+ validatePropertyExpression: validatePropertyExpression,
1276
+ separateIconPath: separateIconPath,
1277
+ getDefaultNodeIcon: getDefaultNodeIcon,
1278
+ getNodeIcon: getNodeIcon,
1279
+ getNodeLabel: getNodeLabel,
1280
+ getNodeColor: getNodeColor,
1281
+ addSpinnerOverlay: addSpinnerOverlay,
1282
+ decodeObject: decodeObject,
1283
+ parseContextKey: parseContextKey,
1284
+ createIconElement: createIconElement,
1285
+ sanitize: sanitize,
1286
+ };
1287
+ })();