camstreamerlib 4.0.0-beta.2 → 4.0.0-beta.21
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 +5 -1
- package/cjs/CamOverlayAPI.d.ts +629 -0
- package/cjs/CamOverlayAPI.js +255 -0
- package/{CamOverlayDrawingAPI.d.ts → cjs/CamOverlayDrawingAPI.d.ts} +1 -1
- package/cjs/CamOverlayDrawingAPI.js +235 -0
- package/cjs/CamOverlayPainter/Frame.js +301 -0
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/Painter.d.ts +14 -3
- package/cjs/CamOverlayPainter/Painter.js +171 -0
- package/cjs/CamOverlayPainter/ResourceManager.js +46 -0
- package/cjs/CamScripterAPI.d.ts +36 -0
- package/cjs/CamScripterAPI.js +73 -0
- package/{CamScripterAPICameraEventsGenerator.d.ts → cjs/CamScripterAPICameraEventsGenerator.d.ts} +1 -1
- package/cjs/CamScripterAPICameraEventsGenerator.js +162 -0
- package/{CamStreamerAPI.d.ts → cjs/CamStreamerAPI.d.ts} +5 -5
- package/cjs/CamStreamerAPI.js +59 -0
- package/{CamSwitcherAPI.d.ts → cjs/CamSwitcherAPI.d.ts} +10 -6
- package/cjs/CamSwitcherAPI.js +351 -0
- package/{CamSwitcherEvents.d.ts → cjs/CamSwitcherEvents.d.ts} +2 -2
- package/cjs/CamSwitcherEvents.js +67 -0
- package/cjs/CreatePackage.js +106 -0
- package/cjs/PlaneTrackerAPI.d.ts +47 -0
- package/cjs/PlaneTrackerAPI.js +176 -0
- package/{VapixAPI.d.ts → cjs/VapixAPI.d.ts} +19 -7
- package/cjs/VapixAPI.js +491 -0
- package/{VapixEvents.d.ts → cjs/VapixEvents.d.ts} +1 -1
- package/cjs/VapixEvents.js +88 -0
- package/{errors → cjs/errors}/errors.d.ts +3 -0
- package/cjs/errors/errors.js +86 -0
- package/{events → cjs/events}/AxisCameraStationEvents.d.ts +3 -2
- package/cjs/events/AxisCameraStationEvents.js +48 -0
- package/{events → cjs/events}/GenetecAgent.d.ts +4 -3
- package/cjs/events/GenetecAgent.js +123 -0
- package/cjs/index.d.ts +18 -0
- package/cjs/index.js +42 -0
- package/cjs/internal/Digest.js +42 -0
- package/cjs/internal/ProxyClient.d.ts +11 -0
- package/cjs/internal/ProxyClient.js +46 -0
- package/cjs/internal/constants.js +4 -0
- package/cjs/internal/transformers.js +32 -0
- package/cjs/internal/types.d.ts +35 -0
- package/cjs/internal/types.js +2 -0
- package/{internal → cjs/internal}/utils.d.ts +5 -1
- package/cjs/internal/utils.js +69 -0
- package/{internal → cjs/internal}/versionCompare.d.ts +2 -2
- package/cjs/internal/versionCompare.js +53 -0
- package/cjs/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/cjs/models/CamOverlayAPI/accuweatherSchema.js +48 -0
- package/cjs/models/CamOverlayAPI/constants.d.ts +11 -0
- package/cjs/models/CamOverlayAPI/constants.js +14 -0
- package/cjs/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
- package/cjs/models/CamOverlayAPI/customGraphicsSchema.js +73 -0
- package/cjs/models/CamOverlayAPI/fileSchema.d.ts +28 -0
- package/cjs/models/CamOverlayAPI/fileSchema.js +17 -0
- package/cjs/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/cjs/models/CamOverlayAPI/imagesSchema.js +10 -0
- package/cjs/models/CamOverlayAPI/index.d.ts +13 -0
- package/cjs/models/CamOverlayAPI/index.js +29 -0
- package/cjs/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/cjs/models/CamOverlayAPI/infotickerSchema.js +27 -0
- package/cjs/models/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/cjs/models/CamOverlayAPI/pipSchema.js +40 -0
- package/cjs/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
- package/cjs/models/CamOverlayAPI/ptzCompassSchema.js +26 -0
- package/cjs/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/cjs/models/CamOverlayAPI/ptzSchema.js +13 -0
- package/cjs/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/cjs/models/CamOverlayAPI/screenSharingSchema.js +9 -0
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +9 -0
- package/cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
- package/cjs/models/CamOverlayAPI/widgetCommonSchema.js +76 -0
- package/cjs/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
- package/cjs/models/CamOverlayAPI/widgetsSchema.js +27 -0
- package/cjs/node/DefaultClient.d.ts +16 -0
- package/cjs/node/DefaultClient.js +56 -0
- package/cjs/node/HttpRequestSender.js +89 -0
- package/cjs/node/HttpServer.js +96 -0
- package/{node → cjs/node}/WsClient.d.ts +1 -1
- package/cjs/node/WsClient.js +149 -0
- package/{node → cjs/node}/WsEventClient.d.ts +1 -1
- package/cjs/node/WsEventClient.js +22 -0
- package/cjs/node/index.d.ts +2 -0
- package/cjs/node/index.js +7 -0
- package/cjs/types/CamOverlayAPI.d.ts +328 -0
- package/cjs/types/CamOverlayAPI.js +26 -0
- package/{types → cjs/types}/CamScripterAPI.d.ts +66 -7
- package/cjs/types/CamScripterAPI.js +35 -0
- package/{types → cjs/types}/CamStreamerAPI.d.ts +16 -5
- package/cjs/types/CamStreamerAPI.js +32 -0
- package/{types → cjs/types}/CamSwitcherAPI.d.ts +5 -5
- package/cjs/types/CamSwitcherAPI.js +137 -0
- package/{types/CamswitcherEvents.d.ts → cjs/types/CamSwitcherEvents.d.ts} +77 -0
- package/cjs/types/CamSwitcherEvents.js +70 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +2 -0
- package/cjs/types/PlaneTrackerAPI.js +2 -0
- package/{types → cjs/types}/VapixAPI.d.ts +479 -519
- package/cjs/types/VapixAPI.js +139 -0
- package/cjs/types/common.js +14 -0
- package/cjs/web/DefaultClient.d.ts +6 -0
- package/cjs/web/DefaultClient.js +22 -0
- package/cjs/web/WsClient.js +62 -0
- package/cjs/web/index.d.ts +2 -0
- package/cjs/web/index.js +7 -0
- package/esm/CamOverlayAPI.d.ts +629 -0
- package/esm/CamOverlayAPI.js +251 -0
- package/esm/CamOverlayDrawingAPI.d.ts +86 -0
- package/{CamOverlayDrawingAPI.js → esm/CamOverlayDrawingAPI.js} +6 -3
- package/esm/CamOverlayPainter/Frame.d.ts +96 -0
- package/esm/CamOverlayPainter/Painter.d.ts +48 -0
- package/{CamOverlayPainter → esm/CamOverlayPainter}/Painter.js +4 -1
- package/esm/CamOverlayPainter/ResourceManager.d.ts +14 -0
- package/{CamOverlayPainter → esm/CamOverlayPainter}/ResourceManager.js +6 -10
- package/esm/CamScripterAPI.d.ts +36 -0
- package/esm/CamScripterAPI.js +69 -0
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +74 -0
- package/{CamScripterAPICameraEventsGenerator.js → esm/CamScripterAPICameraEventsGenerator.js} +6 -3
- package/esm/CamStreamerAPI.d.ts +16 -0
- package/{CamStreamerAPI.js → esm/CamStreamerAPI.js} +4 -10
- package/esm/CamSwitcherAPI.d.ts +52 -0
- package/{CamSwitcherAPI.js → esm/CamSwitcherAPI.js} +24 -27
- package/esm/CamSwitcherEvents.d.ts +18 -0
- package/{CamSwitcherEvents.js → esm/CamSwitcherEvents.js} +1 -1
- package/esm/CreatePackage.d.ts +1 -0
- package/esm/PlaneTrackerAPI.d.ts +47 -0
- package/esm/PlaneTrackerAPI.js +172 -0
- package/esm/VapixAPI.d.ts +78 -0
- package/{VapixAPI.js → esm/VapixAPI.js} +93 -60
- package/esm/VapixEvents.d.ts +43 -0
- package/{VapixEvents.js → esm/VapixEvents.js} +3 -3
- package/esm/errors/errors.d.ts +37 -0
- package/{errors → esm/errors}/errors.js +6 -0
- package/esm/events/AxisCameraStationEvents.d.ts +10 -0
- package/{events → esm/events}/AxisCameraStationEvents.js +1 -1
- package/esm/events/GenetecAgent.d.ts +175 -0
- package/{events → esm/events}/GenetecAgent.js +5 -5
- package/esm/index.d.ts +18 -0
- package/esm/index.js +18 -0
- package/esm/internal/Digest.d.ts +4 -0
- package/{internal → esm/internal}/Digest.js +6 -6
- package/esm/internal/ProxyClient.d.ts +11 -0
- package/{internal → esm/internal}/ProxyClient.js +6 -4
- package/esm/internal/constants.d.ts +1 -0
- package/esm/internal/transformers.d.ts +5 -0
- package/esm/internal/types.d.ts +35 -0
- package/esm/internal/types.js +1 -0
- package/esm/internal/utils.d.ts +15 -0
- package/{internal → esm/internal}/utils.js +20 -1
- package/esm/internal/versionCompare.d.ts +6 -0
- package/esm/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/esm/models/CamOverlayAPI/accuweatherSchema.js +45 -0
- package/esm/models/CamOverlayAPI/constants.d.ts +11 -0
- package/esm/models/CamOverlayAPI/constants.js +11 -0
- package/esm/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
- package/esm/models/CamOverlayAPI/customGraphicsSchema.js +70 -0
- package/esm/models/CamOverlayAPI/fileSchema.d.ts +28 -0
- package/esm/models/CamOverlayAPI/fileSchema.js +14 -0
- package/esm/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/esm/models/CamOverlayAPI/imagesSchema.js +7 -0
- package/esm/models/CamOverlayAPI/index.d.ts +13 -0
- package/esm/models/CamOverlayAPI/index.js +13 -0
- package/esm/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/esm/models/CamOverlayAPI/infotickerSchema.js +24 -0
- package/esm/models/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/esm/models/CamOverlayAPI/pipSchema.js +37 -0
- package/esm/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
- package/esm/models/CamOverlayAPI/ptzCompassSchema.js +23 -0
- package/esm/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/esm/models/CamOverlayAPI/ptzSchema.js +10 -0
- package/esm/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/esm/models/CamOverlayAPI/screenSharingSchema.js +6 -0
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +6 -0
- package/esm/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
- package/esm/models/CamOverlayAPI/widgetCommonSchema.js +73 -0
- package/esm/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
- package/esm/models/CamOverlayAPI/widgetsSchema.js +24 -0
- package/esm/node/DefaultClient.d.ts +16 -0
- package/{node → esm/node}/DefaultClient.js +9 -7
- package/esm/node/HttpRequestSender.d.ts +28 -0
- package/esm/node/HttpServer.d.ts +21 -0
- package/{node → esm/node}/HttpServer.js +1 -1
- package/esm/node/WsClient.d.ts +39 -0
- package/esm/node/WsEventClient.d.ts +13 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/types/CamOverlayAPI.d.ts +328 -0
- package/esm/types/CamOverlayAPI.js +14 -0
- package/esm/types/CamScripterAPI.d.ts +126 -0
- package/esm/types/CamScripterAPI.js +32 -0
- package/esm/types/CamStreamerAPI.d.ts +150 -0
- package/{types → esm/types}/CamStreamerAPI.js +4 -0
- package/esm/types/CamSwitcherAPI.d.ts +814 -0
- package/esm/types/CamSwitcherEvents.d.ts +568 -0
- package/{types/CamswitcherEvents.js → esm/types/CamSwitcherEvents.js} +8 -0
- package/esm/types/PlaneTrackerAPI.d.ts +2 -0
- package/esm/types/PlaneTrackerAPI.js +1 -0
- package/esm/types/VapixAPI.d.ts +1664 -0
- package/{types → esm/types}/VapixAPI.js +30 -23
- package/esm/types/common.d.ts +37 -0
- package/esm/web/DefaultClient.d.ts +6 -0
- package/{web → esm/web}/DefaultClient.js +6 -4
- package/esm/web/WsClient.d.ts +13 -0
- package/{web → esm/web}/WsClient.js +2 -2
- package/esm/web/index.d.ts +2 -0
- package/esm/web/index.js +2 -0
- package/package.json +6 -6
- package/CamOverlayAPI.d.ts +0 -31
- package/CamOverlayAPI.js +0 -172
- package/CamScripterAPI.d.ts +0 -19
- package/CamScripterAPI.js +0 -66
- package/internal/ProxyClient.d.ts +0 -11
- package/internal/common.d.ts +0 -40
- package/internal/common.js +0 -23
- package/node/DefaultClient.d.ts +0 -15
- package/types/CamOverlayAPI.d.ts +0 -188
- package/types/CamOverlayAPI.js +0 -44
- package/types/CamScripterAPI.js +0 -17
- package/web/DefaultClient.d.ts +0 -6
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/Frame.d.ts +0 -0
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/ResourceManager.d.ts +0 -0
- package/{CreatePackage.d.ts → cjs/CreatePackage.d.ts} +0 -0
- package/{internal → cjs/internal}/Digest.d.ts +0 -0
- package/{internal → cjs/internal}/constants.d.ts +0 -0
- package/{internal → cjs/internal}/transformers.d.ts +0 -0
- package/{node → cjs/node}/HttpRequestSender.d.ts +0 -0
- package/{node → cjs/node}/HttpServer.d.ts +0 -0
- package/{types → cjs/types}/common.d.ts +2 -2
- /package/{web → cjs/web}/WsClient.d.ts +0 -0
- /package/{CamOverlayPainter → esm/CamOverlayPainter}/Frame.js +0 -0
- /package/{CreatePackage.js → esm/CreatePackage.js} +0 -0
- /package/{internal → esm/internal}/constants.js +0 -0
- /package/{internal → esm/internal}/transformers.js +0 -0
- /package/{internal → esm/internal}/versionCompare.js +0 -0
- /package/{node → esm/node}/HttpRequestSender.js +0 -0
- /package/{node → esm/node}/WsClient.js +0 -0
- /package/{node → esm/node}/WsEventClient.js +0 -0
- /package/{types → esm/types}/CamSwitcherAPI.js +0 -0
- /package/{types → esm/types}/common.js +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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.sdCardWatchedStatuses = exports.guardTourSchema = exports.APP_IDS = exports.applicationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const transformers_1 = require("../internal/transformers");
|
|
6
|
+
exports.applicationSchema = zod_1.z.object({
|
|
7
|
+
Name: zod_1.z.string(),
|
|
8
|
+
NiceName: zod_1.z.string(),
|
|
9
|
+
Vendor: zod_1.z.string(),
|
|
10
|
+
Version: zod_1.z.string(),
|
|
11
|
+
ApplicationID: zod_1.z.string().optional(),
|
|
12
|
+
License: zod_1.z.string(),
|
|
13
|
+
Status: zod_1.z.string(),
|
|
14
|
+
ConfigurationPage: zod_1.z.string().optional(),
|
|
15
|
+
VendorHomePage: zod_1.z.string().optional(),
|
|
16
|
+
LicenseName: zod_1.z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
exports.APP_IDS = [
|
|
19
|
+
'CamStreamer',
|
|
20
|
+
'CamSwitcher',
|
|
21
|
+
'CamOverlay',
|
|
22
|
+
'CamScripter',
|
|
23
|
+
'PlaneTracker',
|
|
24
|
+
'Ndihxplugin',
|
|
25
|
+
'SportTracker',
|
|
26
|
+
];
|
|
27
|
+
exports.guardTourSchema = zod_1.z.object({
|
|
28
|
+
id: zod_1.z.string(),
|
|
29
|
+
camNbr: zod_1.z.unknown(),
|
|
30
|
+
name: zod_1.z.string(),
|
|
31
|
+
randomEnabled: zod_1.z.unknown(),
|
|
32
|
+
running: zod_1.z.string(),
|
|
33
|
+
timeBetweenSequences: zod_1.z.unknown(),
|
|
34
|
+
tour: zod_1.z.array(zod_1.z.object({
|
|
35
|
+
moveSpeed: zod_1.z.unknown(),
|
|
36
|
+
position: zod_1.z.unknown(),
|
|
37
|
+
presetNbr: zod_1.z.unknown(),
|
|
38
|
+
waitTime: zod_1.z.unknown(),
|
|
39
|
+
waitTimeViewType: zod_1.z.unknown(),
|
|
40
|
+
})),
|
|
41
|
+
});
|
|
42
|
+
const audioSampleRatesSchema = zod_1.z.object({
|
|
43
|
+
sample_rate: zod_1.z.number(),
|
|
44
|
+
bit_rates: zod_1.z.array(zod_1.z.number()),
|
|
45
|
+
});
|
|
46
|
+
const audioSampleRatesOutSchema = audioSampleRatesSchema.transform(transformers_1.toCamelCaseDeep);
|
|
47
|
+
exports.sdCardWatchedStatuses = ['OK', 'connected', 'disconnected'];
|
|
48
|
+
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() })));
|
|
49
|
+
exports.cameraPTZItemDataSchema = zod_1.z.object({
|
|
50
|
+
pan: zod_1.z.number().optional(),
|
|
51
|
+
tilt: zod_1.z.number().optional(),
|
|
52
|
+
zoom: zod_1.z.number().optional(),
|
|
53
|
+
});
|
|
54
|
+
exports.cameraPTZItemSchema = zod_1.z.object({
|
|
55
|
+
name: zod_1.z.string(),
|
|
56
|
+
id: zod_1.z.number(),
|
|
57
|
+
data: exports.cameraPTZItemDataSchema,
|
|
58
|
+
});
|
|
59
|
+
exports.audioDeviceSignalingChannelTypeSchema = zod_1.z.object({
|
|
60
|
+
id: zod_1.z.string(),
|
|
61
|
+
gain: zod_1.z.number(),
|
|
62
|
+
mute: zod_1.z.boolean(),
|
|
63
|
+
});
|
|
64
|
+
exports.audioDeviceSignalingTypeSchema = zod_1.z.object({
|
|
65
|
+
id: zod_1.z.string(),
|
|
66
|
+
powerType: zod_1.z.string().optional(),
|
|
67
|
+
channels: zod_1.z.array(exports.audioDeviceSignalingChannelTypeSchema),
|
|
68
|
+
});
|
|
69
|
+
exports.audioDeviceConnectionTypeSchema = zod_1.z.object({
|
|
70
|
+
id: zod_1.z.string(),
|
|
71
|
+
signalingTypeSelected: zod_1.z.string(),
|
|
72
|
+
signalingTypes: zod_1.z.array(exports.audioDeviceSignalingTypeSchema),
|
|
73
|
+
});
|
|
74
|
+
exports.audioDeviceInputOutputSchema = zod_1.z.object({
|
|
75
|
+
id: zod_1.z.string(),
|
|
76
|
+
name: zod_1.z.string(),
|
|
77
|
+
enabled: zod_1.z.boolean(),
|
|
78
|
+
connectionTypes: zod_1.z.array(exports.audioDeviceConnectionTypeSchema),
|
|
79
|
+
connectionTypeSelected: zod_1.z.string(),
|
|
80
|
+
});
|
|
81
|
+
exports.audioDeviceSchema = zod_1.z.object({
|
|
82
|
+
id: zod_1.z.string(),
|
|
83
|
+
name: zod_1.z.string(),
|
|
84
|
+
inputs: zod_1.z.array(exports.audioDeviceInputOutputSchema),
|
|
85
|
+
outputs: zod_1.z.array(exports.audioDeviceInputOutputSchema),
|
|
86
|
+
});
|
|
87
|
+
const audioDeviceFromRequestSchema = zod_1.z.object({
|
|
88
|
+
id: zod_1.z.string(),
|
|
89
|
+
name: zod_1.z.string(),
|
|
90
|
+
inputs: zod_1.z.array(exports.audioDeviceInputOutputSchema).optional(),
|
|
91
|
+
outputs: zod_1.z.array(exports.audioDeviceInputOutputSchema).optional(),
|
|
92
|
+
});
|
|
93
|
+
exports.audioDeviceRequestSchema = zod_1.z.object({
|
|
94
|
+
data: zod_1.z.object({ devices: zod_1.z.array(audioDeviceFromRequestSchema) }),
|
|
95
|
+
});
|
|
96
|
+
exports.maxFpsResponseSchema = zod_1.z.object({
|
|
97
|
+
data: zod_1.z
|
|
98
|
+
.array(zod_1.z.object({
|
|
99
|
+
channel: zod_1.z.number(),
|
|
100
|
+
captureMode: zod_1.z.array(zod_1.z.object({
|
|
101
|
+
enabled: zod_1.z.boolean(),
|
|
102
|
+
maxFPS: zod_1.z.number().optional(),
|
|
103
|
+
})),
|
|
104
|
+
}))
|
|
105
|
+
.optional(),
|
|
106
|
+
});
|
|
107
|
+
exports.dateTimeinfoSchema = zod_1.z.object({
|
|
108
|
+
data: zod_1.z.object({
|
|
109
|
+
dateTime: zod_1.z.string(),
|
|
110
|
+
dstEnabled: zod_1.z.boolean(),
|
|
111
|
+
localDateTime: zod_1.z.string(),
|
|
112
|
+
posixTimeZone: zod_1.z.string(),
|
|
113
|
+
timeZone: zod_1.z.string().optional(),
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
exports.timeZoneSchema = zod_1.z.discriminatedUnion('status', [
|
|
117
|
+
zod_1.z.object({
|
|
118
|
+
status: zod_1.z.literal('success'),
|
|
119
|
+
data: zod_1.z.object({
|
|
120
|
+
activeTimeZone: zod_1.z.string(),
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
zod_1.z.object({
|
|
124
|
+
status: zod_1.z.literal('error'),
|
|
125
|
+
error: zod_1.z.object({
|
|
126
|
+
message: zod_1.z.string(),
|
|
127
|
+
}),
|
|
128
|
+
}),
|
|
129
|
+
]);
|
|
130
|
+
exports.audioSampleRatesResponseSchema = zod_1.z.object({
|
|
131
|
+
data: zod_1.z.object({
|
|
132
|
+
encoders: zod_1.z
|
|
133
|
+
.object({
|
|
134
|
+
aac: zod_1.z.array(audioSampleRatesSchema),
|
|
135
|
+
AAC: zod_1.z.array(audioSampleRatesSchema),
|
|
136
|
+
})
|
|
137
|
+
.partial(),
|
|
138
|
+
}),
|
|
139
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.audioChannelSchema = zod_1.z.union([zod_1.z.literal('mono'), zod_1.z.literal('stereo')]);
|
|
6
|
+
exports.audioChannelCountSchema = zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(2)]);
|
|
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')]);
|
|
9
|
+
exports.networkCameraListSchema = zod_1.z.array(zod_1.z.object({
|
|
10
|
+
name: zod_1.z.string(),
|
|
11
|
+
ip: zod_1.z.string(),
|
|
12
|
+
}));
|
|
13
|
+
exports.keyboardShortcutSchema = zod_1.z.string().nullable();
|
|
14
|
+
exports.keyboardShortcutsSchema = zod_1.z.record(exports.keyboardShortcutSchema);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IClient } from '../internal/types';
|
|
3
|
+
export declare class DefaultClient implements IClient<Response> {
|
|
4
|
+
get: (url: string, parameters?: import("../internal/types").TParameters | undefined, headers?: Record<string, string> | undefined) => Promise<Response>;
|
|
5
|
+
post: (url: string, data: string | Buffer | FormData, parameters?: import("../internal/types").TParameters | undefined, headers?: Record<string, string> | undefined) => Promise<Response>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultClient = void 0;
|
|
4
|
+
const utils_1 = require("../internal/utils");
|
|
5
|
+
class DefaultClient {
|
|
6
|
+
get = (...params) => {
|
|
7
|
+
const [url, parameters, headers] = params;
|
|
8
|
+
return fetch((0, utils_1.addParametersToPath)(url, parameters), {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers: headers,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
post = (...params) => {
|
|
14
|
+
const [url, data, parameters, headers] = params;
|
|
15
|
+
return fetch((0, utils_1.addParametersToPath)(url, parameters), {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: data,
|
|
18
|
+
headers: headers,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.DefaultClient = DefaultClient;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WsClient = void 0;
|
|
4
|
+
const REFRESH_TIMEOUT = 5_000;
|
|
5
|
+
class WsClient {
|
|
6
|
+
getUrl;
|
|
7
|
+
getAuthToken;
|
|
8
|
+
isDestroyed = false;
|
|
9
|
+
ws = null;
|
|
10
|
+
restartTimeout = null;
|
|
11
|
+
constructor(getUrl, getAuthToken) {
|
|
12
|
+
this.getUrl = getUrl;
|
|
13
|
+
this.getAuthToken = getAuthToken;
|
|
14
|
+
}
|
|
15
|
+
init() {
|
|
16
|
+
if (this.isDestroyed) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.destroyWebsocket();
|
|
20
|
+
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);
|
|
32
|
+
ws.onclose = () => {
|
|
33
|
+
this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
34
|
+
};
|
|
35
|
+
this.ws = ws;
|
|
36
|
+
}
|
|
37
|
+
send = (msg) => {
|
|
38
|
+
this.ws?.send(msg);
|
|
39
|
+
};
|
|
40
|
+
onmessage = (_) => { };
|
|
41
|
+
destroy = () => {
|
|
42
|
+
this.isDestroyed = true;
|
|
43
|
+
this.destroyWebsocket();
|
|
44
|
+
};
|
|
45
|
+
destroyWebsocket() {
|
|
46
|
+
if (this.restartTimeout !== null) {
|
|
47
|
+
clearTimeout(this.restartTimeout);
|
|
48
|
+
this.restartTimeout = null;
|
|
49
|
+
}
|
|
50
|
+
if (!this.ws) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.ws.onmessage = null;
|
|
54
|
+
this.ws.onopen = null;
|
|
55
|
+
this.ws.onclose = null;
|
|
56
|
+
if (this.ws.readyState === this.ws.OPEN) {
|
|
57
|
+
this.ws.close();
|
|
58
|
+
}
|
|
59
|
+
this.ws = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.WsClient = WsClient;
|
package/cjs/web/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WsClient = exports.DefaultClient = void 0;
|
|
4
|
+
var DefaultClient_1 = require("./DefaultClient");
|
|
5
|
+
Object.defineProperty(exports, "DefaultClient", { enumerable: true, get: function () { return DefaultClient_1.DefaultClient; } });
|
|
6
|
+
var WsClient_1 = require("./WsClient");
|
|
7
|
+
Object.defineProperty(exports, "WsClient", { enumerable: true, get: function () { return WsClient_1.WsClient; } });
|