@frangoteam/fuxa-min 1.1.19

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 (414) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -0
  3. package/_images/Pipes/P1.svg +39 -0
  4. package/_images/Tanks/Fl.svg +7 -0
  5. package/api/alarms/index.js +132 -0
  6. package/api/auth/index.js +71 -0
  7. package/api/command/index.js +187 -0
  8. package/api/daq/index.js +79 -0
  9. package/api/diagnose/index.js +163 -0
  10. package/api/index.js +181 -0
  11. package/api/jwt-helper.js +106 -0
  12. package/api/plugins/index.js +109 -0
  13. package/api/projects/index.js +229 -0
  14. package/api/resources/index.js +118 -0
  15. package/api/scripts/index.js +82 -0
  16. package/api/users/index.js +109 -0
  17. package/dist/3rdpartylicenses.txt +1477 -0
  18. package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
  19. package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
  20. package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
  21. package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
  22. package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
  23. package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
  24. package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
  25. package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
  26. package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
  27. package/dist/assets/fonts/icomoon.eot +0 -0
  28. package/dist/assets/fonts/icomoon.svg +19 -0
  29. package/dist/assets/fonts/icomoon.ttf +0 -0
  30. package/dist/assets/fonts/icomoon.woff +0 -0
  31. package/dist/assets/fonts/myicons.eot +0 -0
  32. package/dist/assets/fonts/myicons.svg +19 -0
  33. package/dist/assets/fonts/myicons.ttf +0 -0
  34. package/dist/assets/fonts/myicons.woff +0 -0
  35. package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
  36. package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
  37. package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
  38. package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
  39. package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
  40. package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
  41. package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
  42. package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
  43. package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
  44. package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
  45. package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
  46. package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
  47. package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
  48. package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
  49. package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
  50. package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
  51. package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
  52. package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
  53. package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
  54. package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
  55. package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
  56. package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
  57. package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
  58. package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
  59. package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
  60. package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
  61. package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
  62. package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
  63. package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
  64. package/dist/assets/i18n/de.json +1308 -0
  65. package/dist/assets/i18n/en.json +1438 -0
  66. package/dist/assets/i18n/es.json +777 -0
  67. package/dist/assets/i18n/fr.json +1129 -0
  68. package/dist/assets/i18n/ko.json +774 -0
  69. package/dist/assets/i18n/pt.json +657 -0
  70. package/dist/assets/i18n/ru.json +1228 -0
  71. package/dist/assets/i18n/tr.json +673 -0
  72. package/dist/assets/i18n/ua.json +614 -0
  73. package/dist/assets/i18n/zh-cn.json +1252 -0
  74. package/dist/assets/images/align-bottom.svg +88 -0
  75. package/dist/assets/images/align-center.svg +86 -0
  76. package/dist/assets/images/align-left.svg +86 -0
  77. package/dist/assets/images/align-middle.svg +88 -0
  78. package/dist/assets/images/align-right.svg +88 -0
  79. package/dist/assets/images/align-top.svg +88 -0
  80. package/dist/assets/images/bag.svg +115 -0
  81. package/dist/assets/images/button.svg +22 -0
  82. package/dist/assets/images/chart.svg +17 -0
  83. package/dist/assets/images/circle.svg +84 -0
  84. package/dist/assets/images/compressor-a.svg +2 -0
  85. package/dist/assets/images/editvalue.svg +14 -0
  86. package/dist/assets/images/ellipse.svg +84 -0
  87. package/dist/assets/images/flip-orizontal.svg +86 -0
  88. package/dist/assets/images/flip-vertical.svg +82 -0
  89. package/dist/assets/images/gauge-donut.png +0 -0
  90. package/dist/assets/images/gauge-mat.png +0 -0
  91. package/dist/assets/images/gauge-zone.png +0 -0
  92. package/dist/assets/images/graphbar.svg +18 -0
  93. package/dist/assets/images/group.svg +91 -0
  94. package/dist/assets/images/iframe.svg +54 -0
  95. package/dist/assets/images/image.svg +95 -0
  96. package/dist/assets/images/led-circle.svg +77 -0
  97. package/dist/assets/images/line.svg +86 -0
  98. package/dist/assets/images/linecap-butt.svg +77 -0
  99. package/dist/assets/images/linecap-round.svg +77 -0
  100. package/dist/assets/images/linecap-square.svg +82 -0
  101. package/dist/assets/images/linejoin-bevel.svg +77 -0
  102. package/dist/assets/images/linejoin-miter.svg +77 -0
  103. package/dist/assets/images/linejoin-round.svg +77 -0
  104. package/dist/assets/images/logo.svg +18 -0
  105. package/dist/assets/images/path.svg +100 -0
  106. package/dist/assets/images/pencil.svg +98 -0
  107. package/dist/assets/images/pipe.svg +15 -0
  108. package/dist/assets/images/progress-v.svg +79 -0
  109. package/dist/assets/images/rect.svg +84 -0
  110. package/dist/assets/images/select-pointer.svg +93 -0
  111. package/dist/assets/images/selectvalue.svg +14 -0
  112. package/dist/assets/images/semaphore.svg +19 -0
  113. package/dist/assets/images/slider.svg +17 -0
  114. package/dist/assets/images/switch.svg +15 -0
  115. package/dist/assets/images/table.svg +55 -0
  116. package/dist/assets/images/text.svg +294 -0
  117. package/dist/assets/images/to-bottom.svg +163 -0
  118. package/dist/assets/images/to-path.svg +94 -0
  119. package/dist/assets/images/to-top.svg +163 -0
  120. package/dist/assets/images/to_top.svg +88 -0
  121. package/dist/assets/images/todelete.svg +13 -0
  122. package/dist/assets/images/ungroup.svg +108 -0
  123. package/dist/assets/images/value.svg +81 -0
  124. package/dist/assets/images/valve-a.svg +2 -0
  125. package/dist/assets/images/webcam.svg +16 -0
  126. package/dist/assets/lib/ext-styles.css +28 -0
  127. package/dist/assets/lib/gauge/gauge.js +988 -0
  128. package/dist/assets/lib/gauge/gauge.min.js +1 -0
  129. package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
  130. package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
  131. package/dist/assets/lib/numeral/locales.min.js +7 -0
  132. package/dist/assets/lib/numeral/numeral.min.js +8 -0
  133. package/dist/assets/lib/pdfkit-table/index.js +967 -0
  134. package/dist/assets/lib/svg/raphael.min.js +1 -0
  135. package/dist/assets/lib/svg/svg.js +5573 -0
  136. package/dist/assets/lib/svg/svg.min.js +13 -0
  137. package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
  138. package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
  139. package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
  140. package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
  141. package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
  142. package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
  143. package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
  144. package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
  145. package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
  146. package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
  147. package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
  148. package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
  149. package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
  150. package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
  151. package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
  152. package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
  153. package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
  154. package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
  155. package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
  156. package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
  157. package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
  158. package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
  159. package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
  160. package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
  161. package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
  162. package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
  163. package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
  164. package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
  165. package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
  166. package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
  167. package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
  168. package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
  169. package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
  170. package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
  171. package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
  172. package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
  173. package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
  174. package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
  175. package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
  176. package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
  177. package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
  178. package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
  179. package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
  180. package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
  181. package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
  182. package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
  183. package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
  184. package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
  185. package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
  186. package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
  187. package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
  188. package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
  189. package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
  190. package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
  191. package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
  192. package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
  193. package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
  194. package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
  195. package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
  196. package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
  197. package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
  198. package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
  199. package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
  200. package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
  201. package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
  202. package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
  203. package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
  204. package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
  205. package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
  206. package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
  207. package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
  208. package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
  209. package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
  210. package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
  211. package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
  212. package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
  213. package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
  214. package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
  215. package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
  216. package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
  217. package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
  218. package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
  219. package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
  220. package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
  221. package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
  222. package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
  223. package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
  224. package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
  225. package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
  226. package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
  227. package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
  228. package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
  229. package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
  230. package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
  231. package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
  232. package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
  233. package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
  234. package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
  235. package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
  236. package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
  237. package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
  238. package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
  239. package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
  240. package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
  241. package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
  242. package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
  243. package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
  244. package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
  245. package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
  246. package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
  247. package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
  248. package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
  249. package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
  250. package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
  251. package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
  252. package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
  253. package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
  254. package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
  255. package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
  256. package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
  257. package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
  258. package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
  259. package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
  260. package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
  261. package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
  262. package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
  263. package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
  264. package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
  265. package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
  266. package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
  267. package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
  268. package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
  269. package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
  270. package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
  271. package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
  272. package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
  273. package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
  274. package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
  275. package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
  276. package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
  277. package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
  278. package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
  279. package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
  280. package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
  281. package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
  282. package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
  283. package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
  284. package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
  285. package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
  286. package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
  287. package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
  288. package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
  289. package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
  290. package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
  291. package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
  292. package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
  293. package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
  294. package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
  295. package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
  296. package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
  297. package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
  298. package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
  299. package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
  300. package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
  301. package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
  302. package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
  303. package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
  304. package/dist/assets/lib/uplot/placement.min.js +2 -0
  305. package/dist/assets/project.demo.fuxap +1 -0
  306. package/dist/favicon.ico +0 -0
  307. package/dist/icomoon.86abfb46e057ade8.eot +0 -0
  308. package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
  309. package/dist/icomoon.ce427f75e21963af.ttf +0 -0
  310. package/dist/icomoon.dfb0a89feb346906.svg +19 -0
  311. package/dist/index.html +50 -0
  312. package/dist/logo.0e8e64e69250a450.svg +18 -0
  313. package/dist/main.a356f552d9838b9e.js +1 -0
  314. package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
  315. package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
  316. package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
  317. package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
  318. package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
  319. package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
  320. package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
  321. package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
  322. package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
  323. package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
  324. package/dist/polyfills.2696a6f9dc75535e.js +1 -0
  325. package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
  326. package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
  327. package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
  328. package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
  329. package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
  330. package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
  331. package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
  332. package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
  333. package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
  334. package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
  335. package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
  336. package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
  337. package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
  338. package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
  339. package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
  340. package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
  341. package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
  342. package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
  343. package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
  344. package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
  345. package/dist/runtime.8ef63094e52a66ba.js +1 -0
  346. package/dist/scripts.1c3385254ff4c93c.js +1 -0
  347. package/dist/styles.cf8e3cf50d039a5c.css +1 -0
  348. package/fuxa.js +39 -0
  349. package/main.js +381 -0
  350. package/package.json +68 -0
  351. package/paths.js +44 -0
  352. package/project.default.json +11 -0
  353. package/project.demo.fuxap +1 -0
  354. package/runtime/alarms/alarmstorage.js +205 -0
  355. package/runtime/alarms/index.js +678 -0
  356. package/runtime/devices/bacnet/index.js +730 -0
  357. package/runtime/devices/device-utils.js +95 -0
  358. package/runtime/devices/device.js +551 -0
  359. package/runtime/devices/ethernetip/index.js +381 -0
  360. package/runtime/devices/fuxaserver/index.js +310 -0
  361. package/runtime/devices/httprequest/index.js +495 -0
  362. package/runtime/devices/index.js +489 -0
  363. package/runtime/devices/modbus/datatypes.js +122 -0
  364. package/runtime/devices/modbus/index.js +730 -0
  365. package/runtime/devices/mqtt/index.js +618 -0
  366. package/runtime/devices/odbc/index.js +408 -0
  367. package/runtime/devices/opcua/index.js +817 -0
  368. package/runtime/devices/s7/datatypes.js +88 -0
  369. package/runtime/devices/s7/index.js +702 -0
  370. package/runtime/devices/template/index.js +141 -0
  371. package/runtime/events.js +33 -0
  372. package/runtime/index.js +559 -0
  373. package/runtime/jobs/cleaner.js +74 -0
  374. package/runtime/jobs/fonts/LICENSE.txt +202 -0
  375. package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
  376. package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
  377. package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
  378. package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
  379. package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
  380. package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
  381. package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
  382. package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
  383. package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
  384. package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
  385. package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
  386. package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
  387. package/runtime/jobs/helper/image-generator.js +82 -0
  388. package/runtime/jobs/index.js +214 -0
  389. package/runtime/jobs/report.js +353 -0
  390. package/runtime/logger.js +113 -0
  391. package/runtime/notificator/index.js +383 -0
  392. package/runtime/notificator/notifystorage.js +179 -0
  393. package/runtime/plugins/index.js +255 -0
  394. package/runtime/project/index.js +959 -0
  395. package/runtime/project/prjstorage.js +222 -0
  396. package/runtime/scripts/index.js +313 -0
  397. package/runtime/scripts/msm.js +146 -0
  398. package/runtime/storage/calculator.js +227 -0
  399. package/runtime/storage/daqstorage.js +188 -0
  400. package/runtime/storage/influxdb/index.js +240 -0
  401. package/runtime/storage/sqlite/currentstorage.js +144 -0
  402. package/runtime/storage/sqlite/index.js +695 -0
  403. package/runtime/storage/tdengine/index.js +106 -0
  404. package/runtime/users/index.js +123 -0
  405. package/runtime/users/usrstorage.js +201 -0
  406. package/runtime/utils.js +284 -0
  407. package/screenshot/feature-action-move.gif +0 -0
  408. package/screenshot/fuxa-ani.gif +0 -0
  409. package/screenshot/fuxa-device.gif +0 -0
  410. package/screenshot/fuxa-editor.png +0 -0
  411. package/screenshot/fuxa-hmi.gif +0 -0
  412. package/screenshot/fuxa-home.png +0 -0
  413. package/screenshot/fuxa-test.gif +0 -0
  414. package/settings.default.js +65 -0
@@ -0,0 +1,222 @@
1
+ /**
2
+ * Module to manage the project datastore in a database
3
+ * Table: 'general', 'views', 'devices', 'chart'
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ var sqlite3 = require('sqlite3').verbose();
11
+
12
+ var settings // Application settings
13
+ var logger; // Application logger
14
+ var db_prj; // Database of project
15
+
16
+ /**
17
+ * Init and bind the database resource
18
+ * @param {*} _settings
19
+ * @param {*} _log
20
+ */
21
+ function init(_settings, _log) {
22
+ settings = _settings;
23
+ logger = _log;
24
+
25
+ return _bind();
26
+ }
27
+
28
+ /**
29
+ * Bind the database resource by create the table if not exist
30
+ */
31
+ function _bind() {
32
+ return new Promise(function (resolve, reject) {
33
+ var dbfile = path.join(settings.workDir, 'project.fuxap.db');
34
+ var dbfileExist = fs.existsSync(dbfile);
35
+ db_prj = new sqlite3.Database(dbfile, function (err) {
36
+ if (err) {
37
+ logger.error(`prjstorage.bind failed! ${err}`);
38
+ reject();
39
+ }
40
+ logger.info(`prjstorage.connected-to ${dbfile} database`, true);
41
+ });
42
+ // prepare query
43
+ var sql = "CREATE TABLE if not exists general (name TEXT PRIMARY KEY, value TEXT);";
44
+ sql += "CREATE TABLE if not exists views (name TEXT PRIMARY KEY, value TEXT);";
45
+ sql += "CREATE TABLE if not exists devices (name TEXT PRIMARY KEY, value TEXT, connection TEXT, cntid TEXT, cntpwd TEXT);";
46
+ sql += "CREATE TABLE if not exists devicesSecurity (name TEXT PRIMARY KEY, value TEXT);";
47
+ sql += "CREATE TABLE if not exists texts (name TEXT PRIMARY KEY, value TEXT);";
48
+ sql += "CREATE TABLE if not exists alarms (name TEXT PRIMARY KEY, value TEXT);";
49
+ sql += "CREATE TABLE if not exists notifications (name TEXT PRIMARY KEY, value TEXT);";
50
+ sql += "CREATE TABLE if not exists scripts (name TEXT PRIMARY KEY, value TEXT);";
51
+ sql += "CREATE TABLE if not exists reports (name TEXT PRIMARY KEY, value TEXT);";
52
+ db_prj.exec(sql, function (err) {
53
+ if (err) {
54
+ logger.error(`prjstorage.bind failed! ${err}`);
55
+ reject();
56
+ } else {
57
+ resolve(dbfileExist);
58
+ }
59
+ });
60
+ });
61
+ }
62
+
63
+ /**
64
+ * Set default project value in database
65
+ */
66
+ function setDefault() {
67
+ return new Promise(function (resolve, reject) {
68
+ var scs = [];
69
+ scs.push({ table: TableType.GENERAL, name: 'version', value: '1.00' });
70
+ scs.push({ table: TableType.DEVICES, name: 'server', value: { 'id': '0', 'name': 'FUXA Server', 'type': 'FuxaServer', 'property': {} } });
71
+ setSections(scs).then(() => {
72
+ resolve();
73
+ }).catch(function (err) {
74
+ reject(err);
75
+ });
76
+ });
77
+ }
78
+
79
+ /**
80
+ * Insert the list of values in database tables, if exist replace the value of name(key)
81
+ * The section contains the name of table, name(key) and value
82
+ * @param {*} sections
83
+ */
84
+ function setSections(sections) {
85
+ return new Promise(function (resolve, reject) {
86
+ // prepare query
87
+ var sql = "";
88
+ for(var i = 0; i < sections.length; i++) {
89
+ var value = JSON.stringify(sections[i].value).replace(/\'/g,"''");
90
+ sql += "INSERT OR REPLACE INTO " + sections[i].table + " (name, value) VALUES('" + sections[i].name + "','"+ value + "');";
91
+ }
92
+ db_prj.exec(sql, function (err) {
93
+ if (err) {
94
+ logger.error(`prjstorage.set failed! ${err}`);
95
+ reject();
96
+ } else {
97
+ resolve();
98
+ }
99
+ });
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Insert the values in database table, if exist replace the value of name(key)
105
+ * The section contains the name of table, name(key) and value
106
+ * @param {*} section
107
+ */
108
+ function setSection(section) {
109
+ return new Promise(function (resolve, reject) {
110
+ var value = JSON.stringify(section.value).replace(/\'/g,"''");
111
+ var sql = "INSERT OR REPLACE INTO " + section.table + " (name, value) VALUES('" + section.name + "','"+ value + "');";
112
+ db_prj.exec(sql, function (err) {
113
+ if (err) {
114
+ logger.error(`prjstorage.set failed! ${err}`);
115
+ reject();
116
+ } else {
117
+ resolve();
118
+ }
119
+ });
120
+ });
121
+ }
122
+
123
+ /**
124
+ * Return all values of table with this name
125
+ * If name is null return all values in table
126
+ * @param {*} table
127
+ * @param {*} name
128
+ */
129
+ function getSection(table, name) {
130
+ return new Promise(function (resolve, reject) {
131
+ var sql = "SELECT name, value FROM " + table;
132
+ if (name) {
133
+ sql += " WHERE name = '" + name + "'";
134
+ }
135
+ db_prj.all(sql, function (err, rows) {
136
+ if (err) {
137
+ reject(err);
138
+ } else {
139
+ resolve(rows);
140
+ }
141
+ });
142
+ });
143
+ }
144
+
145
+ /**
146
+ * Delete the values in database table
147
+ * The section contains the name of table, name(key)
148
+ * @param {*} section
149
+ */
150
+ function deleteSection(section) {
151
+ return new Promise(function (resolve, reject) {
152
+ var sql = "DELETE FROM " + section.table + " WHERE name = '" + section.name + "'";
153
+ db_prj.run(sql, function (err, rows) {
154
+ if (err) {
155
+ reject(err);
156
+ } else {
157
+ resolve();
158
+ }
159
+ });
160
+ });
161
+ }
162
+
163
+ /**
164
+ * Close the database
165
+ */
166
+ function close() {
167
+ if (db_prj) {
168
+ db_prj.close();
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Clear all table in database
174
+ */
175
+ function clearAll() {
176
+ return new Promise(function (resolve, reject) {
177
+ // prepare query
178
+ var sql = "DELETE FROM general;";
179
+ sql += "DELETE FROM views;";
180
+ sql += "DELETE FROM devices;";
181
+ sql += "DELETE FROM texts;";
182
+ sql += "DELETE FROM alarms;";
183
+ sql += "DELETE FROM notifications;";
184
+ sql += "DELETE FROM scripts;";
185
+ sql += "DELETE FROM reports;";
186
+ db_prj.exec(sql, function (err) {
187
+ if (err) {
188
+ logger.error(`prjstorage.clear failed! ${err}`);
189
+ reject();
190
+ } else {
191
+ resolve(true);
192
+ }
193
+ });
194
+ });
195
+ }
196
+
197
+ /**
198
+ * Database Table
199
+ */
200
+ const TableType = {
201
+ GENERAL: 'general',
202
+ DEVICES: 'devices',
203
+ VIEWS: 'views',
204
+ DEVICESSECURITY: 'devicesSecurity',
205
+ TEXTS: 'texts',
206
+ ALARMS: 'alarms',
207
+ NOTIFICATIONS: 'notifications',
208
+ SCRIPTS: 'scripts',
209
+ REPORTS: 'reports',
210
+ }
211
+
212
+ module.exports = {
213
+ init: init,
214
+ close: close,
215
+ clearAll: clearAll,
216
+ getSection: getSection,
217
+ setSections: setSections,
218
+ setSection: setSection,
219
+ deleteSection: deleteSection,
220
+ setDefault: setDefault,
221
+ TableType: TableType,
222
+ };
@@ -0,0 +1,313 @@
1
+ /*
2
+ * Script manager: check and run scheduled script, run script call from frontend
3
+ */
4
+
5
+ 'use strict';
6
+
7
+ const MyScriptModule = require('./msm');
8
+ const nodeSchedule = require('node-schedule');
9
+
10
+ var SCRIPT_CHECK_STATUS_INTERVAL = 1000;
11
+
12
+ function ScriptsManager(_runtime) {
13
+ var runtime = _runtime;
14
+ var events = runtime.events; // Events to commit change to runtime
15
+ var settings = runtime.settings; // Settings
16
+ var logger = runtime.logger; // Logger
17
+ var scriptsCheckStatus = null; // TimerInterval to check scripts manager status
18
+ var working = false; // Working flag to manage overloading of check notificator status
19
+ var status = ScriptsStatusEnum.INIT;// Current status (StateMachine)
20
+ var lastCheck = 0; // Timestamp to check intervall only in IDLE
21
+ var schedulingMap = {}; // Mapped script mit scheduling
22
+ var scriptModule = MyScriptModule.create(events, logger);
23
+
24
+ /**
25
+ * Start TimerInterval to check Scripts
26
+ */
27
+ this.start = function () {
28
+ return new Promise(function (resolve, reject) {
29
+ logger.info('scripts.start-checkstatus', true);
30
+ scriptsCheckStatus = setInterval(function () {
31
+ _checkStatus();
32
+ }, SCRIPT_CHECK_STATUS_INTERVAL);
33
+ });
34
+ }
35
+
36
+ /**
37
+ * Stop StateMachine, break TimerInterval (_checkStatus)
38
+ */
39
+ this.stop = function () {
40
+ return new Promise(function (resolve, reject) {
41
+ logger.info('scripts.stop-checkstatus!', true);
42
+ if (scriptsCheckStatus) {
43
+ clearInterval(scriptsCheckStatus);
44
+ scriptsCheckStatus = null;
45
+ status = ScriptsStatusEnum.INIT;
46
+ working = false;
47
+ }
48
+ resolve();
49
+ });
50
+ }
51
+
52
+ this.reset = function () {
53
+ // this.clear();
54
+ status = ScriptsStatusEnum.LOAD;
55
+ }
56
+
57
+ this.updateScript = function (script) {
58
+ this.reset();
59
+ }
60
+
61
+ this.removeScript = function (script) {
62
+ this.reset();
63
+ }
64
+
65
+ /**
66
+ * Run script, <script> {id, name, parameters: <ScriptParam> {name, type: <ScriptParamType>[tagid, value], value: any} }
67
+ * @returns
68
+ */
69
+ this.runScript = function (script) {
70
+ return new Promise(async function (resolve, reject) {
71
+ try {
72
+ var result;
73
+ if (script.test) {
74
+ result = await scriptModule.runTestScript(script);
75
+ } else {
76
+ logger.info(`Run script ${script.name}`);
77
+ result = scriptModule.runScript(script);
78
+ }
79
+ resolve(result || `Script OK: ${script.name}`);
80
+ } catch (err) {
81
+ reject(err);
82
+ }
83
+ });
84
+ }
85
+
86
+ this.isAuthorised = function (_script, groups) {
87
+ try {
88
+ const st = scriptModule.getScript(_script);
89
+ var admin = (groups === -1 || groups === 255) ? true : false;
90
+ if (admin || (st && (!st.permission || st.permission & groups))) {
91
+ return true;
92
+ }
93
+ } catch (err) {
94
+ logger.error(err);
95
+ }
96
+ return false;
97
+ }
98
+
99
+ this.sysFunctionExist = (functionName) => {
100
+ const sysFncs = _getSystemFunctions();
101
+ return !!sysFncs[functionName];
102
+ }
103
+
104
+ this.runSysFunction = (functionName, params) => {
105
+ return scriptModule.runSysFunction(functionName, params);
106
+ }
107
+
108
+ /**
109
+ * Check the Scripts state machine
110
+ */
111
+ var _checkStatus = function () {
112
+ if (status === ScriptsStatusEnum.INIT) {
113
+ if (_checkWorking(true)) {
114
+ _init().then(function () {
115
+ status = ScriptsStatusEnum.LOAD;
116
+ _checkWorking(false);
117
+ }).catch(function (err) {
118
+ _checkWorking(false);
119
+ });
120
+ }
121
+ } else if (status === ScriptsStatusEnum.LOAD) {
122
+ if (_checkWorking(true)) {
123
+ _loadProperty().then(function () {
124
+ _checkWorking(false);
125
+ status = ScriptsStatusEnum.IDLE;
126
+ }).catch(function (err) {
127
+ _checkWorking(false);
128
+ });
129
+ }
130
+ } else if (status === ScriptsStatusEnum.IDLE) {
131
+ const time = new Date().getTime();
132
+ Object.keys(schedulingMap).forEach((name) => {
133
+ const script = schedulingMap[name];
134
+ if (script.isToRun(time)) {
135
+ try {
136
+ scriptModule.runScriptWithoutParameter(script);
137
+ script.lastRun = time;
138
+ } catch (err) {
139
+ if (err.message) {
140
+ logger.error(err.message);
141
+ } else {
142
+ logger.error(err);
143
+ }
144
+ }
145
+ }
146
+ });
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Init Scripts manager
152
+ */
153
+ var _init = function () {
154
+ return new Promise(function (resolve, reject) {
155
+ try {
156
+ scriptModule.init(_getSystemFunctions());
157
+ resolve();
158
+ } catch (err) {
159
+ logger.error(err);
160
+ }
161
+ });
162
+ }
163
+
164
+ var _checkWorking = function (check) {
165
+ if (check && working) {
166
+ logger.warn('scripts manager working (check) overload!');
167
+ return false;
168
+ }
169
+ working = check;
170
+ return true;
171
+ }
172
+
173
+ /**
174
+ * Load Scripts property in local for check
175
+ */
176
+ var _loadProperty = function () {
177
+ return new Promise(function (resolve, reject) {
178
+ schedulingMap = {};
179
+ try {
180
+ nodeSchedule.gracefulShutdown();
181
+ } catch (e) {
182
+ logger.error(e);
183
+ }
184
+ runtime.project.getScripts().then((scripts) => {
185
+ if (scripts) {
186
+ var lr = scriptModule.loadScripts(scripts);
187
+ Object.values(scripts).forEach((script) => {
188
+ if (script.scheduling) {
189
+ const scriptSchedule = new ScriptSchedule(script);
190
+ if (script.scheduling.interval && script.mode != 'CLIENT') {
191
+ schedulingMap[script.name] = scriptSchedule;
192
+ } else if (script.scheduling.mode === ScriptSchedulingMode.scheduling) {
193
+ try {
194
+ scriptSchedule.getScheduleRules().forEach((scheduleRule) => {
195
+ logger.info(`Load script-schedule ${script.name} - ${JSON.stringify(scheduleRule)}`);
196
+ nodeSchedule.scheduleJob(scheduleRule, function() {
197
+ scriptModule.runScriptWithoutParameter(script);
198
+ });
199
+ });
200
+ } catch (er) {
201
+ logger.error(er);
202
+ }
203
+ }
204
+ }
205
+ });
206
+ resolve(lr.messages);
207
+ } else {
208
+ resolve();
209
+ }
210
+ }).catch(function (err) {
211
+ reject(err);
212
+ });
213
+ });
214
+ }
215
+
216
+ var _getSystemFunctions = function () {
217
+ var sysFncs = {};
218
+ sysFncs['$getTag'] = runtime.devices.getTagValue;
219
+ sysFncs['$setTag'] = runtime.devices.setTagValue;
220
+ sysFncs['$getTagId'] = runtime.devices.getTagId;
221
+ sysFncs['$setView'] = _setCommandView;
222
+ sysFncs['$enableDevice'] = runtime.devices.enableDevice;
223
+ sysFncs['$getTagDaqSettings'] = runtime.devices.getTagDaqSettings;
224
+ sysFncs['$setTagDaqSettings'] = runtime.devices.setTagDaqSettings;
225
+ return sysFncs;
226
+ }
227
+
228
+ var _setCommandView = function (view, force) {
229
+ let command = { command: ScriptCommandEnum.SETVIEW, params: [view, force] };
230
+ runtime.scriptSendCommand(command);
231
+ }
232
+ }
233
+
234
+ module.exports = {
235
+ create: function (runtime) {
236
+ return new ScriptsManager(runtime);
237
+ }
238
+ }
239
+
240
+ /**
241
+ * State of Scripts manager
242
+ */
243
+ const ScriptsStatusEnum = {
244
+ INIT: 'init',
245
+ LOAD: 'load',
246
+ IDLE: 'idle',
247
+ }
248
+
249
+ function ScriptSchedule(script) {
250
+ this.id = script.id;
251
+ this.name = script.name;
252
+ this.scheduling = script.scheduling;
253
+ this.lastRun = 0;
254
+ this.created = new Date().getTime();
255
+
256
+ this.isToRun = function(time) {
257
+ if (this.scheduling.mode === ScriptSchedulingMode.start) {
258
+ return !this.lastRun && (time - this.created > this.scheduling.interval * 1000);
259
+ } else if (this.scheduling.mode !== ScriptSchedulingMode.scheduling) {
260
+ return (time - this.lastRun > this.scheduling.interval * 1000);
261
+ }
262
+ }
263
+
264
+ this.getScheduleRules = function() {
265
+ let result = [];
266
+ if (this.scheduling.schedules) {
267
+ this.scheduling.schedules.forEach(schedule => {
268
+
269
+ if (schedule.type === SchedulerType.date && schedule.date) {
270
+ var date = new Date(schedule.date);
271
+ if (schedule.time) {
272
+ const [hour, minute, seconds] = schedule.time.split(':');
273
+ if (hour) date.setHours(hour);
274
+ if (minute) date.setMinutes(minute);
275
+ if (seconds) date.setSeconds(seconds);
276
+ }
277
+ result.push(date);
278
+ } else {
279
+ const rule = new nodeSchedule.RecurrenceRule();
280
+ if (schedule.hour) rule.hour = schedule.hour;
281
+ if (schedule.minute) rule.minute = schedule.minute;
282
+ if (schedule.days) {
283
+ rule.dayOfWeek = [];
284
+ if (schedule.days.includes('sun')) rule.dayOfWeek.push(0);
285
+ if (schedule.days.includes('mon')) rule.dayOfWeek.push(1);
286
+ if (schedule.days.includes('tue')) rule.dayOfWeek.push(2);
287
+ if (schedule.days.includes('wed')) rule.dayOfWeek.push(3);
288
+ if (schedule.days.includes('thu')) rule.dayOfWeek.push(4);
289
+ if (schedule.days.includes('fri')) rule.dayOfWeek.push(5);
290
+ if (schedule.days.includes('sat')) rule.dayOfWeek.push(6);
291
+ }
292
+ result.push(rule);
293
+ }
294
+ });
295
+ }
296
+ return result;
297
+ }
298
+ }
299
+
300
+ const ScriptCommandEnum = {
301
+ SETVIEW: 'SETVIEW',
302
+ }
303
+
304
+ const ScriptSchedulingMode = {
305
+ interval: 'interval',
306
+ start: 'start',
307
+ scheduling: 'scheduling',
308
+ }
309
+
310
+ const SchedulerType = {
311
+ weekly: 0,
312
+ date: 1,
313
+ }
@@ -0,0 +1,146 @@
1
+
2
+ /*
3
+ * My Script Module: script container, scripts defined in frontend (string code) are to load as function
4
+ */
5
+
6
+ 'use strict';
7
+ const path = require('path');
8
+
9
+ var Module = module.constructor;
10
+
11
+ // const eventsIncludes = 'var events = require("../events").create();';
12
+ const requireInclude = `const path = require('path');`;
13
+ const eventsIncludes = 'var events; var id; var console = { log: function (msg) { if (events) events.emit(\'script-console\', { msg: msg, type: \'log\', id: id });}};';
14
+ // const eventsIncludes = 'var events = require("../events").create();';// var console = { log: function (msg) { if (events) events.emit(\'script-console\', { msg: msg, type: \'log\' });}}';
15
+ const initEvents = { name: 'init', code: 'events = _events; id = _id', parameters: [{ name: '_events' }, { name: '_id' }] };
16
+ // const setSystemFunctions = { name: 'setSysFunctions', code: 'Object.keys(systemFunctions).forEach(k => { });', parameters: [{ name: '_sysfncs' }] };
17
+ // const consoleLog = { name: 'console', code: 'log: function (msg) { if (events) events.emit(\'script-console\', { msg: msg, type: \'log\' });}', parameters: [] };
18
+ // tempScripts['console.error'] = 'function (msg) { events.emit(\'device-status:changed\', { msg: msg, type: \'error\' }); }';
19
+
20
+ function MyScriptsModule(_events, _logger) {
21
+ var events = _events;
22
+ var logger = _logger;
23
+ var module = new Module();
24
+ var scriptsMap = {};
25
+ var systemFunctions = {};
26
+ var scriptsModule;
27
+
28
+ this.init = function (sysfncs) {
29
+ systemFunctions = sysfncs;
30
+ Object.keys(systemFunctions).forEach(k => {
31
+ global[k] = systemFunctions[k];
32
+ });
33
+ }
34
+
35
+ this.loadScripts = function (_scripts) {
36
+ let result = _scriptsToModule(_scripts);
37
+ scriptsModule = result.module;
38
+ scriptsMap = result.scriptsMap;
39
+ return result;
40
+ }
41
+
42
+ this.runTestScript = function (_script) {
43
+ // clone scripts and add or replace script to test
44
+ var tempScripts = JSON.parse(JSON.stringify(scriptsMap));
45
+ tempScripts[_script.name] = _script;
46
+ tempScripts[initEvents.name] = initEvents;
47
+
48
+ var result = _scriptsToModule(tempScripts, eventsIncludes);
49
+ if (result.module) {
50
+ var paramsValue = _script.parameters.map(p => p.value || p);
51
+ result.module[initEvents.name](events, _script.outputId);
52
+ return result.module[_script.name](...paramsValue);
53
+ }
54
+ throw new Error(result);
55
+ }
56
+
57
+ this.runScript = function (_script) {
58
+ if (scriptsModule) {
59
+ var paramsValue = _script.parameters.map(p => p.value || p);
60
+ if (!_script.name) {
61
+ _script = Object.values(scriptsMap).find(s => s.id === _script.id);
62
+ }
63
+ try {
64
+ return scriptsModule[_script.name](...paramsValue);
65
+ } catch (err) {
66
+ console.error(err);
67
+ return err;
68
+ }
69
+ }
70
+ }
71
+
72
+ this.runScriptWithoutParameter = function (_script) {
73
+ if (scriptsModule) {
74
+ if (!_script.name) {
75
+ _script = Object.values(scriptsMap).find(s => s.id === _script.id);
76
+ }
77
+ try {
78
+ return scriptsModule[_script.name]();
79
+ } catch (err) {
80
+ console.error(err);
81
+ return err;
82
+ }
83
+ }
84
+ }
85
+
86
+ this.runSysFunction = function (functionName, params) {
87
+ return global[functionName](...params);
88
+ }
89
+
90
+ this.getScript = function (_script) {
91
+ return Object.values(scriptsMap).find(s => s.id === _script.id);
92
+ }
93
+
94
+ var _scriptsToModule = function (_scripts, _includes) {
95
+ let result = { module: null, messages: [], scriptsMap: {} };
96
+ try {
97
+ let functions = '';
98
+ let toexport = '';
99
+ Object.values(_scripts).forEach((script) => {
100
+ try {
101
+ if (script.code) {
102
+ var params = '';
103
+ for (let i = 0; i < script.parameters.length; i++) {
104
+ if (params.length) params += ',';
105
+ params += `${script.parameters[i].name}`;
106
+ }
107
+ functions += `async function ${script.name} (${params}) { try { ${script.code} } catch (fuxaError) { console.log(fuxaError); return JSON.stringify(fuxaError); } }`;
108
+ toexport += `${script.name}: ${script.name}, `;
109
+ result.scriptsMap[script.name] = script;
110
+ } else {
111
+ logger.warn(`load.script ${script.name} without code!`);
112
+ result.messages.push(`load.script ${script.name} without code!`);
113
+ }
114
+ } catch(e) {
115
+ logger.error(`load.script ${script.name} error: ${(e.stack) ? e.stack : e}`);
116
+ result.messages.push(`load.script ${script.name} error!`);
117
+ }
118
+ });
119
+ var code = '';
120
+ if (_includes) {
121
+ code = `${_includes}`;
122
+ }
123
+ var code = `${requireInclude} ${code} ${functions} module.exports = { ${toexport} };`;
124
+ var filename = path.resolve(__dirname, 'msm-scripts.js');
125
+ result.module = _requireFromString(code, filename);
126
+ } catch(ex) {
127
+ logger.error(`load.script error: ${(ex.stack) ? ex.stack : ex}`);
128
+ return ex;
129
+ }
130
+ return result;
131
+ }
132
+
133
+ var _requireFromString = function (src, filename) {
134
+ delete require.cache[filename];
135
+ var Module = module.constructor;
136
+ var m = new Module();
137
+ m._compile(src, filename);
138
+ return m.exports;
139
+ }
140
+ }
141
+
142
+ module.exports = {
143
+ create: function (events, logger) {
144
+ return new MyScriptsModule(events, logger);
145
+ }
146
+ };