camstreamerlib 4.0.0-beta.99 → 4.0.1
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 +44 -15
- package/cjs/CamOverlayAPI.d.ts +145 -107
- package/cjs/CamOverlayAPI.js +14 -63
- package/cjs/CamScripterAPI.d.ts +5 -8
- package/cjs/CamScripterAPI.js +11 -29
- package/cjs/CamStreamerAPI.d.ts +2362 -806
- package/cjs/CamStreamerAPI.js +68 -76
- package/cjs/CamSwitcherAPI.d.ts +23 -22
- package/cjs/CamSwitcherAPI.js +30 -88
- package/cjs/PlaneTrackerAPI.d.ts +28 -30
- package/cjs/PlaneTrackerAPI.js +20 -75
- package/cjs/VapixAPI.d.ts +36 -23
- package/cjs/VapixAPI.js +227 -106
- package/cjs/errors/errors.d.ts +11 -5
- package/cjs/errors/errors.js +5 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/WsEvents.d.ts +1 -0
- package/cjs/internal/WsEvents.js +5 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/internal/transformers.js +8 -8
- package/cjs/internal/types.d.ts +3 -0
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
- package/cjs/types/CamOverlayAPI/index.js +1 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/cjs/types/CamScripterAPI.d.ts +0 -11
- package/cjs/types/CamScripterAPI.js +1 -5
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
- package/cjs/types/CamStreamerAPI/index.js +1 -3
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/cjs/types/CamSwitcherAPI.d.ts +96 -91
- package/cjs/types/CamSwitcherAPI.js +9 -9
- package/cjs/types/GenetecAgent.d.ts +2 -2
- package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
- package/cjs/types/PlaneTrackerAPI.js +5 -2
- package/cjs/types/VapixAPI.d.ts +51 -32
- package/cjs/types/VapixAPI.js +10 -3
- package/cjs/types/common.d.ts +27 -0
- package/cjs/types/common.js +13 -1
- package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
- package/cjs/types/ws/CamStreamerEvents.js +11 -7
- package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/esm/CamOverlayAPI.js +16 -65
- package/esm/CamScripterAPI.js +9 -30
- package/esm/CamStreamerAPI.js +70 -78
- package/esm/CamSwitcherAPI.js +31 -89
- package/esm/PlaneTrackerAPI.js +21 -76
- package/esm/VapixAPI.js +228 -107
- package/esm/errors/errors.js +5 -1
- package/esm/index.js +1 -0
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/WsEvents.js +5 -0
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/transformers.js +1 -1
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
- package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
- package/esm/types/CamOverlayAPI/index.js +1 -0
- package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/esm/types/CamScripterAPI.js +0 -4
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
- package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/esm/types/CamStreamerAPI/index.js +1 -3
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +9 -1
- package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/esm/types/CamSwitcherAPI.js +8 -8
- package/esm/types/PlaneTrackerAPI.js +5 -2
- package/esm/types/VapixAPI.js +9 -2
- package/esm/types/common.js +12 -0
- package/esm/types/ws/CamStreamerEvents.js +11 -7
- package/package.json +4 -4
- package/types/CamOverlayAPI.d.ts +145 -107
- package/types/CamScripterAPI.d.ts +5 -8
- package/types/CamStreamerAPI.d.ts +2362 -806
- package/types/CamSwitcherAPI.d.ts +23 -22
- package/types/PlaneTrackerAPI.d.ts +28 -30
- package/types/VapixAPI.d.ts +36 -23
- package/types/errors/errors.d.ts +11 -5
- package/types/index.d.ts +1 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/WsEvents.d.ts +1 -0
- package/types/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +3 -0
- package/types/internal/versionCompare.d.ts +2 -2
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/index.d.ts +1 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/types/types/CamScripterAPI.d.ts +0 -11
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/types/types/CamStreamerAPI/index.d.ts +1 -3
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/types/types/CamSwitcherAPI.d.ts +96 -91
- package/types/types/GenetecAgent.d.ts +2 -2
- package/types/types/PlaneTrackerAPI.d.ts +60 -47
- package/types/types/VapixAPI.d.ts +51 -32
- package/types/types/common.d.ts +27 -0
- package/types/types/ws/CamStreamerEvents.d.ts +110 -77
- package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
- package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
- package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
- package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
- package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
- package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
- package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
- package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
- package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
- package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
- package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
package/cjs/types/common.d.ts
CHANGED
|
@@ -48,3 +48,30 @@ export type TCameraImageConfig = {
|
|
|
48
48
|
overlays?: string;
|
|
49
49
|
[key: string]: string | number | undefined;
|
|
50
50
|
};
|
|
51
|
+
export declare const bitrateModeSchema: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
52
|
+
export type TBitrateMode = z.infer<typeof bitrateModeSchema>;
|
|
53
|
+
export declare const bitrateVapixParamsSchema: z.ZodObject<{
|
|
54
|
+
bitrateMode: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
55
|
+
maximumBitRate: z.ZodNumber;
|
|
56
|
+
retentionTime: z.ZodNumber;
|
|
57
|
+
bitRateLimit: z.ZodNumber;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
60
|
+
maximumBitRate: number;
|
|
61
|
+
retentionTime: number;
|
|
62
|
+
bitRateLimit: number;
|
|
63
|
+
}, {
|
|
64
|
+
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
65
|
+
maximumBitRate: number;
|
|
66
|
+
retentionTime: number;
|
|
67
|
+
bitRateLimit: number;
|
|
68
|
+
}>;
|
|
69
|
+
export type TBitrateVapixParams = z.infer<typeof bitrateVapixParamsSchema>;
|
|
70
|
+
export type FileLike = typeof File extends {
|
|
71
|
+
prototype: infer T;
|
|
72
|
+
} ? T : {
|
|
73
|
+
name: string;
|
|
74
|
+
size: number;
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const fileSchema: z.ZodType<File, z.ZodTypeDef, File>;
|
package/cjs/types/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.sdCardStorageTypeSchema = exports.flashStorageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = exports.booleanSchema = void 0;
|
|
3
|
+
exports.fileSchema = exports.bitrateVapixParamsSchema = exports.bitrateModeSchema = exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.sdCardStorageTypeSchema = exports.flashStorageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = exports.booleanSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.booleanSchema = zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]);
|
|
6
6
|
exports.audioChannelSchema = zod_1.z.union([zod_1.z.literal('mono'), zod_1.z.literal('stereo')]);
|
|
@@ -15,3 +15,15 @@ exports.networkCameraListSchema = zod_1.z.array(zod_1.z.object({
|
|
|
15
15
|
}));
|
|
16
16
|
exports.keyboardShortcutSchema = zod_1.z.string().nullable();
|
|
17
17
|
exports.keyboardShortcutsSchema = zod_1.z.record(exports.keyboardShortcutSchema);
|
|
18
|
+
exports.bitrateModeSchema = zod_1.z.union([zod_1.z.literal('VBR'), zod_1.z.literal('MBR'), zod_1.z.literal('ABR')]);
|
|
19
|
+
exports.bitrateVapixParamsSchema = zod_1.z.object({
|
|
20
|
+
bitrateMode: exports.bitrateModeSchema,
|
|
21
|
+
maximumBitRate: zod_1.z.number(),
|
|
22
|
+
retentionTime: zod_1.z.number(),
|
|
23
|
+
bitRateLimit: zod_1.z.number(),
|
|
24
|
+
});
|
|
25
|
+
exports.fileSchema = typeof File !== 'undefined'
|
|
26
|
+
? zod_1.z.instanceof(File)
|
|
27
|
+
: zod_1.z.custom((val) => {
|
|
28
|
+
return val !== null && typeof val === 'object' && 'name' in val && 'size' in val && 'type' in val;
|
|
29
|
+
});
|
|
@@ -10,58 +10,67 @@ declare const csEventsDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
10
10
|
state: string;
|
|
11
11
|
}>, z.ZodObject<{
|
|
12
12
|
type: z.ZodLiteral<"StreamState">;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
active: z.
|
|
16
|
-
|
|
17
|
-
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
13
|
+
streamId: z.ZodString;
|
|
14
|
+
isStreaming: z.ZodBoolean;
|
|
15
|
+
active: z.ZodBoolean;
|
|
16
|
+
enabled: z.ZodBoolean;
|
|
18
17
|
}, "strip", z.ZodTypeAny, {
|
|
19
18
|
type: "StreamState";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
isStreaming: 0 | 1;
|
|
19
|
+
streamId: string;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
active: boolean;
|
|
22
|
+
isStreaming: boolean;
|
|
25
23
|
}, {
|
|
26
24
|
type: "StreamState";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isStreaming: 0 | 1;
|
|
25
|
+
streamId: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
active: boolean;
|
|
28
|
+
isStreaming: boolean;
|
|
32
29
|
}>, z.ZodObject<{
|
|
33
30
|
type: z.ZodLiteral<"CS_API_SUCCESS">;
|
|
34
31
|
apiCall: z.ZodString;
|
|
35
32
|
message: z.ZodString;
|
|
36
|
-
|
|
33
|
+
streamId: z.ZodString;
|
|
37
34
|
}, "strip", z.ZodTypeAny, {
|
|
38
35
|
message: string;
|
|
39
36
|
type: "CS_API_SUCCESS";
|
|
40
|
-
|
|
37
|
+
streamId: string;
|
|
41
38
|
apiCall: string;
|
|
42
39
|
}, {
|
|
43
40
|
message: string;
|
|
44
41
|
type: "CS_API_SUCCESS";
|
|
45
|
-
|
|
42
|
+
streamId: string;
|
|
46
43
|
apiCall: string;
|
|
47
44
|
}>, z.ZodObject<{
|
|
48
45
|
type: z.ZodLiteral<"CS_API_ERROR">;
|
|
49
46
|
apiCall: z.ZodString;
|
|
50
47
|
message: z.ZodString;
|
|
51
|
-
|
|
48
|
+
streamId: z.ZodString;
|
|
52
49
|
code: z.ZodString;
|
|
53
50
|
}, "strip", z.ZodTypeAny, {
|
|
54
51
|
code: string;
|
|
55
52
|
message: string;
|
|
56
53
|
type: "CS_API_ERROR";
|
|
57
|
-
|
|
54
|
+
streamId: string;
|
|
58
55
|
apiCall: string;
|
|
59
56
|
}, {
|
|
60
57
|
code: string;
|
|
61
58
|
message: string;
|
|
62
59
|
type: "CS_API_ERROR";
|
|
63
|
-
|
|
60
|
+
streamId: string;
|
|
64
61
|
apiCall: string;
|
|
62
|
+
}>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
64
|
+
port: z.ZodNumber;
|
|
65
|
+
value: z.ZodBoolean;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
value: boolean;
|
|
68
|
+
type: "PortChanged";
|
|
69
|
+
port: number;
|
|
70
|
+
}, {
|
|
71
|
+
value: boolean;
|
|
72
|
+
type: "PortChanged";
|
|
73
|
+
port: number;
|
|
65
74
|
}>]>;
|
|
66
75
|
export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
67
76
|
type: z.ZodLiteral<"init">;
|
|
@@ -76,58 +85,67 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
76
85
|
state: string;
|
|
77
86
|
}>, z.ZodObject<{
|
|
78
87
|
type: z.ZodLiteral<"StreamState">;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
active: z.
|
|
82
|
-
|
|
83
|
-
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
88
|
+
streamId: z.ZodString;
|
|
89
|
+
isStreaming: z.ZodBoolean;
|
|
90
|
+
active: z.ZodBoolean;
|
|
91
|
+
enabled: z.ZodBoolean;
|
|
84
92
|
}, "strip", z.ZodTypeAny, {
|
|
85
93
|
type: "StreamState";
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
isStreaming: 0 | 1;
|
|
94
|
+
streamId: string;
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
active: boolean;
|
|
97
|
+
isStreaming: boolean;
|
|
91
98
|
}, {
|
|
92
99
|
type: "StreamState";
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
isStreaming: 0 | 1;
|
|
100
|
+
streamId: string;
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
active: boolean;
|
|
103
|
+
isStreaming: boolean;
|
|
98
104
|
}>, z.ZodObject<{
|
|
99
105
|
type: z.ZodLiteral<"CS_API_SUCCESS">;
|
|
100
106
|
apiCall: z.ZodString;
|
|
101
107
|
message: z.ZodString;
|
|
102
|
-
|
|
108
|
+
streamId: z.ZodString;
|
|
103
109
|
}, "strip", z.ZodTypeAny, {
|
|
104
110
|
message: string;
|
|
105
111
|
type: "CS_API_SUCCESS";
|
|
106
|
-
|
|
112
|
+
streamId: string;
|
|
107
113
|
apiCall: string;
|
|
108
114
|
}, {
|
|
109
115
|
message: string;
|
|
110
116
|
type: "CS_API_SUCCESS";
|
|
111
|
-
|
|
117
|
+
streamId: string;
|
|
112
118
|
apiCall: string;
|
|
113
119
|
}>, z.ZodObject<{
|
|
114
120
|
type: z.ZodLiteral<"CS_API_ERROR">;
|
|
115
121
|
apiCall: z.ZodString;
|
|
116
122
|
message: z.ZodString;
|
|
117
|
-
|
|
123
|
+
streamId: z.ZodString;
|
|
118
124
|
code: z.ZodString;
|
|
119
125
|
}, "strip", z.ZodTypeAny, {
|
|
120
126
|
code: string;
|
|
121
127
|
message: string;
|
|
122
128
|
type: "CS_API_ERROR";
|
|
123
|
-
|
|
129
|
+
streamId: string;
|
|
124
130
|
apiCall: string;
|
|
125
131
|
}, {
|
|
126
132
|
code: string;
|
|
127
133
|
message: string;
|
|
128
134
|
type: "CS_API_ERROR";
|
|
129
|
-
|
|
135
|
+
streamId: string;
|
|
130
136
|
apiCall: string;
|
|
137
|
+
}>, z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
139
|
+
port: z.ZodNumber;
|
|
140
|
+
value: z.ZodBoolean;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
value: boolean;
|
|
143
|
+
type: "PortChanged";
|
|
144
|
+
port: number;
|
|
145
|
+
}, {
|
|
146
|
+
value: boolean;
|
|
147
|
+
type: "PortChanged";
|
|
148
|
+
port: number;
|
|
131
149
|
}>]>;
|
|
132
150
|
}, "strip", z.ZodTypeAny, {
|
|
133
151
|
type: "init";
|
|
@@ -136,22 +154,25 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
136
154
|
state: string;
|
|
137
155
|
} | {
|
|
138
156
|
type: "StreamState";
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
isStreaming: 0 | 1;
|
|
157
|
+
streamId: string;
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
active: boolean;
|
|
160
|
+
isStreaming: boolean;
|
|
144
161
|
} | {
|
|
145
162
|
message: string;
|
|
146
163
|
type: "CS_API_SUCCESS";
|
|
147
|
-
|
|
164
|
+
streamId: string;
|
|
148
165
|
apiCall: string;
|
|
149
166
|
} | {
|
|
150
167
|
code: string;
|
|
151
168
|
message: string;
|
|
152
169
|
type: "CS_API_ERROR";
|
|
153
|
-
|
|
170
|
+
streamId: string;
|
|
154
171
|
apiCall: string;
|
|
172
|
+
} | {
|
|
173
|
+
value: boolean;
|
|
174
|
+
type: "PortChanged";
|
|
175
|
+
port: number;
|
|
155
176
|
};
|
|
156
177
|
}, {
|
|
157
178
|
type: "init";
|
|
@@ -160,22 +181,25 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
160
181
|
state: string;
|
|
161
182
|
} | {
|
|
162
183
|
type: "StreamState";
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
isStreaming: 0 | 1;
|
|
184
|
+
streamId: string;
|
|
185
|
+
enabled: boolean;
|
|
186
|
+
active: boolean;
|
|
187
|
+
isStreaming: boolean;
|
|
168
188
|
} | {
|
|
169
189
|
message: string;
|
|
170
190
|
type: "CS_API_SUCCESS";
|
|
171
|
-
|
|
191
|
+
streamId: string;
|
|
172
192
|
apiCall: string;
|
|
173
193
|
} | {
|
|
174
194
|
code: string;
|
|
175
195
|
message: string;
|
|
176
196
|
type: "CS_API_ERROR";
|
|
177
|
-
|
|
197
|
+
streamId: string;
|
|
178
198
|
apiCall: string;
|
|
199
|
+
} | {
|
|
200
|
+
value: boolean;
|
|
201
|
+
type: "PortChanged";
|
|
202
|
+
port: number;
|
|
179
203
|
};
|
|
180
204
|
}>, z.ZodObject<{
|
|
181
205
|
type: z.ZodLiteral<"authorization">;
|
|
@@ -188,58 +212,67 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
188
212
|
state: string;
|
|
189
213
|
}>, z.ZodObject<{
|
|
190
214
|
type: z.ZodLiteral<"StreamState">;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
active: z.
|
|
194
|
-
|
|
195
|
-
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
215
|
+
streamId: z.ZodString;
|
|
216
|
+
isStreaming: z.ZodBoolean;
|
|
217
|
+
active: z.ZodBoolean;
|
|
218
|
+
enabled: z.ZodBoolean;
|
|
196
219
|
}, "strip", z.ZodTypeAny, {
|
|
197
220
|
type: "StreamState";
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
isStreaming: 0 | 1;
|
|
221
|
+
streamId: string;
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
active: boolean;
|
|
224
|
+
isStreaming: boolean;
|
|
203
225
|
}, {
|
|
204
226
|
type: "StreamState";
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
isStreaming: 0 | 1;
|
|
227
|
+
streamId: string;
|
|
228
|
+
enabled: boolean;
|
|
229
|
+
active: boolean;
|
|
230
|
+
isStreaming: boolean;
|
|
210
231
|
}>, z.ZodObject<{
|
|
211
232
|
type: z.ZodLiteral<"CS_API_SUCCESS">;
|
|
212
233
|
apiCall: z.ZodString;
|
|
213
234
|
message: z.ZodString;
|
|
214
|
-
|
|
235
|
+
streamId: z.ZodString;
|
|
215
236
|
}, "strip", z.ZodTypeAny, {
|
|
216
237
|
message: string;
|
|
217
238
|
type: "CS_API_SUCCESS";
|
|
218
|
-
|
|
239
|
+
streamId: string;
|
|
219
240
|
apiCall: string;
|
|
220
241
|
}, {
|
|
221
242
|
message: string;
|
|
222
243
|
type: "CS_API_SUCCESS";
|
|
223
|
-
|
|
244
|
+
streamId: string;
|
|
224
245
|
apiCall: string;
|
|
225
246
|
}>, z.ZodObject<{
|
|
226
247
|
type: z.ZodLiteral<"CS_API_ERROR">;
|
|
227
248
|
apiCall: z.ZodString;
|
|
228
249
|
message: z.ZodString;
|
|
229
|
-
|
|
250
|
+
streamId: z.ZodString;
|
|
230
251
|
code: z.ZodString;
|
|
231
252
|
}, "strip", z.ZodTypeAny, {
|
|
232
253
|
code: string;
|
|
233
254
|
message: string;
|
|
234
255
|
type: "CS_API_ERROR";
|
|
235
|
-
|
|
256
|
+
streamId: string;
|
|
236
257
|
apiCall: string;
|
|
237
258
|
}, {
|
|
238
259
|
code: string;
|
|
239
260
|
message: string;
|
|
240
261
|
type: "CS_API_ERROR";
|
|
241
|
-
|
|
262
|
+
streamId: string;
|
|
242
263
|
apiCall: string;
|
|
264
|
+
}>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
266
|
+
port: z.ZodNumber;
|
|
267
|
+
value: z.ZodBoolean;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
value: boolean;
|
|
270
|
+
type: "PortChanged";
|
|
271
|
+
port: number;
|
|
272
|
+
}, {
|
|
273
|
+
value: boolean;
|
|
274
|
+
type: "PortChanged";
|
|
275
|
+
port: number;
|
|
243
276
|
}>]>;
|
|
244
277
|
export type TCamStreamerEvent = z.infer<typeof csEventsDataSchema>;
|
|
245
278
|
export type TCamStreamerEventType = TCamStreamerEvent['type'];
|
|
@@ -6,25 +6,29 @@ const csEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
6
6
|
zod_1.z.object({ type: zod_1.z.literal('authorization'), state: zod_1.z.string() }),
|
|
7
7
|
zod_1.z.object({
|
|
8
8
|
type: zod_1.z.literal('StreamState'),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
active: zod_1.z.
|
|
12
|
-
|
|
13
|
-
isStreaming: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
|
|
9
|
+
streamId: zod_1.z.string(),
|
|
10
|
+
isStreaming: zod_1.z.boolean(),
|
|
11
|
+
active: zod_1.z.boolean(),
|
|
12
|
+
enabled: zod_1.z.boolean(),
|
|
14
13
|
}),
|
|
15
14
|
zod_1.z.object({
|
|
16
15
|
type: zod_1.z.literal('CS_API_SUCCESS'),
|
|
17
16
|
apiCall: zod_1.z.string(),
|
|
18
17
|
message: zod_1.z.string(),
|
|
19
|
-
|
|
18
|
+
streamId: zod_1.z.string(),
|
|
20
19
|
}),
|
|
21
20
|
zod_1.z.object({
|
|
22
21
|
type: zod_1.z.literal('CS_API_ERROR'),
|
|
23
22
|
apiCall: zod_1.z.string(),
|
|
24
23
|
message: zod_1.z.string(),
|
|
25
|
-
|
|
24
|
+
streamId: zod_1.z.string(),
|
|
26
25
|
code: zod_1.z.string(),
|
|
27
26
|
}),
|
|
27
|
+
zod_1.z.object({
|
|
28
|
+
type: zod_1.z.literal('PortChanged'),
|
|
29
|
+
port: zod_1.z.number(),
|
|
30
|
+
value: zod_1.z.boolean(),
|
|
31
|
+
}),
|
|
28
32
|
]);
|
|
29
33
|
exports.csEventsSchema = zod_1.z.discriminatedUnion('type', [
|
|
30
34
|
zod_1.z.object({ type: zod_1.z.literal('init'), data: csEventsDataSchema }),
|
|
@@ -23,12 +23,12 @@ declare const cswEventsDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
23
23
|
state: z.ZodBoolean;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
25
|
type: "StreamAvailable";
|
|
26
|
-
stream_name: string;
|
|
27
26
|
state: boolean;
|
|
27
|
+
stream_name: string;
|
|
28
28
|
}, {
|
|
29
29
|
type: "StreamAvailable";
|
|
30
|
-
stream_name: string;
|
|
31
30
|
state: boolean;
|
|
31
|
+
stream_name: string;
|
|
32
32
|
}>, z.ZodObject<{
|
|
33
33
|
type: z.ZodLiteral<"StreamSwitchAudio">;
|
|
34
34
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -176,12 +176,12 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
176
176
|
state: z.ZodBoolean;
|
|
177
177
|
}, "strip", z.ZodTypeAny, {
|
|
178
178
|
type: "StreamAvailable";
|
|
179
|
-
stream_name: string;
|
|
180
179
|
state: boolean;
|
|
180
|
+
stream_name: string;
|
|
181
181
|
}, {
|
|
182
182
|
type: "StreamAvailable";
|
|
183
|
-
stream_name: string;
|
|
184
183
|
state: boolean;
|
|
184
|
+
stream_name: string;
|
|
185
185
|
}>, z.ZodObject<{
|
|
186
186
|
type: z.ZodLiteral<"StreamSwitchAudio">;
|
|
187
187
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -313,8 +313,8 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
313
313
|
playlist_name: string;
|
|
314
314
|
} | {
|
|
315
315
|
type: "StreamAvailable";
|
|
316
|
-
stream_name: string;
|
|
317
316
|
state: boolean;
|
|
317
|
+
stream_name: string;
|
|
318
318
|
} | {
|
|
319
319
|
type: "StreamSwitchAudio";
|
|
320
320
|
master_audio: boolean;
|
|
@@ -366,8 +366,8 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
366
366
|
playlist_name: string;
|
|
367
367
|
} | {
|
|
368
368
|
type: "StreamAvailable";
|
|
369
|
-
stream_name: string;
|
|
370
369
|
state: boolean;
|
|
370
|
+
stream_name: string;
|
|
371
371
|
} | {
|
|
372
372
|
type: "StreamSwitchAudio";
|
|
373
373
|
master_audio: boolean;
|
|
@@ -433,12 +433,12 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
433
433
|
state: z.ZodBoolean;
|
|
434
434
|
}, "strip", z.ZodTypeAny, {
|
|
435
435
|
type: "StreamAvailable";
|
|
436
|
-
stream_name: string;
|
|
437
436
|
state: boolean;
|
|
437
|
+
stream_name: string;
|
|
438
438
|
}, {
|
|
439
439
|
type: "StreamAvailable";
|
|
440
|
-
stream_name: string;
|
|
441
440
|
state: boolean;
|
|
441
|
+
stream_name: string;
|
|
442
442
|
}>, z.ZodObject<{
|
|
443
443
|
type: z.ZodLiteral<"StreamSwitchAudio">;
|
|
444
444
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -419,11 +419,11 @@ export declare const planeTrackerUserActionData: z.ZodDiscriminatedUnion<"cgi",
|
|
|
419
419
|
userPriority: string;
|
|
420
420
|
}>;
|
|
421
421
|
postJsonBody: z.ZodObject<{
|
|
422
|
-
mode: z.ZodUnion<[z.ZodLiteral<"MANUAL">, z.ZodLiteral<"AUTOMATIC">]
|
|
422
|
+
mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"MANUAL">, z.ZodLiteral<"AUTOMATIC">]>>;
|
|
423
423
|
}, "strip", z.ZodTypeAny, {
|
|
424
424
|
mode: "MANUAL" | "AUTOMATIC";
|
|
425
425
|
}, {
|
|
426
|
-
mode
|
|
426
|
+
mode?: "MANUAL" | "AUTOMATIC" | undefined;
|
|
427
427
|
}>;
|
|
428
428
|
}, "strip", z.ZodTypeAny, {
|
|
429
429
|
params: {
|
|
@@ -445,7 +445,7 @@ export declare const planeTrackerUserActionData: z.ZodDiscriminatedUnion<"cgi",
|
|
|
445
445
|
ip: string;
|
|
446
446
|
cgi: PlaneTrackerUserActions.SET_TRACKING_MODE;
|
|
447
447
|
postJsonBody: {
|
|
448
|
-
mode
|
|
448
|
+
mode?: "MANUAL" | "AUTOMATIC" | undefined;
|
|
449
449
|
};
|
|
450
450
|
}>, z.ZodObject<{
|
|
451
451
|
cgi: z.ZodLiteral<PlaneTrackerUserActions.SET_ZONES>;
|
package/esm/CamOverlayAPI.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ParsingBlobError, ErrorWithResponse, ServiceNotFoundError, StorageDataFetchError } from './errors/errors';
|
|
1
|
+
import { ErrorWithResponse, ServiceNotFoundError, StorageDataFetchError } from './errors/errors';
|
|
3
2
|
import { networkCameraListSchema } from './types/common';
|
|
4
3
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ImageType, serviceListSchema, servicesSchema, wsResponseSchema, getStorageDataListSchema, getFileListSchema, } from './types/CamOverlayAPI';
|
|
5
|
+
import { BasicAPI } from './internal/BasicAPI';
|
|
7
6
|
const BASE_PATH = '/local/camoverlay/api';
|
|
8
|
-
export class CamOverlayAPI {
|
|
9
|
-
client;
|
|
10
|
-
constructor(client) {
|
|
11
|
-
this.client = client;
|
|
12
|
-
}
|
|
7
|
+
export class CamOverlayAPI extends BasicAPI {
|
|
13
8
|
static getBasePath = () => BASE_PATH;
|
|
14
9
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
15
10
|
static getFilePreviewPath = (path) => `${BASE_PATH}/image.cgi?path=${encodeURIComponent(path)}`;
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
async checkAPIAvailable(options) {
|
|
12
|
+
await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
|
|
18
13
|
}
|
|
19
14
|
async checkCameraTime(options) {
|
|
20
15
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
@@ -33,7 +28,7 @@ export class CamOverlayAPI {
|
|
|
33
28
|
}
|
|
34
29
|
async listFiles(fileType, options) {
|
|
35
30
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
|
|
36
|
-
return
|
|
31
|
+
return getFileListSchema(fileType).parse(res.list);
|
|
37
32
|
}
|
|
38
33
|
async uploadFile(fileType, formData, storage, options) {
|
|
39
34
|
await this._post(`${BASE_PATH}/upload_${fileType}.cgi`, formData, {
|
|
@@ -45,14 +40,14 @@ export class CamOverlayAPI {
|
|
|
45
40
|
await this._postUrlEncoded(`${BASE_PATH}/upload_${fileType}.cgi`, {
|
|
46
41
|
action: 'remove',
|
|
47
42
|
...fileParams,
|
|
48
|
-
}, options
|
|
43
|
+
}, options);
|
|
49
44
|
}
|
|
50
45
|
async getFileStorage(fileType, options) {
|
|
51
46
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'get_storage' }, options);
|
|
52
47
|
if (res.code !== 200) {
|
|
53
48
|
throw new StorageDataFetchError(res);
|
|
54
49
|
}
|
|
55
|
-
return
|
|
50
|
+
return getStorageDataListSchema(fileType).parse(res.list);
|
|
56
51
|
}
|
|
57
52
|
async getFilePreviewFromCamera(path, options) {
|
|
58
53
|
return await this._getBlob(CamOverlayAPI.getFilePreviewPath(path), undefined, options);
|
|
@@ -96,15 +91,15 @@ export class CamOverlayAPI {
|
|
|
96
91
|
return services;
|
|
97
92
|
}
|
|
98
93
|
async updateSingleService(service, options) {
|
|
99
|
-
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`,
|
|
94
|
+
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`, service, {
|
|
100
95
|
action: 'set',
|
|
101
96
|
service_id: service.id,
|
|
102
|
-
}, options
|
|
97
|
+
}, options);
|
|
103
98
|
}
|
|
104
99
|
async updateServices(services, options) {
|
|
105
|
-
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`,
|
|
100
|
+
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`, { services: services }, {
|
|
106
101
|
action: 'set',
|
|
107
|
-
}, options
|
|
102
|
+
}, options);
|
|
108
103
|
}
|
|
109
104
|
updateCGText(serviceId, fields, options) {
|
|
110
105
|
const params = {};
|
|
@@ -143,6 +138,9 @@ export class CamOverlayAPI {
|
|
|
143
138
|
};
|
|
144
139
|
return this.promiseCGUpdate(serviceId, 'update_image', params, contentType, imageData, options);
|
|
145
140
|
}
|
|
141
|
+
downloadReport(options) {
|
|
142
|
+
return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
|
|
143
|
+
}
|
|
146
144
|
async promiseCGUpdate(serviceId, action, params = {}, contentType, data, options) {
|
|
147
145
|
const path = `${BASE_PATH}/customGraphics.cgi`;
|
|
148
146
|
let headers = {};
|
|
@@ -165,51 +163,4 @@ export class CamOverlayAPI {
|
|
|
165
163
|
throw new ErrorWithResponse(res);
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
|
-
async _getJson(path, parameters, options) {
|
|
169
|
-
const agent = this.getClient(options?.proxyParams);
|
|
170
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
171
|
-
if (res.ok) {
|
|
172
|
-
return await res.json();
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
throw new ErrorWithResponse(res);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
async _post(path, data, parameters, options, headers) {
|
|
179
|
-
const agent = this.getClient(options?.proxyParams);
|
|
180
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
181
|
-
if (res.ok) {
|
|
182
|
-
return await res.json();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
throw new ErrorWithResponse(res);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async _getBlob(path, parameters, options) {
|
|
189
|
-
const agent = this.getClient(options?.proxyParams);
|
|
190
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
191
|
-
if (res.ok) {
|
|
192
|
-
return await this.parseBlobResponse(res);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw new ErrorWithResponse(res);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
async parseBlobResponse(response) {
|
|
199
|
-
try {
|
|
200
|
-
return (await response.blob());
|
|
201
|
-
}
|
|
202
|
-
catch (err) {
|
|
203
|
-
throw new ParsingBlobError(err);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
async _postUrlEncoded(path, parameters, options, headers) {
|
|
207
|
-
const data = paramToUrl(parameters);
|
|
208
|
-
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
209
|
-
return this._post(path, data, undefined, options, { ...baseHeaders, ...headers });
|
|
210
|
-
}
|
|
211
|
-
async _postJsonEncoded(path, data, parameters, options, headers) {
|
|
212
|
-
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
213
|
-
return this._post(path, data, parameters, options, { ...baseHeaders, ...headers });
|
|
214
|
-
}
|
|
215
166
|
}
|