@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.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/_images/Pipes/P1.svg +39 -0
- package/_images/Tanks/Fl.svg +7 -0
- package/api/alarms/index.js +132 -0
- package/api/auth/index.js +71 -0
- package/api/command/index.js +187 -0
- package/api/daq/index.js +79 -0
- package/api/diagnose/index.js +163 -0
- package/api/index.js +181 -0
- package/api/jwt-helper.js +106 -0
- package/api/plugins/index.js +109 -0
- package/api/projects/index.js +229 -0
- package/api/resources/index.js +118 -0
- package/api/scripts/index.js +82 -0
- package/api/users/index.js +109 -0
- package/dist/3rdpartylicenses.txt +1477 -0
- package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
- package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
- package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
- package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
- package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
- package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
- package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
- package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
- package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
- package/dist/assets/fonts/icomoon.eot +0 -0
- package/dist/assets/fonts/icomoon.svg +19 -0
- package/dist/assets/fonts/icomoon.ttf +0 -0
- package/dist/assets/fonts/icomoon.woff +0 -0
- package/dist/assets/fonts/myicons.eot +0 -0
- package/dist/assets/fonts/myicons.svg +19 -0
- package/dist/assets/fonts/myicons.ttf +0 -0
- package/dist/assets/fonts/myicons.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
- package/dist/assets/i18n/de.json +1308 -0
- package/dist/assets/i18n/en.json +1438 -0
- package/dist/assets/i18n/es.json +777 -0
- package/dist/assets/i18n/fr.json +1129 -0
- package/dist/assets/i18n/ko.json +774 -0
- package/dist/assets/i18n/pt.json +657 -0
- package/dist/assets/i18n/ru.json +1228 -0
- package/dist/assets/i18n/tr.json +673 -0
- package/dist/assets/i18n/ua.json +614 -0
- package/dist/assets/i18n/zh-cn.json +1252 -0
- package/dist/assets/images/align-bottom.svg +88 -0
- package/dist/assets/images/align-center.svg +86 -0
- package/dist/assets/images/align-left.svg +86 -0
- package/dist/assets/images/align-middle.svg +88 -0
- package/dist/assets/images/align-right.svg +88 -0
- package/dist/assets/images/align-top.svg +88 -0
- package/dist/assets/images/bag.svg +115 -0
- package/dist/assets/images/button.svg +22 -0
- package/dist/assets/images/chart.svg +17 -0
- package/dist/assets/images/circle.svg +84 -0
- package/dist/assets/images/compressor-a.svg +2 -0
- package/dist/assets/images/editvalue.svg +14 -0
- package/dist/assets/images/ellipse.svg +84 -0
- package/dist/assets/images/flip-orizontal.svg +86 -0
- package/dist/assets/images/flip-vertical.svg +82 -0
- package/dist/assets/images/gauge-donut.png +0 -0
- package/dist/assets/images/gauge-mat.png +0 -0
- package/dist/assets/images/gauge-zone.png +0 -0
- package/dist/assets/images/graphbar.svg +18 -0
- package/dist/assets/images/group.svg +91 -0
- package/dist/assets/images/iframe.svg +54 -0
- package/dist/assets/images/image.svg +95 -0
- package/dist/assets/images/led-circle.svg +77 -0
- package/dist/assets/images/line.svg +86 -0
- package/dist/assets/images/linecap-butt.svg +77 -0
- package/dist/assets/images/linecap-round.svg +77 -0
- package/dist/assets/images/linecap-square.svg +82 -0
- package/dist/assets/images/linejoin-bevel.svg +77 -0
- package/dist/assets/images/linejoin-miter.svg +77 -0
- package/dist/assets/images/linejoin-round.svg +77 -0
- package/dist/assets/images/logo.svg +18 -0
- package/dist/assets/images/path.svg +100 -0
- package/dist/assets/images/pencil.svg +98 -0
- package/dist/assets/images/pipe.svg +15 -0
- package/dist/assets/images/progress-v.svg +79 -0
- package/dist/assets/images/rect.svg +84 -0
- package/dist/assets/images/select-pointer.svg +93 -0
- package/dist/assets/images/selectvalue.svg +14 -0
- package/dist/assets/images/semaphore.svg +19 -0
- package/dist/assets/images/slider.svg +17 -0
- package/dist/assets/images/switch.svg +15 -0
- package/dist/assets/images/table.svg +55 -0
- package/dist/assets/images/text.svg +294 -0
- package/dist/assets/images/to-bottom.svg +163 -0
- package/dist/assets/images/to-path.svg +94 -0
- package/dist/assets/images/to-top.svg +163 -0
- package/dist/assets/images/to_top.svg +88 -0
- package/dist/assets/images/todelete.svg +13 -0
- package/dist/assets/images/ungroup.svg +108 -0
- package/dist/assets/images/value.svg +81 -0
- package/dist/assets/images/valve-a.svg +2 -0
- package/dist/assets/images/webcam.svg +16 -0
- package/dist/assets/lib/ext-styles.css +28 -0
- package/dist/assets/lib/gauge/gauge.js +988 -0
- package/dist/assets/lib/gauge/gauge.min.js +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
- package/dist/assets/lib/numeral/locales.min.js +7 -0
- package/dist/assets/lib/numeral/numeral.min.js +8 -0
- package/dist/assets/lib/pdfkit-table/index.js +967 -0
- package/dist/assets/lib/svg/raphael.min.js +1 -0
- package/dist/assets/lib/svg/svg.js +5573 -0
- package/dist/assets/lib/svg/svg.min.js +13 -0
- package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
- package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
- package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
- package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
- package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
- package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
- package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
- package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
- package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
- package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
- package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
- package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
- package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
- package/dist/assets/lib/uplot/placement.min.js +2 -0
- package/dist/assets/project.demo.fuxap +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/icomoon.86abfb46e057ade8.eot +0 -0
- package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
- package/dist/icomoon.ce427f75e21963af.ttf +0 -0
- package/dist/icomoon.dfb0a89feb346906.svg +19 -0
- package/dist/index.html +50 -0
- package/dist/logo.0e8e64e69250a450.svg +18 -0
- package/dist/main.a356f552d9838b9e.js +1 -0
- package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
- package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
- package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
- package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
- package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
- package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
- package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
- package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
- package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
- package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
- package/dist/polyfills.2696a6f9dc75535e.js +1 -0
- package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
- package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
- package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
- package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
- package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
- package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
- package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
- package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
- package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
- package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
- package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
- package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
- package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
- package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
- package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
- package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
- package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
- package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
- package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
- package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
- package/dist/runtime.8ef63094e52a66ba.js +1 -0
- package/dist/scripts.1c3385254ff4c93c.js +1 -0
- package/dist/styles.cf8e3cf50d039a5c.css +1 -0
- package/fuxa.js +39 -0
- package/main.js +381 -0
- package/package.json +68 -0
- package/paths.js +44 -0
- package/project.default.json +11 -0
- package/project.demo.fuxap +1 -0
- package/runtime/alarms/alarmstorage.js +205 -0
- package/runtime/alarms/index.js +678 -0
- package/runtime/devices/bacnet/index.js +730 -0
- package/runtime/devices/device-utils.js +95 -0
- package/runtime/devices/device.js +551 -0
- package/runtime/devices/ethernetip/index.js +381 -0
- package/runtime/devices/fuxaserver/index.js +310 -0
- package/runtime/devices/httprequest/index.js +495 -0
- package/runtime/devices/index.js +489 -0
- package/runtime/devices/modbus/datatypes.js +122 -0
- package/runtime/devices/modbus/index.js +730 -0
- package/runtime/devices/mqtt/index.js +618 -0
- package/runtime/devices/odbc/index.js +408 -0
- package/runtime/devices/opcua/index.js +817 -0
- package/runtime/devices/s7/datatypes.js +88 -0
- package/runtime/devices/s7/index.js +702 -0
- package/runtime/devices/template/index.js +141 -0
- package/runtime/events.js +33 -0
- package/runtime/index.js +559 -0
- package/runtime/jobs/cleaner.js +74 -0
- package/runtime/jobs/fonts/LICENSE.txt +202 -0
- package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
- package/runtime/jobs/helper/image-generator.js +82 -0
- package/runtime/jobs/index.js +214 -0
- package/runtime/jobs/report.js +353 -0
- package/runtime/logger.js +113 -0
- package/runtime/notificator/index.js +383 -0
- package/runtime/notificator/notifystorage.js +179 -0
- package/runtime/plugins/index.js +255 -0
- package/runtime/project/index.js +959 -0
- package/runtime/project/prjstorage.js +222 -0
- package/runtime/scripts/index.js +313 -0
- package/runtime/scripts/msm.js +146 -0
- package/runtime/storage/calculator.js +227 -0
- package/runtime/storage/daqstorage.js +188 -0
- package/runtime/storage/influxdb/index.js +240 -0
- package/runtime/storage/sqlite/currentstorage.js +144 -0
- package/runtime/storage/sqlite/index.js +695 -0
- package/runtime/storage/tdengine/index.js +106 -0
- package/runtime/users/index.js +123 -0
- package/runtime/users/usrstorage.js +201 -0
- package/runtime/utils.js +284 -0
- package/screenshot/feature-action-move.gif +0 -0
- package/screenshot/fuxa-ani.gif +0 -0
- package/screenshot/fuxa-device.gif +0 -0
- package/screenshot/fuxa-editor.png +0 -0
- package/screenshot/fuxa-hmi.gif +0 -0
- package/screenshot/fuxa-home.png +0 -0
- package/screenshot/fuxa-test.gif +0 -0
- package/settings.default.js +65 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'http': webapi wrapper to manage REST API request
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
const axios = require('axios');
|
|
6
|
+
const utils = require('../../utils');
|
|
7
|
+
const deviceUtils = require('../device-utils');
|
|
8
|
+
|
|
9
|
+
function HTTPclient(_data, _logger, _events) {
|
|
10
|
+
var data = _data; // Current webapi data
|
|
11
|
+
var logger = _logger; // Logger var working = false; // Working flag to manage overloading polling and connection
|
|
12
|
+
var working = false; // Working flag to manage overloading polling and connection
|
|
13
|
+
var connected = false; // Connected flag
|
|
14
|
+
var events = _events; // Events to commit change to runtime
|
|
15
|
+
var lastStatus = ''; // Last webapi status
|
|
16
|
+
var varsValue = []; // Signale to send to frontend { id, type, value }
|
|
17
|
+
var requestItemsMap = {}; // Map of request (JSON, CSV, XML, ...) {key: item path, value: tag}
|
|
18
|
+
var overloading = 0; // Overloading counter to mange the break connection
|
|
19
|
+
var lastTimestampRequest; // Last Timestamp request
|
|
20
|
+
var lastTimestampValue; // Last Timestamp of asked values
|
|
21
|
+
var newItemsCount; // Count of new items, between load and received
|
|
22
|
+
|
|
23
|
+
var apiProperty = { getTags: null, postTags: null, format: 'JSON', ownFlag: true };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Connect the client by make a request
|
|
27
|
+
*/
|
|
28
|
+
this.connect = function () {
|
|
29
|
+
return new Promise(function (resolve, reject) {
|
|
30
|
+
if (_checkConnection()) {
|
|
31
|
+
try {
|
|
32
|
+
if (_checkWorking(true)) {
|
|
33
|
+
logger.info(`'${data.name}' try to connect ${apiProperty.getTags}`, true);
|
|
34
|
+
_clearVarsValue();
|
|
35
|
+
_emitStatus('connect-ok');
|
|
36
|
+
resolve();
|
|
37
|
+
connected = true;
|
|
38
|
+
lastTimestampRequest = new Date().getTime();
|
|
39
|
+
_checkWorking(false);
|
|
40
|
+
} else {
|
|
41
|
+
reject();
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
logger.error(`'${data.name}' try to connect error! ${err}`);
|
|
45
|
+
_checkWorking(false);
|
|
46
|
+
connected = false;
|
|
47
|
+
_emitStatus('connect-error');
|
|
48
|
+
_clearVarsValue();
|
|
49
|
+
reject();
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
logger.error(`'${data.name}' missing connection data!`);
|
|
53
|
+
connected = false;
|
|
54
|
+
_emitStatus('connect-failed');
|
|
55
|
+
_clearVarsValue();
|
|
56
|
+
reject();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Disconnect the client
|
|
63
|
+
* Emit connection status to clients, clear all Tags values
|
|
64
|
+
*/
|
|
65
|
+
this.disconnect = function () {
|
|
66
|
+
return new Promise(function (resolve, reject) {
|
|
67
|
+
_checkWorking(false);
|
|
68
|
+
logger.info(`'${data.name}' disconnected!`, true);
|
|
69
|
+
connected = false;
|
|
70
|
+
_emitStatus('connect-off');
|
|
71
|
+
_clearVarsValue();
|
|
72
|
+
resolve();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Read values in polling mode
|
|
78
|
+
* Update the tags values list, save in DAQ if value changed or in interval and emit values to clients
|
|
79
|
+
*/
|
|
80
|
+
this.polling = function () {
|
|
81
|
+
if (_checkWorking(true)) {
|
|
82
|
+
// check connection status
|
|
83
|
+
let dt = new Date().getTime();
|
|
84
|
+
if ((lastTimestampRequest + (data.polling * 3)) < dt) {
|
|
85
|
+
_emitStatus('connect-error');
|
|
86
|
+
_checkWorking(false);
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
_readRequest().then(result => {
|
|
90
|
+
if (result) {
|
|
91
|
+
let varsValueChanged = _updateVarsValue(result);
|
|
92
|
+
lastTimestampValue = new Date().getTime();
|
|
93
|
+
_emitValues(varsValue);
|
|
94
|
+
if (this.addDaq && !utils.isEmptyObject(varsValueChanged)) {
|
|
95
|
+
this.addDaq(varsValueChanged, data.name, data.id);
|
|
96
|
+
}
|
|
97
|
+
if (lastStatus !== 'connect-ok') {
|
|
98
|
+
_emitStatus('connect-ok');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
_checkWorking(false);
|
|
102
|
+
}, reason => {
|
|
103
|
+
logger.error(`'${data.name}' _readRequest error! ${reason}`);
|
|
104
|
+
_checkWorking(false);
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
_checkWorking(false);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
_emitStatus('connect-busy');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Return if http request is working
|
|
116
|
+
* is disconnected if the last request result is older as 3 polling interval
|
|
117
|
+
*/
|
|
118
|
+
this.isConnected = function () {
|
|
119
|
+
return connected;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Set the callback to set value to DAQ
|
|
124
|
+
*/
|
|
125
|
+
this.bindAddDaq = function (fnc) {
|
|
126
|
+
this.addDaq = fnc; // Add the DAQ value to db history
|
|
127
|
+
}
|
|
128
|
+
this.addDaq = null; // Callback to add the DAQ value to db history
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Return the timestamp of last read tag operation on polling
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
this.lastReadTimestamp = () => {
|
|
135
|
+
return lastTimestampValue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Load Tags to read by polling
|
|
140
|
+
*/
|
|
141
|
+
this.load = function (_data) {
|
|
142
|
+
varsValue = [];
|
|
143
|
+
data = JSON.parse(JSON.stringify(_data));
|
|
144
|
+
try {
|
|
145
|
+
requestItemsMap = {};
|
|
146
|
+
var count = Object.keys(data.tags).length;
|
|
147
|
+
for (var id in data.tags) {
|
|
148
|
+
const address = data.tags[id].address || data.tags[id].id;
|
|
149
|
+
if (!requestItemsMap[address]) {
|
|
150
|
+
requestItemsMap[address] = [data.tags[id]];
|
|
151
|
+
} else {
|
|
152
|
+
requestItemsMap[address].push(data.tags[id]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
logger.info(`'${data.name}' data loaded (${count})`, true);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
logger.error(`'${data.name}' load error! ${err}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Return Tag value { id: <name>, value: <value>, ts: <lastTimestampValue> }
|
|
163
|
+
*/
|
|
164
|
+
this.getValue = function (id) {
|
|
165
|
+
if (varsValue[id]) {
|
|
166
|
+
return {id: id, value: varsValue[id].value, ts: lastTimestampValue };
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Return Tags values array { id: <name>, value: <value>, type: <type> }
|
|
173
|
+
*/
|
|
174
|
+
this.getValues = function () {
|
|
175
|
+
return varsValue;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Set the Tag value, not used
|
|
180
|
+
*/
|
|
181
|
+
this.setValue = function (tagId, value) {
|
|
182
|
+
if (apiProperty.ownFlag && data.tags[tagId]) {
|
|
183
|
+
if (apiProperty.postTags) {
|
|
184
|
+
value = _parseValue(data.tags[tagId].type, value);
|
|
185
|
+
data.tags[tagId].value = deviceUtils.tagRawCalculator(value, data.tags[tagId]);
|
|
186
|
+
axios.post(apiProperty.getTags, [{id: tagId, value: data.tags[tagId].value}]).then(res => {
|
|
187
|
+
lastTimestampRequest = new Date().getTime();
|
|
188
|
+
logger.info(`setValue '${data.tags[tagId].name}' to ${value})`, true, true);
|
|
189
|
+
}).catch(err => {
|
|
190
|
+
logger.error(`setValue '${data.tags[tagId].name}' error! ${err}`);
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
logger.error(`postTags undefined (setValue)`, true);
|
|
194
|
+
}
|
|
195
|
+
return true;
|
|
196
|
+
} else {
|
|
197
|
+
logger.error(`setValue not supported!`, true);
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Return connection status 'connect-off', 'connect-ok', 'connect-error'
|
|
204
|
+
*/
|
|
205
|
+
this.getStatus = function () {
|
|
206
|
+
return lastStatus;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Return Tag property
|
|
211
|
+
*/
|
|
212
|
+
this.getTagProperty = function (id) {
|
|
213
|
+
if (data.tags[id]) {
|
|
214
|
+
return { id: id, name: data.tags[id].name, type: data.tags[id].type, format: data.tags[id].format };
|
|
215
|
+
} else {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Return Tags property
|
|
222
|
+
*/
|
|
223
|
+
this.getTagsProperty = function () {
|
|
224
|
+
return new Promise(function (resolve, reject) {
|
|
225
|
+
try {
|
|
226
|
+
resolve({ tags: Object.values(requestItemsMap), newTagsCount: newItemsCount });
|
|
227
|
+
} catch (err) {
|
|
228
|
+
reject(err);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Return the Daq settings of Tag
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
this.getTagDaqSettings = (tagId) => {
|
|
238
|
+
return data.tags[tagId] ? data.tags[tagId].daq : null;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Set Daq settings of Tag
|
|
243
|
+
* @returns
|
|
244
|
+
*/
|
|
245
|
+
this.setTagDaqSettings = (tagId, settings) => {
|
|
246
|
+
if (data.tags[tagId]) {
|
|
247
|
+
utils.mergeObjectsValues(data.tags[tagId].daq, settings);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
var _checkConnection = function () {
|
|
252
|
+
if (data.property.address) {
|
|
253
|
+
apiProperty.getTags = data.property.address;
|
|
254
|
+
apiProperty.ownFlag = false;
|
|
255
|
+
} else {
|
|
256
|
+
apiProperty.getTags = data.property.getTags;
|
|
257
|
+
apiProperty.postTags = data.property.postTags;
|
|
258
|
+
}
|
|
259
|
+
return apiProperty.getTags || apiProperty.postTags;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var _readRequest = function () {
|
|
263
|
+
return new Promise(function (resolve, reject) {
|
|
264
|
+
if (apiProperty.getTags) {
|
|
265
|
+
axios.get(apiProperty.getTags).then(res => {
|
|
266
|
+
lastTimestampRequest = new Date().getTime();
|
|
267
|
+
resolve(res.data);
|
|
268
|
+
}).catch(err => {
|
|
269
|
+
reject(err);
|
|
270
|
+
});
|
|
271
|
+
} else {
|
|
272
|
+
reject();
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Clear the Tags values by setting to null
|
|
279
|
+
* Emit to clients
|
|
280
|
+
*/
|
|
281
|
+
var _clearVarsValue = function () {
|
|
282
|
+
for (var id in varsValue) {
|
|
283
|
+
varsValue[id].value = null;
|
|
284
|
+
}
|
|
285
|
+
_emitValues(varsValue);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Update the Tags values read
|
|
290
|
+
* For WebAPI NotOwn: first convert the request data to a flat struct
|
|
291
|
+
* @param {*} reqdata
|
|
292
|
+
*/
|
|
293
|
+
var _updateVarsValue = (reqdata) => {
|
|
294
|
+
const timestamp = new Date().getTime();
|
|
295
|
+
var changed = {};
|
|
296
|
+
if (apiProperty.ownFlag) {
|
|
297
|
+
var newItems = 0;
|
|
298
|
+
for (var i = 0; i < reqdata.length; i++) {
|
|
299
|
+
const id = reqdata[i].id;
|
|
300
|
+
if (id) {
|
|
301
|
+
if (!data.tags[id]) {
|
|
302
|
+
newItems++;
|
|
303
|
+
} else {
|
|
304
|
+
reqdata[i].daq = data.tags[id].daq;
|
|
305
|
+
}
|
|
306
|
+
requestItemsMap[id] = [reqdata[i]];
|
|
307
|
+
reqdata[i].changed = varsValue[id] && reqdata[i].value !== varsValue[id].value;
|
|
308
|
+
if (!utils.isNullOrUndefined(reqdata[i].value)) {
|
|
309
|
+
reqdata[i].value = deviceUtils.tagValueCompose(reqdata[i].value, data.tags[id]);
|
|
310
|
+
reqdata[i].timestamp = timestamp;
|
|
311
|
+
if (this.addDaq && deviceUtils.tagDaqToSave(reqdata[i], timestamp)) {
|
|
312
|
+
changed[id] = reqdata[i];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
reqdata[i].changed = false;
|
|
316
|
+
varsValue[id] = reqdata[i];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
newItemsCount = newItems;
|
|
320
|
+
return changed;
|
|
321
|
+
} else {
|
|
322
|
+
var someval = false;
|
|
323
|
+
var result = {};
|
|
324
|
+
var items = dataToFlat(reqdata, apiProperty);
|
|
325
|
+
for (var key in items) {
|
|
326
|
+
if (requestItemsMap[key]) {
|
|
327
|
+
for (var index in requestItemsMap[key]) {
|
|
328
|
+
var tag = requestItemsMap[key][index];
|
|
329
|
+
if (tag) {
|
|
330
|
+
someval = true;
|
|
331
|
+
result[tag.id] = {
|
|
332
|
+
id: tag.id,
|
|
333
|
+
value: (tag.memaddress) ? items[tag.memaddress] : items[key],
|
|
334
|
+
type: items[key].type,
|
|
335
|
+
daq: tag.daq,
|
|
336
|
+
tagref: tag
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (someval) {
|
|
343
|
+
for (var id in result) {
|
|
344
|
+
result[id].changed = varsValue[id] && result[id].value !== varsValue[id].value;
|
|
345
|
+
if (!utils.isNullOrUndefined(result[id].value)) {
|
|
346
|
+
result[id].value = deviceUtils.tagValueCompose(result[id].value, result[id].tagref);
|
|
347
|
+
result[id].timestamp = timestamp;
|
|
348
|
+
if (this.addDaq && deviceUtils.tagDaqToSave(result[id], timestamp)) {
|
|
349
|
+
changed[id] = result[id];
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
result[id].changed = false;
|
|
353
|
+
varsValue[id] = result[id];
|
|
354
|
+
}
|
|
355
|
+
return changed;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Emit the webapi connection status
|
|
363
|
+
* @param {*} status
|
|
364
|
+
*/
|
|
365
|
+
var _emitStatus = function (status) {
|
|
366
|
+
lastStatus = status;
|
|
367
|
+
events.emit('device-status:changed', { id: data.id, status: status });
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Emit the webapi Tags values array { id: <name>, value: <value>, type: <type> }
|
|
372
|
+
* @param {*} values
|
|
373
|
+
*/
|
|
374
|
+
var _emitValues = function (values) {
|
|
375
|
+
events.emit('device-value:changed', { id: data.id, values: values });
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Used to manage the async connection and polling automation (that not overloading)
|
|
380
|
+
* @param {*} check
|
|
381
|
+
*/
|
|
382
|
+
var _checkWorking = function (check) {
|
|
383
|
+
if (check && working) {
|
|
384
|
+
overloading++;
|
|
385
|
+
logger.warn(`'${data.name}' working (connection || polling) overload! ${overloading}`);
|
|
386
|
+
// !The driver don't give the break connection
|
|
387
|
+
if (overloading >= 3) {
|
|
388
|
+
connected = false;
|
|
389
|
+
// disconnect();
|
|
390
|
+
} else {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
working = check;
|
|
395
|
+
overloading = 0;
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Cheack and parse the value return converted value
|
|
401
|
+
* @param {*} type as string
|
|
402
|
+
* @param {*} value as string
|
|
403
|
+
* return converted value
|
|
404
|
+
*/
|
|
405
|
+
var _parseValue = function (type, value) {
|
|
406
|
+
if (type === 'number') {
|
|
407
|
+
return parseFloat(value);
|
|
408
|
+
} else if (type === 'boolean') {
|
|
409
|
+
return Boolean(value);
|
|
410
|
+
} else if (type === 'string') {
|
|
411
|
+
return value;
|
|
412
|
+
} else {
|
|
413
|
+
let val = parseFloat(value);
|
|
414
|
+
if (Number.isNaN(val)) {
|
|
415
|
+
// maybe boolean
|
|
416
|
+
val = Number(value);
|
|
417
|
+
// maybe string
|
|
418
|
+
if (Number.isNaN(val)) {
|
|
419
|
+
val = value;
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
val = parseFloat(val.toFixed(5));
|
|
423
|
+
}
|
|
424
|
+
return val;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function dataToFlat(data, property) {
|
|
430
|
+
|
|
431
|
+
var parseTree = function(nodes, id, parent) {
|
|
432
|
+
let result = {};
|
|
433
|
+
let nodeId = id;
|
|
434
|
+
if (parent) {
|
|
435
|
+
nodeId = parent + ':' + nodeId;
|
|
436
|
+
}
|
|
437
|
+
if (Array.isArray(nodes)) {
|
|
438
|
+
let idx = 0;
|
|
439
|
+
for(var key in nodes) {
|
|
440
|
+
let tres = parseTree(nodes[key], '[' + idx++ + ']', nodeId);
|
|
441
|
+
Object.keys(tres).forEach( key => {
|
|
442
|
+
result[key] = tres[key];
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
} else if (nodes && typeof nodes === 'object') {
|
|
446
|
+
for(var key in nodes) {
|
|
447
|
+
let tres = parseTree(nodes[key], key, nodeId);
|
|
448
|
+
Object.keys(tres).forEach( key => {
|
|
449
|
+
result[key] = tres[key];
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
result[nodeId] = nodes;
|
|
454
|
+
}
|
|
455
|
+
return result;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (property.format === 'CSV') {
|
|
459
|
+
|
|
460
|
+
} else if (property.format === 'JSON') {
|
|
461
|
+
return parseTree(data);
|
|
462
|
+
}
|
|
463
|
+
return data;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Return the result of http request
|
|
468
|
+
*/
|
|
469
|
+
function getRequestResult(property) {
|
|
470
|
+
return new Promise(function (resolve, reject) {
|
|
471
|
+
try {
|
|
472
|
+
if (property.method === 'GET') {
|
|
473
|
+
axios.get(property.address).then(res => {
|
|
474
|
+
resolve(res.data);
|
|
475
|
+
}).catch(err => {
|
|
476
|
+
reject(err);
|
|
477
|
+
});
|
|
478
|
+
} else {
|
|
479
|
+
reject('getrequestresult-error: method is missing!');
|
|
480
|
+
}
|
|
481
|
+
} catch (err) {
|
|
482
|
+
reject('getrequestresult-error: ' + err);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
module.exports = {
|
|
488
|
+
init: function (settings) {
|
|
489
|
+
// deviceCloseTimeout = settings.deviceCloseTimeout || 15000;
|
|
490
|
+
},
|
|
491
|
+
create: function (data, logger, events) {
|
|
492
|
+
return new HTTPclient(data, logger, events);
|
|
493
|
+
},
|
|
494
|
+
getRequestResult: getRequestResult
|
|
495
|
+
}
|