camstreamerlib 4.0.0-beta.16 → 4.0.0-beta.161
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/README.md +143 -38
- package/cjs/CamOverlayAPI.d.ts +603 -327
- package/cjs/CamOverlayAPI.js +99 -184
- package/cjs/CamScripterAPI.d.ts +41 -17
- package/cjs/CamScripterAPI.js +54 -56
- package/cjs/CamStreamerAPI.d.ts +3557 -14
- package/cjs/CamStreamerAPI.js +174 -52
- package/cjs/CamSwitcherAPI.d.ts +158 -42
- package/cjs/CamSwitcherAPI.js +148 -189
- package/cjs/PlaneTrackerAPI.d.ts +238 -29
- package/cjs/PlaneTrackerAPI.js +187 -101
- package/cjs/VapixAPI.d.ts +97 -44
- package/cjs/VapixAPI.js +400 -207
- package/cjs/{CreatePackage.js → bin/CreatePackage.js} +44 -18
- package/cjs/errors/errors.d.ts +75 -4
- package/cjs/errors/errors.js +142 -7
- package/cjs/index.d.ts +20 -9
- package/cjs/index.js +28 -14
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/ProxyClient.d.ts +8 -9
- package/cjs/internal/ProxyClient.js +28 -34
- package/cjs/internal/WsEvents.d.ts +38 -0
- package/cjs/{CamSwitcherEvents.js → internal/WsEvents.js} +33 -22
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/internal/transformers.js +8 -8
- package/cjs/internal/types.d.ts +32 -20
- package/cjs/internal/utils.d.ts +1 -3
- package/cjs/internal/utils.js +1 -12
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +28 -20
- package/{esm → cjs/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.d.ts +5 -21
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +5 -17
- package/cjs/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/cjs/node/CamOverlayPainter/ResourceManager.js +72 -0
- package/cjs/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +13 -13
- package/cjs/node/DefaultClient.d.ts +6 -6
- package/cjs/node/DefaultClient.js +12 -16
- package/cjs/{internal → node}/Digest.js +24 -1
- package/cjs/node/Digest.test.js +13 -0
- package/cjs/node/HttpRequestSender.d.ts +1 -0
- package/cjs/node/HttpRequestSender.js +14 -4
- package/cjs/node/HttpServer.d.ts +1 -1
- package/cjs/node/HttpServer.js +29 -6
- package/cjs/node/TimeZoneDaemon.d.ts +6 -0
- package/cjs/node/TimeZoneDaemon.js +29 -0
- package/cjs/node/VapixEvents.d.ts +16 -0
- package/cjs/{VapixEvents.js → node/VapixEvents.js} +10 -10
- package/cjs/node/WsClient.d.ts +9 -18
- package/cjs/node/WsClient.js +27 -20
- package/cjs/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/cjs/{events → node/events}/AxisCameraStationEvents.js +18 -13
- package/cjs/node/events/GenetecAgent.d.ts +16 -0
- package/cjs/node/events/GenetecAgent.js +124 -0
- package/cjs/node/index.d.ts +18 -2
- package/cjs/node/index.js +39 -5
- package/cjs/{models/CamOverlayAPI/widgetsSchema.d.ts → types/CamOverlayAPI/CamOverlayAPI.d.ts} +2794 -767
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +135 -0
- package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.d.ts +19 -19
- package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.js +7 -8
- package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.d.ts +108 -107
- package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.js +5 -6
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
- package/{esm/models → cjs/types}/CamOverlayAPI/imagesSchema.d.ts +19 -19
- package/cjs/types/CamOverlayAPI/imagesSchema.js +9 -0
- package/cjs/{models → types}/CamOverlayAPI/index.d.ts +3 -4
- package/cjs/{models → types}/CamOverlayAPI/index.js +3 -4
- package/cjs/{models → types}/CamOverlayAPI/infotickerSchema.d.ts +27 -27
- package/cjs/{models → types}/CamOverlayAPI/infotickerSchema.js +6 -7
- package/{esm/models → cjs/types}/CamOverlayAPI/pipSchema.d.ts +21 -21
- package/cjs/{models → types}/CamOverlayAPI/pipSchema.js +5 -6
- package/{esm/models → cjs/types}/CamOverlayAPI/ptzCompassSchema.d.ts +18 -15
- package/cjs/{models → types}/CamOverlayAPI/ptzCompassSchema.js +5 -5
- package/cjs/{models → types}/CamOverlayAPI/ptzSchema.d.ts +28 -28
- package/cjs/types/CamOverlayAPI/ptzSchema.js +12 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +132 -0
- package/{esm/models → cjs/types}/CamOverlayAPI/screenSharingSchema.d.ts +15 -15
- package/cjs/types/CamOverlayAPI/screenSharingSchema.js +8 -0
- package/{esm/models/CamOverlayAPI/widgetCommonSchema.d.ts → cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts} +80 -60
- package/cjs/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/serviceCommonTypes.js} +39 -21
- package/{esm/models → cjs/types}/CamOverlayAPI/webCameraSharingSchema.d.ts +15 -15
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +8 -0
- package/cjs/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/cjs/types/CamOverlayDrawingAPI.js +2 -0
- package/cjs/types/CamOverlayPainter.d.ts +76 -0
- package/cjs/types/CamOverlayPainter.js +14 -0
- package/cjs/types/CamScripterAPI.d.ts +75 -23
- package/cjs/types/CamScripterAPI.js +20 -8
- package/cjs/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +26085 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +222 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +574 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.js +23 -0
- package/cjs/types/CamStreamerAPI/index.d.ts +6 -0
- package/cjs/types/CamStreamerAPI/index.js +22 -0
- package/cjs/types/{CamStreamerAPI.d.ts → CamStreamerAPI/oldStreamSchema.d.ts} +104 -35
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +53 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +570 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +123 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8642 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +534 -0
- package/cjs/types/CamStreamerAPI/windySchema.js +19 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +542 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +22 -0
- package/cjs/types/CamSwitcherAPI.d.ts +205 -121
- package/cjs/types/CamSwitcherAPI.js +38 -1
- package/cjs/{events → types}/GenetecAgent.d.ts +47 -47
- package/cjs/types/GenetecAgent.js +31 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +993 -0
- package/cjs/types/PlaneTrackerAPI.js +336 -0
- package/cjs/types/VapixAPI.d.ts +281 -22
- package/cjs/types/VapixAPI.js +74 -4
- package/cjs/types/VapixEvents.d.ts +15 -0
- package/cjs/types/VapixEvents.js +2 -0
- package/cjs/types/common.d.ts +43 -3
- package/cjs/types/common.js +17 -2
- package/cjs/types/ws/CamOverlayEvents.d.ts +88 -0
- package/cjs/types/ws/CamOverlayEvents.js +19 -0
- package/cjs/types/ws/CamStreamerEvents.d.ts +282 -0
- package/cjs/types/ws/CamStreamerEvents.js +36 -0
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +1703 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +207 -0
- package/cjs/web/DefaultClient.d.ts +7 -5
- package/cjs/web/DefaultClient.js +25 -11
- package/cjs/web/WsClient.d.ts +9 -5
- package/cjs/web/WsClient.js +16 -18
- package/cjs/ws/CamOverlayEvents.d.ts +8 -0
- package/cjs/ws/CamOverlayEvents.js +24 -0
- package/cjs/ws/CamStreamerEvents.d.ts +8 -0
- package/cjs/ws/CamStreamerEvents.js +24 -0
- package/cjs/ws/CamSwitcherEvents.d.ts +8 -0
- package/cjs/ws/CamSwitcherEvents.js +24 -0
- package/cjs/ws/PlaneTrackerEvents.d.ts +9 -0
- package/cjs/ws/PlaneTrackerEvents.js +30 -0
- package/esm/CamOverlayAPI.js +99 -184
- package/esm/CamScripterAPI.js +52 -57
- package/esm/CamStreamerAPI.js +172 -51
- package/esm/CamSwitcherAPI.js +151 -192
- package/esm/PlaneTrackerAPI.js +186 -100
- package/esm/VapixAPI.js +402 -209
- package/esm/{CreatePackage.js → bin/CreatePackage.js} +16 -16
- package/esm/errors/errors.js +124 -6
- package/esm/index.js +20 -9
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/ProxyClient.js +28 -34
- package/esm/{CamSwitcherEvents.js → internal/WsEvents.js} +31 -20
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/transformers.js +1 -1
- package/esm/internal/utils.js +0 -9
- package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +26 -18
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +2 -13
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +7 -5
- package/esm/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +11 -11
- package/esm/node/DefaultClient.js +12 -16
- package/esm/node/Digest.test.js +11 -0
- package/esm/node/HttpRequestSender.js +14 -4
- package/esm/node/HttpServer.js +1 -1
- package/esm/node/TimeZoneDaemon.js +25 -0
- package/esm/{VapixEvents.js → node/VapixEvents.js} +10 -10
- package/esm/node/WsClient.js +22 -15
- package/esm/{events → node/events}/AxisCameraStationEvents.js +18 -13
- package/esm/node/events/GenetecAgent.js +120 -0
- package/esm/node/index.js +18 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +113 -0
- package/esm/{models → types}/CamOverlayAPI/accuweatherSchema.js +3 -4
- package/esm/{models → types}/CamOverlayAPI/customGraphicsSchema.js +3 -4
- package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
- package/esm/types/CamOverlayAPI/imagesSchema.js +6 -0
- package/esm/{models → types}/CamOverlayAPI/index.js +3 -4
- package/esm/{models → types}/CamOverlayAPI/infotickerSchema.js +3 -4
- package/esm/{models → types}/CamOverlayAPI/pipSchema.js +4 -5
- package/esm/{models → types}/CamOverlayAPI/ptzCompassSchema.js +4 -4
- package/esm/types/CamOverlayAPI/ptzSchema.js +9 -0
- package/esm/types/CamOverlayAPI/scoreBoardSchema.js +129 -0
- package/esm/types/CamOverlayAPI/screenSharingSchema.js +5 -0
- package/esm/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/serviceCommonTypes.js} +38 -20
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +5 -0
- package/esm/types/CamOverlayDrawingAPI.js +1 -0
- package/esm/types/CamOverlayPainter.js +11 -0
- package/esm/types/CamScripterAPI.js +19 -7
- package/esm/types/CamScripterAPICameraEventsGenerator.js +1 -0
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +199 -0
- package/esm/types/CamStreamerAPI/facebookSchema.js +17 -0
- package/esm/types/CamStreamerAPI/index.js +6 -0
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +50 -0
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +120 -0
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +13 -0
- package/esm/types/CamStreamerAPI/youtubeSchema.js +16 -0
- package/esm/types/CamSwitcherAPI.js +38 -1
- package/esm/types/GenetecAgent.js +28 -0
- package/esm/types/PlaneTrackerAPI.js +333 -0
- package/esm/types/VapixAPI.js +73 -3
- package/esm/types/VapixEvents.js +1 -0
- package/esm/types/common.js +16 -1
- package/esm/types/ws/CamOverlayEvents.js +16 -0
- package/esm/types/ws/CamStreamerEvents.js +33 -0
- package/esm/types/ws/PlaneTrackerEvents.js +204 -0
- package/esm/web/DefaultClient.js +25 -11
- package/esm/web/WsClient.js +16 -18
- package/esm/ws/CamOverlayEvents.js +20 -0
- package/esm/ws/CamStreamerEvents.js +20 -0
- package/esm/ws/CamSwitcherEvents.js +20 -0
- package/esm/ws/PlaneTrackerEvents.js +26 -0
- package/package.json +46 -12
- package/{esm → types}/CamOverlayAPI.d.ts +603 -327
- package/types/CamScripterAPI.d.ts +43 -0
- package/types/CamStreamerAPI.d.ts +3559 -0
- package/types/CamSwitcherAPI.d.ts +168 -0
- package/types/PlaneTrackerAPI.d.ts +239 -0
- package/types/VapixAPI.d.ts +131 -0
- package/types/bin/CreatePackage.d.ts +1 -0
- package/types/errors/errors.d.ts +108 -0
- package/types/index.d.ts +28 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/ProxyClient.d.ts +10 -0
- package/types/internal/WsEvents.d.ts +38 -0
- package/{esm → types}/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +47 -0
- package/{esm → types}/internal/utils.d.ts +1 -3
- package/{esm → types}/internal/versionCompare.d.ts +2 -2
- package/types/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/{cjs → types/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/{esm → types/node}/CamOverlayPainter/Painter.d.ts +5 -21
- package/types/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/types/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/types/node/DefaultClient.d.ts +16 -0
- package/types/node/Digest.test.d.ts +1 -0
- package/{esm → types}/node/HttpRequestSender.d.ts +1 -0
- package/{esm → types}/node/HttpServer.d.ts +1 -1
- package/types/node/TimeZoneDaemon.d.ts +6 -0
- package/types/node/VapixEvents.d.ts +16 -0
- package/types/node/WsClient.d.ts +30 -0
- package/types/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/types/node/events/GenetecAgent.d.ts +16 -0
- package/types/node/index.d.ts +18 -0
- package/{esm/models/CamOverlayAPI/widgetsSchema.d.ts → types/types/CamOverlayAPI/CamOverlayAPI.d.ts} +2794 -767
- package/{esm/models → types/types}/CamOverlayAPI/accuweatherSchema.d.ts +19 -19
- package/{esm/models → types/types}/CamOverlayAPI/customGraphicsSchema.d.ts +108 -107
- package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/{cjs/models → types/types}/CamOverlayAPI/imagesSchema.d.ts +19 -19
- package/{esm/models → types/types}/CamOverlayAPI/index.d.ts +3 -4
- package/{esm/models → types/types}/CamOverlayAPI/infotickerSchema.d.ts +27 -27
- package/{cjs/models → types/types}/CamOverlayAPI/pipSchema.d.ts +21 -21
- package/{cjs/models → types/types}/CamOverlayAPI/ptzCompassSchema.d.ts +18 -15
- package/{esm/models → types/types}/CamOverlayAPI/ptzSchema.d.ts +28 -28
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/{cjs/models → types/types}/CamOverlayAPI/screenSharingSchema.d.ts +15 -15
- package/{cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts → types/types/CamOverlayAPI/serviceCommonTypes.d.ts} +80 -60
- package/{cjs/models → types/types}/CamOverlayAPI/webCameraSharingSchema.d.ts +15 -15
- package/types/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/types/types/CamOverlayPainter.d.ts +76 -0
- package/types/types/CamScripterAPI.d.ts +119 -0
- package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +26085 -0
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +574 -0
- package/types/types/CamStreamerAPI/index.d.ts +6 -0
- package/{esm/types/CamStreamerAPI.d.ts → types/types/CamStreamerAPI/oldStreamSchema.d.ts} +104 -35
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +570 -0
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8642 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +534 -0
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +542 -0
- package/{esm → types}/types/CamSwitcherAPI.d.ts +205 -121
- package/{esm/events → types/types}/GenetecAgent.d.ts +47 -47
- package/types/types/PlaneTrackerAPI.d.ts +993 -0
- package/{esm → types}/types/VapixAPI.d.ts +281 -22
- package/types/types/VapixEvents.d.ts +15 -0
- package/types/types/common.d.ts +77 -0
- package/types/types/ws/CamOverlayEvents.d.ts +88 -0
- package/types/types/ws/CamStreamerEvents.d.ts +282 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +1703 -0
- package/types/web/DefaultClient.d.ts +8 -0
- package/types/web/WsClient.d.ts +17 -0
- package/types/ws/CamOverlayEvents.d.ts +8 -0
- package/types/ws/CamStreamerEvents.d.ts +8 -0
- package/types/ws/CamSwitcherEvents.d.ts +8 -0
- package/types/ws/PlaneTrackerEvents.d.ts +9 -0
- package/cjs/CamOverlayDrawingAPI.d.ts +0 -86
- package/cjs/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/cjs/CamOverlayPainter/ResourceManager.js +0 -46
- package/cjs/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/cjs/CamSwitcherEvents.d.ts +0 -18
- package/cjs/VapixEvents.d.ts +0 -43
- package/cjs/events/AxisCameraStationEvents.d.ts +0 -10
- package/cjs/events/GenetecAgent.js +0 -123
- package/cjs/models/CamOverlayAPI/constants.d.ts +0 -11
- package/cjs/models/CamOverlayAPI/constants.js +0 -14
- package/cjs/models/CamOverlayAPI/fileSchema.d.ts +0 -28
- package/cjs/models/CamOverlayAPI/fileSchema.js +0 -17
- package/cjs/models/CamOverlayAPI/imagesSchema.js +0 -10
- package/cjs/models/CamOverlayAPI/ptzSchema.js +0 -13
- package/cjs/models/CamOverlayAPI/screenSharingSchema.js +0 -9
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +0 -9
- package/cjs/models/CamOverlayAPI/widgetsSchema.js +0 -27
- package/cjs/node/WsEventClient.d.ts +0 -13
- package/cjs/node/WsEventClient.js +0 -22
- package/cjs/types/CamOverlayAPI.d.ts +0 -328
- package/cjs/types/CamOverlayAPI.js +0 -26
- package/cjs/types/CamStreamerAPI.js +0 -28
- package/esm/CamOverlayDrawingAPI.d.ts +0 -86
- package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/esm/CamScripterAPI.d.ts +0 -19
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/esm/CamStreamerAPI.d.ts +0 -16
- package/esm/CamSwitcherAPI.d.ts +0 -52
- package/esm/CamSwitcherEvents.d.ts +0 -18
- package/esm/PlaneTrackerAPI.d.ts +0 -30
- package/esm/VapixAPI.d.ts +0 -78
- package/esm/VapixEvents.d.ts +0 -43
- package/esm/errors/errors.d.ts +0 -37
- package/esm/events/AxisCameraStationEvents.d.ts +0 -10
- package/esm/events/GenetecAgent.js +0 -119
- package/esm/index.d.ts +0 -17
- package/esm/internal/ProxyClient.d.ts +0 -11
- package/esm/internal/types.d.ts +0 -35
- package/esm/models/CamOverlayAPI/constants.d.ts +0 -11
- package/esm/models/CamOverlayAPI/constants.js +0 -11
- package/esm/models/CamOverlayAPI/fileSchema.d.ts +0 -28
- package/esm/models/CamOverlayAPI/fileSchema.js +0 -14
- package/esm/models/CamOverlayAPI/imagesSchema.js +0 -7
- package/esm/models/CamOverlayAPI/ptzSchema.js +0 -10
- package/esm/models/CamOverlayAPI/screenSharingSchema.js +0 -6
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +0 -6
- package/esm/models/CamOverlayAPI/widgetsSchema.js +0 -24
- package/esm/node/DefaultClient.d.ts +0 -16
- package/esm/node/WsClient.d.ts +0 -39
- package/esm/node/WsEventClient.d.ts +0 -13
- package/esm/node/WsEventClient.js +0 -18
- package/esm/types/CamOverlayAPI.d.ts +0 -328
- package/esm/types/CamOverlayAPI.js +0 -14
- package/esm/types/CamScripterAPI.d.ts +0 -67
- package/esm/types/CamStreamerAPI.js +0 -25
- package/esm/types/common.d.ts +0 -37
- package/esm/web/DefaultClient.d.ts +0 -6
- package/esm/web/WsClient.d.ts +0 -13
- package/esm/web/index.d.ts +0 -2
- package/cjs/{CreatePackage.d.ts → bin/CreatePackage.d.ts} +0 -0
- package/cjs/{internal → node}/Digest.d.ts +0 -0
- package/{esm/CreatePackage.d.ts → cjs/node/Digest.test.d.ts} +0 -0
- package/{esm/types → cjs/types/ws}/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- package/esm/{internal → node}/Digest.js +0 -0
- package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- package/{esm → types}/internal/transformers.d.ts +0 -0
- package/{esm/internal → types/node}/Digest.d.ts +0 -0
- package/{cjs/types → types/types/ws}/CamSwitcherEvents.d.ts +8 -8
- /package/{esm/node → types/web}/index.d.ts +0 -0
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { CamOverlayDrawingAPI
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
8
|
-
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
9
|
-
export type TFrameOptions = {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
text?: string;
|
|
16
|
-
fontColor?: TRgb;
|
|
17
|
-
font?: string;
|
|
18
|
-
bgColor?: TRgba;
|
|
19
|
-
bgImage?: string;
|
|
20
|
-
bgType?: TObjectFitType;
|
|
21
|
-
borderRadius?: number;
|
|
22
|
-
borderWidth?: number;
|
|
23
|
-
borderColor?: TRgba;
|
|
24
|
-
customDraw?: TDrawingCallback;
|
|
25
|
-
layer?: number;
|
|
26
|
-
};
|
|
27
|
-
export type TFrameInfo = {
|
|
28
|
-
width: number;
|
|
29
|
-
height: number;
|
|
30
|
-
};
|
|
31
|
-
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
32
|
-
export interface Frame {
|
|
33
|
-
on(event: 'open', listener: () => void): this;
|
|
34
|
-
on(event: 'close', listener: () => void): this;
|
|
35
|
-
on(event: 'layoutChanged', listener: () => void): this;
|
|
36
|
-
emit(event: 'open'): boolean;
|
|
37
|
-
emit(event: 'close'): boolean;
|
|
38
|
-
emit(event: 'layoutChanged'): boolean;
|
|
39
|
-
}
|
|
3
|
+
import { CamOverlayDrawingAPI } from '../CamOverlayDrawingAPI';
|
|
4
|
+
import { TAlign, TCairoCreateResponse, TUploadImageResponse } from '../../types/CamOverlayDrawingAPI';
|
|
5
|
+
import { ResourceManager } from './ResourceManager';
|
|
6
|
+
import { TBg, TBorder, TDrawingCallback, TFrame, TFrameOptions, TObjectFitType, TRgb, TRgba, TText, TTmf } from '../../types/CamOverlayPainter';
|
|
40
7
|
export declare class Frame extends EventEmitter {
|
|
41
8
|
protected enabled: boolean;
|
|
42
9
|
protected posX: number;
|
|
@@ -64,17 +31,21 @@ export declare class Frame extends EventEmitter {
|
|
|
64
31
|
disable(): void;
|
|
65
32
|
setFramePosition(x: number, y: number): void;
|
|
66
33
|
setFrameSize(width: number, height: number): void;
|
|
34
|
+
getFrameInfo(): TFrame;
|
|
67
35
|
setText(text: string, align: TAlign, textType?: TTmf, fontColor?: TRgb): void;
|
|
68
36
|
setFontColor(fontColor: TRgb): void;
|
|
69
37
|
setFont(fontName: string): void;
|
|
70
38
|
setFontData(fontData: TCairoCreateResponse): void;
|
|
39
|
+
getTextInfo(): TText;
|
|
71
40
|
setBgColor(color: TRgba): void;
|
|
72
41
|
setBgImage(imageName: string, type?: TObjectFitType): void;
|
|
73
42
|
setBgImageData(imageData: TUploadImageResponse, type?: TObjectFitType): void;
|
|
74
43
|
setBgType(type: TObjectFitType): void;
|
|
44
|
+
getBgInfo(): TBg;
|
|
75
45
|
setBorderRadius(radius: number): void;
|
|
76
46
|
setBorderWidth(width: number): void;
|
|
77
47
|
setBorderColor(color: TRgba): void;
|
|
48
|
+
getBorderInfo(): TBorder;
|
|
78
49
|
setCustomDraw(customDraw: TDrawingCallback): void;
|
|
79
50
|
resetFont(): void;
|
|
80
51
|
resetBgColor(): void;
|
|
@@ -57,6 +57,14 @@ class Frame extends events_1.EventEmitter {
|
|
|
57
57
|
this.width = width;
|
|
58
58
|
this.height = height;
|
|
59
59
|
}
|
|
60
|
+
getFrameInfo() {
|
|
61
|
+
return {
|
|
62
|
+
x: this.posX,
|
|
63
|
+
y: this.posY,
|
|
64
|
+
width: this.width,
|
|
65
|
+
height: this.height,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
60
68
|
setText(text, align, textType = 'TFM_OVERFLOW', fontColor) {
|
|
61
69
|
this.text = text;
|
|
62
70
|
this.align = align;
|
|
@@ -76,6 +84,16 @@ class Frame extends events_1.EventEmitter {
|
|
|
76
84
|
this.fontName = undefined;
|
|
77
85
|
this.font = fontData;
|
|
78
86
|
}
|
|
87
|
+
getTextInfo() {
|
|
88
|
+
return {
|
|
89
|
+
text: this.text,
|
|
90
|
+
textAlign: this.align,
|
|
91
|
+
textType: this.textType,
|
|
92
|
+
fontColor: this.fontColor,
|
|
93
|
+
font: this.font,
|
|
94
|
+
fontName: this.fontName,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
79
97
|
setBgColor(color) {
|
|
80
98
|
this.bgColor = color;
|
|
81
99
|
}
|
|
@@ -92,6 +110,14 @@ class Frame extends events_1.EventEmitter {
|
|
|
92
110
|
setBgType(type) {
|
|
93
111
|
this.bgType = type;
|
|
94
112
|
}
|
|
113
|
+
getBgInfo() {
|
|
114
|
+
return {
|
|
115
|
+
bgColor: this.bgColor,
|
|
116
|
+
bgImage: this.bgImage,
|
|
117
|
+
bgImageName: this.bgImageName,
|
|
118
|
+
bgType: this.bgType,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
95
121
|
setBorderRadius(radius) {
|
|
96
122
|
this.borderRadius = radius;
|
|
97
123
|
}
|
|
@@ -101,6 +127,13 @@ class Frame extends events_1.EventEmitter {
|
|
|
101
127
|
setBorderColor(color) {
|
|
102
128
|
this.borderColor = color;
|
|
103
129
|
}
|
|
130
|
+
getBorderInfo() {
|
|
131
|
+
return {
|
|
132
|
+
borderRadius: this.borderRadius,
|
|
133
|
+
borderWidth: this.borderWidth,
|
|
134
|
+
borderColor: this.borderColor,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
104
137
|
setCustomDraw(customDraw) {
|
|
105
138
|
this.customDraw = customDraw;
|
|
106
139
|
}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import { CamOverlayDrawingAPI
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly center_left: readonly [-1, 0];
|
|
7
|
-
readonly bottom_left: readonly [-1, 1];
|
|
8
|
-
readonly top_center: readonly [0, -1];
|
|
9
|
-
readonly center: readonly [0, 0];
|
|
10
|
-
readonly bottom_center: readonly [0, 1];
|
|
11
|
-
readonly top_right: readonly [1, -1];
|
|
12
|
-
readonly center_right: readonly [1, 0];
|
|
13
|
-
readonly bottom_right: readonly [1, 1];
|
|
14
|
-
};
|
|
15
|
-
type TCoAlignment = keyof typeof COORD;
|
|
16
|
-
export type TPainterOptions = TFrameOptions & {
|
|
17
|
-
screenWidth: number;
|
|
18
|
-
screenHeight: number;
|
|
19
|
-
coAlignment: TCoAlignment;
|
|
20
|
-
};
|
|
1
|
+
import { CamOverlayDrawingAPI } from '../CamOverlayDrawingAPI';
|
|
2
|
+
import { CamOverlayDrawingOptions } from '../../types/CamOverlayDrawingAPI';
|
|
3
|
+
import { ResourceManager } from './ResourceManager';
|
|
4
|
+
import { Frame } from './Frame';
|
|
5
|
+
import { TCoAlignment, TPainterOptions } from '../../types/CamOverlayPainter';
|
|
21
6
|
export declare class Painter extends Frame {
|
|
22
7
|
private screenWidth;
|
|
23
8
|
private screenHeight;
|
|
@@ -45,4 +30,3 @@ export declare class Painter extends Frame {
|
|
|
45
30
|
private cleanupSurface;
|
|
46
31
|
private positionConvertor;
|
|
47
32
|
}
|
|
48
|
-
export { Frame, TFrameOptions as FrameOptions, ResourceManager, CamOverlayDrawingOptions };
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Painter = void 0;
|
|
4
4
|
const CamOverlayDrawingAPI_1 = require("../CamOverlayDrawingAPI");
|
|
5
5
|
const ResourceManager_1 = require("./ResourceManager");
|
|
6
|
-
exports.ResourceManager = ResourceManager_1.default;
|
|
7
6
|
const Frame_1 = require("./Frame");
|
|
8
|
-
|
|
9
|
-
exports.COORD = {
|
|
10
|
-
top_left: [-1, -1],
|
|
11
|
-
center_left: [-1, 0],
|
|
12
|
-
bottom_left: [-1, 1],
|
|
13
|
-
top_center: [0, -1],
|
|
14
|
-
center: [0, 0],
|
|
15
|
-
bottom_center: [0, 1],
|
|
16
|
-
top_right: [1, -1],
|
|
17
|
-
center_right: [1, 0],
|
|
18
|
-
bottom_right: [1, 1],
|
|
19
|
-
};
|
|
7
|
+
const CamOverlayPainter_1 = require("../../types/CamOverlayPainter");
|
|
20
8
|
class Painter extends Frame_1.Frame {
|
|
21
9
|
screenWidth;
|
|
22
10
|
screenHeight;
|
|
@@ -27,11 +15,11 @@ class Painter extends Frame_1.Frame {
|
|
|
27
15
|
layers = [];
|
|
28
16
|
constructor(opt, coopt) {
|
|
29
17
|
super(opt);
|
|
30
|
-
this.coAlignment =
|
|
18
|
+
this.coAlignment = CamOverlayPainter_1.COORD[opt.coAlignment];
|
|
31
19
|
this.screenWidth = opt.screenWidth;
|
|
32
20
|
this.screenHeight = opt.screenHeight;
|
|
33
21
|
this.cod = new CamOverlayDrawingAPI_1.CamOverlayDrawingAPI(coopt);
|
|
34
|
-
this.rm = new ResourceManager_1.
|
|
22
|
+
this.rm = new ResourceManager_1.ResourceManager(this.cod);
|
|
35
23
|
}
|
|
36
24
|
get camOverlayDrawingAPI() {
|
|
37
25
|
return this.cod;
|
|
@@ -71,7 +59,7 @@ class Painter extends Frame_1.Frame {
|
|
|
71
59
|
this.screenHeight = sh;
|
|
72
60
|
}
|
|
73
61
|
setCoAlignment(coAlignment) {
|
|
74
|
-
this.coAlignment =
|
|
62
|
+
this.coAlignment = CamOverlayPainter_1.COORD[coAlignment];
|
|
75
63
|
}
|
|
76
64
|
layoutChanged() {
|
|
77
65
|
this.refreshLayers = true;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CamOverlayDrawingAPI } from '../CamOverlayDrawingAPI';
|
|
2
|
+
import { TUploadImageResponse, TCairoCreateResponse } from '../../types/CamOverlayDrawingAPI';
|
|
3
|
+
export declare class ResourceManager {
|
|
4
|
+
private co;
|
|
5
|
+
private imgFileNames;
|
|
6
|
+
private fontFileNames;
|
|
7
|
+
private images;
|
|
8
|
+
private fonts;
|
|
9
|
+
constructor(co: CamOverlayDrawingAPI);
|
|
10
|
+
registerImage(moniker: string, fileName: string): void;
|
|
11
|
+
registerFont(moniker: string, fileName: string): void;
|
|
12
|
+
image(moniker: string): Promise<TUploadImageResponse | undefined>;
|
|
13
|
+
font(moniker: string): Promise<TCairoCreateResponse | undefined>;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ResourceManager = void 0;
|
|
27
|
+
const fs = __importStar(require("fs/promises"));
|
|
28
|
+
class ResourceManager {
|
|
29
|
+
co;
|
|
30
|
+
imgFileNames = {};
|
|
31
|
+
fontFileNames = {};
|
|
32
|
+
images = {};
|
|
33
|
+
fonts = {};
|
|
34
|
+
constructor(co) {
|
|
35
|
+
this.co = co;
|
|
36
|
+
}
|
|
37
|
+
registerImage(moniker, fileName) {
|
|
38
|
+
this.imgFileNames[moniker] = process.env.INSTALL_PATH + '/images/' + fileName;
|
|
39
|
+
}
|
|
40
|
+
registerFont(moniker, fileName) {
|
|
41
|
+
this.fontFileNames[moniker] = process.env.INSTALL_PATH + '/fonts/' + fileName;
|
|
42
|
+
}
|
|
43
|
+
async image(moniker) {
|
|
44
|
+
if (this.images[moniker] !== undefined) {
|
|
45
|
+
return this.images[moniker];
|
|
46
|
+
}
|
|
47
|
+
const path = this.imgFileNames[moniker];
|
|
48
|
+
if (path !== undefined) {
|
|
49
|
+
const imgData = await fs.readFile(path);
|
|
50
|
+
this.images[moniker] = await this.co.uploadImageData(imgData);
|
|
51
|
+
return this.images[moniker];
|
|
52
|
+
}
|
|
53
|
+
throw new Error('Error! Unknown image requested!');
|
|
54
|
+
}
|
|
55
|
+
async font(moniker) {
|
|
56
|
+
if (this.fonts[moniker] !== undefined) {
|
|
57
|
+
return this.fonts[moniker];
|
|
58
|
+
}
|
|
59
|
+
const path = this.fontFileNames[moniker];
|
|
60
|
+
if (path !== undefined) {
|
|
61
|
+
const fontData = await fs.readFile(path);
|
|
62
|
+
this.fonts[moniker] = await this.co.uploadFontData(fontData);
|
|
63
|
+
return this.fonts[moniker];
|
|
64
|
+
}
|
|
65
|
+
throw new Error('Error! Unknown font requested!');
|
|
66
|
+
}
|
|
67
|
+
clear() {
|
|
68
|
+
this.images = {};
|
|
69
|
+
this.fonts = {};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ResourceManager = ResourceManager;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { Options } from '../internal/types';
|
|
4
|
+
import { TCamScripterEvent, TEventDeclaration, TEventUndeclaration, TCamScripterResponse } from '../types/CamScripterAPICameraEventsGenerator';
|
|
5
|
+
export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
6
|
+
private tls;
|
|
7
|
+
private tlsInsecure;
|
|
8
|
+
private ip;
|
|
9
|
+
private port;
|
|
10
|
+
private user;
|
|
11
|
+
private pass;
|
|
12
|
+
private callId;
|
|
13
|
+
private sendMessages;
|
|
14
|
+
private timeoutCheckTimer;
|
|
15
|
+
private wsConnected;
|
|
16
|
+
private ws;
|
|
17
|
+
constructor(options?: Options);
|
|
18
|
+
connect(): void;
|
|
19
|
+
disconnect(): void;
|
|
20
|
+
declareEvent(eventDeclaration: TEventDeclaration): Promise<TCamScripterResponse>;
|
|
21
|
+
undeclareEvent(eventUndeclaration: TEventUndeclaration): Promise<TCamScripterResponse>;
|
|
22
|
+
sendEvent(event: TCamScripterEvent): Promise<TCamScripterResponse>;
|
|
23
|
+
private createWsClient;
|
|
24
|
+
private incomingWsMessageHandler;
|
|
25
|
+
private sendMessage;
|
|
26
|
+
private startMsgsTimeoutCheck;
|
|
27
|
+
private stopMsgsTimeoutCheck;
|
|
28
|
+
private reconnectWithError;
|
|
29
|
+
private reportErr;
|
|
30
|
+
private reportClose;
|
|
31
|
+
}
|
package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CamScripterAPICameraEventsGenerator = void 0;
|
|
4
|
-
const
|
|
5
|
-
const WsClient_1 = require("./
|
|
6
|
-
class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const WsClient_1 = require("./WsClient");
|
|
6
|
+
class CamScripterAPICameraEventsGenerator extends events_1.EventEmitter {
|
|
7
7
|
tls;
|
|
8
8
|
tlsInsecure;
|
|
9
9
|
ip;
|
|
@@ -27,14 +27,14 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
27
27
|
this.sendMessages = {};
|
|
28
28
|
this.wsConnected = false;
|
|
29
29
|
this.createWsClient();
|
|
30
|
-
EventEmitter.call(this);
|
|
30
|
+
events_1.EventEmitter.call(this);
|
|
31
31
|
}
|
|
32
32
|
connect() {
|
|
33
33
|
this.ws.open();
|
|
34
34
|
this.startMsgsTimeoutCheck();
|
|
35
35
|
}
|
|
36
36
|
disconnect() {
|
|
37
|
-
this.ws.
|
|
37
|
+
this.ws.destroy();
|
|
38
38
|
this.stopMsgsTimeoutCheck();
|
|
39
39
|
}
|
|
40
40
|
declareEvent(eventDeclaration) {
|
|
@@ -70,21 +70,21 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
70
70
|
protocol: 'camera-events',
|
|
71
71
|
};
|
|
72
72
|
this.ws = new WsClient_1.WsClient(options);
|
|
73
|
-
this.ws.
|
|
73
|
+
this.ws.onOpen = () => {
|
|
74
74
|
this.wsConnected = true;
|
|
75
75
|
this.emit('open');
|
|
76
|
-
}
|
|
77
|
-
this.ws.
|
|
78
|
-
this.ws.
|
|
76
|
+
};
|
|
77
|
+
this.ws.onMessage = (data) => this.incomingWsMessageHandler(data.toString());
|
|
78
|
+
this.ws.onError = (error) => {
|
|
79
79
|
this.reportErr(error);
|
|
80
|
-
}
|
|
81
|
-
this.ws.
|
|
80
|
+
};
|
|
81
|
+
this.ws.onClose = () => {
|
|
82
82
|
this.wsConnected = false;
|
|
83
83
|
this.reportClose();
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
}
|
|
86
86
|
incomingWsMessageHandler(msgData) {
|
|
87
|
-
const dataJSON = JSON.parse(msgData
|
|
87
|
+
const dataJSON = JSON.parse(msgData);
|
|
88
88
|
let errorResponse;
|
|
89
89
|
if ('error' in dataJSON) {
|
|
90
90
|
errorResponse = dataJSON;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { IClient, HttpOptions, TGetParams, TPostParams } from '../internal/types';
|
|
4
|
+
import { FormData as UndiciFormData, Response as UndiciResponse } from 'undici';
|
|
5
|
+
export declare class DefaultClient implements IClient<UndiciResponse, UndiciFormData | Buffer> {
|
|
5
6
|
private tls;
|
|
6
7
|
private ip;
|
|
7
8
|
private port;
|
|
@@ -9,8 +10,7 @@ export declare class DefaultClient implements IClient<UndiciResponse> {
|
|
|
9
10
|
private pass;
|
|
10
11
|
private httpRequestSender;
|
|
11
12
|
constructor(opt?: HttpOptions);
|
|
12
|
-
get
|
|
13
|
-
|
|
14
|
-
post: (url: string, data: string | Buffer | FormData, parameters?: TParameters | undefined, headers?: Record<string, string> | undefined) => Promise<UndiciResponse>;
|
|
13
|
+
get(params: TGetParams): Promise<UndiciResponse>;
|
|
14
|
+
post(params: TPostParams<UndiciFormData | Buffer>): Promise<UndiciResponse>;
|
|
15
15
|
private getBaseConnectionParams;
|
|
16
16
|
}
|
|
@@ -25,31 +25,27 @@ class DefaultClient {
|
|
|
25
25
|
}
|
|
26
26
|
this.httpRequestSender = new HttpRequestSender_1.HttpRequestSender(agentOptions);
|
|
27
27
|
}
|
|
28
|
-
get
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
get = (...params) => {
|
|
32
|
-
const [path, parameters, headers] = params;
|
|
33
|
-
const options = this.getBaseConnectionParams('GET', path, parameters ?? {});
|
|
34
|
-
options.headers = headers;
|
|
28
|
+
get(params) {
|
|
29
|
+
const { path, parameters, headers, timeout } = params;
|
|
30
|
+
const options = this.getBaseConnectionParams('GET', path, parameters, headers, timeout);
|
|
35
31
|
return this.httpRequestSender.sendRequest(options);
|
|
36
|
-
}
|
|
37
|
-
post
|
|
38
|
-
const
|
|
39
|
-
const options = this.getBaseConnectionParams('POST', path, parameters
|
|
40
|
-
options.headers = headers;
|
|
32
|
+
}
|
|
33
|
+
post(params) {
|
|
34
|
+
const { path, data, parameters, headers, timeout } = params;
|
|
35
|
+
const options = this.getBaseConnectionParams('POST', path, parameters, headers, timeout);
|
|
41
36
|
return this.httpRequestSender.sendRequest(options, data);
|
|
42
|
-
}
|
|
43
|
-
getBaseConnectionParams(method, path, params) {
|
|
44
|
-
const pathName = (0, utils_1.addParametersToPath)(path, params);
|
|
37
|
+
}
|
|
38
|
+
getBaseConnectionParams(method, path, params, headers, timeout) {
|
|
45
39
|
return {
|
|
46
40
|
method: method,
|
|
47
41
|
protocol: this.tls ? 'https:' : 'http:',
|
|
48
42
|
host: this.ip,
|
|
49
43
|
port: this.port,
|
|
50
|
-
path:
|
|
44
|
+
path: (0, utils_1.addParametersToPath)(path, params),
|
|
51
45
|
user: this.user,
|
|
52
46
|
pass: this.pass,
|
|
47
|
+
headers,
|
|
48
|
+
timeout,
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
51
|
}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.Digest = void 0;
|
|
4
|
-
const crypto = require("crypto");
|
|
27
|
+
const crypto = __importStar(require("crypto"));
|
|
5
28
|
class Digest {
|
|
6
29
|
nonceCount = 1;
|
|
7
30
|
getAuthHeader(user, pass, method, uri, wwwAuthenticateHeader) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Digest_1 = require("./Digest");
|
|
4
|
+
const globals_1 = require("@jest/globals");
|
|
5
|
+
(0, globals_1.describe)('Digest', () => {
|
|
6
|
+
(0, globals_1.describe)('getAuthHeader', () => {
|
|
7
|
+
(0, globals_1.test)('Checks, that Digest.getAuthHeader() returns correct value.', () => {
|
|
8
|
+
const testString = 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="5ccc069c403ebaf9f0171e9517f40e41"';
|
|
9
|
+
const value = 'Digest username="root",realm="testrealm@host.com",nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",uri="www.cz",response="63f54af3ce5cf193a7435d5c68625472",qop=auth,nc=00000001,cnonce="162d50aa594e9648"';
|
|
10
|
+
(0, globals_1.expect)(new Digest_1.Digest().getAuthHeader('root', 'pass', 'GET', 'www.cz', testString)).toBe(value);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpRequestSender = void 0;
|
|
4
|
-
const Digest_1 = require("
|
|
4
|
+
const Digest_1 = require("./Digest");
|
|
5
5
|
const undici_1 = require("undici");
|
|
6
6
|
class HttpRequestSender {
|
|
7
7
|
agent;
|
|
@@ -11,8 +11,18 @@ class HttpRequestSender {
|
|
|
11
11
|
connect: { rejectUnauthorized: agentOptions?.rejectUnaurhorized, keepAlive: agentOptions?.keepAlive },
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
sendRequest(options, postData) {
|
|
15
|
-
|
|
14
|
+
async sendRequest(options, postData) {
|
|
15
|
+
const stackHolder = { stack: '' };
|
|
16
|
+
Error.captureStackTrace(stackHolder, this.sendRequest);
|
|
17
|
+
try {
|
|
18
|
+
return await this.sendRequestWithAuth(options, postData);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof Error) {
|
|
22
|
+
err.stack = `${err.stack}\nCaptured at:\n${stackHolder.stack}`;
|
|
23
|
+
}
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
27
|
async sendRequestWithAuth(options, postData, wwwAuthenticateHeader) {
|
|
18
28
|
options.timeout ??= 10000;
|
|
@@ -82,7 +92,7 @@ class HttpRequestSender {
|
|
|
82
92
|
return authData.digest.getAuthHeader(options.user, options.pass, options.method ?? 'GET', options.path, authData.wwwAuthenticateHeader);
|
|
83
93
|
}
|
|
84
94
|
else {
|
|
85
|
-
return `Basic ${
|
|
95
|
+
return `Basic ${Buffer.from(`${options.user}:${options.pass}`).toString('base64')}`;
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
98
|
}
|
package/cjs/node/HttpServer.d.ts
CHANGED
package/cjs/node/HttpServer.js
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.HttpServer = void 0;
|
|
4
|
-
const http = require("http");
|
|
5
|
-
const url = require("url");
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const
|
|
9
|
-
class HttpServer extends EventEmitter {
|
|
27
|
+
const http = __importStar(require("http"));
|
|
28
|
+
const url = __importStar(require("url"));
|
|
29
|
+
const fs = __importStar(require("fs"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
const events_1 = require("events");
|
|
32
|
+
class HttpServer extends events_1.EventEmitter {
|
|
10
33
|
host;
|
|
11
34
|
port;
|
|
12
35
|
registeredPaths;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeZoneDaemon = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const execPromise = (0, util_1.promisify)(child_process_1.exec);
|
|
7
|
+
class TimeZoneDaemon {
|
|
8
|
+
checkTimer;
|
|
9
|
+
constructor(checkInterval = 60000) {
|
|
10
|
+
this.checkTimer = setInterval(() => this.checkAndUpdateTimeZone(), checkInterval);
|
|
11
|
+
}
|
|
12
|
+
stop() {
|
|
13
|
+
clearInterval(this.checkTimer);
|
|
14
|
+
}
|
|
15
|
+
async checkAndUpdateTimeZone() {
|
|
16
|
+
try {
|
|
17
|
+
const { stdout } = await execPromise('timedatectl show -p Timezone --value');
|
|
18
|
+
const systemTimezone = stdout.toString().trim();
|
|
19
|
+
const nodeTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
20
|
+
if (systemTimezone !== nodeTimezone) {
|
|
21
|
+
process.env.TZ = systemTimezone;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error('Error checking/updating timezone:', error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.TimeZoneDaemon = TimeZoneDaemon;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter2 as EventEmitter } from 'eventemitter2';
|
|
2
|
+
import { Options } from '../internal/types';
|
|
3
|
+
export declare class VapixEvents extends EventEmitter {
|
|
4
|
+
private tls;
|
|
5
|
+
private tlsInsecure;
|
|
6
|
+
private ip;
|
|
7
|
+
private port;
|
|
8
|
+
private user;
|
|
9
|
+
private pass;
|
|
10
|
+
private ws;
|
|
11
|
+
constructor(options?: Options);
|
|
12
|
+
connect(): void;
|
|
13
|
+
disconnect(): void;
|
|
14
|
+
private createWsClient;
|
|
15
|
+
private isReservedEventName;
|
|
16
|
+
}
|