camstreamerlib 4.0.34-be26059 → 4.0.35-bc56d1e
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 +6 -0
- package/cjs/CamOverlayAPI.js +16 -0
- package/cjs/CamSwitcherAPI.d.ts +1 -1
- package/cjs/PlaneTrackerAPI.d.ts +1 -1
- package/cjs/PlaneTrackerAPI.js +2 -1
- package/cjs/VapixAPI.js +4 -2
- package/cjs/errors/errors.js +4 -4
- package/cjs/types/CamSwitcherAPI.d.ts +4 -4
- package/cjs/types/PlaneTrackerAPI.d.ts +0 -13
- package/cjs/types/PlaneTrackerAPI.js +3 -8
- package/cjs/types/common.d.ts +13 -0
- package/cjs/types/common.js +6 -1
- package/esm/CamOverlayAPI.js +17 -1
- package/esm/PlaneTrackerAPI.js +2 -1
- package/esm/VapixAPI.js +4 -2
- package/esm/errors/errors.js +4 -4
- package/esm/types/PlaneTrackerAPI.js +2 -7
- package/esm/types/common.js +5 -0
- package/package.json +9 -12
- package/types/CamOverlayAPI.d.ts +6 -0
- package/types/CamSwitcherAPI.d.ts +1 -1
- package/types/PlaneTrackerAPI.d.ts +1 -1
- package/types/types/CamSwitcherAPI.d.ts +4 -4
- package/types/types/PlaneTrackerAPI.d.ts +0 -13
- package/types/types/common.d.ts +13 -0
package/cjs/CamOverlayAPI.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> exten
|
|
|
14
14
|
}[]>;
|
|
15
15
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
16
16
|
getMjpegStreamImage(mjpegUrl: string, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
|
|
17
|
+
isViewerPassValid(pass: string, options?: THttpRequestOptions): Promise<boolean>;
|
|
18
|
+
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
19
|
+
alias: string;
|
|
20
|
+
ws: string;
|
|
21
|
+
ws_initial_message: string;
|
|
22
|
+
}>;
|
|
17
23
|
listFiles<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TFileList<T>>;
|
|
18
24
|
uploadFile<T extends TFileType>(fileType: T, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType<T>, options?: THttpRequestOptions): Promise<void>;
|
|
19
25
|
removeFile<T extends TFileType>(fileType: T, fileParams: TFile<T>, options?: THttpRequestOptions): Promise<void>;
|
package/cjs/CamOverlayAPI.js
CHANGED
|
@@ -29,6 +29,22 @@ class CamOverlayAPI extends BasicAPI_1.BasicAPI {
|
|
|
29
29
|
async getMjpegStreamImage(mjpegUrl, options) {
|
|
30
30
|
return await this._getBlob(`${BASE_PATH}/fetch_mjpeg_image.cgi`, { mjpeg_url: decodeURIComponent(mjpegUrl) }, options);
|
|
31
31
|
}
|
|
32
|
+
async isViewerPassValid(pass, options) {
|
|
33
|
+
const res = await this._getJson(`${BASE_PATH}/check_pass.cgi`, { pass }, options);
|
|
34
|
+
if (res.status !== 200) {
|
|
35
|
+
throw new Error(res.message);
|
|
36
|
+
}
|
|
37
|
+
return res.data === '1';
|
|
38
|
+
}
|
|
39
|
+
async getLiveViewAlias(rtspUrl, options) {
|
|
40
|
+
const agent = this.getClient(options?.proxyParams);
|
|
41
|
+
const res = await agent.get({
|
|
42
|
+
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
43
|
+
parameters: { rtsp_url: rtspUrl },
|
|
44
|
+
timeout: options?.timeout,
|
|
45
|
+
});
|
|
46
|
+
return common_1.wsAliasResponseSchema.parse(await res.json());
|
|
47
|
+
}
|
|
32
48
|
async listFiles(fileType, options) {
|
|
33
49
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
|
|
34
50
|
return (0, CamOverlayAPI_1.getFileListSchema)(fileType).parse(res.list);
|
package/cjs/CamSwitcherAPI.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
|
|
|
28
28
|
}[]>;
|
|
29
29
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
30
30
|
getOutputInfo(options?: THttpRequestOptions): Promise<{
|
|
31
|
-
rtspUrl: string;
|
|
32
31
|
ws: string;
|
|
33
32
|
wsInitialMessage: string;
|
|
33
|
+
rtspUrl: string;
|
|
34
34
|
}>;
|
|
35
35
|
getAudioPushInfo(options?: THttpRequestOptions): Promise<{
|
|
36
36
|
ws: string;
|
package/cjs/PlaneTrackerAPI.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
|
|
|
12
12
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
13
13
|
serverRunCheck(options?: THttpRequestOptions): Promise<boolean>;
|
|
14
14
|
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
15
|
+
alias: string;
|
|
15
16
|
ws: string;
|
|
16
17
|
ws_initial_message: string;
|
|
17
|
-
alias: string;
|
|
18
18
|
}>;
|
|
19
19
|
resetPtzCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
20
20
|
resetFocusCalibration(options?: THttpRequestOptions): Promise<void>;
|
package/cjs/PlaneTrackerAPI.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.PlaneTrackerAPI = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const PlaneTrackerAPI_1 = require("./types/PlaneTrackerAPI");
|
|
6
6
|
const errors_1 = require("./errors/errors");
|
|
7
|
+
const common_1 = require("./types/common");
|
|
7
8
|
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
8
9
|
const PlaneTrackerEvents_1 = require("./types/ws/PlaneTrackerEvents");
|
|
9
10
|
const BASE_PATH = '/local/planetracker';
|
|
@@ -37,7 +38,7 @@ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
|
|
|
37
38
|
parameters: { rtsp_url: rtspUrl },
|
|
38
39
|
timeout: options?.timeout,
|
|
39
40
|
});
|
|
40
|
-
return
|
|
41
|
+
return common_1.wsAliasResponseSchema.parse(await res.json());
|
|
41
42
|
}
|
|
42
43
|
async resetPtzCalibration(options) {
|
|
43
44
|
const agent = this.getClient(options?.proxyParams);
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -93,7 +93,9 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
|
|
|
93
93
|
};
|
|
94
94
|
await this._postJsonEncoded('/axis-cgi/opticscontrol.cgi', data, undefined, options);
|
|
95
95
|
}
|
|
96
|
-
catch {
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.warn('Failed to perform autofocus: ', error instanceof Error ? error.message : String(error));
|
|
98
|
+
console.warn('Falling back to deprecated optics setup API');
|
|
97
99
|
await this._postUrlEncoded('/axis-cgi/opticssetup.cgi', {
|
|
98
100
|
autofocus: 'perform',
|
|
99
101
|
source: '1',
|
|
@@ -144,7 +146,7 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
|
|
|
144
146
|
return data.data.activeTimeZone;
|
|
145
147
|
}
|
|
146
148
|
catch (error) {
|
|
147
|
-
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message :
|
|
149
|
+
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message : String(error));
|
|
148
150
|
console.warn('Falling back to deprecated time API v1');
|
|
149
151
|
}
|
|
150
152
|
try {
|
package/cjs/errors/errors.js
CHANGED
|
@@ -26,7 +26,7 @@ class ServiceNotFoundError extends Error {
|
|
|
26
26
|
exports.ServiceNotFoundError = ServiceNotFoundError;
|
|
27
27
|
class ParsingBlobError extends Error {
|
|
28
28
|
constructor(err) {
|
|
29
|
-
super('Error parsing response as Blob: ' + err);
|
|
29
|
+
super('Error parsing response as Blob: ' + String(err));
|
|
30
30
|
this.name = 'ParsingBlobError';
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -99,7 +99,7 @@ class NoDeviceInfoError extends Error {
|
|
|
99
99
|
exports.NoDeviceInfoError = NoDeviceInfoError;
|
|
100
100
|
class FetchDeviceInfoError extends Error {
|
|
101
101
|
constructor(err) {
|
|
102
|
-
super('Error fetching remote camera data: ' + err);
|
|
102
|
+
super('Error fetching remote camera data: ' + String(err));
|
|
103
103
|
this.name = 'NoDeviceInfoFromCameraError';
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -127,7 +127,7 @@ class PtzNotSupportedError extends Error {
|
|
|
127
127
|
exports.PtzNotSupportedError = PtzNotSupportedError;
|
|
128
128
|
class StorageDataFetchError extends Error {
|
|
129
129
|
constructor(err) {
|
|
130
|
-
super('Error fetching storage data: ' + err);
|
|
130
|
+
super('Error fetching storage data: ' + String(err));
|
|
131
131
|
this.name = 'StorageDataFetchError';
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -155,7 +155,7 @@ class TimezoneNotSetupError extends Error {
|
|
|
155
155
|
exports.TimezoneNotSetupError = TimezoneNotSetupError;
|
|
156
156
|
class TimezoneFetchError extends Error {
|
|
157
157
|
constructor(err) {
|
|
158
|
-
super('Error fetching time zone information: ' + err);
|
|
158
|
+
super('Error fetching time zone information: ' + String(err));
|
|
159
159
|
this.name = 'TimezoneFetchError';
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -25,21 +25,21 @@ export declare const outputInfoSchema: z.ZodEffects<z.ZodObject<{
|
|
|
25
25
|
ws: z.ZodString;
|
|
26
26
|
ws_initial_message: z.ZodString;
|
|
27
27
|
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
rtsp_url: string;
|
|
29
28
|
ws: string;
|
|
30
29
|
ws_initial_message: string;
|
|
31
|
-
}, {
|
|
32
30
|
rtsp_url: string;
|
|
31
|
+
}, {
|
|
33
32
|
ws: string;
|
|
34
33
|
ws_initial_message: string;
|
|
34
|
+
rtsp_url: string;
|
|
35
35
|
}>, {
|
|
36
|
-
rtspUrl: string;
|
|
37
36
|
ws: string;
|
|
38
37
|
wsInitialMessage: string;
|
|
38
|
+
rtspUrl: string;
|
|
39
39
|
}, {
|
|
40
|
-
rtsp_url: string;
|
|
41
40
|
ws: string;
|
|
42
41
|
ws_initial_message: string;
|
|
42
|
+
rtsp_url: string;
|
|
43
43
|
}>;
|
|
44
44
|
export type TOutputInfo = z.infer<typeof outputInfoSchema>;
|
|
45
45
|
export declare const audioPushInfoSchema: z.ZodEffects<z.ZodObject<{
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export type TImportDataType = 'MAP_DATA' | 'SERVER_DATA' | 'ALL';
|
|
3
3
|
export type TExportDataType = 'NIGHT_SKY_CALIBRATION_DATA' | 'ALL';
|
|
4
|
-
export declare const wsAliasResponseSchema: z.ZodObject<{
|
|
5
|
-
alias: z.ZodString;
|
|
6
|
-
ws: z.ZodString;
|
|
7
|
-
ws_initial_message: z.ZodString;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
ws: string;
|
|
10
|
-
ws_initial_message: string;
|
|
11
|
-
alias: string;
|
|
12
|
-
}, {
|
|
13
|
-
ws: string;
|
|
14
|
-
ws_initial_message: string;
|
|
15
|
-
alias: string;
|
|
16
|
-
}>;
|
|
17
4
|
export declare const connectionSchema: z.ZodObject<{
|
|
18
5
|
protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
|
|
19
6
|
ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REMOTE_ID_CATEGORY_IDS = exports.ADSB_CATEGORY_IDS = exports.domainListSchema = exports.zonesSchema = exports.zonePerimeterSchema = exports.domainIdSchema = exports.mapInfoSchema = exports.mapTypeSchema = exports.friendlyListSchema = exports.priorityListSchema = exports.blackListSchema = exports.whiteListSchema = exports.priorityListEntrySchema = exports.listEntrySchema = exports.listEntryIdTypeSchema = exports.listEntryDomainSchema = exports.flightInfoSchema = exports.trackingModeSchema = exports.getIcaoSchema = exports.serverSettingsSchema = exports.cameraSettingsSchema = exports.widgetSchema = exports.milestoneCameraListSchema = exports.connectionSchema =
|
|
3
|
+
exports.REMOTE_ID_CATEGORY_IDS = exports.ADSB_CATEGORY_IDS = exports.domainListSchema = exports.zonesSchema = exports.zonePerimeterSchema = exports.domainIdSchema = exports.mapInfoSchema = exports.mapTypeSchema = exports.friendlyListSchema = exports.priorityListSchema = exports.blackListSchema = exports.whiteListSchema = exports.priorityListEntrySchema = exports.listEntrySchema = exports.listEntryIdTypeSchema = exports.listEntryDomainSchema = exports.flightInfoSchema = exports.trackingModeSchema = exports.getIcaoSchema = exports.serverSettingsSchema = exports.cameraSettingsSchema = exports.widgetSchema = exports.milestoneCameraListSchema = exports.connectionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.wsAliasResponseSchema = zod_1.z.object({
|
|
6
|
-
alias: zod_1.z.string(),
|
|
7
|
-
ws: zod_1.z.string(),
|
|
8
|
-
ws_initial_message: zod_1.z.string(),
|
|
9
|
-
});
|
|
10
5
|
exports.connectionSchema = zod_1.z.object({
|
|
11
6
|
protocol: zod_1.z.union([zod_1.z.literal('http'), zod_1.z.literal('https'), zod_1.z.literal('https_insecure')]),
|
|
12
7
|
ip: zod_1.z.union([zod_1.z.string().ip(), zod_1.z.literal('')]),
|
|
@@ -45,12 +40,12 @@ const aircraftIdentificationLabelSchema = zod_1.z.object({
|
|
|
45
40
|
secondRow: labelOptionsSchema,
|
|
46
41
|
thirdRow: labelOptionsSchema,
|
|
47
42
|
fourthRow: labelOptionsSchema,
|
|
48
|
-
opacity: zod_1.z.number().
|
|
43
|
+
opacity: zod_1.z.number().nonnegative(),
|
|
49
44
|
});
|
|
50
45
|
const droneLabelOptionsSchema = zod_1.z.union([zod_1.z.literal('blank'), zod_1.z.literal('remote_id')]);
|
|
51
46
|
const droneIdentificationLabelSchema = zod_1.z.object({
|
|
52
47
|
firstRow: droneLabelOptionsSchema,
|
|
53
|
-
opacity: zod_1.z.number().
|
|
48
|
+
opacity: zod_1.z.number().nonnegative(),
|
|
54
49
|
});
|
|
55
50
|
const DEFAULT_DRONE_IDENTIFICATION_LABEL = {
|
|
56
51
|
firstRow: 'remote_id',
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -26,6 +26,19 @@ export declare const keyboardShortcutSchema: z.ZodNullable<z.ZodString>;
|
|
|
26
26
|
export declare const keyboardShortcutsSchema: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
27
27
|
export type TKeyboardShortcut = z.infer<typeof keyboardShortcutSchema>;
|
|
28
28
|
export type TKeyboardShortcuts = z.infer<typeof keyboardShortcutsSchema>;
|
|
29
|
+
export declare const wsAliasResponseSchema: z.ZodObject<{
|
|
30
|
+
alias: z.ZodString;
|
|
31
|
+
ws: z.ZodString;
|
|
32
|
+
ws_initial_message: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
alias: string;
|
|
35
|
+
ws: string;
|
|
36
|
+
ws_initial_message: string;
|
|
37
|
+
}, {
|
|
38
|
+
alias: string;
|
|
39
|
+
ws: string;
|
|
40
|
+
ws_initial_message: string;
|
|
41
|
+
}>;
|
|
29
42
|
export type TProxyTarget = {
|
|
30
43
|
ip: string;
|
|
31
44
|
mdnsName: string;
|
package/cjs/types/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.fileSchema = exports.bitrateVapixParamsSchema = exports.bitrateModeSchema = exports.wsAliasResponseSchema = 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,6 +15,11 @@ 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.wsAliasResponseSchema = zod_1.z.object({
|
|
19
|
+
alias: zod_1.z.string(),
|
|
20
|
+
ws: zod_1.z.string(),
|
|
21
|
+
ws_initial_message: zod_1.z.string(),
|
|
22
|
+
});
|
|
18
23
|
exports.bitrateModeSchema = zod_1.z.union([zod_1.z.literal('VBR'), zod_1.z.literal('MBR'), zod_1.z.literal('ABR')]);
|
|
19
24
|
exports.bitrateVapixParamsSchema = zod_1.z.object({
|
|
20
25
|
bitrateMode: exports.bitrateModeSchema,
|
package/esm/CamOverlayAPI.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorWithResponse, ServiceNotFoundError, StorageDataFetchError } from './errors/errors';
|
|
2
|
-
import { networkCameraListSchema } from './types/common';
|
|
2
|
+
import { networkCameraListSchema, wsAliasResponseSchema } from './types/common';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ImageType, serviceListSchema, servicesSchema, wsResponseSchema, getStorageDataListSchema, getFileListSchema, } from './types/CamOverlayAPI';
|
|
5
5
|
import { BasicAPI } from './internal/BasicAPI';
|
|
@@ -26,6 +26,22 @@ export class CamOverlayAPI extends BasicAPI {
|
|
|
26
26
|
async getMjpegStreamImage(mjpegUrl, options) {
|
|
27
27
|
return await this._getBlob(`${BASE_PATH}/fetch_mjpeg_image.cgi`, { mjpeg_url: decodeURIComponent(mjpegUrl) }, options);
|
|
28
28
|
}
|
|
29
|
+
async isViewerPassValid(pass, options) {
|
|
30
|
+
const res = await this._getJson(`${BASE_PATH}/check_pass.cgi`, { pass }, options);
|
|
31
|
+
if (res.status !== 200) {
|
|
32
|
+
throw new Error(res.message);
|
|
33
|
+
}
|
|
34
|
+
return res.data === '1';
|
|
35
|
+
}
|
|
36
|
+
async getLiveViewAlias(rtspUrl, options) {
|
|
37
|
+
const agent = this.getClient(options?.proxyParams);
|
|
38
|
+
const res = await agent.get({
|
|
39
|
+
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
40
|
+
parameters: { rtsp_url: rtspUrl },
|
|
41
|
+
timeout: options?.timeout,
|
|
42
|
+
});
|
|
43
|
+
return wsAliasResponseSchema.parse(await res.json());
|
|
44
|
+
}
|
|
29
45
|
async listFiles(fileType, options) {
|
|
30
46
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
|
|
31
47
|
return getFileListSchema(fileType).parse(res.list);
|
package/esm/PlaneTrackerAPI.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { blackListSchema, cameraSettingsSchema, domainListSchema, flightInfoSchema, getIcaoSchema, mapInfoSchema, milestoneCameraListSchema, priorityListSchema, serverSettingsSchema, trackingModeSchema, whiteListSchema,
|
|
2
|
+
import { blackListSchema, cameraSettingsSchema, domainListSchema, flightInfoSchema, getIcaoSchema, mapInfoSchema, milestoneCameraListSchema, priorityListSchema, serverSettingsSchema, trackingModeSchema, whiteListSchema, zonesSchema, } from './types/PlaneTrackerAPI';
|
|
3
3
|
import { CannotSetCoordsInAutoModeError, ImportSettingsError, InvalidAltitudeError, InvalidLatLngError, ResetCalibrationError, ServerError, BadRequestError, } from './errors/errors';
|
|
4
|
+
import { wsAliasResponseSchema } from './types/common';
|
|
4
5
|
import { BasicAPI } from './internal/BasicAPI';
|
|
5
6
|
import { apiUserInputSchema } from './types/ws/PlaneTrackerEvents';
|
|
6
7
|
const BASE_PATH = '/local/planetracker';
|
package/esm/VapixAPI.js
CHANGED
|
@@ -90,7 +90,9 @@ export class VapixAPI extends BasicAPI {
|
|
|
90
90
|
};
|
|
91
91
|
await this._postJsonEncoded('/axis-cgi/opticscontrol.cgi', data, undefined, options);
|
|
92
92
|
}
|
|
93
|
-
catch {
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.warn('Failed to perform autofocus: ', error instanceof Error ? error.message : String(error));
|
|
95
|
+
console.warn('Falling back to deprecated optics setup API');
|
|
94
96
|
await this._postUrlEncoded('/axis-cgi/opticssetup.cgi', {
|
|
95
97
|
autofocus: 'perform',
|
|
96
98
|
source: '1',
|
|
@@ -141,7 +143,7 @@ export class VapixAPI extends BasicAPI {
|
|
|
141
143
|
return data.data.activeTimeZone;
|
|
142
144
|
}
|
|
143
145
|
catch (error) {
|
|
144
|
-
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message :
|
|
146
|
+
console.warn('Failed to fetch time zone data from time API v2:', error instanceof Error ? error.message : String(error));
|
|
145
147
|
console.warn('Falling back to deprecated time API v1');
|
|
146
148
|
}
|
|
147
149
|
try {
|
package/esm/errors/errors.js
CHANGED
|
@@ -20,7 +20,7 @@ export class ServiceNotFoundError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
export class ParsingBlobError extends Error {
|
|
22
22
|
constructor(err) {
|
|
23
|
-
super('Error parsing response as Blob: ' + err);
|
|
23
|
+
super('Error parsing response as Blob: ' + String(err));
|
|
24
24
|
this.name = 'ParsingBlobError';
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -84,7 +84,7 @@ export class NoDeviceInfoError extends Error {
|
|
|
84
84
|
}
|
|
85
85
|
export class FetchDeviceInfoError extends Error {
|
|
86
86
|
constructor(err) {
|
|
87
|
-
super('Error fetching remote camera data: ' + err);
|
|
87
|
+
super('Error fetching remote camera data: ' + String(err));
|
|
88
88
|
this.name = 'NoDeviceInfoFromCameraError';
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -108,7 +108,7 @@ export class PtzNotSupportedError extends Error {
|
|
|
108
108
|
}
|
|
109
109
|
export class StorageDataFetchError extends Error {
|
|
110
110
|
constructor(err) {
|
|
111
|
-
super('Error fetching storage data: ' + err);
|
|
111
|
+
super('Error fetching storage data: ' + String(err));
|
|
112
112
|
this.name = 'StorageDataFetchError';
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -132,7 +132,7 @@ export class TimezoneNotSetupError extends Error {
|
|
|
132
132
|
}
|
|
133
133
|
export class TimezoneFetchError extends Error {
|
|
134
134
|
constructor(err) {
|
|
135
|
-
super('Error fetching time zone information: ' + err);
|
|
135
|
+
super('Error fetching time zone information: ' + String(err));
|
|
136
136
|
this.name = 'TimezoneFetchError';
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const wsAliasResponseSchema = z.object({
|
|
3
|
-
alias: z.string(),
|
|
4
|
-
ws: z.string(),
|
|
5
|
-
ws_initial_message: z.string(),
|
|
6
|
-
});
|
|
7
2
|
export const connectionSchema = z.object({
|
|
8
3
|
protocol: z.union([z.literal('http'), z.literal('https'), z.literal('https_insecure')]),
|
|
9
4
|
ip: z.union([z.string().ip(), z.literal('')]),
|
|
@@ -42,12 +37,12 @@ const aircraftIdentificationLabelSchema = z.object({
|
|
|
42
37
|
secondRow: labelOptionsSchema,
|
|
43
38
|
thirdRow: labelOptionsSchema,
|
|
44
39
|
fourthRow: labelOptionsSchema,
|
|
45
|
-
opacity: z.number().
|
|
40
|
+
opacity: z.number().nonnegative(),
|
|
46
41
|
});
|
|
47
42
|
const droneLabelOptionsSchema = z.union([z.literal('blank'), z.literal('remote_id')]);
|
|
48
43
|
const droneIdentificationLabelSchema = z.object({
|
|
49
44
|
firstRow: droneLabelOptionsSchema,
|
|
50
|
-
opacity: z.number().
|
|
45
|
+
opacity: z.number().nonnegative(),
|
|
51
46
|
});
|
|
52
47
|
const DEFAULT_DRONE_IDENTIFICATION_LABEL = {
|
|
53
48
|
firstRow: 'remote_id',
|
package/esm/types/common.js
CHANGED
|
@@ -12,6 +12,11 @@ export const networkCameraListSchema = z.array(z.object({
|
|
|
12
12
|
}));
|
|
13
13
|
export const keyboardShortcutSchema = z.string().nullable();
|
|
14
14
|
export const keyboardShortcutsSchema = z.record(keyboardShortcutSchema);
|
|
15
|
+
export const wsAliasResponseSchema = z.object({
|
|
16
|
+
alias: z.string(),
|
|
17
|
+
ws: z.string(),
|
|
18
|
+
ws_initial_message: z.string(),
|
|
19
|
+
});
|
|
15
20
|
export const bitrateModeSchema = z.union([z.literal('VBR'), z.literal('MBR'), z.literal('ABR')]);
|
|
16
21
|
export const bitrateVapixParamsSchema = z.object({
|
|
17
22
|
bitrateMode: bitrateModeSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camstreamerlib",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.35-bc56d1e",
|
|
4
4
|
"description": "Helper library for CamStreamer ACAP applications.",
|
|
5
5
|
"prettier": "@camstreamer/prettier-config",
|
|
6
6
|
"engine": {
|
|
@@ -16,34 +16,31 @@
|
|
|
16
16
|
"zod": "^3.25.76"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@camstreamer/eslint-config": "^1.0.
|
|
19
|
+
"@camstreamer/eslint-config": "^1.0.10",
|
|
20
20
|
"@camstreamer/prettier-config": "^2.0.4",
|
|
21
|
+
"@eslint/js": "^10.0.1",
|
|
21
22
|
"@types/adm-zip": "^0.5.5",
|
|
22
23
|
"@types/jest": "^30.0.0",
|
|
23
24
|
"@types/node": "^18.19.127",
|
|
24
25
|
"@types/ws": "^8.5.10",
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "^8.71.1",
|
|
26
|
-
"@typescript-eslint/parser": "^8.71.1",
|
|
27
26
|
"esbuild": "^0.28.2",
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"eslint-plugin-deprecation": "^2.0.0",
|
|
27
|
+
"eslint": "^10.12.0",
|
|
30
28
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
29
|
+
"globals": "^17.13.0",
|
|
31
30
|
"jest": "^30.5.2",
|
|
32
31
|
"npm-run-all": "^4.1.5",
|
|
33
32
|
"prettier": "^2.7.1",
|
|
34
33
|
"ts-jest": "^29.4.14",
|
|
35
34
|
"ts-node": "^10.7.0",
|
|
36
|
-
"typescript": "5.3.3"
|
|
35
|
+
"typescript": "5.3.3",
|
|
36
|
+
"typescript-eslint": "^8.71.2"
|
|
37
37
|
},
|
|
38
38
|
"overrides": {
|
|
39
39
|
"js-yaml": "^4.3.2",
|
|
40
|
-
"browserslist": "^4.28.7"
|
|
41
|
-
"eslint-plugin-deprecation": {
|
|
42
|
-
"@typescript-eslint/utils": "^8.71.1"
|
|
43
|
-
}
|
|
40
|
+
"browserslist": "^4.28.7"
|
|
44
41
|
},
|
|
45
42
|
"scripts": {
|
|
46
|
-
"clean": "
|
|
43
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
47
44
|
"build": "npm-run-all clean build:cjs build:esm copyPackage",
|
|
48
45
|
"build:cjs": "tsc --project tsconfig.cjs.json",
|
|
49
46
|
"build:esm": "tsc --project tsconfig.esm.json",
|
package/types/CamOverlayAPI.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> exten
|
|
|
14
14
|
}[]>;
|
|
15
15
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
16
16
|
getMjpegStreamImage(mjpegUrl: string, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
|
|
17
|
+
isViewerPassValid(pass: string, options?: THttpRequestOptions): Promise<boolean>;
|
|
18
|
+
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
19
|
+
alias: string;
|
|
20
|
+
ws: string;
|
|
21
|
+
ws_initial_message: string;
|
|
22
|
+
}>;
|
|
17
23
|
listFiles<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TFileList<T>>;
|
|
18
24
|
uploadFile<T extends TFileType>(fileType: T, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType<T>, options?: THttpRequestOptions): Promise<void>;
|
|
19
25
|
removeFile<T extends TFileType>(fileType: T, fileParams: TFile<T>, options?: THttpRequestOptions): Promise<void>;
|
|
@@ -28,9 +28,9 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
|
|
|
28
28
|
}[]>;
|
|
29
29
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
30
30
|
getOutputInfo(options?: THttpRequestOptions): Promise<{
|
|
31
|
-
rtspUrl: string;
|
|
32
31
|
ws: string;
|
|
33
32
|
wsInitialMessage: string;
|
|
33
|
+
rtspUrl: string;
|
|
34
34
|
}>;
|
|
35
35
|
getAudioPushInfo(options?: THttpRequestOptions): Promise<{
|
|
36
36
|
ws: string;
|
|
@@ -12,9 +12,9 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
|
|
|
12
12
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
13
13
|
serverRunCheck(options?: THttpRequestOptions): Promise<boolean>;
|
|
14
14
|
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
15
|
+
alias: string;
|
|
15
16
|
ws: string;
|
|
16
17
|
ws_initial_message: string;
|
|
17
|
-
alias: string;
|
|
18
18
|
}>;
|
|
19
19
|
resetPtzCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
20
20
|
resetFocusCalibration(options?: THttpRequestOptions): Promise<void>;
|
|
@@ -25,21 +25,21 @@ export declare const outputInfoSchema: z.ZodEffects<z.ZodObject<{
|
|
|
25
25
|
ws: z.ZodString;
|
|
26
26
|
ws_initial_message: z.ZodString;
|
|
27
27
|
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
rtsp_url: string;
|
|
29
28
|
ws: string;
|
|
30
29
|
ws_initial_message: string;
|
|
31
|
-
}, {
|
|
32
30
|
rtsp_url: string;
|
|
31
|
+
}, {
|
|
33
32
|
ws: string;
|
|
34
33
|
ws_initial_message: string;
|
|
34
|
+
rtsp_url: string;
|
|
35
35
|
}>, {
|
|
36
|
-
rtspUrl: string;
|
|
37
36
|
ws: string;
|
|
38
37
|
wsInitialMessage: string;
|
|
38
|
+
rtspUrl: string;
|
|
39
39
|
}, {
|
|
40
|
-
rtsp_url: string;
|
|
41
40
|
ws: string;
|
|
42
41
|
ws_initial_message: string;
|
|
42
|
+
rtsp_url: string;
|
|
43
43
|
}>;
|
|
44
44
|
export type TOutputInfo = z.infer<typeof outputInfoSchema>;
|
|
45
45
|
export declare const audioPushInfoSchema: z.ZodEffects<z.ZodObject<{
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export type TImportDataType = 'MAP_DATA' | 'SERVER_DATA' | 'ALL';
|
|
3
3
|
export type TExportDataType = 'NIGHT_SKY_CALIBRATION_DATA' | 'ALL';
|
|
4
|
-
export declare const wsAliasResponseSchema: z.ZodObject<{
|
|
5
|
-
alias: z.ZodString;
|
|
6
|
-
ws: z.ZodString;
|
|
7
|
-
ws_initial_message: z.ZodString;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
ws: string;
|
|
10
|
-
ws_initial_message: string;
|
|
11
|
-
alias: string;
|
|
12
|
-
}, {
|
|
13
|
-
ws: string;
|
|
14
|
-
ws_initial_message: string;
|
|
15
|
-
alias: string;
|
|
16
|
-
}>;
|
|
17
4
|
export declare const connectionSchema: z.ZodObject<{
|
|
18
5
|
protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
|
|
19
6
|
ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
package/types/types/common.d.ts
CHANGED
|
@@ -26,6 +26,19 @@ export declare const keyboardShortcutSchema: z.ZodNullable<z.ZodString>;
|
|
|
26
26
|
export declare const keyboardShortcutsSchema: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
27
27
|
export type TKeyboardShortcut = z.infer<typeof keyboardShortcutSchema>;
|
|
28
28
|
export type TKeyboardShortcuts = z.infer<typeof keyboardShortcutsSchema>;
|
|
29
|
+
export declare const wsAliasResponseSchema: z.ZodObject<{
|
|
30
|
+
alias: z.ZodString;
|
|
31
|
+
ws: z.ZodString;
|
|
32
|
+
ws_initial_message: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
alias: string;
|
|
35
|
+
ws: string;
|
|
36
|
+
ws_initial_message: string;
|
|
37
|
+
}, {
|
|
38
|
+
alias: string;
|
|
39
|
+
ws: string;
|
|
40
|
+
ws_initial_message: string;
|
|
41
|
+
}>;
|
|
29
42
|
export type TProxyTarget = {
|
|
30
43
|
ip: string;
|
|
31
44
|
mdnsName: string;
|