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.
- package/README.md +142 -38
- package/cjs/CamOverlayAPI.js +135 -92
- package/cjs/CamScripterAPI.js +52 -42
- package/cjs/CamStreamerAPI.js +83 -39
- package/cjs/CamSwitcherAPI.js +141 -123
- package/cjs/PlaneTrackerAPI.js +247 -0
- package/cjs/VapixAPI.js +323 -233
- package/cjs/{CreatePackage.js → bin/CreatePackage.js} +22 -19
- package/cjs/errors/errors.js +113 -1
- package/cjs/index.js +28 -5
- package/cjs/internal/ProxyClient.js +28 -32
- package/cjs/{CamSwitcherEvents.js → internal/WsEvents.js} +28 -22
- package/cjs/internal/types.js +2 -0
- package/cjs/internal/utils.js +22 -3
- package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +17 -14
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +5 -17
- package/cjs/node/CamOverlayPainter/ResourceManager.js +72 -0
- package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +16 -13
- package/cjs/node/DefaultClient.js +10 -12
- package/cjs/{internal → node}/Digest.js +8 -5
- package/cjs/node/Digest.test.js +13 -0
- package/cjs/node/HttpRequestSender.js +14 -4
- package/cjs/node/HttpServer.js +15 -12
- package/cjs/{VapixEvents.js → node/VapixEvents.js} +10 -10
- package/cjs/node/WsClient.js +30 -20
- package/cjs/node/events/AxisCameraStationEvents.js +53 -0
- package/cjs/node/events/GenetecAgent.js +123 -0
- package/cjs/node/index.js +38 -5
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +92 -0
- package/cjs/types/CamOverlayAPI/accuweatherSchema.js +47 -0
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +72 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.js +9 -0
- package/cjs/types/CamOverlayAPI/index.js +27 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.js +26 -0
- package/cjs/types/CamOverlayAPI/pipSchema.js +39 -0
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +26 -0
- package/cjs/types/CamOverlayAPI/ptzSchema.js +12 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +132 -0
- package/cjs/types/CamOverlayAPI/screenSharingSchema.js +8 -0
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +91 -0
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +8 -0
- package/cjs/types/CamOverlayDrawingAPI.js +2 -0
- package/cjs/types/CamOverlayPainter.js +14 -0
- package/cjs/types/CamScripterAPI.js +24 -8
- package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
- package/cjs/types/CamStreamerAPI.js +34 -3
- package/cjs/types/CamSwitcherAPI.js +38 -1
- package/cjs/types/GenetecAgent.js +31 -0
- package/cjs/types/PlaneTrackerAPI.js +310 -0
- package/cjs/types/VapixAPI.js +71 -13
- package/cjs/types/VapixEvents.js +2 -0
- package/cjs/types/common.js +4 -2
- package/cjs/types/ws/CamOverlayEvents.js +19 -0
- package/cjs/types/ws/CamStreamerEvents.js +32 -0
- package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +8 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +194 -0
- package/cjs/web/DefaultClient.js +26 -10
- package/cjs/web/WsClient.js +16 -18
- package/cjs/ws/CamOverlayEvents.js +24 -0
- package/cjs/ws/CamStreamerEvents.js +24 -0
- package/cjs/ws/CamSwitcherEvents.js +24 -0
- package/cjs/ws/PlaneTrackerEvents.js +30 -0
- package/esm/CamOverlayAPI.js +131 -88
- package/esm/CamScripterAPI.js +48 -38
- package/esm/CamStreamerAPI.js +81 -38
- package/esm/CamSwitcherAPI.js +137 -119
- package/esm/PlaneTrackerAPI.js +243 -0
- package/esm/VapixAPI.js +315 -225
- package/esm/{CreatePackage.js → bin/CreatePackage.js} +3 -3
- package/esm/errors/errors.js +96 -0
- package/esm/index.js +20 -4
- package/esm/internal/ProxyClient.js +28 -32
- package/esm/{CamSwitcherEvents.js → internal/WsEvents.js} +26 -20
- package/esm/internal/utils.js +17 -1
- package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +12 -12
- 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 +10 -12
- package/esm/{internal → node}/Digest.js +1 -1
- package/esm/node/Digest.test.js +11 -0
- package/esm/node/HttpRequestSender.js +14 -4
- package/esm/node/HttpServer.js +5 -5
- 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 +119 -0
- package/esm/node/index.js +17 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +76 -0
- package/esm/types/CamOverlayAPI/accuweatherSchema.js +44 -0
- package/esm/types/CamOverlayAPI/customGraphicsSchema.js +69 -0
- package/esm/types/CamOverlayAPI/imagesSchema.js +6 -0
- package/esm/types/CamOverlayAPI/index.js +11 -0
- package/esm/types/CamOverlayAPI/infotickerSchema.js +23 -0
- package/esm/types/CamOverlayAPI/pipSchema.js +36 -0
- package/esm/types/CamOverlayAPI/ptzCompassSchema.js +23 -0
- 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/types/CamOverlayAPI/serviceCommonTypes.js +88 -0
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +5 -0
- package/esm/types/CamOverlayPainter.js +11 -0
- package/esm/types/CamScripterAPI.js +23 -7
- package/esm/types/CamScripterAPICameraEventsGenerator.js +1 -0
- package/esm/types/CamStreamerAPI.js +33 -2
- package/esm/types/CamSwitcherAPI.js +38 -1
- package/esm/types/GenetecAgent.js +28 -0
- package/esm/types/PlaneTrackerAPI.js +307 -0
- package/esm/types/VapixAPI.js +70 -12
- package/esm/types/VapixEvents.js +1 -0
- package/esm/types/common.js +3 -1
- package/esm/types/ws/CamOverlayEvents.js +16 -0
- package/esm/types/ws/CamStreamerEvents.js +29 -0
- package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +8 -0
- package/esm/types/ws/PlaneTrackerEvents.js +191 -0
- package/esm/web/DefaultClient.js +26 -10
- 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 +29 -11
- package/types/CamOverlayAPI.d.ts +867 -0
- package/types/CamScripterAPI.d.ts +46 -0
- package/types/CamStreamerAPI.d.ts +64 -0
- package/types/CamSwitcherAPI.d.ts +167 -0
- package/types/PlaneTrackerAPI.d.ts +229 -0
- package/types/VapixAPI.d.ts +118 -0
- package/types/bin/CreatePackage.d.ts +1 -0
- package/types/errors/errors.d.ts +83 -0
- package/types/index.d.ts +27 -0
- package/types/internal/ProxyClient.d.ts +10 -0
- package/types/internal/WsEvents.d.ts +37 -0
- package/types/internal/types.d.ts +47 -0
- package/{cjs → types}/internal/utils.d.ts +4 -1
- package/{cjs → types}/internal/versionCompare.d.ts +2 -2
- package/types/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/{esm → types/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/{cjs → 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/{cjs → types}/node/HttpServer.d.ts +2 -2
- 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 +17 -0
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +4330 -0
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +700 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/types/types/CamOverlayAPI/index.d.ts +11 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/types/types/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +96 -0
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +145 -0
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/types/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/types/types/CamOverlayPainter.d.ts +76 -0
- package/types/types/CamScripterAPI.d.ts +130 -0
- package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/types/types/CamStreamerAPI.d.ts +272 -0
- package/{esm → types}/types/CamSwitcherAPI.d.ts +145 -66
- package/{esm/events → types/types}/GenetecAgent.d.ts +47 -47
- package/types/types/PlaneTrackerAPI.d.ts +918 -0
- package/{cjs → types}/types/VapixAPI.d.ts +647 -465
- package/types/types/VapixEvents.d.ts +15 -0
- package/{cjs → types}/types/common.d.ts +17 -5
- package/types/types/ws/CamOverlayEvents.d.ts +88 -0
- package/types/types/ws/CamStreamerEvents.d.ts +249 -0
- package/{cjs/types → types/types/ws}/CamSwitcherEvents.d.ts +77 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +1597 -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/CamOverlayAPI.d.ts +0 -31
- package/cjs/CamOverlayDrawingAPI.d.ts +0 -86
- package/cjs/CamOverlayPainter/Frame.d.ts +0 -96
- package/cjs/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/cjs/CamOverlayPainter/ResourceManager.js +0 -46
- package/cjs/CamScripterAPI.d.ts +0 -19
- package/cjs/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/cjs/CamStreamerAPI.d.ts +0 -16
- package/cjs/CamSwitcherAPI.d.ts +0 -48
- package/cjs/CamSwitcherEvents.d.ts +0 -18
- package/cjs/VapixAPI.d.ts +0 -66
- package/cjs/VapixEvents.d.ts +0 -43
- package/cjs/errors/errors.d.ts +0 -34
- package/cjs/events/AxisCameraStationEvents.d.ts +0 -9
- package/cjs/events/AxisCameraStationEvents.js +0 -48
- package/cjs/events/GenetecAgent.d.ts +0 -174
- package/cjs/events/GenetecAgent.js +0 -123
- package/cjs/index.d.ts +0 -11
- package/cjs/internal/ProxyClient.d.ts +0 -11
- package/cjs/internal/common.d.ts +0 -39
- package/cjs/internal/common.js +0 -27
- package/cjs/node/DefaultClient.d.ts +0 -15
- package/cjs/node/HttpRequestSender.d.ts +0 -28
- package/cjs/node/WsClient.d.ts +0 -39
- package/cjs/node/WsEventClient.d.ts +0 -13
- package/cjs/node/WsEventClient.js +0 -22
- package/cjs/types/CamOverlayAPI.d.ts +0 -188
- package/cjs/types/CamOverlayAPI.js +0 -47
- package/cjs/types/CamScripterAPI.d.ts +0 -67
- package/cjs/types/CamStreamerAPI.d.ts +0 -139
- package/cjs/types/CamSwitcherAPI.d.ts +0 -814
- package/cjs/web/DefaultClient.d.ts +0 -6
- package/cjs/web/WsClient.d.ts +0 -13
- package/cjs/web/index.d.ts +0 -2
- package/esm/CamOverlayAPI.d.ts +0 -31
- package/esm/CamOverlayDrawingAPI.d.ts +0 -86
- package/esm/CamOverlayPainter/Painter.d.ts +0 -48
- 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 -48
- package/esm/CamSwitcherEvents.d.ts +0 -18
- package/esm/VapixAPI.d.ts +0 -66
- package/esm/VapixEvents.d.ts +0 -43
- package/esm/errors/errors.d.ts +0 -34
- package/esm/events/AxisCameraStationEvents.d.ts +0 -9
- package/esm/events/GenetecAgent.js +0 -119
- package/esm/index.d.ts +0 -11
- package/esm/internal/Digest.d.ts +0 -4
- package/esm/internal/ProxyClient.d.ts +0 -11
- package/esm/internal/common.d.ts +0 -39
- package/esm/internal/common.js +0 -20
- package/esm/internal/constants.d.ts +0 -1
- package/esm/internal/transformers.d.ts +0 -5
- package/esm/internal/utils.d.ts +0 -11
- package/esm/internal/versionCompare.d.ts +0 -6
- package/esm/node/DefaultClient.d.ts +0 -15
- package/esm/node/HttpServer.d.ts +0 -21
- 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/node/index.d.ts +0 -2
- package/esm/types/CamOverlayAPI.d.ts +0 -188
- package/esm/types/CamOverlayAPI.js +0 -44
- package/esm/types/CamScripterAPI.d.ts +0 -67
- package/esm/types/CamStreamerAPI.d.ts +0 -139
- package/esm/types/CamSwitcherEvents.d.ts +0 -491
- package/esm/types/VapixAPI.d.ts +0 -1683
- 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 → esm/internal/types.js} +0 -0
- /package/esm/{CreatePackage.d.ts → types/CamOverlayDrawingAPI.js} +0 -0
- /package/{cjs → types}/internal/constants.d.ts +0 -0
- /package/{cjs → types}/internal/transformers.d.ts +0 -0
- /package/{cjs/internal → types/node}/Digest.d.ts +0 -0
- /package/{cjs/node → types/web}/index.d.ts +0 -0
package/cjs/types/VapixAPI.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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({
|
|
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
|
+
});
|
package/cjs/types/common.js
CHANGED
|
@@ -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.
|
|
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
|
+
]);
|
package/cjs/web/DefaultClient.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
headers: headers,
|
|
10
|
-
});
|
|
6
|
+
domain;
|
|
7
|
+
constructor(domain = '') {
|
|
8
|
+
this.domain = domain;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
return
|
|
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;
|
package/cjs/web/WsClient.js
CHANGED
|
@@ -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 =
|
|
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
|
|
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.
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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;
|