camstreamerlib 4.0.0-beta.18 → 4.0.0-beta.19

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.
@@ -12,7 +12,7 @@ class PlaneTrackerAPI {
12
12
  constructor(client, apiUser) {
13
13
  this.client = client;
14
14
  this.apiUser = apiUser;
15
- this._apiUserQuery = `userId=${this.apiUser.userId}&userName=${this.apiUser.userName}&userPriority=${this.apiUser.userPriority}`;
15
+ this._apiUserQuery = (0, utils_1.paramToUrl)(this.apiUser);
16
16
  }
17
17
  static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
18
18
  async checkCameraTime() {
@@ -89,7 +89,9 @@ class PlaneTrackerAPI {
89
89
  startTrackingPlane = async (icao) => {
90
90
  return await this.client.get(`${exports.BASE_URL}/package/trackIcao.cgi`, {
91
91
  icao: encodeURIComponent(icao),
92
- ...this.apiUser,
92
+ userId: encodeURIComponent(this.apiUser.userId),
93
+ userName: encodeURIComponent(this.apiUser.userName),
94
+ userPriority: this.apiUser.userPriority,
93
95
  });
94
96
  };
95
97
  stopTrackingPlane = async () => {
@@ -106,7 +108,11 @@ class PlaneTrackerAPI {
106
108
  return await this.client.post(`${exports.BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
107
109
  };
108
110
  resetPtzCalibration = async () => {
109
- return await this.client.get(`${exports.BASE_URL}/package/resetPtzCalibration.cgi`);
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
+ });
110
116
  };
111
117
  checkGenetecConnection = async (params) => {
112
118
  return await this._postUrlEncoded(`${exports.BASE_URL}/package/checkGenetecConnection.cgi`, params);
@@ -148,14 +148,15 @@ export declare const cameraDetailsResponseSchema: z.ZodObject<{
148
148
  export type TCameraDetailsResponse = z.infer<typeof cameraDetailsResponseSchema>;
149
149
  export type TCameraDetail = z.infer<typeof cameraDetailSchema>;
150
150
  export type TParams = Array<'Guid' | 'Name' | 'EntityType'>;
151
+ export type TProtocol = 'http' | 'https' | 'https_insecure';
151
152
  export type GenetecAgentOptions = {
152
- protocol?: 'http' | 'https' | 'https_insecure';
153
+ protocol?: TProtocol;
153
154
  ip?: string;
154
155
  port?: number;
155
- base_uri?: string;
156
+ baseUri?: string;
156
157
  user?: string;
157
158
  pass?: string;
158
- app_id?: string;
159
+ appId?: string;
159
160
  };
160
161
  export declare class GenetecAgent {
161
162
  private settings;
@@ -37,13 +37,13 @@ class GenetecAgent {
37
37
  protocol: options.protocol ?? 'http',
38
38
  ip: options.ip ?? '127.0.0.1',
39
39
  port: options.port ?? 80,
40
- base_uri: options.base_uri ?? 'WebSdk',
40
+ baseUri: options.baseUri ?? 'WebSdk',
41
41
  user: options.user ?? 'root',
42
42
  pass: options.pass ?? '',
43
- app_id: options.app_id ?? '',
43
+ appId: options.appId ?? '',
44
44
  };
45
- this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.base_uri}`;
46
- this.credentials = btoa(`${this.settings.user};${this.settings.app_id}:${this.settings.pass}`);
45
+ this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.baseUri}`;
46
+ this.credentials = btoa(`${this.settings.user};${this.settings.appId}:${this.settings.pass}`);
47
47
  }
48
48
  async checkConnection() {
49
49
  const requestOptions = this.getRequestOptions('GET');
@@ -9,7 +9,7 @@ export class PlaneTrackerAPI {
9
9
  constructor(client, apiUser) {
10
10
  this.client = client;
11
11
  this.apiUser = apiUser;
12
- this._apiUserQuery = `userId=${this.apiUser.userId}&userName=${this.apiUser.userName}&userPriority=${this.apiUser.userPriority}`;
12
+ this._apiUserQuery = paramToUrl(this.apiUser);
13
13
  }
14
14
  static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
15
15
  async checkCameraTime() {
@@ -86,7 +86,9 @@ export class PlaneTrackerAPI {
86
86
  startTrackingPlane = async (icao) => {
87
87
  return await this.client.get(`${BASE_URL}/package/trackIcao.cgi`, {
88
88
  icao: encodeURIComponent(icao),
89
- ...this.apiUser,
89
+ userId: encodeURIComponent(this.apiUser.userId),
90
+ userName: encodeURIComponent(this.apiUser.userName),
91
+ userPriority: this.apiUser.userPriority,
90
92
  });
91
93
  };
92
94
  stopTrackingPlane = async () => {
@@ -103,7 +105,11 @@ export class PlaneTrackerAPI {
103
105
  return await this.client.post(`${BASE_URL}/package_data.cgi`, formData, { action: 'IMPORT', dataType });
104
106
  };
105
107
  resetPtzCalibration = async () => {
106
- return await this.client.get(`${BASE_URL}/package/resetPtzCalibration.cgi`);
108
+ return await this.client.get(`${BASE_URL}/package/resetPtzCalibration.cgi`, {
109
+ userId: encodeURIComponent(this.apiUser.userId),
110
+ userName: encodeURIComponent(this.apiUser.userName),
111
+ userPriority: this.apiUser.userPriority,
112
+ });
107
113
  };
108
114
  checkGenetecConnection = async (params) => {
109
115
  return await this._postUrlEncoded(`${BASE_URL}/package/checkGenetecConnection.cgi`, params);
@@ -148,14 +148,15 @@ export declare const cameraDetailsResponseSchema: z.ZodObject<{
148
148
  export type TCameraDetailsResponse = z.infer<typeof cameraDetailsResponseSchema>;
149
149
  export type TCameraDetail = z.infer<typeof cameraDetailSchema>;
150
150
  export type TParams = Array<'Guid' | 'Name' | 'EntityType'>;
151
+ export type TProtocol = 'http' | 'https' | 'https_insecure';
151
152
  export type GenetecAgentOptions = {
152
- protocol?: 'http' | 'https' | 'https_insecure';
153
+ protocol?: TProtocol;
153
154
  ip?: string;
154
155
  port?: number;
155
- base_uri?: string;
156
+ baseUri?: string;
156
157
  user?: string;
157
158
  pass?: string;
158
- app_id?: string;
159
+ appId?: string;
159
160
  };
160
161
  export declare class GenetecAgent {
161
162
  private settings;
@@ -34,13 +34,13 @@ export class GenetecAgent {
34
34
  protocol: options.protocol ?? 'http',
35
35
  ip: options.ip ?? '127.0.0.1',
36
36
  port: options.port ?? 80,
37
- base_uri: options.base_uri ?? 'WebSdk',
37
+ baseUri: options.baseUri ?? 'WebSdk',
38
38
  user: options.user ?? 'root',
39
39
  pass: options.pass ?? '',
40
- app_id: options.app_id ?? '',
40
+ appId: options.appId ?? '',
41
41
  };
42
- this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.base_uri}`;
43
- this.credentials = btoa(`${this.settings.user};${this.settings.app_id}:${this.settings.pass}`);
42
+ this.baseUrl = `${this.settings.protocol}://${this.settings.ip}:${this.settings.port}/${this.settings.baseUri}`;
43
+ this.credentials = btoa(`${this.settings.user};${this.settings.appId}:${this.settings.pass}`);
44
44
  }
45
45
  async checkConnection() {
46
46
  const requestOptions = this.getRequestOptions('GET');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.18",
3
+ "version": "4.0.0-beta.19",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "dependencies": {