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.
Files changed (238) hide show
  1. package/README.md +5 -1
  2. package/cjs/CamOverlayAPI.d.ts +629 -0
  3. package/cjs/CamOverlayAPI.js +255 -0
  4. package/{CamOverlayDrawingAPI.d.ts → cjs/CamOverlayDrawingAPI.d.ts} +1 -1
  5. package/cjs/CamOverlayDrawingAPI.js +235 -0
  6. package/cjs/CamOverlayPainter/Frame.js +301 -0
  7. package/{CamOverlayPainter → cjs/CamOverlayPainter}/Painter.d.ts +14 -3
  8. package/cjs/CamOverlayPainter/Painter.js +171 -0
  9. package/cjs/CamOverlayPainter/ResourceManager.js +46 -0
  10. package/cjs/CamScripterAPI.d.ts +36 -0
  11. package/cjs/CamScripterAPI.js +73 -0
  12. package/{CamScripterAPICameraEventsGenerator.d.ts → cjs/CamScripterAPICameraEventsGenerator.d.ts} +1 -1
  13. package/cjs/CamScripterAPICameraEventsGenerator.js +162 -0
  14. package/{CamStreamerAPI.d.ts → cjs/CamStreamerAPI.d.ts} +5 -5
  15. package/cjs/CamStreamerAPI.js +59 -0
  16. package/{CamSwitcherAPI.d.ts → cjs/CamSwitcherAPI.d.ts} +10 -6
  17. package/cjs/CamSwitcherAPI.js +351 -0
  18. package/{CamSwitcherEvents.d.ts → cjs/CamSwitcherEvents.d.ts} +2 -2
  19. package/cjs/CamSwitcherEvents.js +67 -0
  20. package/cjs/CreatePackage.js +106 -0
  21. package/cjs/PlaneTrackerAPI.d.ts +47 -0
  22. package/cjs/PlaneTrackerAPI.js +176 -0
  23. package/{VapixAPI.d.ts → cjs/VapixAPI.d.ts} +19 -7
  24. package/cjs/VapixAPI.js +491 -0
  25. package/{VapixEvents.d.ts → cjs/VapixEvents.d.ts} +1 -1
  26. package/cjs/VapixEvents.js +88 -0
  27. package/{errors → cjs/errors}/errors.d.ts +3 -0
  28. package/cjs/errors/errors.js +86 -0
  29. package/{events → cjs/events}/AxisCameraStationEvents.d.ts +3 -2
  30. package/cjs/events/AxisCameraStationEvents.js +48 -0
  31. package/{events → cjs/events}/GenetecAgent.d.ts +4 -3
  32. package/cjs/events/GenetecAgent.js +123 -0
  33. package/cjs/index.d.ts +18 -0
  34. package/cjs/index.js +42 -0
  35. package/cjs/internal/Digest.js +42 -0
  36. package/cjs/internal/ProxyClient.d.ts +11 -0
  37. package/cjs/internal/ProxyClient.js +46 -0
  38. package/cjs/internal/constants.js +4 -0
  39. package/cjs/internal/transformers.js +32 -0
  40. package/cjs/internal/types.d.ts +35 -0
  41. package/cjs/internal/types.js +2 -0
  42. package/{internal → cjs/internal}/utils.d.ts +5 -1
  43. package/cjs/internal/utils.js +69 -0
  44. package/{internal → cjs/internal}/versionCompare.d.ts +2 -2
  45. package/cjs/internal/versionCompare.js +53 -0
  46. package/cjs/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
  47. package/cjs/models/CamOverlayAPI/accuweatherSchema.js +48 -0
  48. package/cjs/models/CamOverlayAPI/constants.d.ts +11 -0
  49. package/cjs/models/CamOverlayAPI/constants.js +14 -0
  50. package/cjs/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
  51. package/cjs/models/CamOverlayAPI/customGraphicsSchema.js +73 -0
  52. package/cjs/models/CamOverlayAPI/fileSchema.d.ts +28 -0
  53. package/cjs/models/CamOverlayAPI/fileSchema.js +17 -0
  54. package/cjs/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
  55. package/cjs/models/CamOverlayAPI/imagesSchema.js +10 -0
  56. package/cjs/models/CamOverlayAPI/index.d.ts +13 -0
  57. package/cjs/models/CamOverlayAPI/index.js +29 -0
  58. package/cjs/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
  59. package/cjs/models/CamOverlayAPI/infotickerSchema.js +27 -0
  60. package/cjs/models/CamOverlayAPI/pipSchema.d.ts +125 -0
  61. package/cjs/models/CamOverlayAPI/pipSchema.js +40 -0
  62. package/cjs/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
  63. package/cjs/models/CamOverlayAPI/ptzCompassSchema.js +26 -0
  64. package/cjs/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
  65. package/cjs/models/CamOverlayAPI/ptzSchema.js +13 -0
  66. package/cjs/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
  67. package/cjs/models/CamOverlayAPI/screenSharingSchema.js +9 -0
  68. package/cjs/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
  69. package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +9 -0
  70. package/cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
  71. package/cjs/models/CamOverlayAPI/widgetCommonSchema.js +76 -0
  72. package/cjs/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
  73. package/cjs/models/CamOverlayAPI/widgetsSchema.js +27 -0
  74. package/cjs/node/DefaultClient.d.ts +16 -0
  75. package/cjs/node/DefaultClient.js +56 -0
  76. package/cjs/node/HttpRequestSender.js +89 -0
  77. package/cjs/node/HttpServer.js +96 -0
  78. package/{node → cjs/node}/WsClient.d.ts +1 -1
  79. package/cjs/node/WsClient.js +149 -0
  80. package/{node → cjs/node}/WsEventClient.d.ts +1 -1
  81. package/cjs/node/WsEventClient.js +22 -0
  82. package/cjs/node/index.d.ts +2 -0
  83. package/cjs/node/index.js +7 -0
  84. package/cjs/types/CamOverlayAPI.d.ts +328 -0
  85. package/cjs/types/CamOverlayAPI.js +26 -0
  86. package/{types → cjs/types}/CamScripterAPI.d.ts +66 -7
  87. package/cjs/types/CamScripterAPI.js +35 -0
  88. package/{types → cjs/types}/CamStreamerAPI.d.ts +16 -5
  89. package/cjs/types/CamStreamerAPI.js +32 -0
  90. package/{types → cjs/types}/CamSwitcherAPI.d.ts +5 -5
  91. package/cjs/types/CamSwitcherAPI.js +137 -0
  92. package/{types/CamswitcherEvents.d.ts → cjs/types/CamSwitcherEvents.d.ts} +77 -0
  93. package/cjs/types/CamSwitcherEvents.js +70 -0
  94. package/cjs/types/PlaneTrackerAPI.d.ts +2 -0
  95. package/cjs/types/PlaneTrackerAPI.js +2 -0
  96. package/{types → cjs/types}/VapixAPI.d.ts +479 -519
  97. package/cjs/types/VapixAPI.js +139 -0
  98. package/cjs/types/common.js +14 -0
  99. package/cjs/web/DefaultClient.d.ts +6 -0
  100. package/cjs/web/DefaultClient.js +22 -0
  101. package/cjs/web/WsClient.js +62 -0
  102. package/cjs/web/index.d.ts +2 -0
  103. package/cjs/web/index.js +7 -0
  104. package/esm/CamOverlayAPI.d.ts +629 -0
  105. package/esm/CamOverlayAPI.js +251 -0
  106. package/esm/CamOverlayDrawingAPI.d.ts +86 -0
  107. package/{CamOverlayDrawingAPI.js → esm/CamOverlayDrawingAPI.js} +6 -3
  108. package/esm/CamOverlayPainter/Frame.d.ts +96 -0
  109. package/esm/CamOverlayPainter/Painter.d.ts +48 -0
  110. package/{CamOverlayPainter → esm/CamOverlayPainter}/Painter.js +4 -1
  111. package/esm/CamOverlayPainter/ResourceManager.d.ts +14 -0
  112. package/{CamOverlayPainter → esm/CamOverlayPainter}/ResourceManager.js +6 -10
  113. package/esm/CamScripterAPI.d.ts +36 -0
  114. package/esm/CamScripterAPI.js +69 -0
  115. package/esm/CamScripterAPICameraEventsGenerator.d.ts +74 -0
  116. package/{CamScripterAPICameraEventsGenerator.js → esm/CamScripterAPICameraEventsGenerator.js} +6 -3
  117. package/esm/CamStreamerAPI.d.ts +16 -0
  118. package/{CamStreamerAPI.js → esm/CamStreamerAPI.js} +4 -10
  119. package/esm/CamSwitcherAPI.d.ts +52 -0
  120. package/{CamSwitcherAPI.js → esm/CamSwitcherAPI.js} +24 -27
  121. package/esm/CamSwitcherEvents.d.ts +18 -0
  122. package/{CamSwitcherEvents.js → esm/CamSwitcherEvents.js} +1 -1
  123. package/esm/CreatePackage.d.ts +1 -0
  124. package/esm/PlaneTrackerAPI.d.ts +47 -0
  125. package/esm/PlaneTrackerAPI.js +172 -0
  126. package/esm/VapixAPI.d.ts +78 -0
  127. package/{VapixAPI.js → esm/VapixAPI.js} +93 -60
  128. package/esm/VapixEvents.d.ts +43 -0
  129. package/{VapixEvents.js → esm/VapixEvents.js} +3 -3
  130. package/esm/errors/errors.d.ts +37 -0
  131. package/{errors → esm/errors}/errors.js +6 -0
  132. package/esm/events/AxisCameraStationEvents.d.ts +10 -0
  133. package/{events → esm/events}/AxisCameraStationEvents.js +1 -1
  134. package/esm/events/GenetecAgent.d.ts +175 -0
  135. package/{events → esm/events}/GenetecAgent.js +5 -5
  136. package/esm/index.d.ts +18 -0
  137. package/esm/index.js +18 -0
  138. package/esm/internal/Digest.d.ts +4 -0
  139. package/{internal → esm/internal}/Digest.js +6 -6
  140. package/esm/internal/ProxyClient.d.ts +11 -0
  141. package/{internal → esm/internal}/ProxyClient.js +6 -4
  142. package/esm/internal/constants.d.ts +1 -0
  143. package/esm/internal/transformers.d.ts +5 -0
  144. package/esm/internal/types.d.ts +35 -0
  145. package/esm/internal/types.js +1 -0
  146. package/esm/internal/utils.d.ts +15 -0
  147. package/{internal → esm/internal}/utils.js +20 -1
  148. package/esm/internal/versionCompare.d.ts +6 -0
  149. package/esm/models/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
  150. package/esm/models/CamOverlayAPI/accuweatherSchema.js +45 -0
  151. package/esm/models/CamOverlayAPI/constants.d.ts +11 -0
  152. package/esm/models/CamOverlayAPI/constants.js +11 -0
  153. package/esm/models/CamOverlayAPI/customGraphicsSchema.d.ts +699 -0
  154. package/esm/models/CamOverlayAPI/customGraphicsSchema.js +70 -0
  155. package/esm/models/CamOverlayAPI/fileSchema.d.ts +28 -0
  156. package/esm/models/CamOverlayAPI/fileSchema.js +14 -0
  157. package/esm/models/CamOverlayAPI/imagesSchema.d.ts +95 -0
  158. package/esm/models/CamOverlayAPI/imagesSchema.js +7 -0
  159. package/esm/models/CamOverlayAPI/index.d.ts +13 -0
  160. package/esm/models/CamOverlayAPI/index.js +13 -0
  161. package/esm/models/CamOverlayAPI/infotickerSchema.d.ts +96 -0
  162. package/esm/models/CamOverlayAPI/infotickerSchema.js +24 -0
  163. package/esm/models/CamOverlayAPI/pipSchema.d.ts +125 -0
  164. package/esm/models/CamOverlayAPI/pipSchema.js +37 -0
  165. package/esm/models/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
  166. package/esm/models/CamOverlayAPI/ptzCompassSchema.js +23 -0
  167. package/esm/models/CamOverlayAPI/ptzSchema.d.ts +118 -0
  168. package/esm/models/CamOverlayAPI/ptzSchema.js +10 -0
  169. package/esm/models/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
  170. package/esm/models/CamOverlayAPI/screenSharingSchema.js +6 -0
  171. package/esm/models/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
  172. package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +6 -0
  173. package/esm/models/CamOverlayAPI/widgetCommonSchema.d.ts +126 -0
  174. package/esm/models/CamOverlayAPI/widgetCommonSchema.js +73 -0
  175. package/esm/models/CamOverlayAPI/widgetsSchema.d.ts +2823 -0
  176. package/esm/models/CamOverlayAPI/widgetsSchema.js +24 -0
  177. package/esm/node/DefaultClient.d.ts +16 -0
  178. package/{node → esm/node}/DefaultClient.js +9 -7
  179. package/esm/node/HttpRequestSender.d.ts +28 -0
  180. package/esm/node/HttpServer.d.ts +21 -0
  181. package/{node → esm/node}/HttpServer.js +1 -1
  182. package/esm/node/WsClient.d.ts +39 -0
  183. package/esm/node/WsEventClient.d.ts +13 -0
  184. package/esm/node/index.d.ts +2 -0
  185. package/esm/node/index.js +2 -0
  186. package/esm/types/CamOverlayAPI.d.ts +328 -0
  187. package/esm/types/CamOverlayAPI.js +14 -0
  188. package/esm/types/CamScripterAPI.d.ts +126 -0
  189. package/esm/types/CamScripterAPI.js +32 -0
  190. package/esm/types/CamStreamerAPI.d.ts +150 -0
  191. package/{types → esm/types}/CamStreamerAPI.js +4 -0
  192. package/esm/types/CamSwitcherAPI.d.ts +814 -0
  193. package/esm/types/CamSwitcherEvents.d.ts +568 -0
  194. package/{types/CamswitcherEvents.js → esm/types/CamSwitcherEvents.js} +8 -0
  195. package/esm/types/PlaneTrackerAPI.d.ts +2 -0
  196. package/esm/types/PlaneTrackerAPI.js +1 -0
  197. package/esm/types/VapixAPI.d.ts +1664 -0
  198. package/{types → esm/types}/VapixAPI.js +30 -23
  199. package/esm/types/common.d.ts +37 -0
  200. package/esm/web/DefaultClient.d.ts +6 -0
  201. package/{web → esm/web}/DefaultClient.js +6 -4
  202. package/esm/web/WsClient.d.ts +13 -0
  203. package/{web → esm/web}/WsClient.js +2 -2
  204. package/esm/web/index.d.ts +2 -0
  205. package/esm/web/index.js +2 -0
  206. package/package.json +6 -6
  207. package/CamOverlayAPI.d.ts +0 -31
  208. package/CamOverlayAPI.js +0 -172
  209. package/CamScripterAPI.d.ts +0 -19
  210. package/CamScripterAPI.js +0 -66
  211. package/internal/ProxyClient.d.ts +0 -11
  212. package/internal/common.d.ts +0 -40
  213. package/internal/common.js +0 -23
  214. package/node/DefaultClient.d.ts +0 -15
  215. package/types/CamOverlayAPI.d.ts +0 -188
  216. package/types/CamOverlayAPI.js +0 -44
  217. package/types/CamScripterAPI.js +0 -17
  218. package/web/DefaultClient.d.ts +0 -6
  219. package/{CamOverlayPainter → cjs/CamOverlayPainter}/Frame.d.ts +0 -0
  220. package/{CamOverlayPainter → cjs/CamOverlayPainter}/ResourceManager.d.ts +0 -0
  221. package/{CreatePackage.d.ts → cjs/CreatePackage.d.ts} +0 -0
  222. package/{internal → cjs/internal}/Digest.d.ts +0 -0
  223. package/{internal → cjs/internal}/constants.d.ts +0 -0
  224. package/{internal → cjs/internal}/transformers.d.ts +0 -0
  225. package/{node → cjs/node}/HttpRequestSender.d.ts +0 -0
  226. package/{node → cjs/node}/HttpServer.d.ts +0 -0
  227. package/{types → cjs/types}/common.d.ts +2 -2
  228. /package/{web → cjs/web}/WsClient.d.ts +0 -0
  229. /package/{CamOverlayPainter → esm/CamOverlayPainter}/Frame.js +0 -0
  230. /package/{CreatePackage.js → esm/CreatePackage.js} +0 -0
  231. /package/{internal → esm/internal}/constants.js +0 -0
  232. /package/{internal → esm/internal}/transformers.js +0 -0
  233. /package/{internal → esm/internal}/versionCompare.js +0 -0
  234. /package/{node → esm/node}/HttpRequestSender.js +0 -0
  235. /package/{node → esm/node}/WsClient.js +0 -0
  236. /package/{node → esm/node}/WsEventClient.js +0 -0
  237. /package/{types → esm/types}/CamSwitcherAPI.js +0 -0
  238. /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/common';
2
- import { TApplication, TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice } from './types/VapixAPI';
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 | undefined, path: string, parameters?: TParameters, headers?: Record<string, string>): Promise<TResponse>;
9
- postJson(proxy: TProxyParam | undefined, path: string, jsonData: Record<string, any>, headers?: Record<string, string>): Promise<TResponse>;
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: string;
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<TApplication[]>;
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>;