camstreamerlib 4.0.0-beta.127 → 4.0.0-beta.128
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/cjs/VapixAPI.d.ts +2 -1
- package/cjs/VapixAPI.js +12 -4
- package/cjs/internal/BasicAPI.js +4 -8
- package/esm/VapixAPI.js +13 -5
- package/esm/internal/BasicAPI.js +4 -8
- package/package.json +1 -1
- package/types/VapixAPI.d.ts +2 -1
package/cjs/VapixAPI.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IClient, TResponse } from './internal/types';
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
2
|
import { TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
3
|
import { TCameraImageConfig, THttpRequestOptions } from './types/common';
|
|
4
4
|
import { BasicAPI } from './internal/BasicAPI';
|
|
@@ -8,6 +8,7 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
|
|
|
8
8
|
new (form?: HTMLFormElement | undefined, submitter?: HTMLElement | null | undefined): FormData;
|
|
9
9
|
prototype: FormData;
|
|
10
10
|
});
|
|
11
|
+
postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
11
12
|
postJson: (path: string, data: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions) => Promise<TResponse>;
|
|
12
13
|
getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<ReturnType<Client["get"]>>;
|
|
13
14
|
getEventDeclarations(options?: THttpRequestOptions): Promise<string>;
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -13,6 +13,16 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
|
|
|
13
13
|
super(client);
|
|
14
14
|
this.CustomFormData = CustomFormData;
|
|
15
15
|
}
|
|
16
|
+
async postUrlEncoded(path, parameters, headers, options) {
|
|
17
|
+
const data = (0, utils_1.paramToUrl)(parameters);
|
|
18
|
+
const head = { ...headers, 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
19
|
+
const agent = this.getClient(options?.proxyParams);
|
|
20
|
+
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
16
26
|
postJson = async (path, data, headers, options) => {
|
|
17
27
|
const agent = this.getClient(options?.proxyParams);
|
|
18
28
|
const jsonData = JSON.stringify(data);
|
|
@@ -22,12 +32,10 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
|
|
|
22
32
|
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
23
33
|
timeout: options?.timeout,
|
|
24
34
|
});
|
|
25
|
-
if (res.ok) {
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
35
|
+
if (!res.ok) {
|
|
29
36
|
throw new errors_1.ErrorWithResponse(res);
|
|
30
37
|
}
|
|
38
|
+
return res;
|
|
31
39
|
};
|
|
32
40
|
async getCameraImage(parameters, options) {
|
|
33
41
|
const agent = this.getClient(options?.proxyParams);
|
package/cjs/internal/BasicAPI.js
CHANGED
|
@@ -70,12 +70,10 @@ class BasicAPI {
|
|
|
70
70
|
headers: { 'Content-Type': 'application/json' },
|
|
71
71
|
timeout: options?.timeout,
|
|
72
72
|
});
|
|
73
|
-
if (res.ok) {
|
|
74
|
-
return res;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
73
|
+
if (!res.ok) {
|
|
77
74
|
throw new errors_1.ErrorWithResponse(res);
|
|
78
75
|
}
|
|
76
|
+
return res;
|
|
79
77
|
}
|
|
80
78
|
async _postUrlEncoded(path, data, options) {
|
|
81
79
|
const encodedData = (0, utils_1.paramToUrl)(data);
|
|
@@ -86,12 +84,10 @@ class BasicAPI {
|
|
|
86
84
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
87
85
|
timeout: options?.timeout,
|
|
88
86
|
});
|
|
89
|
-
if (res.ok) {
|
|
90
|
-
return res;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
87
|
+
if (!res.ok) {
|
|
93
88
|
throw new errors_1.ErrorWithResponse(res);
|
|
94
89
|
}
|
|
90
|
+
return res;
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
exports.BasicAPI = BasicAPI;
|
package/esm/VapixAPI.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arrayToUrl, isNullish } from './internal/utils';
|
|
1
|
+
import { arrayToUrl, isNullish, paramToUrl } from './internal/utils';
|
|
2
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, ErrorWithResponse, SDCardActionError, SDCardJobError, SettingParameterError, TimezoneFetchError, TimezoneNotSetupError, } from './errors/errors';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -10,6 +10,16 @@ export class VapixAPI extends BasicAPI {
|
|
|
10
10
|
super(client);
|
|
11
11
|
this.CustomFormData = CustomFormData;
|
|
12
12
|
}
|
|
13
|
+
async postUrlEncoded(path, parameters, headers, options) {
|
|
14
|
+
const data = paramToUrl(parameters);
|
|
15
|
+
const head = { ...headers, 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
16
|
+
const agent = this.getClient(options?.proxyParams);
|
|
17
|
+
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
18
|
+
if (!res.ok) {
|
|
19
|
+
throw new ErrorWithResponse(res);
|
|
20
|
+
}
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
13
23
|
postJson = async (path, data, headers, options) => {
|
|
14
24
|
const agent = this.getClient(options?.proxyParams);
|
|
15
25
|
const jsonData = JSON.stringify(data);
|
|
@@ -19,12 +29,10 @@ export class VapixAPI extends BasicAPI {
|
|
|
19
29
|
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
20
30
|
timeout: options?.timeout,
|
|
21
31
|
});
|
|
22
|
-
if (res.ok) {
|
|
23
|
-
return res;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
32
|
+
if (!res.ok) {
|
|
26
33
|
throw new ErrorWithResponse(res);
|
|
27
34
|
}
|
|
35
|
+
return res;
|
|
28
36
|
};
|
|
29
37
|
async getCameraImage(parameters, options) {
|
|
30
38
|
const agent = this.getClient(options?.proxyParams);
|
package/esm/internal/BasicAPI.js
CHANGED
|
@@ -67,12 +67,10 @@ export class BasicAPI {
|
|
|
67
67
|
headers: { 'Content-Type': 'application/json' },
|
|
68
68
|
timeout: options?.timeout,
|
|
69
69
|
});
|
|
70
|
-
if (res.ok) {
|
|
71
|
-
return res;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
70
|
+
if (!res.ok) {
|
|
74
71
|
throw new ErrorWithResponse(res);
|
|
75
72
|
}
|
|
73
|
+
return res;
|
|
76
74
|
}
|
|
77
75
|
async _postUrlEncoded(path, data, options) {
|
|
78
76
|
const encodedData = paramToUrl(data);
|
|
@@ -83,11 +81,9 @@ export class BasicAPI {
|
|
|
83
81
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
84
82
|
timeout: options?.timeout,
|
|
85
83
|
});
|
|
86
|
-
if (res.ok) {
|
|
87
|
-
return res;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
84
|
+
if (!res.ok) {
|
|
90
85
|
throw new ErrorWithResponse(res);
|
|
91
86
|
}
|
|
87
|
+
return res;
|
|
92
88
|
}
|
|
93
89
|
}
|
package/package.json
CHANGED
package/types/VapixAPI.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IClient, TResponse } from './internal/types';
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
2
|
import { TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
3
|
import { TCameraImageConfig, THttpRequestOptions } from './types/common';
|
|
4
4
|
import { BasicAPI } from './internal/BasicAPI';
|
|
@@ -8,6 +8,7 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
|
|
|
8
8
|
new (form?: HTMLFormElement | undefined, submitter?: HTMLElement | null | undefined): FormData;
|
|
9
9
|
prototype: FormData;
|
|
10
10
|
});
|
|
11
|
+
postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
11
12
|
postJson: (path: string, data: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions) => Promise<TResponse>;
|
|
12
13
|
getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<ReturnType<Client["get"]>>;
|
|
13
14
|
getEventDeclarations(options?: THttpRequestOptions): Promise<string>;
|