camstreamerlib 4.0.0-beta.6 → 4.0.0-beta.60

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 (265) hide show
  1. package/README.md +142 -38
  2. package/cjs/CamOverlayAPI.js +135 -92
  3. package/cjs/CamScripterAPI.js +52 -42
  4. package/cjs/CamStreamerAPI.js +83 -39
  5. package/cjs/CamSwitcherAPI.js +141 -123
  6. package/cjs/PlaneTrackerAPI.js +247 -0
  7. package/cjs/VapixAPI.js +323 -233
  8. package/cjs/{CreatePackage.js → bin/CreatePackage.js} +22 -19
  9. package/cjs/errors/errors.js +113 -1
  10. package/cjs/index.js +28 -5
  11. package/cjs/internal/ProxyClient.js +28 -32
  12. package/cjs/{CamSwitcherEvents.js → internal/WsEvents.js} +28 -22
  13. package/cjs/internal/types.js +2 -0
  14. package/cjs/internal/utils.js +22 -3
  15. package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +17 -14
  16. package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
  17. package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +5 -17
  18. package/cjs/node/CamOverlayPainter/ResourceManager.js +72 -0
  19. package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +16 -13
  20. package/cjs/node/DefaultClient.js +10 -12
  21. package/cjs/{internal → node}/Digest.js +8 -5
  22. package/cjs/node/Digest.test.js +13 -0
  23. package/cjs/node/HttpRequestSender.js +14 -4
  24. package/cjs/node/HttpServer.js +15 -12
  25. package/cjs/{VapixEvents.js → node/VapixEvents.js} +10 -10
  26. package/cjs/node/WsClient.js +30 -20
  27. package/cjs/node/events/AxisCameraStationEvents.js +53 -0
  28. package/cjs/node/events/GenetecAgent.js +123 -0
  29. package/cjs/node/index.js +38 -5
  30. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +92 -0
  31. package/cjs/types/CamOverlayAPI/accuweatherSchema.js +47 -0
  32. package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +72 -0
  33. package/cjs/types/CamOverlayAPI/imagesSchema.js +9 -0
  34. package/cjs/types/CamOverlayAPI/index.js +27 -0
  35. package/cjs/types/CamOverlayAPI/infotickerSchema.js +26 -0
  36. package/cjs/types/CamOverlayAPI/pipSchema.js +39 -0
  37. package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +26 -0
  38. package/cjs/types/CamOverlayAPI/ptzSchema.js +12 -0
  39. package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +132 -0
  40. package/cjs/types/CamOverlayAPI/screenSharingSchema.js +8 -0
  41. package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +91 -0
  42. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +8 -0
  43. package/cjs/types/CamOverlayDrawingAPI.js +2 -0
  44. package/cjs/types/CamOverlayPainter.js +14 -0
  45. package/cjs/types/CamScripterAPI.js +24 -8
  46. package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
  47. package/cjs/types/CamStreamerAPI.js +34 -3
  48. package/cjs/types/CamSwitcherAPI.js +38 -1
  49. package/cjs/types/GenetecAgent.js +31 -0
  50. package/cjs/types/PlaneTrackerAPI.js +310 -0
  51. package/cjs/types/VapixAPI.js +71 -13
  52. package/cjs/types/VapixEvents.js +2 -0
  53. package/cjs/types/common.js +4 -2
  54. package/cjs/types/ws/CamOverlayEvents.js +19 -0
  55. package/cjs/types/ws/CamStreamerEvents.js +32 -0
  56. package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +8 -0
  57. package/cjs/types/ws/PlaneTrackerEvents.js +194 -0
  58. package/cjs/web/DefaultClient.js +26 -10
  59. package/cjs/web/WsClient.js +16 -18
  60. package/cjs/ws/CamOverlayEvents.js +24 -0
  61. package/cjs/ws/CamStreamerEvents.js +24 -0
  62. package/cjs/ws/CamSwitcherEvents.js +24 -0
  63. package/cjs/ws/PlaneTrackerEvents.js +30 -0
  64. package/esm/CamOverlayAPI.js +131 -88
  65. package/esm/CamScripterAPI.js +48 -38
  66. package/esm/CamStreamerAPI.js +81 -38
  67. package/esm/CamSwitcherAPI.js +137 -119
  68. package/esm/PlaneTrackerAPI.js +243 -0
  69. package/esm/VapixAPI.js +315 -225
  70. package/esm/{CreatePackage.js → bin/CreatePackage.js} +3 -3
  71. package/esm/errors/errors.js +96 -0
  72. package/esm/index.js +20 -4
  73. package/esm/internal/ProxyClient.js +28 -32
  74. package/esm/{CamSwitcherEvents.js → internal/WsEvents.js} +26 -20
  75. package/esm/internal/utils.js +17 -1
  76. package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +12 -12
  77. package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
  78. package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +2 -13
  79. package/esm/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +7 -5
  80. package/esm/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +11 -11
  81. package/esm/node/DefaultClient.js +10 -12
  82. package/esm/{internal → node}/Digest.js +1 -1
  83. package/esm/node/Digest.test.js +11 -0
  84. package/esm/node/HttpRequestSender.js +14 -4
  85. package/esm/node/HttpServer.js +5 -5
  86. package/esm/{VapixEvents.js → node/VapixEvents.js} +10 -10
  87. package/esm/node/WsClient.js +22 -15
  88. package/esm/{events → node/events}/AxisCameraStationEvents.js +18 -13
  89. package/esm/node/events/GenetecAgent.js +119 -0
  90. package/esm/node/index.js +17 -2
  91. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +76 -0
  92. package/esm/types/CamOverlayAPI/accuweatherSchema.js +44 -0
  93. package/esm/types/CamOverlayAPI/customGraphicsSchema.js +69 -0
  94. package/esm/types/CamOverlayAPI/imagesSchema.js +6 -0
  95. package/esm/types/CamOverlayAPI/index.js +11 -0
  96. package/esm/types/CamOverlayAPI/infotickerSchema.js +23 -0
  97. package/esm/types/CamOverlayAPI/pipSchema.js +36 -0
  98. package/esm/types/CamOverlayAPI/ptzCompassSchema.js +23 -0
  99. package/esm/types/CamOverlayAPI/ptzSchema.js +9 -0
  100. package/esm/types/CamOverlayAPI/scoreBoardSchema.js +129 -0
  101. package/esm/types/CamOverlayAPI/screenSharingSchema.js +5 -0
  102. package/esm/types/CamOverlayAPI/serviceCommonTypes.js +88 -0
  103. package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +5 -0
  104. package/esm/types/CamOverlayPainter.js +11 -0
  105. package/esm/types/CamScripterAPI.js +23 -7
  106. package/esm/types/CamScripterAPICameraEventsGenerator.js +1 -0
  107. package/esm/types/CamStreamerAPI.js +33 -2
  108. package/esm/types/CamSwitcherAPI.js +38 -1
  109. package/esm/types/GenetecAgent.js +28 -0
  110. package/esm/types/PlaneTrackerAPI.js +307 -0
  111. package/esm/types/VapixAPI.js +70 -12
  112. package/esm/types/VapixEvents.js +1 -0
  113. package/esm/types/common.js +3 -1
  114. package/esm/types/ws/CamOverlayEvents.js +16 -0
  115. package/esm/types/ws/CamStreamerEvents.js +29 -0
  116. package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +8 -0
  117. package/esm/types/ws/PlaneTrackerEvents.js +191 -0
  118. package/esm/web/DefaultClient.js +26 -10
  119. package/esm/web/WsClient.js +16 -18
  120. package/esm/ws/CamOverlayEvents.js +20 -0
  121. package/esm/ws/CamStreamerEvents.js +20 -0
  122. package/esm/ws/CamSwitcherEvents.js +20 -0
  123. package/esm/ws/PlaneTrackerEvents.js +26 -0
  124. package/package.json +29 -11
  125. package/types/CamOverlayAPI.d.ts +867 -0
  126. package/types/CamScripterAPI.d.ts +46 -0
  127. package/types/CamStreamerAPI.d.ts +64 -0
  128. package/types/CamSwitcherAPI.d.ts +167 -0
  129. package/types/PlaneTrackerAPI.d.ts +229 -0
  130. package/types/VapixAPI.d.ts +118 -0
  131. package/types/bin/CreatePackage.d.ts +1 -0
  132. package/types/errors/errors.d.ts +83 -0
  133. package/types/index.d.ts +27 -0
  134. package/types/internal/ProxyClient.d.ts +10 -0
  135. package/types/internal/WsEvents.d.ts +37 -0
  136. package/types/internal/types.d.ts +47 -0
  137. package/{cjs → types}/internal/utils.d.ts +4 -1
  138. package/{cjs → types}/internal/versionCompare.d.ts +2 -2
  139. package/types/node/CamOverlayDrawingAPI.d.ts +41 -0
  140. package/{esm → types/node}/CamOverlayPainter/Frame.d.ts +8 -37
  141. package/{cjs → types/node}/CamOverlayPainter/Painter.d.ts +5 -21
  142. package/types/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
  143. package/types/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
  144. package/types/node/DefaultClient.d.ts +16 -0
  145. package/types/node/Digest.test.d.ts +1 -0
  146. package/{esm → types}/node/HttpRequestSender.d.ts +1 -0
  147. package/{cjs → types}/node/HttpServer.d.ts +2 -2
  148. package/types/node/VapixEvents.d.ts +16 -0
  149. package/types/node/WsClient.d.ts +30 -0
  150. package/types/node/events/AxisCameraStationEvents.d.ts +12 -0
  151. package/types/node/events/GenetecAgent.d.ts +16 -0
  152. package/types/node/index.d.ts +17 -0
  153. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +4330 -0
  154. package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
  155. package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +700 -0
  156. package/types/types/CamOverlayAPI/imagesSchema.d.ts +95 -0
  157. package/types/types/CamOverlayAPI/index.d.ts +11 -0
  158. package/types/types/CamOverlayAPI/infotickerSchema.d.ts +96 -0
  159. package/types/types/CamOverlayAPI/pipSchema.d.ts +125 -0
  160. package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +96 -0
  161. package/types/types/CamOverlayAPI/ptzSchema.d.ts +118 -0
  162. package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
  163. package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
  164. package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +145 -0
  165. package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
  166. package/types/types/CamOverlayDrawingAPI.d.ts +48 -0
  167. package/types/types/CamOverlayPainter.d.ts +76 -0
  168. package/types/types/CamScripterAPI.d.ts +130 -0
  169. package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
  170. package/types/types/CamStreamerAPI.d.ts +272 -0
  171. package/{esm → types}/types/CamSwitcherAPI.d.ts +145 -66
  172. package/{esm/events → types/types}/GenetecAgent.d.ts +47 -47
  173. package/types/types/PlaneTrackerAPI.d.ts +918 -0
  174. package/{cjs → types}/types/VapixAPI.d.ts +647 -465
  175. package/types/types/VapixEvents.d.ts +15 -0
  176. package/{cjs → types}/types/common.d.ts +17 -5
  177. package/types/types/ws/CamOverlayEvents.d.ts +88 -0
  178. package/types/types/ws/CamStreamerEvents.d.ts +249 -0
  179. package/{cjs/types → types/types/ws}/CamSwitcherEvents.d.ts +77 -0
  180. package/types/types/ws/PlaneTrackerEvents.d.ts +1597 -0
  181. package/types/web/DefaultClient.d.ts +8 -0
  182. package/types/web/WsClient.d.ts +17 -0
  183. package/types/ws/CamOverlayEvents.d.ts +8 -0
  184. package/types/ws/CamStreamerEvents.d.ts +8 -0
  185. package/types/ws/CamSwitcherEvents.d.ts +8 -0
  186. package/types/ws/PlaneTrackerEvents.d.ts +9 -0
  187. package/cjs/CamOverlayAPI.d.ts +0 -31
  188. package/cjs/CamOverlayDrawingAPI.d.ts +0 -86
  189. package/cjs/CamOverlayPainter/Frame.d.ts +0 -96
  190. package/cjs/CamOverlayPainter/ResourceManager.d.ts +0 -14
  191. package/cjs/CamOverlayPainter/ResourceManager.js +0 -46
  192. package/cjs/CamScripterAPI.d.ts +0 -19
  193. package/cjs/CamScripterAPICameraEventsGenerator.d.ts +0 -74
  194. package/cjs/CamStreamerAPI.d.ts +0 -16
  195. package/cjs/CamSwitcherAPI.d.ts +0 -48
  196. package/cjs/CamSwitcherEvents.d.ts +0 -18
  197. package/cjs/VapixAPI.d.ts +0 -66
  198. package/cjs/VapixEvents.d.ts +0 -43
  199. package/cjs/errors/errors.d.ts +0 -34
  200. package/cjs/events/AxisCameraStationEvents.d.ts +0 -9
  201. package/cjs/events/AxisCameraStationEvents.js +0 -48
  202. package/cjs/events/GenetecAgent.d.ts +0 -174
  203. package/cjs/events/GenetecAgent.js +0 -123
  204. package/cjs/index.d.ts +0 -11
  205. package/cjs/internal/ProxyClient.d.ts +0 -11
  206. package/cjs/internal/common.d.ts +0 -39
  207. package/cjs/internal/common.js +0 -27
  208. package/cjs/node/DefaultClient.d.ts +0 -15
  209. package/cjs/node/HttpRequestSender.d.ts +0 -28
  210. package/cjs/node/WsClient.d.ts +0 -39
  211. package/cjs/node/WsEventClient.d.ts +0 -13
  212. package/cjs/node/WsEventClient.js +0 -22
  213. package/cjs/types/CamOverlayAPI.d.ts +0 -188
  214. package/cjs/types/CamOverlayAPI.js +0 -47
  215. package/cjs/types/CamScripterAPI.d.ts +0 -67
  216. package/cjs/types/CamStreamerAPI.d.ts +0 -139
  217. package/cjs/types/CamSwitcherAPI.d.ts +0 -814
  218. package/cjs/web/DefaultClient.d.ts +0 -6
  219. package/cjs/web/WsClient.d.ts +0 -13
  220. package/cjs/web/index.d.ts +0 -2
  221. package/esm/CamOverlayAPI.d.ts +0 -31
  222. package/esm/CamOverlayDrawingAPI.d.ts +0 -86
  223. package/esm/CamOverlayPainter/Painter.d.ts +0 -48
  224. package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -14
  225. package/esm/CamScripterAPI.d.ts +0 -19
  226. package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
  227. package/esm/CamStreamerAPI.d.ts +0 -16
  228. package/esm/CamSwitcherAPI.d.ts +0 -48
  229. package/esm/CamSwitcherEvents.d.ts +0 -18
  230. package/esm/VapixAPI.d.ts +0 -66
  231. package/esm/VapixEvents.d.ts +0 -43
  232. package/esm/errors/errors.d.ts +0 -34
  233. package/esm/events/AxisCameraStationEvents.d.ts +0 -9
  234. package/esm/events/GenetecAgent.js +0 -119
  235. package/esm/index.d.ts +0 -11
  236. package/esm/internal/Digest.d.ts +0 -4
  237. package/esm/internal/ProxyClient.d.ts +0 -11
  238. package/esm/internal/common.d.ts +0 -39
  239. package/esm/internal/common.js +0 -20
  240. package/esm/internal/constants.d.ts +0 -1
  241. package/esm/internal/transformers.d.ts +0 -5
  242. package/esm/internal/utils.d.ts +0 -11
  243. package/esm/internal/versionCompare.d.ts +0 -6
  244. package/esm/node/DefaultClient.d.ts +0 -15
  245. package/esm/node/HttpServer.d.ts +0 -21
  246. package/esm/node/WsClient.d.ts +0 -39
  247. package/esm/node/WsEventClient.d.ts +0 -13
  248. package/esm/node/WsEventClient.js +0 -18
  249. package/esm/node/index.d.ts +0 -2
  250. package/esm/types/CamOverlayAPI.d.ts +0 -188
  251. package/esm/types/CamOverlayAPI.js +0 -44
  252. package/esm/types/CamScripterAPI.d.ts +0 -67
  253. package/esm/types/CamStreamerAPI.d.ts +0 -139
  254. package/esm/types/CamSwitcherEvents.d.ts +0 -491
  255. package/esm/types/VapixAPI.d.ts +0 -1683
  256. package/esm/types/common.d.ts +0 -37
  257. package/esm/web/DefaultClient.d.ts +0 -6
  258. package/esm/web/WsClient.d.ts +0 -13
  259. package/esm/web/index.d.ts +0 -2
  260. /package/{cjs/CreatePackage.d.ts → esm/internal/types.js} +0 -0
  261. /package/esm/{CreatePackage.d.ts → types/CamOverlayDrawingAPI.js} +0 -0
  262. /package/{cjs → types}/internal/constants.d.ts +0 -0
  263. /package/{cjs → types}/internal/transformers.d.ts +0 -0
  264. /package/{cjs/internal → types/node}/Digest.d.ts +0 -0
  265. /package/{cjs/node → types/web}/index.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.audioSampleRatesResponseSchema = exports.dateTimeinfoSchema = exports.maxFpsResponseSchema = exports.audioDeviceRequestSchema = exports.audioDeviceSchema = exports.audioDeviceInputOutputSchema = exports.audioDeviceConnectionTypeSchema = exports.audioDeviceSignalingTypeSchema = exports.audioDeviceSignalingChannelTypeSchema = exports.cameraPTZItemSchema = exports.cameraPTZItemDataSchema = exports.PtzOverviewSchema = exports.sdCardWatchedStatuses = exports.guardTourSchema = exports.applicationListSchema = exports.APP_IDS = exports.applicationSchema = void 0;
3
+ exports.portSequenceStateSchema = exports.portSetSchema = exports.getPortsResponseSchema = exports.portStatusSchema = exports.audioSampleRatesResponseSchema = exports.timeZoneSchema = exports.dateTimeinfoSchema = exports.maxFpsResponseSchema = exports.audioDeviceRequestSchema = exports.audioDeviceSchema = exports.audioDeviceInputOutputSchema = exports.audioDeviceConnectionTypeSchema = exports.audioDeviceSignalingTypeSchema = exports.audioDeviceSignalingChannelTypeSchema = exports.cameraPTZItemSchema = exports.cameraPTZItemDataSchema = exports.ptzOverviewSchema = exports.sdCardInfoSchema = exports.sdCardWatchedStatuses = exports.guardTourSchema = exports.APP_IDS = exports.applicationListSchema = exports.applicationSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const transformers_1 = require("../internal/transformers");
6
6
  exports.applicationSchema = zod_1.z.object({
@@ -15,6 +15,19 @@ exports.applicationSchema = zod_1.z.object({
15
15
  VendorHomePage: zod_1.z.string().optional(),
16
16
  LicenseName: zod_1.z.string().optional(),
17
17
  });
18
+ exports.applicationListSchema = zod_1.z.array(exports.applicationSchema.extend({
19
+ appId: zod_1.z
20
+ .union([
21
+ zod_1.z.literal('CamStreamer'),
22
+ zod_1.z.literal('CamSwitcher'),
23
+ zod_1.z.literal('CamOverlay'),
24
+ zod_1.z.literal('CamScripter'),
25
+ zod_1.z.literal('PlaneTracker'),
26
+ zod_1.z.literal('Ndihxplugin'),
27
+ zod_1.z.literal('SportTracker'),
28
+ ])
29
+ .nullable(),
30
+ }));
18
31
  exports.APP_IDS = [
19
32
  'CamStreamer',
20
33
  'CamSwitcher',
@@ -22,15 +35,8 @@ exports.APP_IDS = [
22
35
  'CamScripter',
23
36
  'PlaneTracker',
24
37
  'Ndihxplugin',
38
+ 'SportTracker',
25
39
  ];
26
- exports.applicationListSchema = zod_1.z.object({
27
- reply: zod_1.z.object({
28
- $: zod_1.z.object({ result: zod_1.z.string() }),
29
- application: zod_1.z.array(zod_1.z.object({
30
- $: exports.applicationSchema,
31
- })),
32
- }),
33
- });
34
40
  exports.guardTourSchema = zod_1.z.object({
35
41
  id: zod_1.z.string(),
36
42
  camNbr: zod_1.z.unknown(),
@@ -52,7 +58,12 @@ const audioSampleRatesSchema = zod_1.z.object({
52
58
  });
53
59
  const audioSampleRatesOutSchema = audioSampleRatesSchema.transform(transformers_1.toCamelCaseDeep);
54
60
  exports.sdCardWatchedStatuses = ['OK', 'connected', 'disconnected'];
55
- exports.PtzOverviewSchema = zod_1.z.record(zod_1.z.number(), zod_1.z.array(zod_1.z.object({ id: zod_1.z.number(), name: zod_1.z.string() })));
61
+ exports.sdCardInfoSchema = zod_1.z.object({
62
+ status: zod_1.z.enum(exports.sdCardWatchedStatuses),
63
+ totalSize: zod_1.z.number(),
64
+ freeSize: zod_1.z.number(),
65
+ });
66
+ exports.ptzOverviewSchema = zod_1.z.record(zod_1.z.number(), zod_1.z.array(zod_1.z.object({ id: zod_1.z.number(), name: zod_1.z.string() })));
56
67
  exports.cameraPTZItemDataSchema = zod_1.z.object({
57
68
  pan: zod_1.z.number().optional(),
58
69
  tilt: zod_1.z.number().optional(),
@@ -70,7 +81,7 @@ exports.audioDeviceSignalingChannelTypeSchema = zod_1.z.object({
70
81
  });
71
82
  exports.audioDeviceSignalingTypeSchema = zod_1.z.object({
72
83
  id: zod_1.z.string(),
73
- powerType: zod_1.z.string(),
84
+ powerType: zod_1.z.string().optional(),
74
85
  channels: zod_1.z.array(exports.audioDeviceSignalingChannelTypeSchema),
75
86
  });
76
87
  exports.audioDeviceConnectionTypeSchema = zod_1.z.object({
@@ -97,7 +108,9 @@ const audioDeviceFromRequestSchema = zod_1.z.object({
97
108
  inputs: zod_1.z.array(exports.audioDeviceInputOutputSchema).optional(),
98
109
  outputs: zod_1.z.array(exports.audioDeviceInputOutputSchema).optional(),
99
110
  });
100
- exports.audioDeviceRequestSchema = zod_1.z.object({ devices: zod_1.z.array(audioDeviceFromRequestSchema) });
111
+ exports.audioDeviceRequestSchema = zod_1.z.object({
112
+ data: zod_1.z.object({ devices: zod_1.z.array(audioDeviceFromRequestSchema) }),
113
+ });
101
114
  exports.maxFpsResponseSchema = zod_1.z.object({
102
115
  data: zod_1.z
103
116
  .array(zod_1.z.object({
@@ -115,9 +128,23 @@ exports.dateTimeinfoSchema = zod_1.z.object({
115
128
  dstEnabled: zod_1.z.boolean(),
116
129
  localDateTime: zod_1.z.string(),
117
130
  posixTimeZone: zod_1.z.string(),
118
- timeZone: zod_1.z.string(),
131
+ timeZone: zod_1.z.string().optional(),
119
132
  }),
120
133
  });
134
+ exports.timeZoneSchema = zod_1.z.discriminatedUnion('status', [
135
+ zod_1.z.object({
136
+ status: zod_1.z.literal('success'),
137
+ data: zod_1.z.object({
138
+ activeTimeZone: zod_1.z.string(),
139
+ }),
140
+ }),
141
+ zod_1.z.object({
142
+ status: zod_1.z.literal('error'),
143
+ error: zod_1.z.object({
144
+ message: zod_1.z.string(),
145
+ }),
146
+ }),
147
+ ]);
121
148
  exports.audioSampleRatesResponseSchema = zod_1.z.object({
122
149
  data: zod_1.z.object({
123
150
  encoders: zod_1.z
@@ -128,3 +155,34 @@ exports.audioSampleRatesResponseSchema = zod_1.z.object({
128
155
  .partial(),
129
156
  }),
130
157
  });
158
+ exports.portStatusSchema = zod_1.z.object({
159
+ port: zod_1.z.string(),
160
+ state: zod_1.z.enum(['open', 'closed']),
161
+ configurable: zod_1.z.boolean(),
162
+ readonly: zod_1.z.boolean().optional(),
163
+ usage: zod_1.z.string(),
164
+ direction: zod_1.z.enum(['input', 'output']),
165
+ name: zod_1.z.string(),
166
+ normalState: zod_1.z.enum(['open', 'closed']),
167
+ });
168
+ exports.getPortsResponseSchema = zod_1.z.object({
169
+ apiVersion: zod_1.z.string(),
170
+ context: zod_1.z.string(),
171
+ method: zod_1.z.literal('getPorts'),
172
+ data: zod_1.z.object({
173
+ numberOfPorts: zod_1.z.number(),
174
+ items: zod_1.z.array(exports.portStatusSchema),
175
+ }),
176
+ });
177
+ exports.portSetSchema = zod_1.z.object({
178
+ port: zod_1.z.string(),
179
+ state: zod_1.z.enum(['open', 'closed']),
180
+ usage: zod_1.z.string().optional(),
181
+ direction: zod_1.z.enum(['input', 'output']).optional(),
182
+ name: zod_1.z.string().optional(),
183
+ normalState: zod_1.z.enum(['open', 'closed']).optional(),
184
+ });
185
+ exports.portSequenceStateSchema = zod_1.z.object({
186
+ state: zod_1.z.enum(['open', 'closed']),
187
+ time: zod_1.z.number().min(0).max(65535),
188
+ });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = void 0;
3
+ exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.sdCardStorageTypeSchema = exports.flashStorageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.audioChannelSchema = zod_1.z.union([zod_1.z.literal('mono'), zod_1.z.literal('stereo')]);
6
6
  exports.audioChannelCountSchema = zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(2)]);
7
7
  exports.h264ProfileSchema = zod_1.z.union([zod_1.z.literal('high'), zod_1.z.literal('main'), zod_1.z.literal('baseline')]);
8
- exports.storageTypeSchema = zod_1.z.union([zod_1.z.literal('SD_DISK'), zod_1.z.literal('FLASH')]);
8
+ exports.flashStorageTypeSchema = zod_1.z.literal('FLASH');
9
+ exports.sdCardStorageTypeSchema = zod_1.z.literal('SD_DISK');
10
+ exports.storageTypeSchema = zod_1.z.union([exports.sdCardStorageTypeSchema, exports.flashStorageTypeSchema]);
9
11
  exports.networkCameraListSchema = zod_1.z.array(zod_1.z.object({
10
12
  name: zod_1.z.string(),
11
13
  ip: zod_1.z.string(),
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coEventsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const coEventsDataSchema = zod_1.z.discriminatedUnion('type', [
6
+ zod_1.z.object({ type: zod_1.z.literal('authorization'), state: zod_1.z.string() }),
7
+ zod_1.z.object({
8
+ type: zod_1.z.literal('ServiceStart'),
9
+ serviceId: zod_1.z.number(),
10
+ }),
11
+ zod_1.z.object({
12
+ type: zod_1.z.literal('ServiceStop'),
13
+ serviceId: zod_1.z.number(),
14
+ }),
15
+ ]);
16
+ exports.coEventsSchema = zod_1.z.discriminatedUnion('type', [
17
+ zod_1.z.object({ type: zod_1.z.literal('init'), data: coEventsDataSchema }),
18
+ ...coEventsDataSchema.options,
19
+ ]);
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.csEventsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const csEventsDataSchema = zod_1.z.discriminatedUnion('type', [
6
+ zod_1.z.object({ type: zod_1.z.literal('authorization'), state: zod_1.z.string() }),
7
+ zod_1.z.object({
8
+ type: zod_1.z.literal('StreamState'),
9
+ streamID: zod_1.z.number(),
10
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
11
+ active: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
12
+ automationState: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
13
+ isStreaming: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
14
+ }),
15
+ zod_1.z.object({
16
+ type: zod_1.z.literal('CS_API_SUCCESS'),
17
+ apiCall: zod_1.z.string(),
18
+ message: zod_1.z.string(),
19
+ streamID: zod_1.z.string(),
20
+ }),
21
+ zod_1.z.object({
22
+ type: zod_1.z.literal('CS_API_ERROR'),
23
+ apiCall: zod_1.z.string(),
24
+ message: zod_1.z.string(),
25
+ streamID: zod_1.z.string(),
26
+ code: zod_1.z.string(),
27
+ }),
28
+ ]);
29
+ exports.csEventsSchema = zod_1.z.discriminatedUnion('type', [
30
+ zod_1.z.object({ type: zod_1.z.literal('init'), data: csEventsDataSchema }),
31
+ ...csEventsDataSchema.options,
32
+ ]);
@@ -19,6 +19,14 @@ const cswEventsDataSchema = zod_1.z.discriminatedUnion('type', [
19
19
  clip_name: zod_1.z.string().optional(),
20
20
  master_audio: zod_1.z.boolean(),
21
21
  }),
22
+ zod_1.z.object({
23
+ type: zod_1.z.literal('StreamSwitchVideoError'),
24
+ playlist_name: zod_1.z.string(),
25
+ playlist_active_stream: zod_1.z.number(),
26
+ stream_name: zod_1.z.string().optional(),
27
+ clip_name: zod_1.z.string().optional(),
28
+ info: zod_1.z.string(),
29
+ }),
22
30
  zod_1.z.object({
23
31
  type: zod_1.z.literal('StreamSwitchAudioError'),
24
32
  stream_name: zod_1.z.string().optional(),
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ptrEventsSchema = exports.planeTrackerUserActionData = exports.PlaneTrackerUserActions = exports.PlaneTrackerWsEvents = void 0;
4
+ const zod_1 = require("zod");
5
+ const PlaneTrackerAPI_1 = require("../PlaneTrackerAPI");
6
+ const apiFlightDataSchema = zod_1.z.object({
7
+ icao: zod_1.z.string(),
8
+ lat: zod_1.z.number(),
9
+ lon: zod_1.z.number(),
10
+ heading: zod_1.z.number(),
11
+ groundSpeed: zod_1.z.number(),
12
+ altitudeAMSL: zod_1.z.number(),
13
+ cameraDistance: zod_1.z.number(),
14
+ autoTrackingOrder: zod_1.z.number(),
15
+ whiteListed: zod_1.z.boolean(),
16
+ blackListed: zod_1.z.boolean(),
17
+ priorityListed: zod_1.z.boolean(),
18
+ autoSelectionIgnored: zod_1.z.boolean(),
19
+ signalQuality: zod_1.z.number(),
20
+ emergencyState: zod_1.z.boolean(),
21
+ emergencyStatusMessage: zod_1.z.string(),
22
+ });
23
+ const apiUserSchema = zod_1.z.object({
24
+ userId: zod_1.z.string(),
25
+ userName: zod_1.z.string(),
26
+ userPriority: zod_1.z.number(),
27
+ ip: zod_1.z.string(),
28
+ });
29
+ const apiStringUserSchema = zod_1.z.object({
30
+ userId: zod_1.z.string(),
31
+ userName: zod_1.z.string(),
32
+ userPriority: zod_1.z.string(),
33
+ });
34
+ var PlaneTrackerWsEvents;
35
+ (function (PlaneTrackerWsEvents) {
36
+ PlaneTrackerWsEvents["FLIGHT_LIST"] = "FLIGHT_LIST";
37
+ PlaneTrackerWsEvents["CAMERA_POSITION"] = "CAMERA_POSITION";
38
+ PlaneTrackerWsEvents["TRACKING_START"] = "TRACKING_START";
39
+ PlaneTrackerWsEvents["TRACKING_STOP"] = "TRACKING_STOP";
40
+ PlaneTrackerWsEvents["USER_ACTION"] = "USER_ACTION";
41
+ PlaneTrackerWsEvents["CONNECTED_USERS"] = "CONNECTED_USERS";
42
+ PlaneTrackerWsEvents["FORCE_TRACKING_STATUS"] = "FORCE_TRACKING_STATUS";
43
+ })(PlaneTrackerWsEvents || (exports.PlaneTrackerWsEvents = PlaneTrackerWsEvents = {}));
44
+ var PlaneTrackerUserActions;
45
+ (function (PlaneTrackerUserActions) {
46
+ PlaneTrackerUserActions["TRACK_ICAO"] = "trackIcao.cgi";
47
+ PlaneTrackerUserActions["RESET_ICAO"] = "resetIcao.cgi";
48
+ PlaneTrackerUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
49
+ PlaneTrackerUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
50
+ PlaneTrackerUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
51
+ PlaneTrackerUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
52
+ PlaneTrackerUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
53
+ PlaneTrackerUserActions["SET_ZONES"] = "setZones.cgi";
54
+ PlaneTrackerUserActions["RESET_PTZ_CALIBRATION"] = "resetPtzCalibration.cgi";
55
+ PlaneTrackerUserActions["LOCK_API"] = "lockApi.cgi";
56
+ PlaneTrackerUserActions["UNLOCK_API"] = "unlockApi.cgi";
57
+ })(PlaneTrackerUserActions || (exports.PlaneTrackerUserActions = PlaneTrackerUserActions = {}));
58
+ exports.planeTrackerUserActionData = zod_1.z.discriminatedUnion('cgi', [
59
+ zod_1.z.object({
60
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.TRACK_ICAO),
61
+ ip: zod_1.z.string(),
62
+ params: apiStringUserSchema.extend({
63
+ icao: zod_1.z.string(),
64
+ }),
65
+ }),
66
+ zod_1.z.object({
67
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.RESET_ICAO),
68
+ ip: zod_1.z.string(),
69
+ params: apiStringUserSchema,
70
+ }),
71
+ zod_1.z.object({
72
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.SET_PRIORITY_LIST),
73
+ ip: zod_1.z.string(),
74
+ params: apiStringUserSchema,
75
+ postJsonBody: zod_1.z.object({
76
+ priorityList: zod_1.z.array(zod_1.z.string()),
77
+ }),
78
+ }),
79
+ zod_1.z.object({
80
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.SET_BLACK_LIST),
81
+ ip: zod_1.z.string(),
82
+ params: apiStringUserSchema,
83
+ postJsonBody: zod_1.z.object({
84
+ blackList: zod_1.z.array(zod_1.z.string()),
85
+ }),
86
+ }),
87
+ zod_1.z.object({
88
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.SET_WHITE_LIST),
89
+ ip: zod_1.z.string(),
90
+ params: apiStringUserSchema,
91
+ postJsonBody: zod_1.z.object({
92
+ whiteList: zod_1.z.array(zod_1.z.string()),
93
+ }),
94
+ }),
95
+ zod_1.z.object({
96
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.GO_TO_COORDINATES),
97
+ ip: zod_1.z.string(),
98
+ params: apiStringUserSchema.extend({
99
+ lat: zod_1.z.string(),
100
+ lon: zod_1.z.string(),
101
+ }),
102
+ }),
103
+ zod_1.z.object({
104
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.SET_TRACKING_MODE),
105
+ ip: zod_1.z.string(),
106
+ params: apiStringUserSchema,
107
+ postJsonBody: PlaneTrackerAPI_1.trackingModeSchema,
108
+ }),
109
+ zod_1.z.object({
110
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.SET_ZONES),
111
+ ip: zod_1.z.string(),
112
+ params: apiStringUserSchema,
113
+ postJsonBody: PlaneTrackerAPI_1.zonesSchema,
114
+ }),
115
+ zod_1.z.object({
116
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.RESET_PTZ_CALIBRATION),
117
+ ip: zod_1.z.string(),
118
+ params: apiStringUserSchema,
119
+ }),
120
+ zod_1.z.object({
121
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.LOCK_API),
122
+ ip: zod_1.z.string(),
123
+ params: apiStringUserSchema.extend({
124
+ timeout: zod_1.z.string(),
125
+ }),
126
+ }),
127
+ zod_1.z.object({
128
+ cgi: zod_1.z.literal(PlaneTrackerUserActions.UNLOCK_API),
129
+ ip: zod_1.z.string(),
130
+ params: apiStringUserSchema,
131
+ }),
132
+ ]);
133
+ const ptrEventsDataSchema = zod_1.z.discriminatedUnion('type', [
134
+ zod_1.z.object({
135
+ type: zod_1.z.literal('CAMERA_POSITION'),
136
+ lat: zod_1.z.number(),
137
+ lon: zod_1.z.number(),
138
+ azimuth: zod_1.z.number().min(0).max(360),
139
+ elevation: zod_1.z.number().min(-90).max(90),
140
+ fov: zod_1.z.number(),
141
+ }),
142
+ zod_1.z.object({
143
+ type: zod_1.z.literal('TRACKING_START'),
144
+ icao: zod_1.z.string(),
145
+ }),
146
+ zod_1.z.object({
147
+ type: zod_1.z.literal('TRACKING_STOP'),
148
+ }),
149
+ zod_1.z.object({
150
+ type: zod_1.z.literal('FLIGHT_LIST'),
151
+ list: zod_1.z.array(apiFlightDataSchema),
152
+ }),
153
+ zod_1.z.object({
154
+ type: zod_1.z.literal('USER_ACTION'),
155
+ ip: zod_1.z.string(),
156
+ params: apiStringUserSchema.extend({
157
+ lat: zod_1.z.string().optional(),
158
+ lon: zod_1.z.string().optional(),
159
+ timeout: zod_1.z.string().optional(),
160
+ }),
161
+ cgi: zod_1.z.enum([
162
+ PlaneTrackerUserActions.TRACK_ICAO,
163
+ PlaneTrackerUserActions.RESET_ICAO,
164
+ PlaneTrackerUserActions.SET_PRIORITY_LIST,
165
+ PlaneTrackerUserActions.SET_BLACK_LIST,
166
+ PlaneTrackerUserActions.SET_WHITE_LIST,
167
+ PlaneTrackerUserActions.GO_TO_COORDINATES,
168
+ PlaneTrackerUserActions.SET_TRACKING_MODE,
169
+ PlaneTrackerUserActions.SET_ZONES,
170
+ PlaneTrackerUserActions.RESET_PTZ_CALIBRATION,
171
+ PlaneTrackerUserActions.LOCK_API,
172
+ PlaneTrackerUserActions.UNLOCK_API,
173
+ ]),
174
+ postJsonBody: zod_1.z.any(),
175
+ }),
176
+ zod_1.z.object({
177
+ type: zod_1.z.literal('CONNECTED_USERS'),
178
+ users: zod_1.z.array(apiUserSchema),
179
+ }),
180
+ zod_1.z.object({
181
+ type: zod_1.z.literal('FORCE_TRACKING_STATUS'),
182
+ enabled: zod_1.z.boolean(),
183
+ icao: zod_1.z.string().optional(),
184
+ }),
185
+ zod_1.z.object({
186
+ type: zod_1.z.literal('API_LOCK_STATUS'),
187
+ isLocked: zod_1.z.boolean(),
188
+ user: apiUserSchema.optional(),
189
+ }),
190
+ ]);
191
+ exports.ptrEventsSchema = zod_1.z.discriminatedUnion('type', [
192
+ zod_1.z.object({ type: zod_1.z.literal('init'), data: ptrEventsDataSchema }),
193
+ ...ptrEventsDataSchema.options,
194
+ ]);
@@ -3,18 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultClient = void 0;
4
4
  const utils_1 = require("../internal/utils");
5
5
  class DefaultClient {
6
- get(url, parameters, headers) {
7
- return fetch((0, utils_1.addParametersToPath)(url, parameters), {
8
- method: 'GET',
9
- headers: headers,
10
- });
6
+ domain;
7
+ constructor(domain = '') {
8
+ this.domain = domain;
11
9
  }
12
- post(url, data, parameters, headers) {
13
- return fetch((0, utils_1.addParametersToPath)(url, parameters), {
10
+ get = (params) => {
11
+ return this.fetchWithTimeout((0, utils_1.addParametersToPath)(params.path, params.parameters), {
12
+ method: 'GET',
13
+ headers: params.headers,
14
+ }, params.timeout);
15
+ };
16
+ post = (params) => {
17
+ return this.fetchWithTimeout((0, utils_1.addParametersToPath)(params.path, params.parameters), {
14
18
  method: 'POST',
15
- body: data,
16
- headers: headers,
17
- });
19
+ body: params.data,
20
+ headers: params.headers,
21
+ }, params.timeout);
22
+ };
23
+ async fetchWithTimeout(path, options, timeout) {
24
+ const controller = new AbortController();
25
+ const timeoutId = timeout !== undefined ? setTimeout(() => controller.abort(), timeout) : null;
26
+ try {
27
+ return await fetch(`${this.domain}${path}`, { ...options, signal: controller.signal });
28
+ }
29
+ finally {
30
+ if (timeoutId) {
31
+ clearTimeout(timeoutId);
32
+ }
33
+ }
18
34
  }
19
35
  }
20
36
  exports.DefaultClient = DefaultClient;
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WsClient = void 0;
4
- const REFRESH_TIMEOUT = 5_000;
4
+ const REFRESH_TIMEOUT = 5000;
5
5
  class WsClient {
6
6
  getUrl;
7
- getAuthToken;
8
7
  isDestroyed = false;
9
8
  ws = null;
10
9
  restartTimeout = null;
11
- constructor(getUrl, getAuthToken) {
10
+ constructor(getUrl) {
12
11
  this.getUrl = getUrl;
13
- this.getAuthToken = getAuthToken;
14
12
  }
15
13
  init() {
16
14
  if (this.isDestroyed) {
@@ -18,32 +16,32 @@ class WsClient {
18
16
  }
19
17
  this.destroyWebsocket();
20
18
  const ws = new WebSocket(this.getUrl(), 'events');
21
- ws.onopen = async () => {
22
- try {
23
- const token = await this.getAuthToken();
24
- ws.send(JSON.stringify({ authorization: token }));
25
- }
26
- catch (error) {
27
- console.error('Error sending auth token:', error);
28
- ws.close();
29
- }
30
- };
31
- ws.onmessage = (e) => this.onmessage(e);
19
+ ws.binaryType = 'arraybuffer';
20
+ ws.onopen = () => this.onOpen();
21
+ ws.onmessage = (e) => this.onMessage(e.data);
32
22
  ws.onclose = () => {
33
- this.restartTimeout = setTimeout(() => this.init(), REFRESH_TIMEOUT);
23
+ this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
34
24
  };
35
25
  this.ws = ws;
36
26
  }
37
27
  send = (msg) => {
38
28
  this.ws?.send(msg);
39
29
  };
40
- onmessage = (_) => { };
30
+ onMessage = (_) => { };
31
+ onOpen = () => { };
32
+ onClose = () => { };
33
+ onError = (error) => {
34
+ console.error(error);
35
+ };
36
+ reconnect = () => {
37
+ this.ws?.close();
38
+ };
41
39
  destroy = () => {
42
40
  this.isDestroyed = true;
43
41
  this.destroyWebsocket();
44
42
  };
45
43
  destroyWebsocket() {
46
- if (this.restartTimeout) {
44
+ if (this.restartTimeout !== null) {
47
45
  clearTimeout(this.restartTimeout);
48
46
  this.restartTimeout = null;
49
47
  }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CamOverlayEvents = void 0;
4
+ const WsEvents_1 = require("../internal/WsEvents");
5
+ const CamOverlayEvents_1 = require("../types/ws/CamOverlayEvents");
6
+ class CamOverlayEvents extends WsEvents_1.WsEvents {
7
+ getAuthToken;
8
+ constructor(ws, getAuthToken) {
9
+ super((data) => CamOverlayEvents_1.coEventsSchema.parse(data), ws);
10
+ this.getAuthToken = getAuthToken;
11
+ this.ws.onOpen = this.sendInitMsg;
12
+ }
13
+ sendInitMsg = async () => {
14
+ try {
15
+ const token = await this.getAuthToken();
16
+ this.ws.send(JSON.stringify({ authorization: token }));
17
+ }
18
+ catch (error) {
19
+ console.error('Error on open:', error);
20
+ this.ws.reconnect();
21
+ }
22
+ };
23
+ }
24
+ exports.CamOverlayEvents = CamOverlayEvents;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CamStreamerEvents = void 0;
4
+ const WsEvents_1 = require("../internal/WsEvents");
5
+ const CamStreamerEvents_1 = require("../types/ws/CamStreamerEvents");
6
+ class CamStreamerEvents extends WsEvents_1.WsEvents {
7
+ getAuthToken;
8
+ constructor(ws, getAuthToken) {
9
+ super((data) => CamStreamerEvents_1.csEventsSchema.parse(data), ws);
10
+ this.getAuthToken = getAuthToken;
11
+ this.ws.onOpen = this.sendInitMsg;
12
+ }
13
+ sendInitMsg = async () => {
14
+ try {
15
+ const token = await this.getAuthToken();
16
+ this.ws.send(JSON.stringify({ authorization: token }));
17
+ }
18
+ catch (error) {
19
+ console.error('Error on open:', error);
20
+ this.ws.reconnect();
21
+ }
22
+ };
23
+ }
24
+ exports.CamStreamerEvents = CamStreamerEvents;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CamSwitcherEvents = void 0;
4
+ const WsEvents_1 = require("../internal/WsEvents");
5
+ const CamSwitcherEvents_1 = require("../types/ws/CamSwitcherEvents");
6
+ class CamSwitcherEvents extends WsEvents_1.WsEvents {
7
+ getAuthToken;
8
+ constructor(ws, getAuthToken) {
9
+ super((data) => CamSwitcherEvents_1.cswEventsSchema.parse(data), ws);
10
+ this.getAuthToken = getAuthToken;
11
+ this.ws.onOpen = this.sendInitMsg;
12
+ }
13
+ sendInitMsg = async () => {
14
+ try {
15
+ const token = await this.getAuthToken();
16
+ this.ws.send(JSON.stringify({ authorization: token }));
17
+ }
18
+ catch (error) {
19
+ console.error('Error on open:', error);
20
+ this.ws.reconnect();
21
+ }
22
+ };
23
+ }
24
+ exports.CamSwitcherEvents = CamSwitcherEvents;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaneTrackerEvents = void 0;
4
+ const WsEvents_1 = require("../internal/WsEvents");
5
+ const PlaneTrackerEvents_1 = require("../types/ws/PlaneTrackerEvents");
6
+ class PlaneTrackerEvents extends WsEvents_1.WsEvents {
7
+ _apiUser;
8
+ constructor(ws, _apiUser) {
9
+ super((data) => {
10
+ const parsedData = PlaneTrackerEvents_1.ptrEventsSchema.parse(data);
11
+ if (parsedData.type === PlaneTrackerEvents_1.PlaneTrackerWsEvents.USER_ACTION) {
12
+ const { type, ...actionData } = parsedData;
13
+ const userAction = PlaneTrackerEvents_1.planeTrackerUserActionData.parse(actionData);
14
+ return { ...userAction, type };
15
+ }
16
+ return parsedData;
17
+ }, ws);
18
+ this._apiUser = _apiUser;
19
+ this.ws.onOpen = this.sendInitMsg;
20
+ }
21
+ sendInitMsg = () => {
22
+ this.ws.send(JSON.stringify({
23
+ type: 'USER_INFO',
24
+ userId: this._apiUser.userId,
25
+ userName: this._apiUser.userName,
26
+ userPriority: this._apiUser.userPriority,
27
+ }));
28
+ };
29
+ }
30
+ exports.PlaneTrackerEvents = PlaneTrackerEvents;