camstreamerlib 4.0.0-beta.15 → 4.0.0-beta.17
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/PlaneTrackerAPI.d.ts +40 -0
- package/cjs/PlaneTrackerAPI.js +163 -0
- package/cjs/VapixAPI.d.ts +1 -1
- package/cjs/VapixAPI.js +21 -3
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +4 -1
- package/cjs/types/PlaneTrackerAPI.d.ts +2 -0
- package/cjs/types/PlaneTrackerAPI.js +2 -0
- package/cjs/types/VapixAPI.d.ts +44 -5
- package/cjs/types/VapixAPI.js +16 -2
- package/cjs/web/WsClient.js +2 -2
- package/esm/PlaneTrackerAPI.d.ts +40 -0
- package/esm/PlaneTrackerAPI.js +159 -0
- package/esm/VapixAPI.d.ts +1 -1
- package/esm/VapixAPI.js +22 -4
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/types/PlaneTrackerAPI.d.ts +2 -0
- package/esm/types/PlaneTrackerAPI.js +1 -0
- package/esm/types/VapixAPI.d.ts +44 -5
- package/esm/types/VapixAPI.js +15 -1
- package/esm/web/WsClient.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
|
+
import { TExportDataType, TImportDataType } from './types/PlaneTrackerAPI';
|
|
3
|
+
type ICAO = string;
|
|
4
|
+
export declare const BASE_URL = "/local/planetracker";
|
|
5
|
+
export declare class PlaneTrackerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
static getProxyUrlPath: () => string;
|
|
9
|
+
checkCameraTime(): Promise<boolean>;
|
|
10
|
+
fetchCameraSettings: () => Promise<any>;
|
|
11
|
+
setCameraSettings: (settingsJsonString: string) => Promise<TResponse>;
|
|
12
|
+
fetchServerSettings: () => Promise<any>;
|
|
13
|
+
fetchMapInfo: () => Promise<any>;
|
|
14
|
+
fetchFlightInfo: (icao: ICAO) => Promise<any>;
|
|
15
|
+
getZones: () => Promise<any>;
|
|
16
|
+
setZones: (zonesJsonString: string) => Promise<TResponse>;
|
|
17
|
+
getPriorityList: () => Promise<any>;
|
|
18
|
+
setPriorityList: (priorityListJsonString: string) => Promise<TResponse>;
|
|
19
|
+
getWhiteList: () => Promise<any>;
|
|
20
|
+
setWhiteList: (whiteListJsonString: string) => Promise<TResponse>;
|
|
21
|
+
getBlackList: () => Promise<any>;
|
|
22
|
+
setBlackList: (blackListJsonString: string) => Promise<TResponse>;
|
|
23
|
+
getTrackingMode: () => Promise<any>;
|
|
24
|
+
setTrackingMode: (modeJsonString: string) => Promise<TResponse>;
|
|
25
|
+
startTrackingPlane: (icao: ICAO) => Promise<TResponse>;
|
|
26
|
+
stopTrackingPlane: () => Promise<TResponse>;
|
|
27
|
+
goToCoordinates: (lat: number, lon: number, alt?: number) => Promise<TResponse>;
|
|
28
|
+
exportAppSettings: (dataType: TExportDataType) => Promise<TBlobResponse<Client>>;
|
|
29
|
+
importAppSettings: (dataType: TImportDataType, formData: FormData) => Promise<TResponse>;
|
|
30
|
+
resetPtzCalibration: () => Promise<TResponse>;
|
|
31
|
+
checkGenetecConnection: (params: TParameters) => Promise<TResponse>;
|
|
32
|
+
getGenetecCameraList: (params: TParameters) => Promise<any>;
|
|
33
|
+
serverRunCheck: () => Promise<TResponse>;
|
|
34
|
+
private _getJson;
|
|
35
|
+
private _getBlob;
|
|
36
|
+
private parseBlobResponse;
|
|
37
|
+
private _postJsonEncoded;
|
|
38
|
+
private _postUrlEncoded;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaneTrackerAPI = exports.BASE_URL = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("./internal/utils");
|
|
6
|
+
const errors_1 = require("./errors/errors");
|
|
7
|
+
exports.BASE_URL = '/local/planetracker';
|
|
8
|
+
class PlaneTrackerAPI {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
|
|
14
|
+
async checkCameraTime() {
|
|
15
|
+
const responseSchema = zod_1.z.discriminatedUnion('state', [
|
|
16
|
+
zod_1.z.object({
|
|
17
|
+
state: zod_1.z.literal(true),
|
|
18
|
+
code: zod_1.z.number(),
|
|
19
|
+
}),
|
|
20
|
+
zod_1.z.object({
|
|
21
|
+
state: zod_1.z.literal(false),
|
|
22
|
+
code: zod_1.z.number(),
|
|
23
|
+
reason: zod_1.z.union([
|
|
24
|
+
zod_1.z.literal('INVALID_TIME'),
|
|
25
|
+
zod_1.z.literal('COULDNT_RESOLVE_HOST'),
|
|
26
|
+
zod_1.z.literal('CONNECTION_ERROR'),
|
|
27
|
+
]),
|
|
28
|
+
message: zod_1.z.string(),
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
const response = await this._getJson(`${exports.BASE_URL}/camera_time.cgi`);
|
|
32
|
+
const cameraTime = responseSchema.parse(response);
|
|
33
|
+
if (!cameraTime.state) {
|
|
34
|
+
console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
|
|
35
|
+
}
|
|
36
|
+
return cameraTime.state;
|
|
37
|
+
}
|
|
38
|
+
fetchCameraSettings = async () => {
|
|
39
|
+
return await this._getJson(`${exports.BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
|
|
40
|
+
};
|
|
41
|
+
setCameraSettings = async (settingsJsonString) => {
|
|
42
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package_camera_settings.cgi`, settingsJsonString, {
|
|
43
|
+
action: 'set',
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
fetchServerSettings = async () => {
|
|
47
|
+
return await this._getJson(`${exports.BASE_URL}/package_server_settings.cgi`, { action: 'get' });
|
|
48
|
+
};
|
|
49
|
+
fetchMapInfo = async () => {
|
|
50
|
+
return await this._getJson(`${exports.BASE_URL}/package/getMapInfo.cgi`);
|
|
51
|
+
};
|
|
52
|
+
fetchFlightInfo = async (icao) => {
|
|
53
|
+
return await this._getJson(`${exports.BASE_URL}/package/flightInfo.cgi`, { icao });
|
|
54
|
+
};
|
|
55
|
+
getZones = async () => {
|
|
56
|
+
return await this._getJson(`${exports.BASE_URL}/package/getZones.cgi`);
|
|
57
|
+
};
|
|
58
|
+
setZones = async (zonesJsonString) => {
|
|
59
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setZones.cgi`, zonesJsonString);
|
|
60
|
+
};
|
|
61
|
+
getPriorityList = async () => {
|
|
62
|
+
return await this._getJson(`${exports.BASE_URL}/package/getPriorityList.cgi`);
|
|
63
|
+
};
|
|
64
|
+
setPriorityList = async (priorityListJsonString) => {
|
|
65
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setPriorityList.cgi`, priorityListJsonString);
|
|
66
|
+
};
|
|
67
|
+
getWhiteList = async () => {
|
|
68
|
+
return await this._getJson(`${exports.BASE_URL}/package/getWhiteList.cgi`);
|
|
69
|
+
};
|
|
70
|
+
setWhiteList = async (whiteListJsonString) => {
|
|
71
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setWhiteList.cgi`, whiteListJsonString);
|
|
72
|
+
};
|
|
73
|
+
getBlackList = async () => {
|
|
74
|
+
return await this._getJson(`${exports.BASE_URL}/package/getBlackList.cgi`);
|
|
75
|
+
};
|
|
76
|
+
setBlackList = async (blackListJsonString) => {
|
|
77
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setBlackList.cgi`, blackListJsonString);
|
|
78
|
+
};
|
|
79
|
+
getTrackingMode = async () => {
|
|
80
|
+
return await this._getJson(`${exports.BASE_URL}/package/getTrackingMode.cgi`);
|
|
81
|
+
};
|
|
82
|
+
setTrackingMode = async (modeJsonString) => {
|
|
83
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setTrackingMode.cgi`, modeJsonString);
|
|
84
|
+
};
|
|
85
|
+
startTrackingPlane = async (icao) => {
|
|
86
|
+
return await this.client.get(`${exports.BASE_URL}/package/trackIcao.cgi`, { icao });
|
|
87
|
+
};
|
|
88
|
+
stopTrackingPlane = async () => {
|
|
89
|
+
return await this.client.get(`${exports.BASE_URL}/package/resetIcao.cgi`);
|
|
90
|
+
};
|
|
91
|
+
goToCoordinates = async (lat, lon, alt) => {
|
|
92
|
+
const url = `${exports.BASE_URL}/package/goToCoordinates.cgi?lat=${lat}&lon=${lon}`;
|
|
93
|
+
return await this.client.get(`${url}${alt !== undefined ? `&alt=${alt}` : ''}`);
|
|
94
|
+
};
|
|
95
|
+
exportAppSettings = async (dataType) => {
|
|
96
|
+
return await this._getBlob(`${exports.BASE_URL}/package_data.cgi`, { action: 'EXPORT', dataType });
|
|
97
|
+
};
|
|
98
|
+
importAppSettings = async (dataType, formData) => {
|
|
99
|
+
return await this.client.post(`${exports.BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
|
|
100
|
+
};
|
|
101
|
+
resetPtzCalibration = async () => {
|
|
102
|
+
return await this.client.get(`${exports.BASE_URL}/package/resetPtzCalibration.cgi`);
|
|
103
|
+
};
|
|
104
|
+
checkGenetecConnection = async (params) => {
|
|
105
|
+
return await this._postUrlEncoded(`${exports.BASE_URL}/package/checkGenetecConnection.cgi`, params);
|
|
106
|
+
};
|
|
107
|
+
getGenetecCameraList = async (params) => {
|
|
108
|
+
const res = await this._postUrlEncoded(`${exports.BASE_URL}/package/getGenetecCameraList.cgi`, params);
|
|
109
|
+
return await res.json();
|
|
110
|
+
};
|
|
111
|
+
serverRunCheck = async () => {
|
|
112
|
+
return await this.client.get(`${exports.BASE_URL}/package/serverRunCheck.cgi`);
|
|
113
|
+
};
|
|
114
|
+
async _getJson(...args) {
|
|
115
|
+
const res = await this.client.get(...args);
|
|
116
|
+
if (res.ok) {
|
|
117
|
+
return await res.json();
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async _getBlob(...args) {
|
|
124
|
+
const res = await this.client.get(...args);
|
|
125
|
+
if (res.ok) {
|
|
126
|
+
return await this.parseBlobResponse(res);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async parseBlobResponse(response) {
|
|
133
|
+
try {
|
|
134
|
+
return (await response.blob());
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
throw new errors_1.ParsingBlobError(err);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async _postJsonEncoded(...args) {
|
|
141
|
+
const [path, data, params, headers] = args;
|
|
142
|
+
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
143
|
+
const res = await this.client.post(path, data, params, { ...baseHeaders, ...headers });
|
|
144
|
+
if (res.ok) {
|
|
145
|
+
return res;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async _postUrlEncoded(path, params, headers) {
|
|
152
|
+
const data = (0, utils_1.paramToUrl)(params);
|
|
153
|
+
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
154
|
+
const res = await this.client.post(path, data, {}, { ...baseHeaders, ...headers });
|
|
155
|
+
if (res.ok) {
|
|
156
|
+
return res;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.PlaneTrackerAPI = PlaneTrackerAPI;
|
package/cjs/VapixAPI.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
|
|
|
26
26
|
dstEnabled: boolean;
|
|
27
27
|
localDateTime: string;
|
|
28
28
|
posixTimeZone: string;
|
|
29
|
-
timeZone
|
|
29
|
+
timeZone?: string | undefined;
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
32
|
getDevicesSettings(proxy?: TProxyParam): Promise<TAudioDevice[]>;
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -171,9 +171,27 @@ class VapixAPI {
|
|
|
171
171
|
return captureMode.maxFPS;
|
|
172
172
|
}
|
|
173
173
|
async getTimezone(proxy = null) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
try {
|
|
175
|
+
const resV2 = await this.client.get(proxy, '/config/rest/time/v2/timeZone');
|
|
176
|
+
if (!resV2.ok) {
|
|
177
|
+
throw new Error(await (0, utils_1.responseStringify)(resV2));
|
|
178
|
+
}
|
|
179
|
+
const json = await resV2.json();
|
|
180
|
+
const data = VapixAPI_1.timeZoneSchema.parse(json);
|
|
181
|
+
if (data.status === 'error') {
|
|
182
|
+
throw new Error(data.error.message);
|
|
183
|
+
}
|
|
184
|
+
return data.data.activeTimeZone;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message : JSON.stringify(error));
|
|
188
|
+
console.warn('Falling back to deprecated time API v1');
|
|
189
|
+
}
|
|
190
|
+
const data = await this.getDateTimeInfo(proxy);
|
|
191
|
+
if (data.data.timeZone === undefined) {
|
|
192
|
+
throw new Error('Time zone not setup on the device');
|
|
193
|
+
}
|
|
194
|
+
return data.data.timeZone;
|
|
177
195
|
}
|
|
178
196
|
async getDateTimeInfo(proxy = null) {
|
|
179
197
|
const data = { apiVersion: '1.0', method: 'getDateTimeInfo' };
|
package/cjs/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export { VapixAPI } from './VapixAPI';
|
|
|
9
9
|
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
10
10
|
export { CamScripterAPI } from './CamScripterAPI';
|
|
11
11
|
export { CamStreamerAPI } from './CamStreamerAPI';
|
|
12
|
+
export { PlaneTrackerAPI } from './PlaneTrackerAPI';
|
|
12
13
|
export * from './types/CamSwitcherEvents';
|
|
13
14
|
export * from './types/CamSwitcherAPI';
|
|
14
15
|
export * from './types/VapixAPI';
|
|
15
16
|
export * from './types/CamOverlayAPI';
|
|
16
17
|
export * from './models/CamOverlayAPI';
|
|
18
|
+
export * from './types/PlaneTrackerAPI';
|
package/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CamStreamerAPI = exports.CamScripterAPI = exports.CamOverlayAPI = exports.VapixAPI = exports.CamSwitcherEvents = exports.CamSwitcherAPI = void 0;
|
|
17
|
+
exports.PlaneTrackerAPI = exports.CamStreamerAPI = exports.CamScripterAPI = exports.CamOverlayAPI = exports.VapixAPI = exports.CamSwitcherEvents = exports.CamSwitcherAPI = void 0;
|
|
18
18
|
__exportStar(require("./internal/types"), exports);
|
|
19
19
|
__exportStar(require("./internal/constants"), exports);
|
|
20
20
|
__exportStar(require("./internal/utils"), exports);
|
|
@@ -32,8 +32,11 @@ var CamScripterAPI_1 = require("./CamScripterAPI");
|
|
|
32
32
|
Object.defineProperty(exports, "CamScripterAPI", { enumerable: true, get: function () { return CamScripterAPI_1.CamScripterAPI; } });
|
|
33
33
|
var CamStreamerAPI_1 = require("./CamStreamerAPI");
|
|
34
34
|
Object.defineProperty(exports, "CamStreamerAPI", { enumerable: true, get: function () { return CamStreamerAPI_1.CamStreamerAPI; } });
|
|
35
|
+
var PlaneTrackerAPI_1 = require("./PlaneTrackerAPI");
|
|
36
|
+
Object.defineProperty(exports, "PlaneTrackerAPI", { enumerable: true, get: function () { return PlaneTrackerAPI_1.PlaneTrackerAPI; } });
|
|
35
37
|
__exportStar(require("./types/CamSwitcherEvents"), exports);
|
|
36
38
|
__exportStar(require("./types/CamSwitcherAPI"), exports);
|
|
37
39
|
__exportStar(require("./types/VapixAPI"), exports);
|
|
38
40
|
__exportStar(require("./types/CamOverlayAPI"), exports);
|
|
39
41
|
__exportStar(require("./models/CamOverlayAPI"), exports);
|
|
42
|
+
__exportStar(require("./types/PlaneTrackerAPI"), exports);
|
package/cjs/types/VapixAPI.d.ts
CHANGED
|
@@ -1499,19 +1499,19 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1499
1499
|
dstEnabled: z.ZodBoolean;
|
|
1500
1500
|
localDateTime: z.ZodString;
|
|
1501
1501
|
posixTimeZone: z.ZodString;
|
|
1502
|
-
timeZone: z.ZodString
|
|
1502
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
1503
1503
|
}, "strip", z.ZodTypeAny, {
|
|
1504
1504
|
dateTime: string;
|
|
1505
1505
|
dstEnabled: boolean;
|
|
1506
1506
|
localDateTime: string;
|
|
1507
1507
|
posixTimeZone: string;
|
|
1508
|
-
timeZone
|
|
1508
|
+
timeZone?: string | undefined;
|
|
1509
1509
|
}, {
|
|
1510
1510
|
dateTime: string;
|
|
1511
1511
|
dstEnabled: boolean;
|
|
1512
1512
|
localDateTime: string;
|
|
1513
1513
|
posixTimeZone: string;
|
|
1514
|
-
timeZone
|
|
1514
|
+
timeZone?: string | undefined;
|
|
1515
1515
|
}>;
|
|
1516
1516
|
}, "strip", z.ZodTypeAny, {
|
|
1517
1517
|
data: {
|
|
@@ -1519,7 +1519,7 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1519
1519
|
dstEnabled: boolean;
|
|
1520
1520
|
localDateTime: string;
|
|
1521
1521
|
posixTimeZone: string;
|
|
1522
|
-
timeZone
|
|
1522
|
+
timeZone?: string | undefined;
|
|
1523
1523
|
};
|
|
1524
1524
|
}, {
|
|
1525
1525
|
data: {
|
|
@@ -1527,9 +1527,48 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1527
1527
|
dstEnabled: boolean;
|
|
1528
1528
|
localDateTime: string;
|
|
1529
1529
|
posixTimeZone: string;
|
|
1530
|
-
timeZone
|
|
1530
|
+
timeZone?: string | undefined;
|
|
1531
1531
|
};
|
|
1532
1532
|
}>;
|
|
1533
|
+
export declare const timeZoneSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
1534
|
+
status: z.ZodLiteral<"success">;
|
|
1535
|
+
data: z.ZodObject<{
|
|
1536
|
+
activeTimeZone: z.ZodString;
|
|
1537
|
+
}, "strip", z.ZodTypeAny, {
|
|
1538
|
+
activeTimeZone: string;
|
|
1539
|
+
}, {
|
|
1540
|
+
activeTimeZone: string;
|
|
1541
|
+
}>;
|
|
1542
|
+
}, "strip", z.ZodTypeAny, {
|
|
1543
|
+
status: "success";
|
|
1544
|
+
data: {
|
|
1545
|
+
activeTimeZone: string;
|
|
1546
|
+
};
|
|
1547
|
+
}, {
|
|
1548
|
+
status: "success";
|
|
1549
|
+
data: {
|
|
1550
|
+
activeTimeZone: string;
|
|
1551
|
+
};
|
|
1552
|
+
}>, z.ZodObject<{
|
|
1553
|
+
status: z.ZodLiteral<"error">;
|
|
1554
|
+
error: z.ZodObject<{
|
|
1555
|
+
message: z.ZodString;
|
|
1556
|
+
}, "strip", z.ZodTypeAny, {
|
|
1557
|
+
message: string;
|
|
1558
|
+
}, {
|
|
1559
|
+
message: string;
|
|
1560
|
+
}>;
|
|
1561
|
+
}, "strip", z.ZodTypeAny, {
|
|
1562
|
+
status: "error";
|
|
1563
|
+
error: {
|
|
1564
|
+
message: string;
|
|
1565
|
+
};
|
|
1566
|
+
}, {
|
|
1567
|
+
status: "error";
|
|
1568
|
+
error: {
|
|
1569
|
+
message: string;
|
|
1570
|
+
};
|
|
1571
|
+
}>]>;
|
|
1533
1572
|
export declare const audioSampleRatesResponseSchema: z.ZodObject<{
|
|
1534
1573
|
data: z.ZodObject<{
|
|
1535
1574
|
encoders: z.ZodObject<{
|
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.PtzOverviewSchema = exports.sdCardWatchedStatuses = exports.guardTourSchema = exports.APP_IDS = exports.applicationSchema = void 0;
|
|
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
4
|
const zod_1 = require("zod");
|
|
5
5
|
const transformers_1 = require("../internal/transformers");
|
|
6
6
|
exports.applicationSchema = zod_1.z.object({
|
|
@@ -110,9 +110,23 @@ exports.dateTimeinfoSchema = zod_1.z.object({
|
|
|
110
110
|
dstEnabled: zod_1.z.boolean(),
|
|
111
111
|
localDateTime: zod_1.z.string(),
|
|
112
112
|
posixTimeZone: zod_1.z.string(),
|
|
113
|
-
timeZone: zod_1.z.string(),
|
|
113
|
+
timeZone: zod_1.z.string().optional(),
|
|
114
114
|
}),
|
|
115
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
|
+
]);
|
|
116
130
|
exports.audioSampleRatesResponseSchema = zod_1.z.object({
|
|
117
131
|
data: zod_1.z.object({
|
|
118
132
|
encoders: zod_1.z
|
package/cjs/web/WsClient.js
CHANGED
|
@@ -30,7 +30,7 @@ class WsClient {
|
|
|
30
30
|
};
|
|
31
31
|
ws.onmessage = (e) => this.onmessage(e);
|
|
32
32
|
ws.onclose = () => {
|
|
33
|
-
this.restartTimeout = setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
33
|
+
this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
34
34
|
};
|
|
35
35
|
this.ws = ws;
|
|
36
36
|
}
|
|
@@ -43,7 +43,7 @@ class WsClient {
|
|
|
43
43
|
this.destroyWebsocket();
|
|
44
44
|
};
|
|
45
45
|
destroyWebsocket() {
|
|
46
|
-
if (this.restartTimeout) {
|
|
46
|
+
if (this.restartTimeout !== null) {
|
|
47
47
|
clearTimeout(this.restartTimeout);
|
|
48
48
|
this.restartTimeout = null;
|
|
49
49
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
|
+
import { TExportDataType, TImportDataType } from './types/PlaneTrackerAPI';
|
|
3
|
+
type ICAO = string;
|
|
4
|
+
export declare const BASE_URL = "/local/planetracker";
|
|
5
|
+
export declare class PlaneTrackerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
static getProxyUrlPath: () => string;
|
|
9
|
+
checkCameraTime(): Promise<boolean>;
|
|
10
|
+
fetchCameraSettings: () => Promise<any>;
|
|
11
|
+
setCameraSettings: (settingsJsonString: string) => Promise<TResponse>;
|
|
12
|
+
fetchServerSettings: () => Promise<any>;
|
|
13
|
+
fetchMapInfo: () => Promise<any>;
|
|
14
|
+
fetchFlightInfo: (icao: ICAO) => Promise<any>;
|
|
15
|
+
getZones: () => Promise<any>;
|
|
16
|
+
setZones: (zonesJsonString: string) => Promise<TResponse>;
|
|
17
|
+
getPriorityList: () => Promise<any>;
|
|
18
|
+
setPriorityList: (priorityListJsonString: string) => Promise<TResponse>;
|
|
19
|
+
getWhiteList: () => Promise<any>;
|
|
20
|
+
setWhiteList: (whiteListJsonString: string) => Promise<TResponse>;
|
|
21
|
+
getBlackList: () => Promise<any>;
|
|
22
|
+
setBlackList: (blackListJsonString: string) => Promise<TResponse>;
|
|
23
|
+
getTrackingMode: () => Promise<any>;
|
|
24
|
+
setTrackingMode: (modeJsonString: string) => Promise<TResponse>;
|
|
25
|
+
startTrackingPlane: (icao: ICAO) => Promise<TResponse>;
|
|
26
|
+
stopTrackingPlane: () => Promise<TResponse>;
|
|
27
|
+
goToCoordinates: (lat: number, lon: number, alt?: number) => Promise<TResponse>;
|
|
28
|
+
exportAppSettings: (dataType: TExportDataType) => Promise<TBlobResponse<Client>>;
|
|
29
|
+
importAppSettings: (dataType: TImportDataType, formData: FormData) => Promise<TResponse>;
|
|
30
|
+
resetPtzCalibration: () => Promise<TResponse>;
|
|
31
|
+
checkGenetecConnection: (params: TParameters) => Promise<TResponse>;
|
|
32
|
+
getGenetecCameraList: (params: TParameters) => Promise<any>;
|
|
33
|
+
serverRunCheck: () => Promise<TResponse>;
|
|
34
|
+
private _getJson;
|
|
35
|
+
private _getBlob;
|
|
36
|
+
private parseBlobResponse;
|
|
37
|
+
private _postJsonEncoded;
|
|
38
|
+
private _postUrlEncoded;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { paramToUrl, responseStringify } from './internal/utils';
|
|
3
|
+
import { ParsingBlobError } from './errors/errors';
|
|
4
|
+
export const BASE_URL = '/local/planetracker';
|
|
5
|
+
export class PlaneTrackerAPI {
|
|
6
|
+
client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
|
|
11
|
+
async checkCameraTime() {
|
|
12
|
+
const responseSchema = z.discriminatedUnion('state', [
|
|
13
|
+
z.object({
|
|
14
|
+
state: z.literal(true),
|
|
15
|
+
code: z.number(),
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
state: z.literal(false),
|
|
19
|
+
code: z.number(),
|
|
20
|
+
reason: z.union([
|
|
21
|
+
z.literal('INVALID_TIME'),
|
|
22
|
+
z.literal('COULDNT_RESOLVE_HOST'),
|
|
23
|
+
z.literal('CONNECTION_ERROR'),
|
|
24
|
+
]),
|
|
25
|
+
message: z.string(),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
const response = await this._getJson(`${BASE_URL}/camera_time.cgi`);
|
|
29
|
+
const cameraTime = responseSchema.parse(response);
|
|
30
|
+
if (!cameraTime.state) {
|
|
31
|
+
console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
|
|
32
|
+
}
|
|
33
|
+
return cameraTime.state;
|
|
34
|
+
}
|
|
35
|
+
fetchCameraSettings = async () => {
|
|
36
|
+
return await this._getJson(`${BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
|
|
37
|
+
};
|
|
38
|
+
setCameraSettings = async (settingsJsonString) => {
|
|
39
|
+
return await this._postJsonEncoded(`${BASE_URL}/package_camera_settings.cgi`, settingsJsonString, {
|
|
40
|
+
action: 'set',
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
fetchServerSettings = async () => {
|
|
44
|
+
return await this._getJson(`${BASE_URL}/package_server_settings.cgi`, { action: 'get' });
|
|
45
|
+
};
|
|
46
|
+
fetchMapInfo = async () => {
|
|
47
|
+
return await this._getJson(`${BASE_URL}/package/getMapInfo.cgi`);
|
|
48
|
+
};
|
|
49
|
+
fetchFlightInfo = async (icao) => {
|
|
50
|
+
return await this._getJson(`${BASE_URL}/package/flightInfo.cgi`, { icao });
|
|
51
|
+
};
|
|
52
|
+
getZones = async () => {
|
|
53
|
+
return await this._getJson(`${BASE_URL}/package/getZones.cgi`);
|
|
54
|
+
};
|
|
55
|
+
setZones = async (zonesJsonString) => {
|
|
56
|
+
return await this._postJsonEncoded(`${BASE_URL}/package/setZones.cgi`, zonesJsonString);
|
|
57
|
+
};
|
|
58
|
+
getPriorityList = async () => {
|
|
59
|
+
return await this._getJson(`${BASE_URL}/package/getPriorityList.cgi`);
|
|
60
|
+
};
|
|
61
|
+
setPriorityList = async (priorityListJsonString) => {
|
|
62
|
+
return await this._postJsonEncoded(`${BASE_URL}/package/setPriorityList.cgi`, priorityListJsonString);
|
|
63
|
+
};
|
|
64
|
+
getWhiteList = async () => {
|
|
65
|
+
return await this._getJson(`${BASE_URL}/package/getWhiteList.cgi`);
|
|
66
|
+
};
|
|
67
|
+
setWhiteList = async (whiteListJsonString) => {
|
|
68
|
+
return await this._postJsonEncoded(`${BASE_URL}/package/setWhiteList.cgi`, whiteListJsonString);
|
|
69
|
+
};
|
|
70
|
+
getBlackList = async () => {
|
|
71
|
+
return await this._getJson(`${BASE_URL}/package/getBlackList.cgi`);
|
|
72
|
+
};
|
|
73
|
+
setBlackList = async (blackListJsonString) => {
|
|
74
|
+
return await this._postJsonEncoded(`${BASE_URL}/package/setBlackList.cgi`, blackListJsonString);
|
|
75
|
+
};
|
|
76
|
+
getTrackingMode = async () => {
|
|
77
|
+
return await this._getJson(`${BASE_URL}/package/getTrackingMode.cgi`);
|
|
78
|
+
};
|
|
79
|
+
setTrackingMode = async (modeJsonString) => {
|
|
80
|
+
return await this._postJsonEncoded(`${BASE_URL}/package/setTrackingMode.cgi`, modeJsonString);
|
|
81
|
+
};
|
|
82
|
+
startTrackingPlane = async (icao) => {
|
|
83
|
+
return await this.client.get(`${BASE_URL}/package/trackIcao.cgi`, { icao });
|
|
84
|
+
};
|
|
85
|
+
stopTrackingPlane = async () => {
|
|
86
|
+
return await this.client.get(`${BASE_URL}/package/resetIcao.cgi`);
|
|
87
|
+
};
|
|
88
|
+
goToCoordinates = async (lat, lon, alt) => {
|
|
89
|
+
const url = `${BASE_URL}/package/goToCoordinates.cgi?lat=${lat}&lon=${lon}`;
|
|
90
|
+
return await this.client.get(`${url}${alt !== undefined ? `&alt=${alt}` : ''}`);
|
|
91
|
+
};
|
|
92
|
+
exportAppSettings = async (dataType) => {
|
|
93
|
+
return await this._getBlob(`${BASE_URL}/package_data.cgi`, { action: 'EXPORT', dataType });
|
|
94
|
+
};
|
|
95
|
+
importAppSettings = async (dataType, formData) => {
|
|
96
|
+
return await this.client.post(`${BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
|
|
97
|
+
};
|
|
98
|
+
resetPtzCalibration = async () => {
|
|
99
|
+
return await this.client.get(`${BASE_URL}/package/resetPtzCalibration.cgi`);
|
|
100
|
+
};
|
|
101
|
+
checkGenetecConnection = async (params) => {
|
|
102
|
+
return await this._postUrlEncoded(`${BASE_URL}/package/checkGenetecConnection.cgi`, params);
|
|
103
|
+
};
|
|
104
|
+
getGenetecCameraList = async (params) => {
|
|
105
|
+
const res = await this._postUrlEncoded(`${BASE_URL}/package/getGenetecCameraList.cgi`, params);
|
|
106
|
+
return await res.json();
|
|
107
|
+
};
|
|
108
|
+
serverRunCheck = async () => {
|
|
109
|
+
return await this.client.get(`${BASE_URL}/package/serverRunCheck.cgi`);
|
|
110
|
+
};
|
|
111
|
+
async _getJson(...args) {
|
|
112
|
+
const res = await this.client.get(...args);
|
|
113
|
+
if (res.ok) {
|
|
114
|
+
return await res.json();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error(await responseStringify(res));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async _getBlob(...args) {
|
|
121
|
+
const res = await this.client.get(...args);
|
|
122
|
+
if (res.ok) {
|
|
123
|
+
return await this.parseBlobResponse(res);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
throw new Error(await responseStringify(res));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async parseBlobResponse(response) {
|
|
130
|
+
try {
|
|
131
|
+
return (await response.blob());
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw new ParsingBlobError(err);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async _postJsonEncoded(...args) {
|
|
138
|
+
const [path, data, params, headers] = args;
|
|
139
|
+
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
140
|
+
const res = await this.client.post(path, data, params, { ...baseHeaders, ...headers });
|
|
141
|
+
if (res.ok) {
|
|
142
|
+
return res;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
throw new Error(await responseStringify(res));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async _postUrlEncoded(path, params, headers) {
|
|
149
|
+
const data = paramToUrl(params);
|
|
150
|
+
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
151
|
+
const res = await this.client.post(path, data, {}, { ...baseHeaders, ...headers });
|
|
152
|
+
if (res.ok) {
|
|
153
|
+
return res;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw new Error(await responseStringify(res));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
package/esm/VapixAPI.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
|
|
|
26
26
|
dstEnabled: boolean;
|
|
27
27
|
localDateTime: string;
|
|
28
28
|
posixTimeZone: string;
|
|
29
|
-
timeZone
|
|
29
|
+
timeZone?: string | undefined;
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
32
|
getDevicesSettings(proxy?: TProxyParam): Promise<TAudioDevice[]>;
|
package/esm/VapixAPI.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prettifyXml from 'prettify-xml';
|
|
2
2
|
import { arrayToUrl, isNullish, paramToUrl, responseStringify } from './internal/utils';
|
|
3
|
-
import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, } from './types/VapixAPI';
|
|
3
|
+
import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, } from './types/VapixAPI';
|
|
4
4
|
import { ApplicationAPIError, MaxFPSError, NoDeviceInfoError, PtzNotSupportedError, SDCardActionError, SDCardJobError, } from './errors/errors';
|
|
5
5
|
import { ProxyClient } from './internal/ProxyClient';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -168,9 +168,27 @@ export class VapixAPI {
|
|
|
168
168
|
return captureMode.maxFPS;
|
|
169
169
|
}
|
|
170
170
|
async getTimezone(proxy = null) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
try {
|
|
172
|
+
const resV2 = await this.client.get(proxy, '/config/rest/time/v2/timeZone');
|
|
173
|
+
if (!resV2.ok) {
|
|
174
|
+
throw new Error(await responseStringify(resV2));
|
|
175
|
+
}
|
|
176
|
+
const json = await resV2.json();
|
|
177
|
+
const data = timeZoneSchema.parse(json);
|
|
178
|
+
if (data.status === 'error') {
|
|
179
|
+
throw new Error(data.error.message);
|
|
180
|
+
}
|
|
181
|
+
return data.data.activeTimeZone;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message : JSON.stringify(error));
|
|
185
|
+
console.warn('Falling back to deprecated time API v1');
|
|
186
|
+
}
|
|
187
|
+
const data = await this.getDateTimeInfo(proxy);
|
|
188
|
+
if (data.data.timeZone === undefined) {
|
|
189
|
+
throw new Error('Time zone not setup on the device');
|
|
190
|
+
}
|
|
191
|
+
return data.data.timeZone;
|
|
174
192
|
}
|
|
175
193
|
async getDateTimeInfo(proxy = null) {
|
|
176
194
|
const data = { apiVersion: '1.0', method: 'getDateTimeInfo' };
|
package/esm/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export { VapixAPI } from './VapixAPI';
|
|
|
9
9
|
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
10
10
|
export { CamScripterAPI } from './CamScripterAPI';
|
|
11
11
|
export { CamStreamerAPI } from './CamStreamerAPI';
|
|
12
|
+
export { PlaneTrackerAPI } from './PlaneTrackerAPI';
|
|
12
13
|
export * from './types/CamSwitcherEvents';
|
|
13
14
|
export * from './types/CamSwitcherAPI';
|
|
14
15
|
export * from './types/VapixAPI';
|
|
15
16
|
export * from './types/CamOverlayAPI';
|
|
16
17
|
export * from './models/CamOverlayAPI';
|
|
18
|
+
export * from './types/PlaneTrackerAPI';
|
package/esm/index.js
CHANGED
|
@@ -9,8 +9,10 @@ export { VapixAPI } from './VapixAPI';
|
|
|
9
9
|
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
10
10
|
export { CamScripterAPI } from './CamScripterAPI';
|
|
11
11
|
export { CamStreamerAPI } from './CamStreamerAPI';
|
|
12
|
+
export { PlaneTrackerAPI } from './PlaneTrackerAPI';
|
|
12
13
|
export * from './types/CamSwitcherEvents';
|
|
13
14
|
export * from './types/CamSwitcherAPI';
|
|
14
15
|
export * from './types/VapixAPI';
|
|
15
16
|
export * from './types/CamOverlayAPI';
|
|
16
17
|
export * from './models/CamOverlayAPI';
|
|
18
|
+
export * from './types/PlaneTrackerAPI';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/types/VapixAPI.d.ts
CHANGED
|
@@ -1499,19 +1499,19 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1499
1499
|
dstEnabled: z.ZodBoolean;
|
|
1500
1500
|
localDateTime: z.ZodString;
|
|
1501
1501
|
posixTimeZone: z.ZodString;
|
|
1502
|
-
timeZone: z.ZodString
|
|
1502
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
1503
1503
|
}, "strip", z.ZodTypeAny, {
|
|
1504
1504
|
dateTime: string;
|
|
1505
1505
|
dstEnabled: boolean;
|
|
1506
1506
|
localDateTime: string;
|
|
1507
1507
|
posixTimeZone: string;
|
|
1508
|
-
timeZone
|
|
1508
|
+
timeZone?: string | undefined;
|
|
1509
1509
|
}, {
|
|
1510
1510
|
dateTime: string;
|
|
1511
1511
|
dstEnabled: boolean;
|
|
1512
1512
|
localDateTime: string;
|
|
1513
1513
|
posixTimeZone: string;
|
|
1514
|
-
timeZone
|
|
1514
|
+
timeZone?: string | undefined;
|
|
1515
1515
|
}>;
|
|
1516
1516
|
}, "strip", z.ZodTypeAny, {
|
|
1517
1517
|
data: {
|
|
@@ -1519,7 +1519,7 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1519
1519
|
dstEnabled: boolean;
|
|
1520
1520
|
localDateTime: string;
|
|
1521
1521
|
posixTimeZone: string;
|
|
1522
|
-
timeZone
|
|
1522
|
+
timeZone?: string | undefined;
|
|
1523
1523
|
};
|
|
1524
1524
|
}, {
|
|
1525
1525
|
data: {
|
|
@@ -1527,9 +1527,48 @@ export declare const dateTimeinfoSchema: z.ZodObject<{
|
|
|
1527
1527
|
dstEnabled: boolean;
|
|
1528
1528
|
localDateTime: string;
|
|
1529
1529
|
posixTimeZone: string;
|
|
1530
|
-
timeZone
|
|
1530
|
+
timeZone?: string | undefined;
|
|
1531
1531
|
};
|
|
1532
1532
|
}>;
|
|
1533
|
+
export declare const timeZoneSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
1534
|
+
status: z.ZodLiteral<"success">;
|
|
1535
|
+
data: z.ZodObject<{
|
|
1536
|
+
activeTimeZone: z.ZodString;
|
|
1537
|
+
}, "strip", z.ZodTypeAny, {
|
|
1538
|
+
activeTimeZone: string;
|
|
1539
|
+
}, {
|
|
1540
|
+
activeTimeZone: string;
|
|
1541
|
+
}>;
|
|
1542
|
+
}, "strip", z.ZodTypeAny, {
|
|
1543
|
+
status: "success";
|
|
1544
|
+
data: {
|
|
1545
|
+
activeTimeZone: string;
|
|
1546
|
+
};
|
|
1547
|
+
}, {
|
|
1548
|
+
status: "success";
|
|
1549
|
+
data: {
|
|
1550
|
+
activeTimeZone: string;
|
|
1551
|
+
};
|
|
1552
|
+
}>, z.ZodObject<{
|
|
1553
|
+
status: z.ZodLiteral<"error">;
|
|
1554
|
+
error: z.ZodObject<{
|
|
1555
|
+
message: z.ZodString;
|
|
1556
|
+
}, "strip", z.ZodTypeAny, {
|
|
1557
|
+
message: string;
|
|
1558
|
+
}, {
|
|
1559
|
+
message: string;
|
|
1560
|
+
}>;
|
|
1561
|
+
}, "strip", z.ZodTypeAny, {
|
|
1562
|
+
status: "error";
|
|
1563
|
+
error: {
|
|
1564
|
+
message: string;
|
|
1565
|
+
};
|
|
1566
|
+
}, {
|
|
1567
|
+
status: "error";
|
|
1568
|
+
error: {
|
|
1569
|
+
message: string;
|
|
1570
|
+
};
|
|
1571
|
+
}>]>;
|
|
1533
1572
|
export declare const audioSampleRatesResponseSchema: z.ZodObject<{
|
|
1534
1573
|
data: z.ZodObject<{
|
|
1535
1574
|
encoders: z.ZodObject<{
|
package/esm/types/VapixAPI.js
CHANGED
|
@@ -107,9 +107,23 @@ export const dateTimeinfoSchema = z.object({
|
|
|
107
107
|
dstEnabled: z.boolean(),
|
|
108
108
|
localDateTime: z.string(),
|
|
109
109
|
posixTimeZone: z.string(),
|
|
110
|
-
timeZone: z.string(),
|
|
110
|
+
timeZone: z.string().optional(),
|
|
111
111
|
}),
|
|
112
112
|
});
|
|
113
|
+
export const timeZoneSchema = z.discriminatedUnion('status', [
|
|
114
|
+
z.object({
|
|
115
|
+
status: z.literal('success'),
|
|
116
|
+
data: z.object({
|
|
117
|
+
activeTimeZone: z.string(),
|
|
118
|
+
}),
|
|
119
|
+
}),
|
|
120
|
+
z.object({
|
|
121
|
+
status: z.literal('error'),
|
|
122
|
+
error: z.object({
|
|
123
|
+
message: z.string(),
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
]);
|
|
113
127
|
export const audioSampleRatesResponseSchema = z.object({
|
|
114
128
|
data: z.object({
|
|
115
129
|
encoders: z
|
package/esm/web/WsClient.js
CHANGED
|
@@ -27,7 +27,7 @@ export class WsClient {
|
|
|
27
27
|
};
|
|
28
28
|
ws.onmessage = (e) => this.onmessage(e);
|
|
29
29
|
ws.onclose = () => {
|
|
30
|
-
this.restartTimeout = setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
30
|
+
this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
31
31
|
};
|
|
32
32
|
this.ws = ws;
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ export class WsClient {
|
|
|
40
40
|
this.destroyWebsocket();
|
|
41
41
|
};
|
|
42
42
|
destroyWebsocket() {
|
|
43
|
-
if (this.restartTimeout) {
|
|
43
|
+
if (this.restartTimeout !== null) {
|
|
44
44
|
clearTimeout(this.restartTimeout);
|
|
45
45
|
this.restartTimeout = null;
|
|
46
46
|
}
|