camstreamerlib 4.0.0-beta.22 → 4.0.0-beta.24

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.
@@ -17,28 +17,8 @@ class CamOverlayAPI {
17
17
  static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
18
18
  static getFilePreviewPath = (path) => `${exports.BASE_URL}/image.cgi?path=${encodeURIComponent(path)}`;
19
19
  async checkCameraTime() {
20
- const responseSchema = zod_1.z.discriminatedUnion('state', [
21
- zod_1.z.object({
22
- state: zod_1.z.literal(true),
23
- code: zod_1.z.number(),
24
- }),
25
- zod_1.z.object({
26
- state: zod_1.z.literal(false),
27
- code: zod_1.z.number(),
28
- reason: zod_1.z.union([
29
- zod_1.z.literal('INVALID_TIME'),
30
- zod_1.z.literal('COULDNT_RESOLVE_HOST'),
31
- zod_1.z.literal('CONNECTION_ERROR'),
32
- ]),
33
- message: zod_1.z.string(),
34
- }),
35
- ]);
36
20
  const response = await this._get(`${exports.BASE_URL}/camera_time.cgi`);
37
- const cameraTime = responseSchema.parse(response);
38
- if (!cameraTime.state) {
39
- console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
40
- }
41
- return cameraTime.state;
21
+ return zod_1.z.boolean().parse(response.state);
42
22
  }
43
23
  async getNetworkCameraList() {
44
24
  const response = await this._get(`${exports.BASE_URL}/network_camera_list.cgi`);
@@ -16,28 +16,8 @@ class PlaneTrackerAPI {
16
16
  }
17
17
  static getProxyUrlPath = () => `${exports.BASE_URL}/proxy.cgi`;
18
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
19
  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;
20
+ return zod_1.z.boolean().parse(response.state);
41
21
  }
42
22
  fetchCameraSettings = async () => {
43
23
  return await this._getJson(`${exports.BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
@@ -69,6 +69,12 @@ export declare const packageConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
69
69
  enabled: boolean;
70
70
  }>>;
71
71
  export type TPackageConfig = z.infer<typeof packageConfigSchema>;
72
+ export type TServerPackageData = {
73
+ name: string;
74
+ package_menu_name: string;
75
+ version: string;
76
+ vendor: string;
77
+ };
72
78
  export declare const storageSchema: z.ZodUnion<[z.ZodTuple<[z.ZodObject<{
73
79
  type: z.ZodLiteral<"INTERNAL">;
74
80
  capacity_mb: z.ZodNumber;
@@ -14,28 +14,8 @@ export class CamOverlayAPI {
14
14
  static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
15
15
  static getFilePreviewPath = (path) => `${BASE_URL}/image.cgi?path=${encodeURIComponent(path)}`;
16
16
  async checkCameraTime() {
17
- const responseSchema = z.discriminatedUnion('state', [
18
- z.object({
19
- state: z.literal(true),
20
- code: z.number(),
21
- }),
22
- z.object({
23
- state: z.literal(false),
24
- code: z.number(),
25
- reason: z.union([
26
- z.literal('INVALID_TIME'),
27
- z.literal('COULDNT_RESOLVE_HOST'),
28
- z.literal('CONNECTION_ERROR'),
29
- ]),
30
- message: z.string(),
31
- }),
32
- ]);
33
17
  const response = await this._get(`${BASE_URL}/camera_time.cgi`);
34
- const cameraTime = responseSchema.parse(response);
35
- if (!cameraTime.state) {
36
- console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
37
- }
38
- return cameraTime.state;
18
+ return z.boolean().parse(response.state);
39
19
  }
40
20
  async getNetworkCameraList() {
41
21
  const response = await this._get(`${BASE_URL}/network_camera_list.cgi`);
@@ -13,28 +13,8 @@ export class PlaneTrackerAPI {
13
13
  }
14
14
  static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
15
15
  async checkCameraTime() {
16
- const responseSchema = z.discriminatedUnion('state', [
17
- z.object({
18
- state: z.literal(true),
19
- code: z.number(),
20
- }),
21
- z.object({
22
- state: z.literal(false),
23
- code: z.number(),
24
- reason: z.union([
25
- z.literal('INVALID_TIME'),
26
- z.literal('COULDNT_RESOLVE_HOST'),
27
- z.literal('CONNECTION_ERROR'),
28
- ]),
29
- message: z.string(),
30
- }),
31
- ]);
32
16
  const response = await this._getJson(`${BASE_URL}/camera_time.cgi`);
33
- const cameraTime = responseSchema.parse(response);
34
- if (!cameraTime.state) {
35
- console.error(`Camera time check failed: ${cameraTime.reason} - ${cameraTime.message}`);
36
- }
37
- return cameraTime.state;
17
+ return z.boolean().parse(response.state);
38
18
  }
39
19
  fetchCameraSettings = async () => {
40
20
  return await this._getJson(`${BASE_URL}/package_camera_settings.cgi`, { action: 'get' });
@@ -69,6 +69,12 @@ export declare const packageConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
69
69
  enabled: boolean;
70
70
  }>>;
71
71
  export type TPackageConfig = z.infer<typeof packageConfigSchema>;
72
+ export type TServerPackageData = {
73
+ name: string;
74
+ package_menu_name: string;
75
+ version: string;
76
+ vendor: string;
77
+ };
72
78
  export declare const storageSchema: z.ZodUnion<[z.ZodTuple<[z.ZodObject<{
73
79
  type: z.ZodLiteral<"INTERNAL">;
74
80
  capacity_mb: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.22",
3
+ "version": "4.0.0-beta.24",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "dependencies": {