camstreamerlib 4.0.0-beta.153 → 4.0.0-beta.155

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.
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.CamScripterAPI = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
4
8
  const BasicAPI_1 = require("./internal/BasicAPI");
5
9
  const CamScripterAPI_1 = require("./types/CamScripterAPI");
6
10
  const common_1 = require("./types/common");
@@ -12,7 +16,7 @@ class CamScripterAPI extends BasicAPI_1.BasicAPI {
12
16
  }
13
17
  async checkCameraTime(options) {
14
18
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
15
- return CamScripterAPI_1.cameraTimeResponseSchema.parse(res).state;
19
+ return zod_1.default.boolean().parse(res.state);
16
20
  }
17
21
  async getNetworkCameraList(options) {
18
22
  const res = await this._getJson(`${BASE_PATH}/network_camera_list.cgi`, undefined, options);
@@ -7,6 +7,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
7
7
  static getProxyPath: () => string;
8
8
  static getWsEventsPath: () => string;
9
9
  checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
10
+ checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
10
11
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
11
12
  getUtcTime(options?: THttpRequestOptions): Promise<number>;
12
13
  getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
@@ -14,6 +14,10 @@ class CamStreamerAPI extends BasicAPI_1.BasicAPI {
14
14
  async checkAPIAvailable(options) {
15
15
  await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
16
16
  }
17
+ async checkCameraTime(options) {
18
+ const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
19
+ return zod_1.z.boolean().parse(res.data?.state);
20
+ }
17
21
  async wsAuthorization(options) {
18
22
  const res = await this._getJson(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
19
23
  if (res.status !== 200) {
@@ -117,14 +117,3 @@ export declare const camscripterApiResponseSchema: z.ZodObject<{
117
117
  message: string;
118
118
  }>;
119
119
  export type TCamscripterApiResponse = z.infer<typeof camscripterApiResponseSchema>;
120
- export declare const cameraTimeResponseSchema: z.ZodObject<{
121
- state: z.ZodBoolean;
122
- code: z.ZodNumber;
123
- }, "strip", z.ZodTypeAny, {
124
- code: number;
125
- state: boolean;
126
- }, {
127
- code: number;
128
- state: boolean;
129
- }>;
130
- export type TCameraTimeResponse = z.infer<typeof cameraTimeResponseSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cameraTimeResponseSchema = exports.camscripterApiResponseSchema = exports.cameraStorageSchema = exports.packageConfigSchema = exports.packageInfoListSchema = exports.nodeStateSchema = void 0;
3
+ exports.camscripterApiResponseSchema = exports.cameraStorageSchema = exports.packageConfigSchema = exports.packageInfoListSchema = exports.nodeStateSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const common_1 = require("./common");
6
6
  exports.nodeStateSchema = zod_1.z.object({
@@ -30,7 +30,3 @@ exports.camscripterApiResponseSchema = zod_1.z.object({
30
30
  status: zod_1.z.number(),
31
31
  message: zod_1.z.string(),
32
32
  });
33
- exports.cameraTimeResponseSchema = zod_1.z.object({
34
- state: zod_1.z.boolean(),
35
- code: zod_1.z.number(),
36
- });
@@ -1,5 +1,6 @@
1
+ import z from 'zod';
1
2
  import { BasicAPI } from './internal/BasicAPI';
2
- import { cameraTimeResponseSchema, nodeStateSchema, packageInfoListSchema, cameraStorageSchema, } from './types/CamScripterAPI';
3
+ import { nodeStateSchema, packageInfoListSchema, cameraStorageSchema } from './types/CamScripterAPI';
3
4
  import { networkCameraListSchema } from './types/common';
4
5
  const BASE_PATH = '/local/camscripter';
5
6
  export class CamScripterAPI extends BasicAPI {
@@ -9,7 +10,7 @@ export class CamScripterAPI extends BasicAPI {
9
10
  }
10
11
  async checkCameraTime(options) {
11
12
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
12
- return cameraTimeResponseSchema.parse(res).state;
13
+ return z.boolean().parse(res.state);
13
14
  }
14
15
  async getNetworkCameraList(options) {
15
16
  const res = await this._getJson(`${BASE_PATH}/network_camera_list.cgi`, undefined, options);
@@ -11,6 +11,10 @@ export class CamStreamerAPI extends BasicAPI {
11
11
  async checkAPIAvailable(options) {
12
12
  await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
13
13
  }
14
+ async checkCameraTime(options) {
15
+ const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
16
+ return z.boolean().parse(res.data?.state);
17
+ }
14
18
  async wsAuthorization(options) {
15
19
  const res = await this._getJson(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
16
20
  if (res.status !== 200) {
@@ -27,7 +27,3 @@ export const camscripterApiResponseSchema = z.object({
27
27
  status: z.number(),
28
28
  message: z.string(),
29
29
  });
30
- export const cameraTimeResponseSchema = z.object({
31
- state: z.boolean(),
32
- code: z.number(),
33
- });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.153",
3
+ "version": "4.0.0-beta.155",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -7,6 +7,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
7
7
  static getProxyPath: () => string;
8
8
  static getWsEventsPath: () => string;
9
9
  checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
10
+ checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
10
11
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
11
12
  getUtcTime(options?: THttpRequestOptions): Promise<number>;
12
13
  getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
@@ -117,14 +117,3 @@ export declare const camscripterApiResponseSchema: z.ZodObject<{
117
117
  message: string;
118
118
  }>;
119
119
  export type TCamscripterApiResponse = z.infer<typeof camscripterApiResponseSchema>;
120
- export declare const cameraTimeResponseSchema: z.ZodObject<{
121
- state: z.ZodBoolean;
122
- code: z.ZodNumber;
123
- }, "strip", z.ZodTypeAny, {
124
- code: number;
125
- state: boolean;
126
- }, {
127
- code: number;
128
- state: boolean;
129
- }>;
130
- export type TCameraTimeResponse = z.infer<typeof cameraTimeResponseSchema>;