camstreamerlib 4.0.0-beta.30 → 4.0.0-beta.32

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 (91) hide show
  1. package/cjs/CamOverlayAPI.d.ts +4 -15
  2. package/cjs/CamOverlayAPI.js +10 -21
  3. package/cjs/CamScripterAPI.d.ts +3 -2
  4. package/cjs/CamScripterAPI.js +5 -5
  5. package/cjs/CamStreamerAPI.d.ts +3 -2
  6. package/cjs/CamStreamerAPI.js +4 -4
  7. package/cjs/CamSwitcherAPI.d.ts +3 -2
  8. package/cjs/CamSwitcherAPI.js +7 -7
  9. package/cjs/PlaneTrackerAPI.d.ts +3 -2
  10. package/cjs/PlaneTrackerAPI.js +15 -15
  11. package/cjs/VapixAPI.d.ts +3 -2
  12. package/cjs/VapixAPI.js +13 -13
  13. package/cjs/events/AxisCameraStationEvents.d.ts +4 -2
  14. package/cjs/events/AxisCameraStationEvents.js +4 -4
  15. package/cjs/index.d.ts +0 -1
  16. package/cjs/index.js +0 -1
  17. package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +708 -521
  18. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +35 -82
  19. package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +7 -37
  20. package/cjs/types/CamOverlayAPI/accuweatherSchema.js +8 -11
  21. package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +63 -146
  22. package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +6 -9
  23. package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +8 -35
  24. package/cjs/types/CamOverlayAPI/imagesSchema.js +5 -8
  25. package/cjs/types/CamOverlayAPI/index.d.ts +2 -0
  26. package/cjs/types/CamOverlayAPI/index.js +2 -0
  27. package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +9 -43
  28. package/cjs/types/CamOverlayAPI/infotickerSchema.js +7 -10
  29. package/cjs/types/CamOverlayAPI/pipSchema.d.ts +5 -46
  30. package/cjs/types/CamOverlayAPI/pipSchema.js +5 -8
  31. package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +7 -40
  32. package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +5 -8
  33. package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +10 -38
  34. package/cjs/types/CamOverlayAPI/ptzSchema.js +5 -8
  35. package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +3 -24
  36. package/cjs/types/CamOverlayAPI/screenSharingSchema.js +4 -7
  37. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +3 -24
  38. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +4 -7
  39. package/cjs/types/CamOverlayAPI/widgetCommonTypes.d.ts +141 -0
  40. package/cjs/types/CamOverlayAPI/widgetCommonTypes.js +87 -0
  41. package/cjs/types/CamStreamerAPI.d.ts +4 -4
  42. package/cjs/types/CamSwitcherAPI.d.ts +0 -2
  43. package/cjs/types/VapixAPI.d.ts +0 -2
  44. package/esm/CamOverlayAPI.d.ts +4 -15
  45. package/esm/CamOverlayAPI.js +9 -20
  46. package/esm/CamScripterAPI.d.ts +3 -2
  47. package/esm/CamScripterAPI.js +5 -5
  48. package/esm/CamStreamerAPI.d.ts +3 -2
  49. package/esm/CamStreamerAPI.js +4 -4
  50. package/esm/CamSwitcherAPI.d.ts +3 -2
  51. package/esm/CamSwitcherAPI.js +7 -7
  52. package/esm/PlaneTrackerAPI.d.ts +3 -2
  53. package/esm/PlaneTrackerAPI.js +15 -15
  54. package/esm/VapixAPI.d.ts +3 -2
  55. package/esm/VapixAPI.js +13 -13
  56. package/esm/events/AxisCameraStationEvents.d.ts +4 -2
  57. package/esm/events/AxisCameraStationEvents.js +4 -4
  58. package/esm/index.d.ts +0 -1
  59. package/esm/index.js +0 -1
  60. package/esm/types/CamOverlayAPI/CamOverlayAPI.d.ts +708 -521
  61. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +17 -73
  62. package/esm/types/CamOverlayAPI/accuweatherSchema.d.ts +7 -37
  63. package/esm/types/CamOverlayAPI/accuweatherSchema.js +1 -3
  64. package/esm/types/CamOverlayAPI/customGraphicsSchema.d.ts +63 -146
  65. package/esm/types/CamOverlayAPI/customGraphicsSchema.js +1 -3
  66. package/esm/types/CamOverlayAPI/imagesSchema.d.ts +8 -35
  67. package/esm/types/CamOverlayAPI/imagesSchema.js +1 -3
  68. package/esm/types/CamOverlayAPI/index.d.ts +2 -0
  69. package/esm/types/CamOverlayAPI/index.js +2 -0
  70. package/esm/types/CamOverlayAPI/infotickerSchema.d.ts +9 -43
  71. package/esm/types/CamOverlayAPI/infotickerSchema.js +1 -3
  72. package/esm/types/CamOverlayAPI/pipSchema.d.ts +5 -46
  73. package/esm/types/CamOverlayAPI/pipSchema.js +1 -3
  74. package/esm/types/CamOverlayAPI/ptzCompassSchema.d.ts +7 -40
  75. package/esm/types/CamOverlayAPI/ptzCompassSchema.js +1 -3
  76. package/esm/types/CamOverlayAPI/ptzSchema.d.ts +10 -38
  77. package/esm/types/CamOverlayAPI/ptzSchema.js +1 -3
  78. package/esm/types/CamOverlayAPI/screenSharingSchema.d.ts +3 -24
  79. package/esm/types/CamOverlayAPI/screenSharingSchema.js +1 -3
  80. package/esm/types/CamOverlayAPI/webCameraSharingSchema.d.ts +3 -24
  81. package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +1 -3
  82. package/esm/types/CamOverlayAPI/widgetCommonTypes.d.ts +141 -0
  83. package/esm/types/CamOverlayAPI/widgetCommonTypes.js +84 -0
  84. package/esm/types/CamStreamerAPI.d.ts +4 -4
  85. package/esm/types/CamSwitcherAPI.d.ts +0 -2
  86. package/esm/types/VapixAPI.d.ts +0 -2
  87. package/package.json +2 -2
  88. package/cjs/node/WsEventClient.d.ts +0 -13
  89. package/cjs/node/WsEventClient.js +0 -22
  90. package/esm/node/WsEventClient.d.ts +0 -13
  91. package/esm/node/WsEventClient.js +0 -18
@@ -11,12 +11,15 @@ export class PlaneTrackerAPI {
11
11
  this.apiUser = apiUser;
12
12
  }
13
13
  static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
14
+ getClient(proxyParams) {
15
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
16
+ }
14
17
  async checkCameraTime(options) {
15
18
  const response = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
16
19
  return z.boolean().parse(response.state);
17
20
  }
18
21
  resetPtzCalibration = async (options) => {
19
- const agent = this.getAgent(options?.proxyParams);
22
+ const agent = this.getClient(options?.proxyParams);
20
23
  return await agent.get({
21
24
  path: `${BASE_PATH}/package/resetPtzCalibration.cgi`,
22
25
  parameters: this.apiUser,
@@ -24,7 +27,7 @@ export class PlaneTrackerAPI {
24
27
  });
25
28
  };
26
29
  resetFocusCalibration = async (options) => {
27
- const agent = this.getAgent(options?.proxyParams);
30
+ const agent = this.getClient(options?.proxyParams);
28
31
  return await agent.get({
29
32
  path: `${BASE_PATH}/package/resetFocusCalibration.cgi`,
30
33
  parameters: this.apiUser,
@@ -32,11 +35,11 @@ export class PlaneTrackerAPI {
32
35
  });
33
36
  };
34
37
  serverRunCheck = async (options) => {
35
- const agent = this.getAgent(options?.proxyParams);
38
+ const agent = this.getClient(options?.proxyParams);
36
39
  return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
37
40
  };
38
41
  getLiveViewAlias = async (rtspUrl, options) => {
39
- const agent = this.getAgent(options?.proxyParams);
42
+ const agent = this.getClient(options?.proxyParams);
40
43
  return await agent.get({
41
44
  path: `${BASE_PATH}/getLiveViewAlias.cgi`,
42
45
  parameters: { rtsp_url: rtspUrl },
@@ -58,7 +61,7 @@ export class PlaneTrackerAPI {
58
61
  return await this._getBlob(`${BASE_PATH}/package_data.cgi`, { action: 'EXPORT', dataType }, options);
59
62
  };
60
63
  importAppSettings = async (dataType, formData, options) => {
61
- const agent = this.getAgent(options?.proxyParams);
64
+ const agent = this.getClient(options?.proxyParams);
62
65
  return await agent.post({
63
66
  path: `${BASE_PATH}/package_data.cgi`,
64
67
  data: formData,
@@ -76,7 +79,7 @@ export class PlaneTrackerAPI {
76
79
  return await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, modeJsonString, this.apiUser, options);
77
80
  };
78
81
  startTrackingPlane = async (icao, options) => {
79
- const agent = this.getAgent(options?.proxyParams);
82
+ const agent = this.getClient(options?.proxyParams);
80
83
  return await agent.get({
81
84
  path: `${BASE_PATH}/package/trackIcao.cgi`,
82
85
  parameters: { icao, ...this.apiUser },
@@ -84,7 +87,7 @@ export class PlaneTrackerAPI {
84
87
  });
85
88
  };
86
89
  stopTrackingPlane = async (options) => {
87
- const agent = this.getAgent(options?.proxyParams);
90
+ const agent = this.getClient(options?.proxyParams);
88
91
  return await agent.get({
89
92
  path: `${BASE_PATH}/package/resetIcao.cgi`,
90
93
  parameters: this.apiUser,
@@ -119,7 +122,7 @@ export class PlaneTrackerAPI {
119
122
  return await this._postJsonEncoded(`${BASE_PATH}/package/setZones.cgi`, zonesJsonString, this.apiUser, options);
120
123
  };
121
124
  goToCoordinates = async (lat, lon, alt, options) => {
122
- const agent = this.getAgent(options?.proxyParams);
125
+ const agent = this.getClient(options?.proxyParams);
123
126
  return await agent.get({
124
127
  path: `${BASE_PATH}/package/goToCoordinates.cgi`,
125
128
  parameters: { lat, lon, alt, ...this.apiUser },
@@ -134,7 +137,7 @@ export class PlaneTrackerAPI {
134
137
  return await res.json();
135
138
  };
136
139
  async _getJson(path, parameters, options) {
137
- const agent = this.getAgent(options?.proxyParams);
140
+ const agent = this.getClient(options?.proxyParams);
138
141
  const res = await agent.get({
139
142
  path,
140
143
  parameters,
@@ -148,7 +151,7 @@ export class PlaneTrackerAPI {
148
151
  }
149
152
  }
150
153
  async _getBlob(path, parameters, options) {
151
- const agent = this.getAgent(options?.proxyParams);
154
+ const agent = this.getClient(options?.proxyParams);
152
155
  const res = await agent.get({
153
156
  path,
154
157
  parameters,
@@ -170,7 +173,7 @@ export class PlaneTrackerAPI {
170
173
  }
171
174
  }
172
175
  async _postJsonEncoded(path, data, parameters, options) {
173
- const agent = this.getAgent(options?.proxyParams);
176
+ const agent = this.getClient(options?.proxyParams);
174
177
  const res = await agent.post({
175
178
  path,
176
179
  data,
@@ -187,7 +190,7 @@ export class PlaneTrackerAPI {
187
190
  }
188
191
  async _postUrlEncoded(path, params, options) {
189
192
  const data = paramToUrl(params);
190
- const agent = this.getAgent(options?.proxyParams);
193
+ const agent = this.getClient(options?.proxyParams);
191
194
  const res = await agent.post({
192
195
  path,
193
196
  data,
@@ -201,7 +204,4 @@ export class PlaneTrackerAPI {
201
204
  throw new Error(await responseStringify(res));
202
205
  }
203
206
  }
204
- getAgent(proxyParams) {
205
- return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
206
- }
207
207
  }
package/esm/VapixAPI.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { IClient, TParameters, TResponse } from './internal/types';
2
2
  import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
3
- import { TCameraImageConfig, THttpRequestOptions } from './types/common';
3
+ import { ProxyClient } from './internal/ProxyClient';
4
+ import { TCameraImageConfig, THttpRequestOptions, TProxyParams } from './types/common';
4
5
  export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
5
6
  private client;
6
7
  constructor(client: Client);
8
+ getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
7
9
  postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
8
10
  postJson(path: string, jsonData: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
9
11
  getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<TResponse>;
@@ -75,5 +77,4 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
75
77
  private static parseParameters;
76
78
  private static parseCameraPtzResponse;
77
79
  private static parsePtz;
78
- private getAgent;
79
80
  }
package/esm/VapixAPI.js CHANGED
@@ -10,10 +10,13 @@ export class VapixAPI {
10
10
  constructor(client) {
11
11
  this.client = client;
12
12
  }
13
+ getClient(proxyParams) {
14
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
15
+ }
13
16
  async postUrlEncoded(path, parameters, headers, options) {
14
17
  const data = paramToUrl(parameters);
15
18
  const head = { ...headers, 'Content-Type': 'application/x-www-form-urlencoded' };
16
- const agent = this.getAgent(options?.proxyParams);
19
+ const agent = this.getClient(options?.proxyParams);
17
20
  const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
18
21
  if (!res.ok) {
19
22
  throw new Error(await responseStringify(res));
@@ -23,7 +26,7 @@ export class VapixAPI {
23
26
  async postJson(path, jsonData, headers, options) {
24
27
  const data = JSON.stringify(jsonData);
25
28
  const head = { ...headers, 'Content-Type': 'application/json' };
26
- const agent = this.getAgent(options?.proxyParams);
29
+ const agent = this.getClient(options?.proxyParams);
27
30
  const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
28
31
  if (!res.ok) {
29
32
  throw new Error(await responseStringify(res));
@@ -31,7 +34,7 @@ export class VapixAPI {
31
34
  return res;
32
35
  }
33
36
  async getCameraImage(parameters, options) {
34
- const agent = this.getAgent(options?.proxyParams);
37
+ const agent = this.getClient(options?.proxyParams);
35
38
  return await agent.get({ path: '/axis-cgi/jpg/image.cgi', parameters, timeout: options?.timeout });
36
39
  }
37
40
  async getEventDeclarations(options) {
@@ -41,7 +44,7 @@ export class VapixAPI {
41
44
  '<GetEventInstances xmlns="http://www.axis.com/vapix/ws/event1"/>' +
42
45
  '</s:Body>' +
43
46
  '</s:Envelope>';
44
- const agent = this.getAgent(options?.proxyParams);
47
+ const agent = this.getClient(options?.proxyParams);
45
48
  const res = await agent.post({
46
49
  path: '/vapix/services',
47
50
  data,
@@ -177,7 +180,7 @@ export class VapixAPI {
177
180
  }
178
181
  async getTimezone(options) {
179
182
  try {
180
- const agent = this.getAgent(options?.proxyParams);
183
+ const agent = this.getClient(options?.proxyParams);
181
184
  const resV2 = await agent.get({ path: '/config/rest/time/v2/timeZone', timeout: options?.timeout });
182
185
  if (!resV2.ok) {
183
186
  throw new Error(await responseStringify(resV2));
@@ -386,7 +389,7 @@ export class VapixAPI {
386
389
  }, undefined, options);
387
390
  }
388
391
  async getApplicationList(options) {
389
- const agent = this.getAgent(options?.proxyParams);
392
+ const agent = this.getClient(options?.proxyParams);
390
393
  const res = await agent.get({ path: '/axis-cgi/applications/list.cgi', timeout: options?.timeout });
391
394
  const xml = await res.text();
392
395
  const parser = new XMLParser({
@@ -407,7 +410,7 @@ export class VapixAPI {
407
410
  });
408
411
  }
409
412
  async startApplication(applicationID, options) {
410
- const agent = this.getAgent(options?.proxyParams);
413
+ const agent = this.getClient(options?.proxyParams);
411
414
  const res = await agent.get({
412
415
  path: '/axis-cgi/applications/control.cgi',
413
416
  parameters: {
@@ -422,7 +425,7 @@ export class VapixAPI {
422
425
  }
423
426
  }
424
427
  async restartApplication(applicationID, options) {
425
- const agent = this.getAgent(options?.proxyParams);
428
+ const agent = this.getClient(options?.proxyParams);
426
429
  const res = await agent.get({
427
430
  path: '/axis-cgi/applications/control.cgi',
428
431
  parameters: {
@@ -437,7 +440,7 @@ export class VapixAPI {
437
440
  }
438
441
  }
439
442
  async stopApplication(applicationID, options) {
440
- const agent = this.getAgent(options?.proxyParams);
443
+ const agent = this.getClient(options?.proxyParams);
441
444
  const res = await agent.get({
442
445
  path: '/axis-cgi/applications/control.cgi',
443
446
  parameters: {
@@ -454,7 +457,7 @@ export class VapixAPI {
454
457
  async installApplication(data, fileName, options) {
455
458
  const formData = new FormData();
456
459
  formData.append('packfil', data, fileName);
457
- const agent = this.getAgent(options?.proxyParams);
460
+ const agent = this.getClient(options?.proxyParams);
458
461
  const res = await agent.post({
459
462
  path: '/axis-cgi/applications/upload.cgi',
460
463
  data: formData,
@@ -537,7 +540,4 @@ export class VapixAPI {
537
540
  });
538
541
  return res;
539
542
  };
540
- getAgent(proxyParams) {
541
- return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
542
- }
543
543
  }
@@ -1,10 +1,12 @@
1
1
  import { HttpOptions } from '../internal/types';
2
- import { THttpRequestOptions } from '../types/common';
2
+ import { THttpRequestOptions, TProxyParams } from '../types/common';
3
+ import { ProxyClient } from '../internal/ProxyClient';
4
+ import { DefaultClient } from '../node';
3
5
  export declare class AxisCameraStationEvents {
4
6
  private sourceKey;
5
7
  private client;
6
8
  constructor(clientOptions: HttpOptions, sourceKey: string);
9
+ getClient(proxyParams?: TProxyParams): DefaultClient | ProxyClient<DefaultClient>;
7
10
  sendEvent(data: Record<string, string>, eventType: string, options?: THttpRequestOptions): Promise<void>;
8
11
  private getDate;
9
- private getAgent;
10
12
  }
@@ -8,6 +8,9 @@ export class AxisCameraStationEvents {
8
8
  this.sourceKey = sourceKey;
9
9
  this.client = new DefaultClient(clientOptions);
10
10
  }
11
+ getClient(proxyParams) {
12
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
13
+ }
11
14
  async sendEvent(data, eventType, options) {
12
15
  const dateString = this.getDate();
13
16
  const event = {
@@ -19,7 +22,7 @@ export class AxisCameraStationEvents {
19
22
  },
20
23
  };
21
24
  const eventData = JSON.stringify(event);
22
- const agent = this.getAgent(options?.proxyParams);
25
+ const agent = this.getClient(options?.proxyParams);
23
26
  const res = await agent.post({
24
27
  path: '/Acs/Api/ExternalDataFacade/AddExternalData',
25
28
  data: eventData,
@@ -43,7 +46,4 @@ export class AxisCameraStationEvents {
43
46
  const seconds = pad(date.getUTCSeconds(), 2);
44
47
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
45
48
  }
46
- getAgent(proxyParams) {
47
- return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
48
- }
49
49
  }
package/esm/index.d.ts CHANGED
@@ -14,7 +14,6 @@ export * from './types/CamSwitcherEvents';
14
14
  export * from './types/CamSwitcherAPI';
15
15
  export * from './types/VapixAPI';
16
16
  export * from './types/CamOverlayAPI';
17
- export * from './types/CamOverlayAPI/CamOverlayAPI';
18
17
  export * from './types/PlaneTrackerAPI';
19
18
  export { Frame } from './CamOverlayPainter/Frame';
20
19
  export { Painter } from './CamOverlayPainter/Painter';
package/esm/index.js CHANGED
@@ -14,7 +14,6 @@ export * from './types/CamSwitcherEvents';
14
14
  export * from './types/CamSwitcherAPI';
15
15
  export * from './types/VapixAPI';
16
16
  export * from './types/CamOverlayAPI';
17
- export * from './types/CamOverlayAPI/CamOverlayAPI';
18
17
  export * from './types/PlaneTrackerAPI';
19
18
  export { Frame } from './CamOverlayPainter/Frame';
20
19
  export { Painter } from './CamOverlayPainter/Painter';