camstreamerlib 4.0.0-beta.2 → 4.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/cjs/CamOverlayAPI.d.ts +629 -0
- package/cjs/CamOverlayAPI.js +255 -0
- package/{CamOverlayDrawingAPI.d.ts → cjs/CamOverlayDrawingAPI.d.ts} +1 -1
- package/cjs/CamOverlayDrawingAPI.js +235 -0
- package/cjs/CamOverlayPainter/Frame.js +301 -0
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/Painter.d.ts +14 -3
- package/cjs/CamOverlayPainter/Painter.js +171 -0
- package/cjs/CamOverlayPainter/ResourceManager.js +46 -0
- package/cjs/CamScripterAPI.d.ts +36 -0
- package/cjs/CamScripterAPI.js +73 -0
- package/{CamScripterAPICameraEventsGenerator.d.ts → cjs/CamScripterAPICameraEventsGenerator.d.ts} +1 -1
- package/cjs/CamScripterAPICameraEventsGenerator.js +162 -0
- package/{CamStreamerAPI.d.ts → cjs/CamStreamerAPI.d.ts} +5 -5
- package/cjs/CamStreamerAPI.js +59 -0
- package/{CamSwitcherAPI.d.ts → cjs/CamSwitcherAPI.d.ts} +10 -6
- package/cjs/CamSwitcherAPI.js +351 -0
- package/{CamSwitcherEvents.d.ts → cjs/CamSwitcherEvents.d.ts} +2 -2
- package/cjs/CamSwitcherEvents.js +67 -0
- package/cjs/CreatePackage.js +106 -0
- package/cjs/PlaneTrackerAPI.d.ts +47 -0
- package/cjs/PlaneTrackerAPI.js +176 -0
- package/{VapixAPI.d.ts → cjs/VapixAPI.d.ts} +19 -7
- package/cjs/VapixAPI.js +491 -0
- package/{VapixEvents.d.ts → cjs/VapixEvents.d.ts} +1 -1
- package/cjs/VapixEvents.js +88 -0
- package/{errors → cjs/errors}/errors.d.ts +3 -0
- package/cjs/errors/errors.js +86 -0
- package/{events → cjs/events}/AxisCameraStationEvents.d.ts +3 -2
- package/cjs/events/AxisCameraStationEvents.js +48 -0
- package/{events → cjs/events}/GenetecAgent.d.ts +4 -3
- package/cjs/events/GenetecAgent.js +123 -0
- package/cjs/index.d.ts +18 -0
- package/cjs/index.js +42 -0
- package/cjs/internal/Digest.js +42 -0
- package/cjs/internal/ProxyClient.d.ts +11 -0
- package/cjs/internal/ProxyClient.js +46 -0
- package/cjs/internal/constants.js +4 -0
- package/cjs/internal/transformers.js +32 -0
- package/cjs/internal/types.d.ts +35 -0
- package/cjs/internal/types.js +2 -0
- package/{internal → cjs/internal}/utils.d.ts +5 -1
- package/cjs/internal/utils.js +69 -0
- package/{internal → cjs/internal}/versionCompare.d.ts +2 -2
- package/cjs/internal/versionCompare.js +53 -0
- package/cjs/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/cjs/models/CamOverlayAPI/accuweatherSchema.js +48 -0
- package/cjs/models/CamOverlayAPI/constants.d.ts +11 -0
- package/cjs/models/CamOverlayAPI/constants.js +14 -0
- package/cjs/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
- package/cjs/models/CamOverlayAPI/customGraphicsSchema.js +73 -0
- package/cjs/models/CamOverlayAPI/fileSchema.d.ts +28 -0
- package/cjs/models/CamOverlayAPI/fileSchema.js +17 -0
- package/cjs/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/cjs/models/CamOverlayAPI/imagesSchema.js +10 -0
- package/cjs/models/CamOverlayAPI/index.d.ts +13 -0
- package/cjs/models/CamOverlayAPI/index.js +29 -0
- package/cjs/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/cjs/models/CamOverlayAPI/infotickerSchema.js +27 -0
- package/cjs/models/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/cjs/models/CamOverlayAPI/pipSchema.js +40 -0
- package/cjs/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
- package/cjs/models/CamOverlayAPI/ptzCompassSchema.js +26 -0
- package/cjs/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/cjs/models/CamOverlayAPI/ptzSchema.js +13 -0
- package/cjs/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/cjs/models/CamOverlayAPI/screenSharingSchema.js +9 -0
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +9 -0
- package/cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
- package/cjs/models/CamOverlayAPI/widgetCommonSchema.js +76 -0
- package/cjs/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
- package/cjs/models/CamOverlayAPI/widgetsSchema.js +27 -0
- package/cjs/node/DefaultClient.d.ts +16 -0
- package/cjs/node/DefaultClient.js +56 -0
- package/cjs/node/HttpRequestSender.js +89 -0
- package/cjs/node/HttpServer.js +96 -0
- package/{node → cjs/node}/WsClient.d.ts +1 -1
- package/cjs/node/WsClient.js +149 -0
- package/{node → cjs/node}/WsEventClient.d.ts +1 -1
- package/cjs/node/WsEventClient.js +22 -0
- package/cjs/node/index.d.ts +2 -0
- package/cjs/node/index.js +7 -0
- package/cjs/types/CamOverlayAPI.d.ts +328 -0
- package/cjs/types/CamOverlayAPI.js +26 -0
- package/{types → cjs/types}/CamScripterAPI.d.ts +66 -7
- package/cjs/types/CamScripterAPI.js +35 -0
- package/{types → cjs/types}/CamStreamerAPI.d.ts +16 -5
- package/cjs/types/CamStreamerAPI.js +32 -0
- package/{types → cjs/types}/CamSwitcherAPI.d.ts +5 -5
- package/cjs/types/CamSwitcherAPI.js +137 -0
- package/{types/CamswitcherEvents.d.ts → cjs/types/CamSwitcherEvents.d.ts} +77 -0
- package/cjs/types/CamSwitcherEvents.js +70 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +2 -0
- package/cjs/types/PlaneTrackerAPI.js +2 -0
- package/{types → cjs/types}/VapixAPI.d.ts +479 -519
- package/cjs/types/VapixAPI.js +139 -0
- package/cjs/types/common.js +14 -0
- package/cjs/web/DefaultClient.d.ts +6 -0
- package/cjs/web/DefaultClient.js +22 -0
- package/cjs/web/WsClient.js +62 -0
- package/cjs/web/index.d.ts +2 -0
- package/cjs/web/index.js +7 -0
- package/esm/CamOverlayAPI.d.ts +629 -0
- package/esm/CamOverlayAPI.js +251 -0
- package/esm/CamOverlayDrawingAPI.d.ts +86 -0
- package/{CamOverlayDrawingAPI.js → esm/CamOverlayDrawingAPI.js} +6 -3
- package/esm/CamOverlayPainter/Frame.d.ts +96 -0
- package/esm/CamOverlayPainter/Painter.d.ts +48 -0
- package/{CamOverlayPainter → esm/CamOverlayPainter}/Painter.js +4 -1
- package/esm/CamOverlayPainter/ResourceManager.d.ts +14 -0
- package/{CamOverlayPainter → esm/CamOverlayPainter}/ResourceManager.js +6 -10
- package/esm/CamScripterAPI.d.ts +36 -0
- package/esm/CamScripterAPI.js +69 -0
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +74 -0
- package/{CamScripterAPICameraEventsGenerator.js → esm/CamScripterAPICameraEventsGenerator.js} +6 -3
- package/esm/CamStreamerAPI.d.ts +16 -0
- package/{CamStreamerAPI.js → esm/CamStreamerAPI.js} +4 -10
- package/esm/CamSwitcherAPI.d.ts +52 -0
- package/{CamSwitcherAPI.js → esm/CamSwitcherAPI.js} +24 -27
- package/esm/CamSwitcherEvents.d.ts +18 -0
- package/{CamSwitcherEvents.js → esm/CamSwitcherEvents.js} +1 -1
- package/esm/CreatePackage.d.ts +1 -0
- package/esm/PlaneTrackerAPI.d.ts +47 -0
- package/esm/PlaneTrackerAPI.js +172 -0
- package/esm/VapixAPI.d.ts +78 -0
- package/{VapixAPI.js → esm/VapixAPI.js} +93 -60
- package/esm/VapixEvents.d.ts +43 -0
- package/{VapixEvents.js → esm/VapixEvents.js} +3 -3
- package/esm/errors/errors.d.ts +37 -0
- package/{errors → esm/errors}/errors.js +6 -0
- package/esm/events/AxisCameraStationEvents.d.ts +10 -0
- package/{events → esm/events}/AxisCameraStationEvents.js +1 -1
- package/esm/events/GenetecAgent.d.ts +175 -0
- package/{events → esm/events}/GenetecAgent.js +5 -5
- package/esm/index.d.ts +18 -0
- package/esm/index.js +18 -0
- package/esm/internal/Digest.d.ts +4 -0
- package/{internal → esm/internal}/Digest.js +6 -6
- package/esm/internal/ProxyClient.d.ts +11 -0
- package/{internal → esm/internal}/ProxyClient.js +6 -4
- package/esm/internal/constants.d.ts +1 -0
- package/esm/internal/transformers.d.ts +5 -0
- package/esm/internal/types.d.ts +35 -0
- package/esm/internal/types.js +1 -0
- package/esm/internal/utils.d.ts +15 -0
- package/{internal → esm/internal}/utils.js +20 -1
- package/esm/internal/versionCompare.d.ts +6 -0
- package/esm/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/esm/models/CamOverlayAPI/accuweatherSchema.js +45 -0
- package/esm/models/CamOverlayAPI/constants.d.ts +11 -0
- package/esm/models/CamOverlayAPI/constants.js +11 -0
- package/esm/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
- package/esm/models/CamOverlayAPI/customGraphicsSchema.js +70 -0
- package/esm/models/CamOverlayAPI/fileSchema.d.ts +28 -0
- package/esm/models/CamOverlayAPI/fileSchema.js +14 -0
- package/esm/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/esm/models/CamOverlayAPI/imagesSchema.js +7 -0
- package/esm/models/CamOverlayAPI/index.d.ts +13 -0
- package/esm/models/CamOverlayAPI/index.js +13 -0
- package/esm/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/esm/models/CamOverlayAPI/infotickerSchema.js +24 -0
- package/esm/models/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/esm/models/CamOverlayAPI/pipSchema.js +37 -0
- package/esm/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
- package/esm/models/CamOverlayAPI/ptzCompassSchema.js +23 -0
- package/esm/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/esm/models/CamOverlayAPI/ptzSchema.js +10 -0
- package/esm/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/esm/models/CamOverlayAPI/screenSharingSchema.js +6 -0
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +6 -0
- package/esm/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
- package/esm/models/CamOverlayAPI/widgetCommonSchema.js +73 -0
- package/esm/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
- package/esm/models/CamOverlayAPI/widgetsSchema.js +24 -0
- package/esm/node/DefaultClient.d.ts +16 -0
- package/{node → esm/node}/DefaultClient.js +9 -7
- package/esm/node/HttpRequestSender.d.ts +28 -0
- package/esm/node/HttpServer.d.ts +21 -0
- package/{node → esm/node}/HttpServer.js +1 -1
- package/esm/node/WsClient.d.ts +39 -0
- package/esm/node/WsEventClient.d.ts +13 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/types/CamOverlayAPI.d.ts +328 -0
- package/esm/types/CamOverlayAPI.js +14 -0
- package/esm/types/CamScripterAPI.d.ts +126 -0
- package/esm/types/CamScripterAPI.js +32 -0
- package/esm/types/CamStreamerAPI.d.ts +150 -0
- package/{types → esm/types}/CamStreamerAPI.js +4 -0
- package/esm/types/CamSwitcherAPI.d.ts +814 -0
- package/esm/types/CamSwitcherEvents.d.ts +568 -0
- package/{types/CamswitcherEvents.js → esm/types/CamSwitcherEvents.js} +8 -0
- package/esm/types/PlaneTrackerAPI.d.ts +2 -0
- package/esm/types/PlaneTrackerAPI.js +1 -0
- package/esm/types/VapixAPI.d.ts +1664 -0
- package/{types → esm/types}/VapixAPI.js +30 -23
- package/esm/types/common.d.ts +37 -0
- package/esm/web/DefaultClient.d.ts +6 -0
- package/{web → esm/web}/DefaultClient.js +6 -4
- package/esm/web/WsClient.d.ts +13 -0
- package/{web → esm/web}/WsClient.js +2 -2
- package/esm/web/index.d.ts +2 -0
- package/esm/web/index.js +2 -0
- package/package.json +6 -6
- package/CamOverlayAPI.d.ts +0 -31
- package/CamOverlayAPI.js +0 -172
- package/CamScripterAPI.d.ts +0 -19
- package/CamScripterAPI.js +0 -66
- package/internal/ProxyClient.d.ts +0 -11
- package/internal/common.d.ts +0 -40
- package/internal/common.js +0 -23
- package/node/DefaultClient.d.ts +0 -15
- package/types/CamOverlayAPI.d.ts +0 -188
- package/types/CamOverlayAPI.js +0 -44
- package/types/CamScripterAPI.js +0 -17
- package/web/DefaultClient.d.ts +0 -6
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/Frame.d.ts +0 -0
- package/{CamOverlayPainter → cjs/CamOverlayPainter}/ResourceManager.d.ts +0 -0
- package/{CreatePackage.d.ts → cjs/CreatePackage.d.ts} +0 -0
- package/{internal → cjs/internal}/Digest.d.ts +0 -0
- package/{internal → cjs/internal}/constants.d.ts +0 -0
- package/{internal → cjs/internal}/transformers.d.ts +0 -0
- package/{node → cjs/node}/HttpRequestSender.d.ts +0 -0
- package/{node → cjs/node}/HttpServer.d.ts +0 -0
- package/{types → cjs/types}/common.d.ts +2 -2
- /package/{web → cjs/web}/WsClient.d.ts +0 -0
- /package/{CamOverlayPainter → esm/CamOverlayPainter}/Frame.js +0 -0
- /package/{CreatePackage.js → esm/CreatePackage.js} +0 -0
- /package/{internal → esm/internal}/constants.js +0 -0
- /package/{internal → esm/internal}/transformers.js +0 -0
- /package/{internal → esm/internal}/versionCompare.js +0 -0
- /package/{node → esm/node}/HttpRequestSender.js +0 -0
- /package/{node → esm/node}/WsClient.js +0 -0
- /package/{node → esm/node}/WsEventClient.js +0 -0
- /package/{types → esm/types}/CamSwitcherAPI.js +0 -0
- /package/{types → esm/types}/common.js +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AdmZip = require("adm-zip");
|
|
4
|
+
const Path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const productionModulesFolder = 'production_modules';
|
|
8
|
+
function isDirectory(path) {
|
|
9
|
+
const stat = fs.statSync(path);
|
|
10
|
+
return stat.isDirectory();
|
|
11
|
+
}
|
|
12
|
+
function getPackageInfo(folder) {
|
|
13
|
+
try {
|
|
14
|
+
const manifest = fs.readFileSync(Path.join(folder, 'manifest.json'));
|
|
15
|
+
const manifestParsed = JSON.parse(manifest.toString());
|
|
16
|
+
return {
|
|
17
|
+
packageName: manifestParsed.package_name,
|
|
18
|
+
packageVersion: manifestParsed.package_version.replace(/\./g, '_'),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
console.error('Get package version:', err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function createZipArchive(zip, folder, options) {
|
|
26
|
+
const zipFileRegex = new RegExp(`${Path.basename(folder)}(_[0-9]){3}\\.zip`);
|
|
27
|
+
const files = fs.readdirSync(folder);
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
const path = Path.join(folder, file);
|
|
30
|
+
const isDir = isDirectory(path);
|
|
31
|
+
if (file[0] === '.' ||
|
|
32
|
+
zipFileRegex.test(file) ||
|
|
33
|
+
file === 'node_modules' ||
|
|
34
|
+
(file === 'src' && options.typeScriptPackage) ||
|
|
35
|
+
options.excludedFileNames.includes(file)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
else if (file === 'dist' && options.typeScriptPackage) {
|
|
39
|
+
zip.addLocalFolder(path);
|
|
40
|
+
}
|
|
41
|
+
else if (file === productionModulesFolder && options.includeNodeModules) {
|
|
42
|
+
zip.addLocalFolder(Path.join(productionModulesFolder, 'node_modules'), 'node_modules');
|
|
43
|
+
}
|
|
44
|
+
else if (isDir) {
|
|
45
|
+
zip.addLocalFolder(path, file);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
zip.addLocalFile(path);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function installDependencies() {
|
|
53
|
+
if (!fs.existsSync(productionModulesFolder)) {
|
|
54
|
+
fs.mkdirSync(productionModulesFolder, {});
|
|
55
|
+
}
|
|
56
|
+
fs.cpSync('package.json', Path.join(productionModulesFolder, 'package.json'));
|
|
57
|
+
fs.cpSync('package-lock.json', Path.join(productionModulesFolder, 'package-lock.json'));
|
|
58
|
+
(0, child_process_1.execSync)(`npm ci --omit=dev`, {
|
|
59
|
+
cwd: Path.join(process.cwd(), productionModulesFolder),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function main(args) {
|
|
63
|
+
const options = {
|
|
64
|
+
includeNodeModules: false,
|
|
65
|
+
typeScriptPackage: false,
|
|
66
|
+
outputFolder: '.',
|
|
67
|
+
excludedFileNames: [],
|
|
68
|
+
};
|
|
69
|
+
for (const arg of args) {
|
|
70
|
+
if (arg === '-i' || arg === '-includeNodeModules') {
|
|
71
|
+
options.includeNodeModules = true;
|
|
72
|
+
}
|
|
73
|
+
if (arg.startsWith('-w=') || arg.startsWith('-where=')) {
|
|
74
|
+
options.outputFolder = arg.substring(arg.indexOf('=') + 1);
|
|
75
|
+
}
|
|
76
|
+
if (arg.startsWith('-e=') || arg.startsWith('-exclude=')) {
|
|
77
|
+
options.excludedFileNames = arg.substring(arg.indexOf('=') + 1).split(',');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (options.includeNodeModules) {
|
|
81
|
+
installDependencies();
|
|
82
|
+
}
|
|
83
|
+
if (fs.existsSync('dist')) {
|
|
84
|
+
options.typeScriptPackage = true;
|
|
85
|
+
}
|
|
86
|
+
const folder = Path.resolve('.');
|
|
87
|
+
const packageInfo = getPackageInfo(folder);
|
|
88
|
+
if (packageInfo === undefined) {
|
|
89
|
+
console.error('Package info not found');
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
const zipFile = `${options.outputFolder}/${packageInfo.packageName}_${packageInfo.packageVersion}.zip`;
|
|
93
|
+
if (fs.existsSync(zipFile)) {
|
|
94
|
+
try {
|
|
95
|
+
fs.unlinkSync(zipFile);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error('An error occured: ', error);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const zip = new AdmZip();
|
|
103
|
+
createZipArchive(zip, folder, options);
|
|
104
|
+
zip.writeZip(zipFile);
|
|
105
|
+
}
|
|
106
|
+
main(process.argv.slice(2));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
|
+
import { TExportDataType, TImportDataType } from './types/PlaneTrackerAPI';
|
|
3
|
+
export type TApiUser = {
|
|
4
|
+
userId: string;
|
|
5
|
+
userName: string;
|
|
6
|
+
userPriority: number;
|
|
7
|
+
};
|
|
8
|
+
type ICAO = string;
|
|
9
|
+
export declare const BASE_URL = "/local/planetracker";
|
|
10
|
+
export declare class PlaneTrackerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
11
|
+
private client;
|
|
12
|
+
private apiUser;
|
|
13
|
+
private _apiUserQuery;
|
|
14
|
+
constructor(client: Client, apiUser: TApiUser);
|
|
15
|
+
static getProxyUrlPath: () => string;
|
|
16
|
+
checkCameraTime(): Promise<boolean>;
|
|
17
|
+
fetchCameraSettings: () => Promise<any>;
|
|
18
|
+
setCameraSettings: (settingsJsonString: string) => Promise<TResponse>;
|
|
19
|
+
fetchServerSettings: () => Promise<any>;
|
|
20
|
+
fetchMapInfo: () => Promise<any>;
|
|
21
|
+
fetchFlightInfo: (icao: ICAO) => Promise<any>;
|
|
22
|
+
getZones: () => Promise<any>;
|
|
23
|
+
setZones: (zonesJsonString: string) => Promise<TResponse>;
|
|
24
|
+
getPriorityList: () => Promise<any>;
|
|
25
|
+
setPriorityList: (priorityListJsonString: string) => Promise<TResponse>;
|
|
26
|
+
getWhiteList: () => Promise<any>;
|
|
27
|
+
setWhiteList: (whiteListJsonString: string) => Promise<TResponse>;
|
|
28
|
+
getBlackList: () => Promise<any>;
|
|
29
|
+
setBlackList: (blackListJsonString: string) => Promise<TResponse>;
|
|
30
|
+
getTrackingMode: () => Promise<any>;
|
|
31
|
+
setTrackingMode: (modeJsonString: string) => Promise<TResponse>;
|
|
32
|
+
startTrackingPlane: (icao: ICAO) => Promise<TResponse>;
|
|
33
|
+
stopTrackingPlane: () => Promise<TResponse>;
|
|
34
|
+
goToCoordinates: (lat: number, lon: number, alt?: number) => Promise<TResponse>;
|
|
35
|
+
exportAppSettings: (dataType: TExportDataType) => Promise<TBlobResponse<Client>>;
|
|
36
|
+
importAppSettings: (dataType: TImportDataType, formData: FormData) => Promise<TResponse>;
|
|
37
|
+
resetPtzCalibration: () => Promise<TResponse>;
|
|
38
|
+
checkGenetecConnection: (params: TParameters) => Promise<TResponse>;
|
|
39
|
+
getGenetecCameraList: (params: TParameters) => Promise<any>;
|
|
40
|
+
serverRunCheck: () => Promise<TResponse>;
|
|
41
|
+
private _getJson;
|
|
42
|
+
private _getBlob;
|
|
43
|
+
private parseBlobResponse;
|
|
44
|
+
private _postJsonEncoded;
|
|
45
|
+
private _postUrlEncoded;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
apiUser;
|
|
11
|
+
_apiUserQuery;
|
|
12
|
+
constructor(client, apiUser) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
this.apiUser = apiUser;
|
|
15
|
+
this._apiUserQuery = (0, utils_1.paramToUrl)(this.apiUser);
|
|
16
|
+
}
|
|
17
|
+
static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
|
|
18
|
+
async checkCameraTime() {
|
|
19
|
+
const responseSchema = zod_1.z.discriminatedUnion('state', [
|
|
20
|
+
zod_1.z.object({
|
|
21
|
+
state: zod_1.z.literal(true),
|
|
22
|
+
code: zod_1.z.number(),
|
|
23
|
+
}),
|
|
24
|
+
zod_1.z.object({
|
|
25
|
+
state: zod_1.z.literal(false),
|
|
26
|
+
code: zod_1.z.number(),
|
|
27
|
+
reason: zod_1.z.union([
|
|
28
|
+
zod_1.z.literal('INVALID_TIME'),
|
|
29
|
+
zod_1.z.literal('COULDNT_RESOLVE_HOST'),
|
|
30
|
+
zod_1.z.literal('CONNECTION_ERROR'),
|
|
31
|
+
]),
|
|
32
|
+
message: zod_1.z.string(),
|
|
33
|
+
}),
|
|
34
|
+
]);
|
|
35
|
+
const response = await this._getJson(`${exports.BASE_URL}/camera_time.cgi`);
|
|
36
|
+
const cameraTime = responseSchema.parse(response);
|
|
37
|
+
if (!cameraTime.state) {
|
|
38
|
+
console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
|
|
39
|
+
}
|
|
40
|
+
return cameraTime.state;
|
|
41
|
+
}
|
|
42
|
+
fetchCameraSettings = async () => {
|
|
43
|
+
return await this._getJson(`${exports.BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
|
|
44
|
+
};
|
|
45
|
+
setCameraSettings = async (settingsJsonString) => {
|
|
46
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package_camera_settings.cgi`, settingsJsonString, {
|
|
47
|
+
action: 'set',
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
fetchServerSettings = async () => {
|
|
51
|
+
return await this._getJson(`${exports.BASE_URL}/package_server_settings.cgi`, { action: 'get' });
|
|
52
|
+
};
|
|
53
|
+
fetchMapInfo = async () => {
|
|
54
|
+
return await this._getJson(`${exports.BASE_URL}/package/getMapInfo.cgi`);
|
|
55
|
+
};
|
|
56
|
+
fetchFlightInfo = async (icao) => {
|
|
57
|
+
return await this._getJson(`${exports.BASE_URL}/package/flightInfo.cgi`, { icao: encodeURIComponent(icao) });
|
|
58
|
+
};
|
|
59
|
+
getZones = async () => {
|
|
60
|
+
return await this._getJson(`${exports.BASE_URL}/package/getZones.cgi`);
|
|
61
|
+
};
|
|
62
|
+
setZones = async (zonesJsonString) => {
|
|
63
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setZones.cgi?${this._apiUserQuery}`, zonesJsonString);
|
|
64
|
+
};
|
|
65
|
+
getPriorityList = async () => {
|
|
66
|
+
return await this._getJson(`${exports.BASE_URL}/package/getPriorityList.cgi`);
|
|
67
|
+
};
|
|
68
|
+
setPriorityList = async (priorityListJsonString) => {
|
|
69
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setPriorityList.cgi?${this._apiUserQuery}`, priorityListJsonString);
|
|
70
|
+
};
|
|
71
|
+
getWhiteList = async () => {
|
|
72
|
+
return await this._getJson(`${exports.BASE_URL}/package/getWhiteList.cgi`);
|
|
73
|
+
};
|
|
74
|
+
setWhiteList = async (whiteListJsonString) => {
|
|
75
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setWhiteList.cgi?${this._apiUserQuery}`, whiteListJsonString);
|
|
76
|
+
};
|
|
77
|
+
getBlackList = async () => {
|
|
78
|
+
return await this._getJson(`${exports.BASE_URL}/package/getBlackList.cgi`);
|
|
79
|
+
};
|
|
80
|
+
setBlackList = async (blackListJsonString) => {
|
|
81
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setBlackList.cgi?${this._apiUserQuery}`, blackListJsonString);
|
|
82
|
+
};
|
|
83
|
+
getTrackingMode = async () => {
|
|
84
|
+
return await this._getJson(`${exports.BASE_URL}/package/getTrackingMode.cgi`);
|
|
85
|
+
};
|
|
86
|
+
setTrackingMode = async (modeJsonString) => {
|
|
87
|
+
return await this._postJsonEncoded(`${exports.BASE_URL}/package/setTrackingMode.cgi?${this._apiUserQuery}`, modeJsonString);
|
|
88
|
+
};
|
|
89
|
+
startTrackingPlane = async (icao) => {
|
|
90
|
+
return await this.client.get(`${exports.BASE_URL}/package/trackIcao.cgi`, {
|
|
91
|
+
icao: encodeURIComponent(icao),
|
|
92
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
93
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
94
|
+
userPriority: this.apiUser.userPriority,
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
stopTrackingPlane = async () => {
|
|
98
|
+
return await this.client.get(`${exports.BASE_URL}/package/resetIcao.cgi?${this._apiUserQuery}`);
|
|
99
|
+
};
|
|
100
|
+
goToCoordinates = async (lat, lon, alt) => {
|
|
101
|
+
const url = `${exports.BASE_URL}/package/goToCoordinates.cgi?lat=${lat}&lon=${lon}&${this._apiUserQuery}`;
|
|
102
|
+
return await this.client.get(`${url}${alt !== undefined ? `&alt=${alt}` : ''}`);
|
|
103
|
+
};
|
|
104
|
+
exportAppSettings = async (dataType) => {
|
|
105
|
+
return await this._getBlob(`${exports.BASE_URL}/package_data.cgi`, { action: 'EXPORT', dataType });
|
|
106
|
+
};
|
|
107
|
+
importAppSettings = async (dataType, formData) => {
|
|
108
|
+
return await this.client.post(`${exports.BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
|
|
109
|
+
};
|
|
110
|
+
resetPtzCalibration = async () => {
|
|
111
|
+
return await this.client.get(`${exports.BASE_URL}/package/resetPtzCalibration.cgi`, {
|
|
112
|
+
userId: encodeURIComponent(this.apiUser.userId),
|
|
113
|
+
userName: encodeURIComponent(this.apiUser.userName),
|
|
114
|
+
userPriority: this.apiUser.userPriority,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
checkGenetecConnection = async (params) => {
|
|
118
|
+
return await this._postUrlEncoded(`${exports.BASE_URL}/package/checkGenetecConnection.cgi`, params);
|
|
119
|
+
};
|
|
120
|
+
getGenetecCameraList = async (params) => {
|
|
121
|
+
const res = await this._postUrlEncoded(`${exports.BASE_URL}/package/getGenetecCameraList.cgi`, params);
|
|
122
|
+
return await res.json();
|
|
123
|
+
};
|
|
124
|
+
serverRunCheck = async () => {
|
|
125
|
+
return await this.client.get(`${exports.BASE_URL}/package/serverRunCheck.cgi`);
|
|
126
|
+
};
|
|
127
|
+
async _getJson(...args) {
|
|
128
|
+
const res = await this.client.get(...args);
|
|
129
|
+
if (res.ok) {
|
|
130
|
+
return await res.json();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async _getBlob(...args) {
|
|
137
|
+
const res = await this.client.get(...args);
|
|
138
|
+
if (res.ok) {
|
|
139
|
+
return await this.parseBlobResponse(res);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async parseBlobResponse(response) {
|
|
146
|
+
try {
|
|
147
|
+
return (await response.blob());
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
throw new errors_1.ParsingBlobError(err);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async _postJsonEncoded(...args) {
|
|
154
|
+
const [path, data, params, headers] = args;
|
|
155
|
+
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
156
|
+
const res = await this.client.post(path, data, params, { ...baseHeaders, ...headers });
|
|
157
|
+
if (res.ok) {
|
|
158
|
+
return res;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async _postUrlEncoded(path, params, headers) {
|
|
165
|
+
const data = (0, utils_1.paramToUrl)(params);
|
|
166
|
+
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
167
|
+
const res = await this.client.post(path, data, {}, { ...baseHeaders, ...headers });
|
|
168
|
+
if (res.ok) {
|
|
169
|
+
return res;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.PlaneTrackerAPI = PlaneTrackerAPI;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IClient, TParameters, TResponse } from './internal/
|
|
2
|
-
import {
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
|
+
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice } from './types/VapixAPI';
|
|
3
3
|
import { ProxyClient } from './internal/ProxyClient';
|
|
4
4
|
import { TCameraImageConfig, TProxyParam } from './types/common';
|
|
5
|
-
export declare class VapixAPI<Client extends IClient = IClient
|
|
5
|
+
export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
6
6
|
client: ProxyClient<Client>;
|
|
7
7
|
constructor(client: Client, getProxyUrl: () => string);
|
|
8
|
-
getUrlEncoded(proxy: TProxyParam
|
|
9
|
-
postJson(proxy: TProxyParam
|
|
8
|
+
getUrlEncoded(proxy: TProxyParam, path: string, parameters?: TParameters, headers?: Record<string, string>): Promise<TResponse>;
|
|
9
|
+
postJson(proxy: TProxyParam, path: string, jsonData: Record<string, any>, headers?: Record<string, string>): Promise<TResponse>;
|
|
10
10
|
getCameraImage(params: TCameraImageConfig, proxy?: TProxyParam): Promise<TResponse>;
|
|
11
11
|
getEventDeclarations(proxy?: TProxyParam): Promise<string>;
|
|
12
12
|
getSupportedAudioSampleRate(proxy?: TProxyParam): Promise<TAudioSampleRates[]>;
|
|
@@ -26,7 +26,7 @@ export declare class VapixAPI<Client extends IClient = IClient> {
|
|
|
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[]>;
|
|
@@ -58,7 +58,19 @@ export declare class VapixAPI<Client extends IClient = IClient> {
|
|
|
58
58
|
getPtzPosition(camera: number, proxy?: TProxyParam): Promise<TCameraPTZItemData>;
|
|
59
59
|
getInputState(port: number, proxy?: TProxyParam): Promise<boolean>;
|
|
60
60
|
setOutputState(port: number, active: boolean, proxy?: TProxyParam): Promise<TResponse>;
|
|
61
|
-
getApplicationList(proxy?: TProxyParam): Promise<
|
|
61
|
+
getApplicationList(proxy?: TProxyParam): Promise<{
|
|
62
|
+
appId: "CamStreamer" | "CamSwitcher" | "CamOverlay" | "CamScripter" | "PlaneTracker" | "Ndihxplugin" | "SportTracker" | null;
|
|
63
|
+
Name: string;
|
|
64
|
+
NiceName: string;
|
|
65
|
+
Vendor: string;
|
|
66
|
+
Version: string;
|
|
67
|
+
License: string;
|
|
68
|
+
Status: string;
|
|
69
|
+
ApplicationID?: string | undefined;
|
|
70
|
+
ConfigurationPage?: string | undefined;
|
|
71
|
+
VendorHomePage?: string | undefined;
|
|
72
|
+
LicenseName?: string | undefined;
|
|
73
|
+
}[]>;
|
|
62
74
|
startApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
63
75
|
restartApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
64
76
|
stopApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|