camstreamerlib 4.0.0-beta.37 → 4.0.0-beta.39

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 (79) hide show
  1. package/README.md +38 -27
  2. package/cjs/CamOverlayAPI.js +42 -75
  3. package/cjs/CamScripterAPI.js +30 -24
  4. package/cjs/CamStreamerAPI.js +30 -33
  5. package/cjs/CamSwitcherAPI.js +57 -52
  6. package/cjs/PlaneTrackerAPI.js +55 -66
  7. package/cjs/VapixAPI.js +23 -22
  8. package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +1 -1
  9. package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +4 -14
  10. package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +1 -1
  11. package/cjs/{VapixEvents.js → node/VapixEvents.js} +1 -1
  12. package/cjs/node/events/GenetecAgent.js +5 -27
  13. package/cjs/node/index.js +17 -0
  14. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +2 -2
  15. package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +6 -1
  16. package/cjs/types/CamOverlayPainter.js +12 -0
  17. package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
  18. package/cjs/types/CamSwitcherAPI.js +38 -1
  19. package/cjs/types/GenetecAgent.js +31 -0
  20. package/cjs/types/PlaneTrackerAPI.js +277 -0
  21. package/cjs/types/VapixAPI.js +20 -2
  22. package/cjs/types/VapixEvents.js +2 -0
  23. package/esm/CamOverlayAPI.js +43 -76
  24. package/esm/CamScripterAPI.js +30 -24
  25. package/esm/CamStreamerAPI.js +30 -30
  26. package/esm/CamSwitcherAPI.js +58 -53
  27. package/esm/PlaneTrackerAPI.js +56 -67
  28. package/esm/VapixAPI.js +24 -23
  29. package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +1 -1
  30. package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +1 -11
  31. package/esm/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +1 -1
  32. package/esm/{VapixEvents.js → node/VapixEvents.js} +1 -1
  33. package/esm/node/events/GenetecAgent.js +1 -23
  34. package/esm/node/index.js +10 -0
  35. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +1 -1
  36. package/esm/types/CamOverlayAPI/scoreBoardSchema.js +6 -1
  37. package/esm/types/CamOverlayPainter.js +11 -1
  38. package/esm/types/CamSwitcherAPI.js +38 -1
  39. package/esm/types/GenetecAgent.js +28 -0
  40. package/esm/types/PlaneTrackerAPI.js +276 -1
  41. package/esm/types/VapixAPI.js +19 -1
  42. package/esm/types/VapixEvents.js +1 -0
  43. package/package.json +1 -1
  44. package/types/CamOverlayAPI.d.ts +24 -14
  45. package/types/CamScripterAPI.d.ts +34 -9
  46. package/types/CamStreamerAPI.d.ts +27 -5
  47. package/types/CamSwitcherAPI.d.ts +136 -23
  48. package/types/PlaneTrackerAPI.d.ts +201 -20
  49. package/types/VapixAPI.d.ts +46 -12
  50. package/types/bin/CreatePackage.d.ts +1 -0
  51. package/types/{CamOverlayDrawingAPI.d.ts → node/CamOverlayDrawingAPI.d.ts} +1 -1
  52. package/types/{CamOverlayPainter → node/CamOverlayPainter}/Frame.d.ts +2 -2
  53. package/types/{CamOverlayPainter → node/CamOverlayPainter}/Painter.d.ts +2 -13
  54. package/types/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.d.ts +1 -1
  55. package/types/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
  56. package/types/node/VapixEvents.d.ts +16 -0
  57. package/types/node/events/GenetecAgent.d.ts +1 -144
  58. package/types/node/index.d.ts +10 -0
  59. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +38 -38
  60. package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +13 -13
  61. package/types/types/CamOverlayDrawingAPI.d.ts +3 -13
  62. package/types/types/CamOverlayPainter.d.ts +12 -10
  63. package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
  64. package/types/types/CamStreamerAPI.d.ts +2 -2
  65. package/types/types/CamSwitcherAPI.d.ts +111 -30
  66. package/types/types/GenetecAgent.d.ts +174 -0
  67. package/types/types/PlaneTrackerAPI.d.ts +859 -0
  68. package/types/types/VapixAPI.d.ts +54 -8
  69. package/types/types/VapixEvents.d.ts +15 -0
  70. package/types/types/common.d.ts +1 -0
  71. package/types/CamScripterAPICameraEventsGenerator.d.ts +0 -74
  72. package/types/VapixEvents.d.ts +0 -43
  73. /package/cjs/{CreatePackage.js → bin/CreatePackage.js} +0 -0
  74. /package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +0 -0
  75. /package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +0 -0
  76. /package/esm/{CreatePackage.js → bin/CreatePackage.js} +0 -0
  77. /package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +0 -0
  78. /package/esm/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +0 -0
  79. /package/{types/CreatePackage.d.ts → esm/types/CamScripterAPICameraEventsGenerator.js} +0 -0
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { paramToUrl, responseStringify } from './internal/utils';
2
+ import { responseStringify } from './internal/utils';
3
+ import { blackListSchema, cameraSettingsSchema, flightInfoSchema, mapInfoSchema, priorityListSchema, serverSettingsSchema, trackingModeSchema, whiteListSchema, zonesSchema, } from './types/PlaneTrackerAPI';
3
4
  import { ParsingBlobError } from './errors/errors';
4
5
  import { ProxyClient } from './internal/ProxyClient';
6
+ import { cameraListSchema } from './types/GenetecAgent';
5
7
  const BASE_PATH = '/local/planetracker';
6
8
  export class PlaneTrackerAPI {
7
9
  client;
@@ -10,13 +12,13 @@ export class PlaneTrackerAPI {
10
12
  this.client = client;
11
13
  this.apiUser = apiUser;
12
14
  }
13
- static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
15
+ static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
14
16
  getClient(proxyParams) {
15
17
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
16
18
  }
17
19
  async checkCameraTime(options) {
18
- const response = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
19
- return z.boolean().parse(response.state);
20
+ const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
21
+ return z.boolean().parse(res.state);
20
22
  }
21
23
  async resetPtzCalibration(options) {
22
24
  const agent = this.getClient(options?.proxyParams);
@@ -47,7 +49,8 @@ export class PlaneTrackerAPI {
47
49
  });
48
50
  }
49
51
  async fetchCameraSettings(options) {
50
- return await this._getJson(`${BASE_PATH}/package_camera_settings.cgi`, { action: 'get' }, options);
52
+ const res = await this._getJson(`${BASE_PATH}/package_camera_settings.cgi`, { action: 'get' }, options);
53
+ return cameraSettingsSchema.parse(res);
51
54
  }
52
55
  async setCameraSettings(settingsJsonString, options) {
53
56
  return await this._postJsonEncoded(`${BASE_PATH}/package_camera_settings.cgi`, settingsJsonString, {
@@ -55,7 +58,8 @@ export class PlaneTrackerAPI {
55
58
  }, options);
56
59
  }
57
60
  async fetchServerSettings(options) {
58
- return await this._getJson(`${BASE_PATH}/package_server_settings.cgi`, { action: 'get' }, options);
61
+ const res = await this._getJson(`${BASE_PATH}/package_server_settings.cgi`, { action: 'get' }, options);
62
+ return serverSettingsSchema.parse(res);
59
63
  }
60
64
  async exportAppSettings(dataType, options) {
61
65
  return await this._getBlob(`${BASE_PATH}/package_data.cgi`, { action: 'EXPORT', dataType }, options);
@@ -70,13 +74,15 @@ export class PlaneTrackerAPI {
70
74
  });
71
75
  }
72
76
  async fetchFlightInfo(icao, options) {
73
- return await this._getJson(`${BASE_PATH}/package/flightInfo.cgi`, { icao: encodeURIComponent(icao) }, options);
77
+ const res = await this._getJson(`${BASE_PATH}/package/flightInfo.cgi`, { icao }, options);
78
+ return flightInfoSchema.parse(res);
74
79
  }
75
80
  async getTrackingMode(options) {
76
- return await this._getJson(`${BASE_PATH}/package/getTrackingMode.cgi`, undefined, options);
81
+ const res = await this._getJson(`${BASE_PATH}/package/getTrackingMode.cgi`, undefined, options);
82
+ return trackingModeSchema.parse(res);
77
83
  }
78
- async setTrackingMode(modeJsonString, options) {
79
- return await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, modeJsonString, this.apiUser, options);
84
+ async setTrackingMode(mode, options) {
85
+ return await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, { mode }, this.apiUser, options);
80
86
  }
81
87
  async startTrackingPlane(icao, options) {
82
88
  const agent = this.getClient(options?.proxyParams);
@@ -95,31 +101,36 @@ export class PlaneTrackerAPI {
95
101
  });
96
102
  }
97
103
  async getPriorityList(options) {
98
- return await this._getJson(`${BASE_PATH}/package/getPriorityList.cgi`, undefined, options);
104
+ const res = await this._getJson(`${BASE_PATH}/package/getPriorityList.cgi`, undefined, options);
105
+ return priorityListSchema.parse(res);
99
106
  }
100
- async setPriorityList(priorityListJsonString, options) {
101
- return await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, priorityListJsonString, this.apiUser, options);
107
+ async setPriorityList(priorityList, options) {
108
+ return await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, { priorityList }, this.apiUser, options);
102
109
  }
103
110
  async getWhiteList(options) {
104
- return await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
111
+ const res = await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
112
+ return whiteListSchema.parse(res);
105
113
  }
106
- async setWhiteList(whiteListJsonString, options) {
107
- return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, whiteListJsonString, this.apiUser, options);
114
+ async setWhiteList(whiteList, options) {
115
+ return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
108
116
  }
109
117
  async getBlackList(options) {
110
- return await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
118
+ const res = await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
119
+ return blackListSchema.parse(res);
111
120
  }
112
- async setBlackList(blackListJsonString, options) {
113
- return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, blackListJsonString, this.apiUser, options);
121
+ async setBlackList(blackList, options) {
122
+ return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
114
123
  }
115
124
  async fetchMapInfo(options) {
116
- return await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
125
+ const res = await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
126
+ return mapInfoSchema.parse(res);
117
127
  }
118
128
  async getZones(options) {
119
- return await this._getJson(`${BASE_PATH}/package/getZones.cgi`, undefined, options);
129
+ const res = await this._getJson(`${BASE_PATH}/package/getZones.cgi`, undefined, options);
130
+ return zonesSchema.parse(res);
120
131
  }
121
- async setZones(zonesJsonString, options) {
122
- return await this._postJsonEncoded(`${BASE_PATH}/package/setZones.cgi`, zonesJsonString, this.apiUser, options);
132
+ async setZones(zones, options) {
133
+ return await this._postJsonEncoded(`${BASE_PATH}/package/setZones.cgi`, { zones }, this.apiUser, options);
123
134
  }
124
135
  async goToCoordinates(lat, lon, alt, options) {
125
136
  const agent = this.getClient(options?.proxyParams);
@@ -130,19 +141,25 @@ export class PlaneTrackerAPI {
130
141
  });
131
142
  }
132
143
  async checkGenetecConnection(params, options) {
133
- return await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
144
+ return await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, '', params, options);
134
145
  }
135
146
  async getGenetecCameraList(params, options) {
136
- const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, params, options);
137
- return await res.json();
147
+ const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, '', params, options);
148
+ return cameraListSchema.parse(res);
138
149
  }
139
- async _getJson(path, parameters, options) {
150
+ async _getJson(path, parameters, options, headers) {
140
151
  const agent = this.getClient(options?.proxyParams);
141
- const res = await agent.get({
142
- path,
143
- parameters,
144
- timeout: options?.timeout,
145
- });
152
+ const res = await agent.get({ path, parameters, timeout: options?.timeout, headers });
153
+ if (res.ok) {
154
+ return await res.json();
155
+ }
156
+ else {
157
+ throw new Error(await responseStringify(res));
158
+ }
159
+ }
160
+ async _post(path, data, parameters, options, headers) {
161
+ const agent = this.getClient(options?.proxyParams);
162
+ const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
146
163
  if (res.ok) {
147
164
  return await res.json();
148
165
  }
@@ -152,11 +169,7 @@ export class PlaneTrackerAPI {
152
169
  }
153
170
  async _getBlob(path, parameters, options) {
154
171
  const agent = this.getClient(options?.proxyParams);
155
- const res = await agent.get({
156
- path,
157
- parameters,
158
- timeout: options?.timeout,
159
- });
172
+ const res = await agent.get({ path, parameters, timeout: options?.timeout });
160
173
  if (res.ok) {
161
174
  return await this.parseBlobResponse(res);
162
175
  }
@@ -172,36 +185,12 @@ export class PlaneTrackerAPI {
172
185
  throw new ParsingBlobError(err);
173
186
  }
174
187
  }
175
- async _postJsonEncoded(path, data, parameters, options) {
176
- const agent = this.getClient(options?.proxyParams);
177
- const res = await agent.post({
178
- path,
179
- data,
180
- parameters,
181
- headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
182
- timeout: options?.timeout,
183
- });
184
- if (res.ok) {
185
- return res;
186
- }
187
- else {
188
- throw new Error(await responseStringify(res));
189
- }
188
+ async _postUrlEncoded(path, data, parameters, options, headers) {
189
+ const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
190
+ return this._post(path, data, parameters, options, { ...baseHeaders, ...headers });
190
191
  }
191
- async _postUrlEncoded(path, params, options) {
192
- const data = paramToUrl(params);
193
- const agent = this.getClient(options?.proxyParams);
194
- const res = await agent.post({
195
- path,
196
- data,
197
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
198
- timeout: options?.timeout,
199
- });
200
- if (res.ok) {
201
- return res;
202
- }
203
- else {
204
- throw new Error(await responseStringify(res));
205
- }
192
+ async _postJsonEncoded(path, data, parameters, options, headers) {
193
+ const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
194
+ return this._post(path, data, parameters, options, { ...baseHeaders, ...headers });
206
195
  }
207
196
  }
package/esm/VapixAPI.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { arrayToUrl, isNullish, paramToUrl, responseStringify } from './internal/utils';
2
- import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, getPortsResponseSchema, } from './types/VapixAPI';
2
+ import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, getPortsResponseSchema, guardTourSchema, ptzOverviewSchema, cameraPTZItemDataSchema, applicationListSchema, sdCardInfoSchema, } from './types/VapixAPI';
3
3
  import { ApplicationAPIError, MaxFPSError, NoDeviceInfoError, PtzNotSupportedError, SDCardActionError, SDCardJobError, } from './errors/errors';
4
4
  import { ProxyClient } from './internal/ProxyClient';
5
5
  import { z } from 'zod';
@@ -107,11 +107,11 @@ export class VapixAPI {
107
107
  });
108
108
  const result = parser.parse(xmlText);
109
109
  const data = result.root.disks.disk;
110
- return {
110
+ return sdCardInfoSchema.parse({
111
111
  totalSize: parseInt(data.totalsize),
112
112
  freeSize: parseInt(data.freesize),
113
113
  status: sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
114
- };
114
+ });
115
115
  }
116
116
  mountSDCard(options) {
117
117
  return this._doSDCardMountAction('MOUNT', options);
@@ -180,7 +180,7 @@ export class VapixAPI {
180
180
  if (isNullish(captureMode.maxFPS)) {
181
181
  throw new MaxFPSError('FPS_NOT_SPECIFIED');
182
182
  }
183
- return captureMode.maxFPS;
183
+ return z.number().parse(captureMode.maxFPS);
184
184
  }
185
185
  async getTimezone(options) {
186
186
  try {
@@ -204,7 +204,7 @@ export class VapixAPI {
204
204
  if (data.data.timeZone === undefined) {
205
205
  throw new Error('Time zone not setup on the device');
206
206
  }
207
- return data.data.timeZone;
207
+ return z.string().parse(data.data.timeZone);
208
208
  }
209
209
  async getDateTimeInfo(options) {
210
210
  const data = { apiVersion: '1.0', method: 'getDateTimeInfo' };
@@ -259,7 +259,7 @@ export class VapixAPI {
259
259
  const gTourList = new Array();
260
260
  const response = await this.getParameter('GuardTour', options);
261
261
  for (let i = 0; i < 20; i++) {
262
- const gTourBaseName = 'root.GuardTour.G' + i;
262
+ const gTourBaseName = 'GuardTour.G' + i;
263
263
  if (gTourBaseName + '.CamNbr' in response) {
264
264
  const gTour = {
265
265
  id: gTourBaseName,
@@ -271,7 +271,7 @@ export class VapixAPI {
271
271
  tour: [],
272
272
  };
273
273
  for (let j = 0; j < 100; j++) {
274
- const tourBaseName = 'root.GuardTour.G' + i + '.Tour.T' + j;
274
+ const tourBaseName = 'GuardTour.G' + i + '.Tour.T' + j;
275
275
  if (tourBaseName + '.MoveSpeed' in response) {
276
276
  const tour = {
277
277
  moveSpeed: response[tourBaseName + '.MoveSpeed'],
@@ -289,17 +289,17 @@ export class VapixAPI {
289
289
  break;
290
290
  }
291
291
  }
292
- return gTourList;
292
+ return guardTourSchema.parse(gTourList);
293
293
  }
294
- setGuardTourEnabled(guardTourID, enable, options) {
294
+ setGuardTourEnabled(guardTourId, enable, options) {
295
295
  const params = {};
296
- params[guardTourID + '.Running'] = enable ? 'yes' : 'no';
296
+ params[guardTourId + '.Running'] = enable ? 'yes' : 'no';
297
297
  return this.setParameter(params, options);
298
298
  }
299
299
  async getPTZPresetList(channel, options) {
300
300
  const res = await this.postUrlEncoded('/axis-cgi/com/ptz.cgi', {
301
301
  query: 'presetposcam',
302
- camera: channel.toString(),
302
+ camera: channel,
303
303
  }, undefined, options);
304
304
  const text = await res.text();
305
305
  const lines = text.split(/[\r\n]/);
@@ -313,7 +313,7 @@ export class VapixAPI {
313
313
  }
314
314
  }
315
315
  }
316
- return positions;
316
+ return z.array(z.string()).parse(positions);
317
317
  }
318
318
  async listPTZ(camera, options) {
319
319
  const url = `/axis-cgi/com/ptz.cgi`;
@@ -347,7 +347,7 @@ export class VapixAPI {
347
347
  res[camera - 1] = item.map(({ data: itemData, ...d }) => d);
348
348
  }
349
349
  });
350
- return res;
350
+ return ptzOverviewSchema.parse(res);
351
351
  }
352
352
  goToPreset(channel, presetName, options) {
353
353
  return this.postUrlEncoded('/axis-cgi/com/ptz.cgi', {
@@ -361,11 +361,11 @@ export class VapixAPI {
361
361
  camera: camera.toString(),
362
362
  }, undefined, options);
363
363
  const params = VapixAPI.parseParameters(await res.text());
364
- return {
364
+ return cameraPTZItemDataSchema.parse({
365
365
  pan: Number(params.pan),
366
366
  tilt: Number(params.tilt),
367
367
  zoom: Number(params.zoom),
368
- };
368
+ });
369
369
  }
370
370
  async getPorts(options) {
371
371
  const res = await this.postJson('/axis-cgi/io/portmanagement.cgi', {
@@ -373,7 +373,7 @@ export class VapixAPI {
373
373
  context: '',
374
374
  method: 'getPorts',
375
375
  }, undefined, options);
376
- const portResponseParsed = await getPortsResponseSchema.parse(res.json());
376
+ const portResponseParsed = getPortsResponseSchema.parse(await res.json());
377
377
  return portResponseParsed.data.items;
378
378
  }
379
379
  async setPorts(ports, options) {
@@ -406,19 +406,20 @@ export class VapixAPI {
406
406
  if (!Array.isArray(apps)) {
407
407
  apps = [apps];
408
408
  }
409
- return apps.map((app) => {
409
+ const appList = apps.map((app) => {
410
410
  return {
411
411
  ...app,
412
412
  appId: APP_IDS.find((id) => id.toLowerCase() === app.Name.toLowerCase()) ?? null,
413
413
  };
414
414
  });
415
+ return applicationListSchema.parse(appList);
415
416
  }
416
- async startApplication(applicationID, options) {
417
+ async startApplication(applicationId, options) {
417
418
  const agent = this.getClient(options?.proxyParams);
418
419
  const res = await agent.get({
419
420
  path: '/axis-cgi/applications/control.cgi',
420
421
  parameters: {
421
- package: applicationID.toLowerCase(),
422
+ package: applicationId.toLowerCase(),
422
423
  action: 'start',
423
424
  },
424
425
  timeout: options?.timeout,
@@ -428,12 +429,12 @@ export class VapixAPI {
428
429
  throw new ApplicationAPIError('START', await responseStringify(res));
429
430
  }
430
431
  }
431
- async restartApplication(applicationID, options) {
432
+ async restartApplication(applicationId, options) {
432
433
  const agent = this.getClient(options?.proxyParams);
433
434
  const res = await agent.get({
434
435
  path: '/axis-cgi/applications/control.cgi',
435
436
  parameters: {
436
- package: applicationID.toLowerCase(),
437
+ package: applicationId.toLowerCase(),
437
438
  action: 'restart',
438
439
  },
439
440
  timeout: options?.timeout,
@@ -443,12 +444,12 @@ export class VapixAPI {
443
444
  throw new ApplicationAPIError('RESTART', await responseStringify(res));
444
445
  }
445
446
  }
446
- async stopApplication(applicationID, options) {
447
+ async stopApplication(applicationId, options) {
447
448
  const agent = this.getClient(options?.proxyParams);
448
449
  const res = await agent.get({
449
450
  path: '/axis-cgi/applications/control.cgi',
450
451
  parameters: {
451
- package: applicationID.toLowerCase(),
452
+ package: applicationId.toLowerCase(),
452
453
  action: 'stop',
453
454
  },
454
455
  timeout: options?.timeout,
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from 'events';
2
- import { WsClient } from './node/WsClient';
2
+ import { WsClient } from './WsClient';
3
3
  export class CamOverlayDrawingAPI extends EventEmitter {
4
4
  tls;
5
5
  tlsInsecure;
@@ -1,17 +1,7 @@
1
1
  import { CamOverlayDrawingAPI } from '../CamOverlayDrawingAPI';
2
2
  import { ResourceManager } from './ResourceManager';
3
3
  import { Frame } from './Frame';
4
- export const COORD = {
5
- top_left: [-1, -1],
6
- center_left: [-1, 0],
7
- bottom_left: [-1, 1],
8
- top_center: [0, -1],
9
- center: [0, 0],
10
- bottom_center: [0, 1],
11
- top_right: [1, -1],
12
- center_right: [1, 0],
13
- bottom_right: [1, 1],
14
- };
4
+ import { COORD } from '../../types/CamOverlayPainter';
15
5
  export class Painter extends Frame {
16
6
  screenWidth;
17
7
  screenHeight;
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from 'events';
2
- import { WsClient } from './node/WsClient';
2
+ import { WsClient } from './WsClient';
3
3
  export class CamScripterAPICameraEventsGenerator extends EventEmitter {
4
4
  tls;
5
5
  tlsInsecure;
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter2 as EventEmitter } from 'eventemitter2';
2
- import { WsClient } from './node/WsClient';
2
+ import { WsClient } from './WsClient';
3
3
  export class VapixEvents extends EventEmitter {
4
4
  tls;
5
5
  tlsInsecure;
@@ -1,27 +1,5 @@
1
- import { z } from 'zod';
2
1
  import { responseStringify, pad } from '../../internal/utils';
3
- const successResponseSchema = z.object({
4
- Rsp: z.object({
5
- Status: z.literal('Ok'),
6
- }),
7
- });
8
- const cameraGuidsResponseSchema = z.object({
9
- Rsp: z.object({
10
- Status: z.literal('Ok'),
11
- Result: z.array(z.object({ Guid: z.string() })),
12
- }),
13
- });
14
- const cameraDetailSchema = z.object({
15
- Guid: z.string().optional(),
16
- Name: z.string().optional(),
17
- EntityType: z.string().optional(),
18
- });
19
- const cameraDetailsResponseSchema = z.object({
20
- Rsp: z.object({
21
- Status: z.literal('Ok'),
22
- Result: z.union([z.array(cameraDetailSchema), cameraDetailSchema]),
23
- }),
24
- });
2
+ import { cameraDetailsResponseSchema, cameraGuidsResponseSchema, successResponseSchema, } from '../../types/GenetecAgent';
25
3
  export class GenetecAgent {
26
4
  settings;
27
5
  baseUrl;
package/esm/node/index.js CHANGED
@@ -3,3 +3,13 @@ export * from './WsClient';
3
3
  export * from './HttpServer';
4
4
  export * from './events/AxisCameraStationEvents';
5
5
  export * from './events/GenetecAgent';
6
+ export { ResourceManager } from './CamOverlayPainter/ResourceManager';
7
+ export { Painter } from './CamOverlayPainter/Painter';
8
+ export { Frame } from './CamOverlayPainter/Frame';
9
+ export * from '../types/CamOverlayPainter';
10
+ export { CamOverlayDrawingAPI } from './CamOverlayDrawingAPI';
11
+ export * from '../types/CamOverlayDrawingAPI';
12
+ export { CamScripterAPICameraEventsGenerator } from './CamScripterAPICameraEventsGenerator';
13
+ export * from '../types/CamScripterAPICameraEventsGenerator';
14
+ export { VapixEvents } from './VapixEvents';
15
+ export * from '../types/VapixEvents';
@@ -9,7 +9,7 @@ import { customGraphicsSchema } from './customGraphicsSchema';
9
9
  import { screenSharingSchema } from './screenSharingSchema';
10
10
  import { webCameraSharingSchema } from './webCameraSharingSchema';
11
11
  import { baseballScoreBoardAutomaticSchema, baseballScoreBoardSchema, scoreBoardSchema, scoreOverviewSchema, } from './scoreBoardSchema';
12
- export const WSResponseSchema = z.object({
12
+ export const wsResponseSchema = z.object({
13
13
  status: z.number(),
14
14
  message: z.string(),
15
15
  });
@@ -1,6 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { coordinateSystemSchema, serviceNames } from './serviceCommonTypes';
3
- export const sportFontSchema = z.union([z.literal('classic'), z.intersection(z.string(), z.object({}))]);
3
+ export const sportFontSchema = z.union([
4
+ z.literal('classic'),
5
+ z.custom((val) => {
6
+ return typeof val === 'string';
7
+ }),
8
+ ]);
4
9
  export const scoreBoardSchema = z.object({
5
10
  id: z.number().nonnegative(),
6
11
  enabled: z.union([z.literal(0), z.literal(1)]),
@@ -1 +1,11 @@
1
- export {};
1
+ export const COORD = {
2
+ top_left: [-1, -1],
3
+ center_left: [-1, 0],
4
+ bottom_left: [-1, 1],
5
+ top_center: [0, -1],
6
+ center: [0, 0],
7
+ bottom_center: [0, 1],
8
+ top_right: [1, -1],
9
+ center_right: [1, 0],
10
+ bottom_right: [1, 1],
11
+ };
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { toCamelCase, toCamelCaseDeep } from '../internal/transformers';
3
- import { storageTypeSchema, keyboardShortcutsSchema, h264ProfileSchema, audioChannelCountSchema, } from './common';
3
+ import { storageTypeSchema, keyboardShortcutsSchema, h264ProfileSchema, audioChannelCountSchema, keyboardShortcutSchema, } from './common';
4
4
  const channelTypeSchema = z.union([z.literal('audio'), z.literal('video'), z.literal('av')]);
5
5
  const playlistPlayTypeSchema = z.union([
6
6
  z.literal('PLAY_ALL'),
@@ -132,3 +132,40 @@ export const clipListSchema = z.object({
132
132
  ])),
133
133
  })),
134
134
  });
135
+ export const bitrateModeSchema = z.union([z.literal('VBR'), z.literal('MBR'), z.literal('ABR')]);
136
+ export const bitrateVapixParamsSchema = z.object({
137
+ bitrateMode: bitrateModeSchema,
138
+ maximumBitRate: z.number(),
139
+ retentionTime: z.number(),
140
+ bitRateLimit: z.number(),
141
+ });
142
+ export const cameraOptionsSchema = bitrateVapixParamsSchema
143
+ .extend({
144
+ resolution: z.string(),
145
+ h264Profile: h264ProfileSchema,
146
+ fps: z.number(),
147
+ compression: z.number().min(0).max(100),
148
+ govLength: z.number(),
149
+ bitrateVapixParams: z.string().nullable(),
150
+ audioSampleRate: z.number(),
151
+ audioChannelCount: audioChannelCountSchema,
152
+ keyboard: z.object({
153
+ fromSource: keyboardShortcutSchema,
154
+ none: keyboardShortcutSchema,
155
+ }),
156
+ })
157
+ .partial();
158
+ export const globalAudioSettingsTypeSchema = z.union([z.literal('fromSource'), z.literal('source')]);
159
+ export const globalAudioSettingsSchema = z.object({
160
+ type: globalAudioSettingsTypeSchema,
161
+ source: z.string(),
162
+ storage: z.string().optional(),
163
+ });
164
+ export const secondaryAudioSettingsSchema = z.object({
165
+ type: z.union([z.literal('CLIP'), z.literal('STREAM'), z.literal('NONE')]),
166
+ streamName: z.string().optional(),
167
+ clipName: z.string().optional(),
168
+ storage: storageTypeSchema,
169
+ secondaryAudioLevel: z.number(),
170
+ masterAudioLevel: z.number(),
171
+ });
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export const successResponseSchema = z.object({
3
+ Rsp: z.object({
4
+ Status: z.literal('Ok'),
5
+ }),
6
+ });
7
+ export const cameraGuidsResponseSchema = z.object({
8
+ Rsp: z.object({
9
+ Status: z.literal('Ok'),
10
+ Result: z.array(z.object({ Guid: z.string() })),
11
+ }),
12
+ });
13
+ export const cameraDetailSchema = z.object({
14
+ Guid: z.string().optional(),
15
+ Name: z.string().optional(),
16
+ EntityType: z.string().optional(),
17
+ });
18
+ export const cameraDetailsResponseSchema = z.object({
19
+ Rsp: z.object({
20
+ Status: z.literal('Ok'),
21
+ Result: z.union([z.array(cameraDetailSchema), cameraDetailSchema]),
22
+ }),
23
+ });
24
+ export const cameraListSchema = z.array(z.object({
25
+ index: z.number(),
26
+ value: z.string(),
27
+ label: z.string(),
28
+ }));