camstreamerlib 4.0.0-beta.76 → 4.0.0-beta.78
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/cjs/CamOverlayAPI.d.ts +22 -22
- package/cjs/CamStreamerAPI.d.ts +47 -49
- package/cjs/CamStreamerAPI.js +36 -23
- package/cjs/PlaneTrackerAPI.d.ts +1 -3
- package/cjs/PlaneTrackerAPI.js +0 -7
- package/cjs/errors/errors.d.ts +7 -0
- package/cjs/errors/errors.js +12 -1
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +81 -81
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +4 -4
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +6 -6
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +6 -6
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +2 -2
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +199 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +48 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/hlsSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/hlsSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/index.d.ts +9 -0
- package/cjs/types/CamStreamerAPI/index.js +25 -0
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +137 -0
- package/cjs/types/{CamStreamerAPI.js → CamStreamerAPI/oldStreamSchema.js} +3 -12
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +20 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +19 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/windySchema.js +11 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +11 -0
- package/cjs/types/common.d.ts +1 -0
- package/cjs/types/common.js +2 -1
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -69
- package/cjs/types/ws/PlaneTrackerEvents.js +0 -11
- package/esm/CamStreamerAPI.js +37 -24
- package/esm/PlaneTrackerAPI.js +1 -8
- package/esm/errors/errors.js +10 -0
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +38 -0
- package/esm/types/CamStreamerAPI/facebookSchema.js +5 -0
- package/esm/types/CamStreamerAPI/hlsSchema.js +5 -0
- package/esm/types/CamStreamerAPI/index.js +9 -0
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +5 -0
- package/esm/types/{CamStreamerAPI.js → CamStreamerAPI/oldStreamSchema.js} +2 -11
- package/esm/types/CamStreamerAPI/rtmpSchema.js +5 -0
- package/esm/types/CamStreamerAPI/sdCardSchema.js +5 -0
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +16 -0
- package/esm/types/CamStreamerAPI/windySchema.js +5 -0
- package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -0
- package/esm/types/common.js +1 -0
- package/esm/types/ws/PlaneTrackerEvents.js +0 -11
- package/package.json +1 -1
- package/types/CamOverlayAPI.d.ts +22 -22
- package/types/CamStreamerAPI.d.ts +47 -49
- package/types/PlaneTrackerAPI.d.ts +1 -3
- package/types/errors/errors.d.ts +7 -0
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +81 -81
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +4 -4
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +6 -6
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/pipSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +6 -6
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +2 -2
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +199 -0
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/hlsSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/index.d.ts +9 -0
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +137 -0
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +20 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +21 -0
- package/types/types/common.d.ts +1 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +3 -69
- package/cjs/types/CamStreamerAPI.d.ts +0 -272
- package/types/types/CamStreamerAPI.d.ts +0 -272
package/cjs/CamOverlayAPI.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
38
38
|
width: number;
|
|
39
39
|
height: number;
|
|
40
40
|
source: string;
|
|
41
|
-
automationType: "
|
|
41
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
42
42
|
cameraList: number[];
|
|
43
43
|
customName: string;
|
|
44
44
|
pos_y: number;
|
|
@@ -68,7 +68,8 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
68
68
|
id: number;
|
|
69
69
|
width: number;
|
|
70
70
|
height: number;
|
|
71
|
-
|
|
71
|
+
title: string;
|
|
72
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
72
73
|
cameraList: number[];
|
|
73
74
|
customName: string;
|
|
74
75
|
pos_x: number;
|
|
@@ -79,7 +80,6 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
79
80
|
font: string;
|
|
80
81
|
location: string;
|
|
81
82
|
locationName: string;
|
|
82
|
-
title: string;
|
|
83
83
|
bgStartColor: "237,143,73,0.93" | "0,0,0,0.75" | "31,32,73,0.9" | "76,94,127,0.95";
|
|
84
84
|
bgEndColor: "0,0,0,0.75" | "234,181,89,0.93" | "73,96,213,0.9" | "140,150,168,0.95";
|
|
85
85
|
lang: "en-us" | "fr-fr" | "ja-jp" | "pt-pt" | "es-es" | "de-de" | "ko-kr" | "zh-hk" | "zh-cn" | "nl-nl" | "cs-cz" | "ru-ru" | "sv-se";
|
|
@@ -96,7 +96,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
96
96
|
id: number;
|
|
97
97
|
width: number;
|
|
98
98
|
height: number;
|
|
99
|
-
automationType: "
|
|
99
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
100
100
|
cameraList: number[];
|
|
101
101
|
customName: string;
|
|
102
102
|
pos_x: number;
|
|
@@ -126,15 +126,15 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
126
126
|
id: number;
|
|
127
127
|
width: number;
|
|
128
128
|
height: number;
|
|
129
|
-
automationType: "
|
|
129
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
130
130
|
cameraList: number[];
|
|
131
131
|
customName: string;
|
|
132
132
|
overlayList: {
|
|
133
133
|
duration: number;
|
|
134
|
+
active: boolean;
|
|
134
135
|
pos_x: number;
|
|
135
136
|
pos_y: number;
|
|
136
137
|
coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
|
|
137
|
-
active: boolean;
|
|
138
138
|
imgPath: string;
|
|
139
139
|
imgName: string;
|
|
140
140
|
scale: number;
|
|
@@ -150,7 +150,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
150
150
|
id: number;
|
|
151
151
|
width: number;
|
|
152
152
|
height: number;
|
|
153
|
-
automationType: "
|
|
153
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
154
154
|
cameraList: number[];
|
|
155
155
|
customName: string;
|
|
156
156
|
ptz_positions: Record<string, {
|
|
@@ -177,7 +177,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
177
177
|
width: number;
|
|
178
178
|
height: number;
|
|
179
179
|
fps: number;
|
|
180
|
-
automationType: "
|
|
180
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
181
181
|
cameraList: number[];
|
|
182
182
|
customName: string;
|
|
183
183
|
pos_x: number;
|
|
@@ -213,7 +213,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
213
213
|
id: number;
|
|
214
214
|
width: number;
|
|
215
215
|
height: number;
|
|
216
|
-
automationType: "
|
|
216
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
217
217
|
cameraList: number[];
|
|
218
218
|
customName: string;
|
|
219
219
|
pos_x: number;
|
|
@@ -294,7 +294,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
294
294
|
width: number;
|
|
295
295
|
height: number;
|
|
296
296
|
fps: number;
|
|
297
|
-
automationType: "
|
|
297
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
298
298
|
cameraList: number[];
|
|
299
299
|
customName: string;
|
|
300
300
|
pos_x: number;
|
|
@@ -312,7 +312,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
312
312
|
width: number;
|
|
313
313
|
height: number;
|
|
314
314
|
fps: number;
|
|
315
|
-
automationType: "
|
|
315
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
316
316
|
cameraList: number[];
|
|
317
317
|
customName: string;
|
|
318
318
|
pos_x: number;
|
|
@@ -448,7 +448,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
448
448
|
width: number;
|
|
449
449
|
height: number;
|
|
450
450
|
source: string;
|
|
451
|
-
automationType: "
|
|
451
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
452
452
|
cameraList: number[];
|
|
453
453
|
customName: string;
|
|
454
454
|
pos_y: number;
|
|
@@ -478,7 +478,8 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
478
478
|
id: number;
|
|
479
479
|
width: number;
|
|
480
480
|
height: number;
|
|
481
|
-
|
|
481
|
+
title: string;
|
|
482
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
482
483
|
cameraList: number[];
|
|
483
484
|
customName: string;
|
|
484
485
|
pos_x: number;
|
|
@@ -489,7 +490,6 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
489
490
|
font: string;
|
|
490
491
|
location: string;
|
|
491
492
|
locationName: string;
|
|
492
|
-
title: string;
|
|
493
493
|
bgStartColor: "237,143,73,0.93" | "0,0,0,0.75" | "31,32,73,0.9" | "76,94,127,0.95";
|
|
494
494
|
bgEndColor: "0,0,0,0.75" | "234,181,89,0.93" | "73,96,213,0.9" | "140,150,168,0.95";
|
|
495
495
|
lang: "en-us" | "fr-fr" | "ja-jp" | "pt-pt" | "es-es" | "de-de" | "ko-kr" | "zh-hk" | "zh-cn" | "nl-nl" | "cs-cz" | "ru-ru" | "sv-se";
|
|
@@ -506,7 +506,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
506
506
|
id: number;
|
|
507
507
|
width: number;
|
|
508
508
|
height: number;
|
|
509
|
-
automationType: "
|
|
509
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
510
510
|
cameraList: number[];
|
|
511
511
|
customName: string;
|
|
512
512
|
pos_x: number;
|
|
@@ -536,15 +536,15 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
536
536
|
id: number;
|
|
537
537
|
width: number;
|
|
538
538
|
height: number;
|
|
539
|
-
automationType: "
|
|
539
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
540
540
|
cameraList: number[];
|
|
541
541
|
customName: string;
|
|
542
542
|
overlayList: {
|
|
543
543
|
duration: number;
|
|
544
|
+
active: boolean;
|
|
544
545
|
pos_x: number;
|
|
545
546
|
pos_y: number;
|
|
546
547
|
coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
|
|
547
|
-
active: boolean;
|
|
548
548
|
imgPath: string;
|
|
549
549
|
imgName: string;
|
|
550
550
|
scale: number;
|
|
@@ -560,7 +560,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
560
560
|
id: number;
|
|
561
561
|
width: number;
|
|
562
562
|
height: number;
|
|
563
|
-
automationType: "
|
|
563
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
564
564
|
cameraList: number[];
|
|
565
565
|
customName: string;
|
|
566
566
|
ptz_positions: Record<string, {
|
|
@@ -587,7 +587,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
587
587
|
width: number;
|
|
588
588
|
height: number;
|
|
589
589
|
fps: number;
|
|
590
|
-
automationType: "
|
|
590
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
591
591
|
cameraList: number[];
|
|
592
592
|
customName: string;
|
|
593
593
|
pos_x: number;
|
|
@@ -623,7 +623,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
623
623
|
id: number;
|
|
624
624
|
width: number;
|
|
625
625
|
height: number;
|
|
626
|
-
automationType: "
|
|
626
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
627
627
|
cameraList: number[];
|
|
628
628
|
customName: string;
|
|
629
629
|
pos_x: number;
|
|
@@ -704,7 +704,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
704
704
|
width: number;
|
|
705
705
|
height: number;
|
|
706
706
|
fps: number;
|
|
707
|
-
automationType: "
|
|
707
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
708
708
|
cameraList: number[];
|
|
709
709
|
customName: string;
|
|
710
710
|
pos_x: number;
|
|
@@ -722,7 +722,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
|
|
|
722
722
|
width: number;
|
|
723
723
|
height: number;
|
|
724
724
|
fps: number;
|
|
725
|
-
automationType: "
|
|
725
|
+
automationType: "schedule" | "time" | "manual" | `input${number}`;
|
|
726
726
|
cameraList: number[];
|
|
727
727
|
customName: string;
|
|
728
728
|
pos_x: number;
|
package/cjs/CamStreamerAPI.d.ts
CHANGED
|
@@ -1,64 +1,62 @@
|
|
|
1
1
|
import { ProxyClient } from './internal/ProxyClient';
|
|
2
2
|
import { IClient, TResponse } from './internal/types';
|
|
3
|
-
import {
|
|
3
|
+
import { TStream } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
4
4
|
import { THttpRequestOptions, TProxyParams } from './types/common';
|
|
5
|
+
import { TOldStream, TOldStringStream } from './types/CamStreamerAPI/oldStreamSchema';
|
|
5
6
|
export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
|
|
6
7
|
private client;
|
|
7
8
|
constructor(client: Client);
|
|
9
|
+
static getProxyPath: () => string;
|
|
8
10
|
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
9
11
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
10
12
|
getUtcTime(options?: THttpRequestOptions): Promise<number>;
|
|
11
|
-
getStreamList(options?: THttpRequestOptions): Promise<Record<number,
|
|
12
|
-
enabled: 0 | 1;
|
|
13
|
-
schedule: string;
|
|
14
|
-
active: 0 | 1;
|
|
15
|
-
audioSource: string;
|
|
16
|
-
avSyncMsec: number;
|
|
17
|
-
internalVapixParameters: string;
|
|
18
|
-
userVapixParameters: string;
|
|
19
|
-
outputParameters: string;
|
|
20
|
-
outputType: "video" | "none" | "images";
|
|
21
|
-
mediaServerUrl: string;
|
|
22
|
-
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
23
|
-
inputUrl: string;
|
|
24
|
-
forceStereo: 0 | 1;
|
|
25
|
-
streamDelay: number | null;
|
|
26
|
-
statusLed: number;
|
|
27
|
-
statusPort: string;
|
|
28
|
-
callApi: number;
|
|
29
|
-
trigger: string;
|
|
30
|
-
prepareAhead: number;
|
|
31
|
-
startTime: number | null;
|
|
32
|
-
stopTime: number | null;
|
|
33
|
-
}>>;
|
|
13
|
+
getStreamList(options?: THttpRequestOptions): Promise<Record<number, TStream>>;
|
|
34
14
|
getStream(streamId: number, options?: THttpRequestOptions): Promise<{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
active:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
15
|
+
type: "facebook";
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
active: boolean;
|
|
18
|
+
title: string;
|
|
19
|
+
order: number;
|
|
20
|
+
} | {
|
|
21
|
+
type: "hls";
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
active: boolean;
|
|
24
|
+
title: string;
|
|
25
|
+
order: number;
|
|
26
|
+
} | {
|
|
27
|
+
type: "mpeg_dvb";
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
active: boolean;
|
|
30
|
+
title: string;
|
|
31
|
+
order: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: "rtmp";
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
active: boolean;
|
|
36
|
+
title: string;
|
|
37
|
+
order: number;
|
|
38
|
+
} | {
|
|
39
|
+
type: "sd_card";
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
active: boolean;
|
|
42
|
+
title: string;
|
|
43
|
+
order: number;
|
|
44
|
+
} | {
|
|
45
|
+
type: "windy";
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
active: boolean;
|
|
48
|
+
title: string;
|
|
49
|
+
order: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "youtube";
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
active: boolean;
|
|
54
|
+
title: string;
|
|
55
|
+
order: number;
|
|
56
56
|
}>;
|
|
57
|
-
|
|
58
|
-
setStream(streamId: number, params: Partial<TStream>, options?: THttpRequestOptions): Promise<void>;
|
|
59
|
-
setStreamParameter(streamId: number, paramName: string, value: string, options?: THttpRequestOptions): Promise<void>;
|
|
57
|
+
setStream(streamId: number, streamData: Partial<TStream>, options?: THttpRequestOptions): Promise<void>;
|
|
60
58
|
isStreaming(streamId: number, options?: THttpRequestOptions): Promise<boolean>;
|
|
61
59
|
deleteStream(streamId: number, options?: THttpRequestOptions): Promise<boolean>;
|
|
62
60
|
private _getJson;
|
|
63
61
|
}
|
|
64
|
-
export declare const parseCameraStreamResponse: (cameraStreamData:
|
|
62
|
+
export declare const parseCameraStreamResponse: (cameraStreamData: TOldStringStream) => TOldStream;
|
package/cjs/CamStreamerAPI.js
CHANGED
|
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseCameraStreamResponse = exports.CamStreamerAPI = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
6
|
-
const CamStreamerAPI_1 = require("./types/CamStreamerAPI");
|
|
6
|
+
const CamStreamerAPI_1 = require("./types/CamStreamerAPI/CamStreamerAPI");
|
|
7
7
|
const errors_1 = require("./errors/errors");
|
|
8
|
+
const oldStreamSchema_1 = require("./types/CamStreamerAPI/oldStreamSchema");
|
|
8
9
|
const BASE_PATH = '/local/camstreamer';
|
|
9
10
|
class CamStreamerAPI {
|
|
10
11
|
client;
|
|
11
12
|
constructor(client) {
|
|
12
13
|
this.client = client;
|
|
13
14
|
}
|
|
15
|
+
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
14
16
|
getClient(proxyParams) {
|
|
15
17
|
return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
|
|
16
18
|
}
|
|
@@ -30,35 +32,46 @@ class CamStreamerAPI {
|
|
|
30
32
|
}
|
|
31
33
|
async getStreamList(options) {
|
|
32
34
|
const res = await this._getJson(`${BASE_PATH}/stream/list.cgi`, undefined, options);
|
|
33
|
-
const list = zod_1.z.record(zod_1.z.string(), CamStreamerAPI_1.cameraStreamSchema).parse(res.data);
|
|
34
35
|
const streamList = {};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const invalidList = {};
|
|
37
|
+
for (const [key, value] of Object.entries(res.data)) {
|
|
38
|
+
const id = parseInt(key);
|
|
39
|
+
try {
|
|
40
|
+
const parsed = CamStreamerAPI_1.streamSchema.parse(value);
|
|
41
|
+
streamList[id] = parsed;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const oldStream = oldStreamSchema_1.oldStringStreamSchema.parse(value);
|
|
45
|
+
const parsedOldStream = (0, exports.parseCameraStreamResponse)(oldStream);
|
|
46
|
+
invalidList[id] = parsedOldStream;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (Object.keys(invalidList).length > 0) {
|
|
50
|
+
throw new errors_1.MigrationError(streamList, invalidList);
|
|
38
51
|
}
|
|
39
52
|
return streamList;
|
|
40
53
|
}
|
|
41
54
|
async getStream(streamId, options) {
|
|
42
55
|
const res = await this._getJson(`${BASE_PATH}/stream/get.cgi`, { stream_id: streamId }, options);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const { streamDelay, startTime, stopTime, ...rest } = params;
|
|
52
|
-
await this._getJson(`${BASE_PATH}/stream/set.cgi`, {
|
|
53
|
-
stream_id: streamId,
|
|
54
|
-
streamDelay: streamDelay ?? '',
|
|
55
|
-
startTime: startTime ?? null,
|
|
56
|
-
stopTime: stopTime ?? null,
|
|
57
|
-
...rest,
|
|
58
|
-
}, options);
|
|
56
|
+
try {
|
|
57
|
+
return CamStreamerAPI_1.streamSchema.parse(res.data);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
const oldStream = oldStreamSchema_1.oldStringStreamSchema.parse(res.data);
|
|
61
|
+
const parsedOldStream = (0, exports.parseCameraStreamResponse)(oldStream);
|
|
62
|
+
throw new errors_1.MigrationError({}, { [streamId]: parsedOldStream });
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
|
-
async
|
|
61
|
-
|
|
65
|
+
async setStream(streamId, streamData, options) {
|
|
66
|
+
const agent = this.getClient(options?.proxyParams);
|
|
67
|
+
await agent.post({
|
|
68
|
+
path: `${BASE_PATH}/stream/set.cgi`,
|
|
69
|
+
data: streamData,
|
|
70
|
+
parameters: {
|
|
71
|
+
stream_id: streamId,
|
|
72
|
+
},
|
|
73
|
+
timeout: options?.timeout,
|
|
74
|
+
});
|
|
62
75
|
}
|
|
63
76
|
async isStreaming(streamId, options) {
|
|
64
77
|
const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
|
package/cjs/PlaneTrackerAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
|
-
import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode,
|
|
2
|
+
import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
|
|
3
3
|
import { THttpRequestOptions, TProxyParams } from './types/common';
|
|
4
4
|
import { ProxyClient } from './internal/ProxyClient';
|
|
5
5
|
export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
@@ -194,8 +194,6 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
194
194
|
getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
|
|
195
195
|
getPriorityList(options?: THttpRequestOptions): Promise<string[]>;
|
|
196
196
|
setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
197
|
-
getTypePriorityList(options?: THttpRequestOptions): Promise<string[]>;
|
|
198
|
-
setTypePriorityList(typePriorityList: TTypePriorityList['typePriorityList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
199
197
|
getWhiteList(options?: THttpRequestOptions): Promise<string[]>;
|
|
200
198
|
setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<TResponse>;
|
|
201
199
|
getBlackList(options?: THttpRequestOptions): Promise<string[]>;
|
package/cjs/PlaneTrackerAPI.js
CHANGED
|
@@ -125,13 +125,6 @@ class PlaneTrackerAPI {
|
|
|
125
125
|
async setPriorityList(priorityList, options) {
|
|
126
126
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, { priorityList }, this.apiUser, options);
|
|
127
127
|
}
|
|
128
|
-
async getTypePriorityList(options) {
|
|
129
|
-
const res = await this._getJson(`${BASE_PATH}/package/getTypePriorityList.cgi`, undefined, options);
|
|
130
|
-
return PlaneTrackerAPI_1.typePriorityListSchema.parse(res).typePriorityList;
|
|
131
|
-
}
|
|
132
|
-
async setTypePriorityList(typePriorityList, options) {
|
|
133
|
-
return await this._postJsonEncoded(`${BASE_PATH}/package/setTypePriorityList.cgi`, { typePriorityList }, this.apiUser, options);
|
|
134
|
-
}
|
|
135
128
|
async getWhiteList(options) {
|
|
136
129
|
const res = await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
|
|
137
130
|
return PlaneTrackerAPI_1.whiteListSchema.parse(res).whiteList;
|
package/cjs/errors/errors.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { TResponse } from '../internal/types';
|
|
2
|
+
import { TStream } from '../types/CamStreamerAPI';
|
|
3
|
+
import { TOldStream } from '../types/CamStreamerAPI/oldStreamSchema';
|
|
2
4
|
export declare class ErrorWithResponse<T extends TResponse> extends Error {
|
|
3
5
|
res: T;
|
|
4
6
|
constructor(res: T);
|
|
@@ -88,4 +90,9 @@ export declare class ServerError extends Error {
|
|
|
88
90
|
export declare class BadRequestError<T extends TResponse> extends ErrorWithResponse<T> {
|
|
89
91
|
constructor(res: T);
|
|
90
92
|
}
|
|
93
|
+
export declare class MigrationError extends Error {
|
|
94
|
+
readonly valid: Record<number, TStream>;
|
|
95
|
+
readonly invalid: Record<number, TOldStream>;
|
|
96
|
+
constructor(valid: Record<number, TStream>, invalid: Record<number, TOldStream>);
|
|
97
|
+
}
|
|
91
98
|
export {};
|
package/cjs/errors/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BadRequestError = exports.ServerError = exports.InvalidAltitudeError = exports.InvalidLatLngError = exports.CannotSetCoordsInAutoModeError = exports.ImportSettingsError = exports.ResetCalibrationError = exports.TimezoneFetchError = exports.TimezoneNotSetupError = exports.UtcTimeFetchError = exports.WsAuthorizationError = exports.StorageDataFetchError = exports.PtzNotSupportedError = exports.AddNewClipError = exports.FetchDeviceInfoError = exports.NoDeviceInfoError = exports.MaxFPSError = exports.SDCardJobError = exports.SDCardActionError = exports.ApplicationAPIError = exports.SettingParameterError = exports.ParameterNotFoundError = exports.JsonParseError = exports.ParsingBlobError = exports.ServiceNotFoundError = exports.ServiceUnavailableError = exports.ErrorWithResponse = void 0;
|
|
3
|
+
exports.MigrationError = exports.BadRequestError = exports.ServerError = exports.InvalidAltitudeError = exports.InvalidLatLngError = exports.CannotSetCoordsInAutoModeError = exports.ImportSettingsError = exports.ResetCalibrationError = exports.TimezoneFetchError = exports.TimezoneNotSetupError = exports.UtcTimeFetchError = exports.WsAuthorizationError = exports.StorageDataFetchError = exports.PtzNotSupportedError = exports.AddNewClipError = exports.FetchDeviceInfoError = exports.NoDeviceInfoError = exports.MaxFPSError = exports.SDCardJobError = exports.SDCardActionError = exports.ApplicationAPIError = exports.SettingParameterError = exports.ParameterNotFoundError = exports.JsonParseError = exports.ParsingBlobError = exports.ServiceNotFoundError = exports.ServiceUnavailableError = exports.ErrorWithResponse = void 0;
|
|
4
4
|
class ErrorWithResponse extends Error {
|
|
5
5
|
res;
|
|
6
6
|
constructor(res) {
|
|
@@ -204,3 +204,14 @@ class BadRequestError extends ErrorWithResponse {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
exports.BadRequestError = BadRequestError;
|
|
207
|
+
class MigrationError extends Error {
|
|
208
|
+
valid;
|
|
209
|
+
invalid;
|
|
210
|
+
constructor(valid, invalid) {
|
|
211
|
+
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
212
|
+
this.name = 'MigrationError';
|
|
213
|
+
this.valid = valid;
|
|
214
|
+
this.invalid = invalid;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.MigrationError = MigrationError;
|