camstreamerlib 4.0.0-beta.106 → 4.0.0-beta.108

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,7 +1,7 @@
1
1
  import { IClient, TBlobResponse, TResponse } from './internal/types';
2
2
  import { THttpRequestOptions, TProxyParams } from './types/common';
3
3
  import { ProxyClient } from './internal/ProxyClient';
4
- import { ImageType, TCoordinates, TField, TFile, TFileType, TFileStorageType, TService } from './types/CamOverlayAPI';
4
+ import { ImageType, TCoordinates, TField, TFile, TFileType, TFileStorageType, TService, TFileList, TStorageDataList } from './types/CamOverlayAPI';
5
5
  export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
6
6
  private client;
7
7
  constructor(client: Client);
@@ -9,6 +9,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getFilePreviewPath: (path: string) => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
13
14
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
14
15
  name: string;
@@ -16,17 +17,10 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
16
17
  }[]>;
17
18
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
18
19
  getMjpegStreamImage(mjpegUrl: string, options?: THttpRequestOptions): Promise<TBlobResponse<Client>>;
19
- listFiles(fileType: TFileType, options?: THttpRequestOptions): Promise<{
20
- path: string;
21
- name: string;
22
- storage: "url" | "flash" | "SD0" | "ftp" | "samba";
23
- }[]>;
24
- uploadFile(fileType: TFileType, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType, options?: THttpRequestOptions): Promise<void>;
25
- removeFile(fileType: TFileType, fileParams: TFile, options?: THttpRequestOptions): Promise<void>;
26
- getFileStorage(fileType: TFileType, options?: THttpRequestOptions): Promise<{
27
- type: "url" | "flash" | "SD0" | "ftp" | "samba";
28
- state: string;
29
- }[]>;
20
+ listFiles<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TFileList<T>>;
21
+ uploadFile<T extends TFileType>(fileType: T, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType<T>, options?: THttpRequestOptions): Promise<void>;
22
+ removeFile<T extends TFileType>(fileType: T, fileParams: TFile<T>, options?: THttpRequestOptions): Promise<void>;
23
+ getFileStorage<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TStorageDataList<T>>;
30
24
  getFilePreviewFromCamera(path: string, options?: THttpRequestOptions): Promise<TBlobResponse<Client>>;
31
25
  updateInfoticker(serviceId: number, text: string, options?: THttpRequestOptions): Promise<void>;
32
26
  setEnabled(serviceId: number, enabled: boolean, options?: THttpRequestOptions): Promise<void>;
@@ -19,6 +19,9 @@ class CamOverlayAPI {
19
19
  getClient(proxyParams) {
20
20
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
21
21
  }
22
+ async checkAPIAvailable(options) {
23
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
24
+ }
22
25
  async checkCameraTime(options) {
23
26
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
24
27
  return zod_1.z.boolean().parse(res.state);
@@ -36,7 +39,7 @@ class CamOverlayAPI {
36
39
  }
37
40
  async listFiles(fileType, options) {
38
41
  const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
39
- return CamOverlayAPI_1.fileListSchema.parse(res.list);
42
+ return (0, CamOverlayAPI_1.getFileListSchema)(fileType).parse(res.list);
40
43
  }
41
44
  async uploadFile(fileType, formData, storage, options) {
42
45
  await this._post(`${BASE_PATH}/upload_${fileType}.cgi`, formData, {
@@ -55,7 +58,7 @@ class CamOverlayAPI {
55
58
  if (res.code !== 200) {
56
59
  throw new errors_1.StorageDataFetchError(res);
57
60
  }
58
- return CamOverlayAPI_1.storageDataListSchema.parse(res.list);
61
+ return (0, CamOverlayAPI_1.getStorageDataListSchema)(fileType).parse(res.list);
59
62
  }
60
63
  async getFilePreviewFromCamera(path, options) {
61
64
  return await this._getBlob(CamOverlayAPI.getFilePreviewPath(path), undefined, options);
@@ -6,6 +6,7 @@ export declare class CamScripterAPI<Client extends IClient<TResponse, any>> {
6
6
  constructor(client: Client);
7
7
  static getProxyPath: () => string;
8
8
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
9
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
9
10
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
10
11
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
11
12
  name: string;
@@ -15,6 +15,9 @@ class CamScripterAPI {
15
15
  getClient(proxyParams) {
16
16
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
17
17
  }
18
+ async checkAPIAvailable(options) {
19
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
20
+ }
18
21
  async checkCameraTime(options) {
19
22
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
20
23
  return CamScripterAPI_1.cameraTimeResponseSchema.parse(res).state;
@@ -9,6 +9,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getWsEventsPath: () => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
13
14
  getUtcTime(options?: THttpRequestOptions): Promise<number>;
14
15
  getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
@@ -18,6 +18,9 @@ class CamStreamerAPI {
18
18
  getClient(proxyParams) {
19
19
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
20
20
  }
21
+ async checkAPIAvailable(options) {
22
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
23
+ }
21
24
  async wsAuthorization(options) {
22
25
  const res = await this._getJson(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
23
26
  if (res.status !== 200) {
@@ -14,6 +14,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
14
14
  static getWsEventsPath: () => string;
15
15
  static getClipPreviewPath: (clipId: string, storage: TStorageType) => string;
16
16
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
17
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
17
18
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
18
19
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
19
20
  name: string;
@@ -25,6 +25,9 @@ class CamSwitcherAPI {
25
25
  getClient(proxyParams) {
26
26
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
27
27
  }
28
+ async checkAPIAvailable(options) {
29
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
30
+ }
28
31
  async checkCameraTime(options) {
29
32
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
30
33
  return zod_1.z.boolean().parse(res.data);
@@ -9,6 +9,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getWsEventsPath: () => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
13
14
  serverRunCheck(options?: THttpRequestOptions): Promise<TResponse>;
14
15
  getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
@@ -20,6 +20,9 @@ class PlaneTrackerAPI {
20
20
  getClient(proxyParams) {
21
21
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
22
22
  }
23
+ async checkAPIAvailable(options) {
24
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
25
+ }
23
26
  async checkCameraTime(options) {
24
27
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
25
28
  return zod_1.z.boolean().parse(res.state);
@@ -4229,9 +4229,12 @@ export declare enum ImageType {
4229
4229
  PNG = 0,
4230
4230
  JPEG = 1
4231
4231
  }
4232
- export declare const fileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4233
- export type TFileStorageType = z.infer<typeof fileStorageTypeSchema>;
4234
- export declare const storageDataListSchema: z.ZodArray<z.ZodObject<{
4232
+ export declare const imageFileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4233
+ export declare const fontFileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4234
+ export type TImageFileStorageType = z.infer<typeof imageFileStorageTypeSchema>;
4235
+ export type TFontFileStorageType = z.infer<typeof fontFileStorageTypeSchema>;
4236
+ export type TFileStorageType<T extends TFileType> = T extends 'image' ? TImageFileStorageType : TFontFileStorageType;
4237
+ export declare const imageFilestorageDataListSchema: z.ZodArray<z.ZodObject<{
4235
4238
  type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4236
4239
  state: z.ZodString;
4237
4240
  }, "strip", z.ZodTypeAny, {
@@ -4241,8 +4244,89 @@ export declare const storageDataListSchema: z.ZodArray<z.ZodObject<{
4241
4244
  type: "url" | "flash" | "SD0" | "ftp" | "samba";
4242
4245
  state: string;
4243
4246
  }>, "many">;
4244
- export type TStorageDataList = z.infer<typeof storageDataListSchema>;
4245
- export declare const storageResponseSchema: z.ZodObject<{
4247
+ export declare const fontStorageDataListSchema: z.ZodArray<z.ZodObject<{
4248
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4249
+ state: z.ZodString;
4250
+ }, "strip", z.ZodTypeAny, {
4251
+ type: "flash" | "SD0";
4252
+ state: string;
4253
+ }, {
4254
+ type: "flash" | "SD0";
4255
+ state: string;
4256
+ }>, "many">;
4257
+ export declare const getStorageDataListSchema: (fileType: TFileType) => z.ZodArray<z.ZodObject<{
4258
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4259
+ state: z.ZodString;
4260
+ }, "strip", z.ZodTypeAny, {
4261
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4262
+ state: string;
4263
+ }, {
4264
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4265
+ state: string;
4266
+ }>, "many"> | z.ZodArray<z.ZodObject<{
4267
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4268
+ state: z.ZodString;
4269
+ }, "strip", z.ZodTypeAny, {
4270
+ type: "flash" | "SD0";
4271
+ state: string;
4272
+ }, {
4273
+ type: "flash" | "SD0";
4274
+ state: string;
4275
+ }>, "many">;
4276
+ export type TImageStorageDataList = z.infer<typeof imageFilestorageDataListSchema>;
4277
+ export type TFontStorageDataList = z.infer<typeof fontStorageDataListSchema>;
4278
+ export type TStorageDataList<T extends TFileType> = T extends 'image' ? TImageStorageDataList : TFontStorageDataList;
4279
+ export declare const imageStorageResponseSchema: z.ZodObject<{
4280
+ code: z.ZodNumber;
4281
+ list: z.ZodArray<z.ZodObject<{
4282
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4283
+ state: z.ZodString;
4284
+ }, "strip", z.ZodTypeAny, {
4285
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4286
+ state: string;
4287
+ }, {
4288
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4289
+ state: string;
4290
+ }>, "many">;
4291
+ }, "strip", z.ZodTypeAny, {
4292
+ code: number;
4293
+ list: {
4294
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4295
+ state: string;
4296
+ }[];
4297
+ }, {
4298
+ code: number;
4299
+ list: {
4300
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4301
+ state: string;
4302
+ }[];
4303
+ }>;
4304
+ export declare const fontStorageResponseSchema: z.ZodObject<{
4305
+ code: z.ZodNumber;
4306
+ list: z.ZodArray<z.ZodObject<{
4307
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4308
+ state: z.ZodString;
4309
+ }, "strip", z.ZodTypeAny, {
4310
+ type: "flash" | "SD0";
4311
+ state: string;
4312
+ }, {
4313
+ type: "flash" | "SD0";
4314
+ state: string;
4315
+ }>, "many">;
4316
+ }, "strip", z.ZodTypeAny, {
4317
+ code: number;
4318
+ list: {
4319
+ type: "flash" | "SD0";
4320
+ state: string;
4321
+ }[];
4322
+ }, {
4323
+ code: number;
4324
+ list: {
4325
+ type: "flash" | "SD0";
4326
+ state: string;
4327
+ }[];
4328
+ }>;
4329
+ export declare const getStorageResponseSchema: (fileType: TFileType) => z.ZodObject<{
4246
4330
  code: z.ZodNumber;
4247
4331
  list: z.ZodArray<z.ZodObject<{
4248
4332
  type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4266,9 +4350,35 @@ export declare const storageResponseSchema: z.ZodObject<{
4266
4350
  type: "url" | "flash" | "SD0" | "ftp" | "samba";
4267
4351
  state: string;
4268
4352
  }[];
4353
+ }> | z.ZodObject<{
4354
+ code: z.ZodNumber;
4355
+ list: z.ZodArray<z.ZodObject<{
4356
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4357
+ state: z.ZodString;
4358
+ }, "strip", z.ZodTypeAny, {
4359
+ type: "flash" | "SD0";
4360
+ state: string;
4361
+ }, {
4362
+ type: "flash" | "SD0";
4363
+ state: string;
4364
+ }>, "many">;
4365
+ }, "strip", z.ZodTypeAny, {
4366
+ code: number;
4367
+ list: {
4368
+ type: "flash" | "SD0";
4369
+ state: string;
4370
+ }[];
4371
+ }, {
4372
+ code: number;
4373
+ list: {
4374
+ type: "flash" | "SD0";
4375
+ state: string;
4376
+ }[];
4269
4377
  }>;
4270
- export type TStorageResponse = z.infer<typeof storageResponseSchema>;
4271
- export declare const fileSchema: z.ZodObject<{
4378
+ export type TImageStorageResponse = z.infer<typeof imageStorageResponseSchema>;
4379
+ export type TFontStorageResponse = z.infer<typeof fontStorageResponseSchema>;
4380
+ export type TStorageResponse<T extends TFileType> = T extends 'image' ? TImageStorageResponse : TFontStorageResponse;
4381
+ export declare const imageFileSchema: z.ZodObject<{
4272
4382
  name: z.ZodString;
4273
4383
  path: z.ZodString;
4274
4384
  storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4281,8 +4391,20 @@ export declare const fileSchema: z.ZodObject<{
4281
4391
  name: string;
4282
4392
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4283
4393
  }>;
4284
- export type TFile = z.infer<typeof fileSchema>;
4285
- export declare const fileListSchema: z.ZodArray<z.ZodObject<{
4394
+ export declare const fontFileSchema: z.ZodObject<{
4395
+ name: z.ZodString;
4396
+ path: z.ZodString;
4397
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4398
+ }, "strip", z.ZodTypeAny, {
4399
+ path: string;
4400
+ name: string;
4401
+ storage: "flash" | "SD0";
4402
+ }, {
4403
+ path: string;
4404
+ name: string;
4405
+ storage: "flash" | "SD0";
4406
+ }>;
4407
+ export declare const getFileSchema: (fileType: TFileType) => z.ZodObject<{
4286
4408
  name: z.ZodString;
4287
4409
  path: z.ZodString;
4288
4410
  storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4294,9 +4416,77 @@ export declare const fileListSchema: z.ZodArray<z.ZodObject<{
4294
4416
  path: string;
4295
4417
  name: string;
4296
4418
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4419
+ }> | z.ZodObject<{
4420
+ name: z.ZodString;
4421
+ path: z.ZodString;
4422
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4423
+ }, "strip", z.ZodTypeAny, {
4424
+ path: string;
4425
+ name: string;
4426
+ storage: "flash" | "SD0";
4427
+ }, {
4428
+ path: string;
4429
+ name: string;
4430
+ storage: "flash" | "SD0";
4431
+ }>;
4432
+ export type TImageFile = z.infer<typeof imageFileSchema>;
4433
+ export type TFontFile = z.infer<typeof fontFileSchema>;
4434
+ export type TFile<T extends TFileType> = T extends 'image' ? TImageFile : TFontFile;
4435
+ export declare const imageFileListSchema: z.ZodArray<z.ZodObject<{
4436
+ name: z.ZodString;
4437
+ path: z.ZodString;
4438
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4439
+ }, "strip", z.ZodTypeAny, {
4440
+ path: string;
4441
+ name: string;
4442
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4443
+ }, {
4444
+ path: string;
4445
+ name: string;
4446
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4447
+ }>, "many">;
4448
+ export declare const fontFileListSchema: z.ZodArray<z.ZodObject<{
4449
+ name: z.ZodString;
4450
+ path: z.ZodString;
4451
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4452
+ }, "strip", z.ZodTypeAny, {
4453
+ path: string;
4454
+ name: string;
4455
+ storage: "flash" | "SD0";
4456
+ }, {
4457
+ path: string;
4458
+ name: string;
4459
+ storage: "flash" | "SD0";
4460
+ }>, "many">;
4461
+ export declare const getFileListSchema: (fileType: TFileType) => z.ZodArray<z.ZodObject<{
4462
+ name: z.ZodString;
4463
+ path: z.ZodString;
4464
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4465
+ }, "strip", z.ZodTypeAny, {
4466
+ path: string;
4467
+ name: string;
4468
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4469
+ }, {
4470
+ path: string;
4471
+ name: string;
4472
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4473
+ }>, "many"> | z.ZodArray<z.ZodObject<{
4474
+ name: z.ZodString;
4475
+ path: z.ZodString;
4476
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4477
+ }, "strip", z.ZodTypeAny, {
4478
+ path: string;
4479
+ name: string;
4480
+ storage: "flash" | "SD0";
4481
+ }, {
4482
+ path: string;
4483
+ name: string;
4484
+ storage: "flash" | "SD0";
4297
4485
  }>, "many">;
4298
- export type TFileList = z.infer<typeof fileListSchema>;
4299
- export declare const fileDataSchema: z.ZodObject<{
4486
+ export type TImageFileList = z.infer<typeof imageFileListSchema>;
4487
+ export type TFontFileList = z.infer<typeof fontFileListSchema>;
4488
+ export type TFileList<T extends TFileType> = T extends 'image' ? TImageFileList : TFontFileList;
4489
+ export declare const imageFileDataSchema: z.ZodObject<{
4300
4490
  code: z.ZodNumber;
4301
4491
  list: z.ZodArray<z.ZodObject<{
4302
4492
  name: z.ZodString;
@@ -4326,5 +4516,96 @@ export declare const fileDataSchema: z.ZodObject<{
4326
4516
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4327
4517
  }[];
4328
4518
  }>;
4329
- export type TFileData = z.infer<typeof fileDataSchema>;
4519
+ export declare const fontFileDataSchema: z.ZodObject<{
4520
+ code: z.ZodNumber;
4521
+ list: z.ZodArray<z.ZodObject<{
4522
+ name: z.ZodString;
4523
+ path: z.ZodString;
4524
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4525
+ }, "strip", z.ZodTypeAny, {
4526
+ path: string;
4527
+ name: string;
4528
+ storage: "flash" | "SD0";
4529
+ }, {
4530
+ path: string;
4531
+ name: string;
4532
+ storage: "flash" | "SD0";
4533
+ }>, "many">;
4534
+ }, "strip", z.ZodTypeAny, {
4535
+ code: number;
4536
+ list: {
4537
+ path: string;
4538
+ name: string;
4539
+ storage: "flash" | "SD0";
4540
+ }[];
4541
+ }, {
4542
+ code: number;
4543
+ list: {
4544
+ path: string;
4545
+ name: string;
4546
+ storage: "flash" | "SD0";
4547
+ }[];
4548
+ }>;
4549
+ export declare const getFileDataSchema: (fileType: TFileType) => z.ZodObject<{
4550
+ code: z.ZodNumber;
4551
+ list: z.ZodArray<z.ZodObject<{
4552
+ name: z.ZodString;
4553
+ path: z.ZodString;
4554
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4555
+ }, "strip", z.ZodTypeAny, {
4556
+ path: string;
4557
+ name: string;
4558
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4559
+ }, {
4560
+ path: string;
4561
+ name: string;
4562
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4563
+ }>, "many">;
4564
+ }, "strip", z.ZodTypeAny, {
4565
+ code: number;
4566
+ list: {
4567
+ path: string;
4568
+ name: string;
4569
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4570
+ }[];
4571
+ }, {
4572
+ code: number;
4573
+ list: {
4574
+ path: string;
4575
+ name: string;
4576
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4577
+ }[];
4578
+ }> | z.ZodObject<{
4579
+ code: z.ZodNumber;
4580
+ list: z.ZodArray<z.ZodObject<{
4581
+ name: z.ZodString;
4582
+ path: z.ZodString;
4583
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4584
+ }, "strip", z.ZodTypeAny, {
4585
+ path: string;
4586
+ name: string;
4587
+ storage: "flash" | "SD0";
4588
+ }, {
4589
+ path: string;
4590
+ name: string;
4591
+ storage: "flash" | "SD0";
4592
+ }>, "many">;
4593
+ }, "strip", z.ZodTypeAny, {
4594
+ code: number;
4595
+ list: {
4596
+ path: string;
4597
+ name: string;
4598
+ storage: "flash" | "SD0";
4599
+ }[];
4600
+ }, {
4601
+ code: number;
4602
+ list: {
4603
+ path: string;
4604
+ name: string;
4605
+ storage: "flash" | "SD0";
4606
+ }[];
4607
+ }>;
4608
+ export type TImageFileData = z.infer<typeof imageFileDataSchema>;
4609
+ export type TFontFileData = z.infer<typeof fontFileDataSchema>;
4610
+ export type TFileData<T extends TFileType> = T extends 'image' ? TImageFileData : TFontFileData;
4330
4611
  export type TOverlayListItem = z.infer<typeof overlaySchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fileDataSchema = exports.fileListSchema = exports.fileSchema = exports.storageResponseSchema = exports.storageDataListSchema = exports.fileStorageTypeSchema = exports.ImageType = exports.isScoreOverview = exports.isBaseballScoreBoardAutomatic = exports.isBaseballScoreBoard = exports.isScoreBoard = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.serviceListSchema = exports.servicesSchema = exports.wsResponseSchema = void 0;
3
+ exports.getFileDataSchema = exports.fontFileDataSchema = exports.imageFileDataSchema = exports.getFileListSchema = exports.fontFileListSchema = exports.imageFileListSchema = exports.getFileSchema = exports.fontFileSchema = exports.imageFileSchema = exports.getStorageResponseSchema = exports.fontStorageResponseSchema = exports.imageStorageResponseSchema = exports.getStorageDataListSchema = exports.fontStorageDataListSchema = exports.imageFilestorageDataListSchema = exports.fontFileStorageTypeSchema = exports.imageFileStorageTypeSchema = exports.ImageType = exports.isScoreOverview = exports.isBaseballScoreBoardAutomatic = exports.isBaseballScoreBoard = exports.isScoreBoard = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.serviceListSchema = exports.servicesSchema = exports.wsResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const infotickerSchema_1 = require("./infotickerSchema");
6
6
  const accuweatherSchema_1 = require("./accuweatherSchema");
@@ -65,28 +65,67 @@ var ImageType;
65
65
  ImageType[ImageType["PNG"] = 0] = "PNG";
66
66
  ImageType[ImageType["JPEG"] = 1] = "JPEG";
67
67
  })(ImageType || (exports.ImageType = ImageType = {}));
68
- exports.fileStorageTypeSchema = zod_1.z.union([
68
+ exports.imageFileStorageTypeSchema = zod_1.z.union([
69
69
  zod_1.z.literal('flash'),
70
70
  zod_1.z.literal('SD0'),
71
71
  zod_1.z.literal('ftp'),
72
72
  zod_1.z.literal('samba'),
73
73
  zod_1.z.literal('url'),
74
74
  ]);
75
- exports.storageDataListSchema = zod_1.z.array(zod_1.z.object({
76
- type: exports.fileStorageTypeSchema,
75
+ exports.fontFileStorageTypeSchema = zod_1.z.union([zod_1.z.literal('flash'), zod_1.z.literal('SD0')]);
76
+ exports.imageFilestorageDataListSchema = zod_1.z.array(zod_1.z.object({
77
+ type: exports.imageFileStorageTypeSchema,
77
78
  state: zod_1.z.string(),
78
79
  }));
79
- exports.storageResponseSchema = zod_1.z.object({
80
+ exports.fontStorageDataListSchema = zod_1.z.array(zod_1.z.object({
81
+ type: exports.fontFileStorageTypeSchema,
82
+ state: zod_1.z.string(),
83
+ }));
84
+ const getStorageDataListSchema = (fileType) => {
85
+ return fileType === 'image' ? exports.imageFilestorageDataListSchema : exports.fontStorageDataListSchema;
86
+ };
87
+ exports.getStorageDataListSchema = getStorageDataListSchema;
88
+ exports.imageStorageResponseSchema = zod_1.z.object({
80
89
  code: zod_1.z.number(),
81
- list: exports.storageDataListSchema,
90
+ list: exports.imageFilestorageDataListSchema,
82
91
  });
83
- exports.fileSchema = zod_1.z.object({
92
+ exports.fontStorageResponseSchema = zod_1.z.object({
93
+ code: zod_1.z.number(),
94
+ list: exports.fontStorageDataListSchema,
95
+ });
96
+ const getStorageResponseSchema = (fileType) => {
97
+ return fileType === 'image' ? exports.imageStorageResponseSchema : exports.fontStorageResponseSchema;
98
+ };
99
+ exports.getStorageResponseSchema = getStorageResponseSchema;
100
+ exports.imageFileSchema = zod_1.z.object({
84
101
  name: zod_1.z.string(),
85
102
  path: zod_1.z.string().url(),
86
- storage: exports.fileStorageTypeSchema,
103
+ storage: exports.imageFileStorageTypeSchema,
104
+ });
105
+ exports.fontFileSchema = zod_1.z.object({
106
+ name: zod_1.z.string(),
107
+ path: zod_1.z.string().url(),
108
+ storage: exports.fontFileStorageTypeSchema,
109
+ });
110
+ const getFileSchema = (fileType) => {
111
+ return fileType === 'image' ? exports.imageFileSchema : exports.fontFileSchema;
112
+ };
113
+ exports.getFileSchema = getFileSchema;
114
+ exports.imageFileListSchema = zod_1.z.array(exports.imageFileSchema);
115
+ exports.fontFileListSchema = zod_1.z.array(exports.fontFileSchema);
116
+ const getFileListSchema = (fileType) => {
117
+ return fileType === 'image' ? exports.imageFileListSchema : exports.fontFileListSchema;
118
+ };
119
+ exports.getFileListSchema = getFileListSchema;
120
+ exports.imageFileDataSchema = zod_1.z.object({
121
+ code: zod_1.z.number(),
122
+ list: exports.imageFileListSchema,
87
123
  });
88
- exports.fileListSchema = zod_1.z.array(exports.fileSchema);
89
- exports.fileDataSchema = zod_1.z.object({
124
+ exports.fontFileDataSchema = zod_1.z.object({
90
125
  code: zod_1.z.number(),
91
- list: exports.fileListSchema,
126
+ list: exports.fontFileListSchema,
92
127
  });
128
+ const getFileDataSchema = (fileType) => {
129
+ return fileType === 'image' ? exports.imageFileDataSchema : exports.fontFileDataSchema;
130
+ };
131
+ exports.getFileDataSchema = getFileDataSchema;
@@ -3,7 +3,7 @@ import { ParsingBlobError, ErrorWithResponse, ServiceNotFoundError, StorageDataF
3
3
  import { networkCameraListSchema } from './types/common';
4
4
  import { z } from 'zod';
5
5
  import { ProxyClient } from './internal/ProxyClient';
6
- import { fileListSchema, ImageType, storageDataListSchema, serviceListSchema, servicesSchema, wsResponseSchema, } from './types/CamOverlayAPI';
6
+ import { ImageType, serviceListSchema, servicesSchema, wsResponseSchema, getStorageDataListSchema, getFileListSchema, } from './types/CamOverlayAPI';
7
7
  const BASE_PATH = '/local/camoverlay/api';
8
8
  export class CamOverlayAPI {
9
9
  client;
@@ -16,6 +16,9 @@ export class CamOverlayAPI {
16
16
  getClient(proxyParams) {
17
17
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
18
18
  }
19
+ async checkAPIAvailable(options) {
20
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
21
+ }
19
22
  async checkCameraTime(options) {
20
23
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
21
24
  return z.boolean().parse(res.state);
@@ -33,7 +36,7 @@ export class CamOverlayAPI {
33
36
  }
34
37
  async listFiles(fileType, options) {
35
38
  const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
36
- return fileListSchema.parse(res.list);
39
+ return getFileListSchema(fileType).parse(res.list);
37
40
  }
38
41
  async uploadFile(fileType, formData, storage, options) {
39
42
  await this._post(`${BASE_PATH}/upload_${fileType}.cgi`, formData, {
@@ -52,7 +55,7 @@ export class CamOverlayAPI {
52
55
  if (res.code !== 200) {
53
56
  throw new StorageDataFetchError(res);
54
57
  }
55
- return storageDataListSchema.parse(res.list);
58
+ return getStorageDataListSchema(fileType).parse(res.list);
56
59
  }
57
60
  async getFilePreviewFromCamera(path, options) {
58
61
  return await this._getBlob(CamOverlayAPI.getFilePreviewPath(path), undefined, options);
@@ -12,6 +12,9 @@ export class CamScripterAPI {
12
12
  getClient(proxyParams) {
13
13
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
14
14
  }
15
+ async checkAPIAvailable(options) {
16
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
17
+ }
15
18
  async checkCameraTime(options) {
16
19
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
17
20
  return cameraTimeResponseSchema.parse(res).state;
@@ -15,6 +15,9 @@ export class CamStreamerAPI {
15
15
  getClient(proxyParams) {
16
16
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
17
17
  }
18
+ async checkAPIAvailable(options) {
19
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
20
+ }
18
21
  async wsAuthorization(options) {
19
22
  const res = await this._getJson(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
20
23
  if (res.status !== 200) {
@@ -22,6 +22,9 @@ export class CamSwitcherAPI {
22
22
  getClient(proxyParams) {
23
23
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
24
24
  }
25
+ async checkAPIAvailable(options) {
26
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
27
+ }
25
28
  async checkCameraTime(options) {
26
29
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
27
30
  return z.boolean().parse(res.data);
@@ -17,6 +17,9 @@ export class PlaneTrackerAPI {
17
17
  getClient(proxyParams) {
18
18
  return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
19
19
  }
20
+ async checkAPIAvailable(options) {
21
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
22
+ }
20
23
  async checkCameraTime(options) {
21
24
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
22
25
  return z.boolean().parse(res.state);
@@ -49,28 +49,62 @@ export var ImageType;
49
49
  ImageType[ImageType["PNG"] = 0] = "PNG";
50
50
  ImageType[ImageType["JPEG"] = 1] = "JPEG";
51
51
  })(ImageType || (ImageType = {}));
52
- export const fileStorageTypeSchema = z.union([
52
+ export const imageFileStorageTypeSchema = z.union([
53
53
  z.literal('flash'),
54
54
  z.literal('SD0'),
55
55
  z.literal('ftp'),
56
56
  z.literal('samba'),
57
57
  z.literal('url'),
58
58
  ]);
59
- export const storageDataListSchema = z.array(z.object({
60
- type: fileStorageTypeSchema,
59
+ export const fontFileStorageTypeSchema = z.union([z.literal('flash'), z.literal('SD0')]);
60
+ export const imageFilestorageDataListSchema = z.array(z.object({
61
+ type: imageFileStorageTypeSchema,
61
62
  state: z.string(),
62
63
  }));
63
- export const storageResponseSchema = z.object({
64
+ export const fontStorageDataListSchema = z.array(z.object({
65
+ type: fontFileStorageTypeSchema,
66
+ state: z.string(),
67
+ }));
68
+ export const getStorageDataListSchema = (fileType) => {
69
+ return fileType === 'image' ? imageFilestorageDataListSchema : fontStorageDataListSchema;
70
+ };
71
+ export const imageStorageResponseSchema = z.object({
64
72
  code: z.number(),
65
- list: storageDataListSchema,
73
+ list: imageFilestorageDataListSchema,
66
74
  });
67
- export const fileSchema = z.object({
75
+ export const fontStorageResponseSchema = z.object({
76
+ code: z.number(),
77
+ list: fontStorageDataListSchema,
78
+ });
79
+ export const getStorageResponseSchema = (fileType) => {
80
+ return fileType === 'image' ? imageStorageResponseSchema : fontStorageResponseSchema;
81
+ };
82
+ export const imageFileSchema = z.object({
68
83
  name: z.string(),
69
84
  path: z.string().url(),
70
- storage: fileStorageTypeSchema,
85
+ storage: imageFileStorageTypeSchema,
86
+ });
87
+ export const fontFileSchema = z.object({
88
+ name: z.string(),
89
+ path: z.string().url(),
90
+ storage: fontFileStorageTypeSchema,
91
+ });
92
+ export const getFileSchema = (fileType) => {
93
+ return fileType === 'image' ? imageFileSchema : fontFileSchema;
94
+ };
95
+ export const imageFileListSchema = z.array(imageFileSchema);
96
+ export const fontFileListSchema = z.array(fontFileSchema);
97
+ export const getFileListSchema = (fileType) => {
98
+ return fileType === 'image' ? imageFileListSchema : fontFileListSchema;
99
+ };
100
+ export const imageFileDataSchema = z.object({
101
+ code: z.number(),
102
+ list: imageFileListSchema,
71
103
  });
72
- export const fileListSchema = z.array(fileSchema);
73
- export const fileDataSchema = z.object({
104
+ export const fontFileDataSchema = z.object({
74
105
  code: z.number(),
75
- list: fileListSchema,
106
+ list: fontFileListSchema,
76
107
  });
108
+ export const getFileDataSchema = (fileType) => {
109
+ return fileType === 'image' ? imageFileDataSchema : fontFileDataSchema;
110
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.106",
3
+ "version": "4.0.0-beta.108",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -1,7 +1,7 @@
1
1
  import { IClient, TBlobResponse, TResponse } from './internal/types';
2
2
  import { THttpRequestOptions, TProxyParams } from './types/common';
3
3
  import { ProxyClient } from './internal/ProxyClient';
4
- import { ImageType, TCoordinates, TField, TFile, TFileType, TFileStorageType, TService } from './types/CamOverlayAPI';
4
+ import { ImageType, TCoordinates, TField, TFile, TFileType, TFileStorageType, TService, TFileList, TStorageDataList } from './types/CamOverlayAPI';
5
5
  export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
6
6
  private client;
7
7
  constructor(client: Client);
@@ -9,6 +9,7 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getFilePreviewPath: (path: string) => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
13
14
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
14
15
  name: string;
@@ -16,17 +17,10 @@ export declare class CamOverlayAPI<Client extends IClient<TResponse, any>> {
16
17
  }[]>;
17
18
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
18
19
  getMjpegStreamImage(mjpegUrl: string, options?: THttpRequestOptions): Promise<TBlobResponse<Client>>;
19
- listFiles(fileType: TFileType, options?: THttpRequestOptions): Promise<{
20
- path: string;
21
- name: string;
22
- storage: "url" | "flash" | "SD0" | "ftp" | "samba";
23
- }[]>;
24
- uploadFile(fileType: TFileType, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType, options?: THttpRequestOptions): Promise<void>;
25
- removeFile(fileType: TFileType, fileParams: TFile, options?: THttpRequestOptions): Promise<void>;
26
- getFileStorage(fileType: TFileType, options?: THttpRequestOptions): Promise<{
27
- type: "url" | "flash" | "SD0" | "ftp" | "samba";
28
- state: string;
29
- }[]>;
20
+ listFiles<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TFileList<T>>;
21
+ uploadFile<T extends TFileType>(fileType: T, formData: Parameters<Client['post']>[0]['data'], storage: TFileStorageType<T>, options?: THttpRequestOptions): Promise<void>;
22
+ removeFile<T extends TFileType>(fileType: T, fileParams: TFile<T>, options?: THttpRequestOptions): Promise<void>;
23
+ getFileStorage<T extends TFileType>(fileType: T, options?: THttpRequestOptions): Promise<TStorageDataList<T>>;
30
24
  getFilePreviewFromCamera(path: string, options?: THttpRequestOptions): Promise<TBlobResponse<Client>>;
31
25
  updateInfoticker(serviceId: number, text: string, options?: THttpRequestOptions): Promise<void>;
32
26
  setEnabled(serviceId: number, enabled: boolean, options?: THttpRequestOptions): Promise<void>;
@@ -6,6 +6,7 @@ export declare class CamScripterAPI<Client extends IClient<TResponse, any>> {
6
6
  constructor(client: Client);
7
7
  static getProxyPath: () => string;
8
8
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
9
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
9
10
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
10
11
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
11
12
  name: string;
@@ -9,6 +9,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getWsEventsPath: () => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
13
14
  getUtcTime(options?: THttpRequestOptions): Promise<number>;
14
15
  getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
@@ -14,6 +14,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
14
14
  static getWsEventsPath: () => string;
15
15
  static getClipPreviewPath: (clipId: string, storage: TStorageType) => string;
16
16
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
17
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
17
18
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
18
19
  getNetworkCameraList(options?: THttpRequestOptions): Promise<{
19
20
  name: string;
@@ -9,6 +9,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
9
9
  static getProxyPath: () => string;
10
10
  static getWsEventsPath: () => string;
11
11
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
12
+ checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
12
13
  checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
13
14
  serverRunCheck(options?: THttpRequestOptions): Promise<TResponse>;
14
15
  getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
@@ -4229,9 +4229,12 @@ export declare enum ImageType {
4229
4229
  PNG = 0,
4230
4230
  JPEG = 1
4231
4231
  }
4232
- export declare const fileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4233
- export type TFileStorageType = z.infer<typeof fileStorageTypeSchema>;
4234
- export declare const storageDataListSchema: z.ZodArray<z.ZodObject<{
4232
+ export declare const imageFileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4233
+ export declare const fontFileStorageTypeSchema: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4234
+ export type TImageFileStorageType = z.infer<typeof imageFileStorageTypeSchema>;
4235
+ export type TFontFileStorageType = z.infer<typeof fontFileStorageTypeSchema>;
4236
+ export type TFileStorageType<T extends TFileType> = T extends 'image' ? TImageFileStorageType : TFontFileStorageType;
4237
+ export declare const imageFilestorageDataListSchema: z.ZodArray<z.ZodObject<{
4235
4238
  type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4236
4239
  state: z.ZodString;
4237
4240
  }, "strip", z.ZodTypeAny, {
@@ -4241,8 +4244,89 @@ export declare const storageDataListSchema: z.ZodArray<z.ZodObject<{
4241
4244
  type: "url" | "flash" | "SD0" | "ftp" | "samba";
4242
4245
  state: string;
4243
4246
  }>, "many">;
4244
- export type TStorageDataList = z.infer<typeof storageDataListSchema>;
4245
- export declare const storageResponseSchema: z.ZodObject<{
4247
+ export declare const fontStorageDataListSchema: z.ZodArray<z.ZodObject<{
4248
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4249
+ state: z.ZodString;
4250
+ }, "strip", z.ZodTypeAny, {
4251
+ type: "flash" | "SD0";
4252
+ state: string;
4253
+ }, {
4254
+ type: "flash" | "SD0";
4255
+ state: string;
4256
+ }>, "many">;
4257
+ export declare const getStorageDataListSchema: (fileType: TFileType) => z.ZodArray<z.ZodObject<{
4258
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4259
+ state: z.ZodString;
4260
+ }, "strip", z.ZodTypeAny, {
4261
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4262
+ state: string;
4263
+ }, {
4264
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4265
+ state: string;
4266
+ }>, "many"> | z.ZodArray<z.ZodObject<{
4267
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4268
+ state: z.ZodString;
4269
+ }, "strip", z.ZodTypeAny, {
4270
+ type: "flash" | "SD0";
4271
+ state: string;
4272
+ }, {
4273
+ type: "flash" | "SD0";
4274
+ state: string;
4275
+ }>, "many">;
4276
+ export type TImageStorageDataList = z.infer<typeof imageFilestorageDataListSchema>;
4277
+ export type TFontStorageDataList = z.infer<typeof fontStorageDataListSchema>;
4278
+ export type TStorageDataList<T extends TFileType> = T extends 'image' ? TImageStorageDataList : TFontStorageDataList;
4279
+ export declare const imageStorageResponseSchema: z.ZodObject<{
4280
+ code: z.ZodNumber;
4281
+ list: z.ZodArray<z.ZodObject<{
4282
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4283
+ state: z.ZodString;
4284
+ }, "strip", z.ZodTypeAny, {
4285
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4286
+ state: string;
4287
+ }, {
4288
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4289
+ state: string;
4290
+ }>, "many">;
4291
+ }, "strip", z.ZodTypeAny, {
4292
+ code: number;
4293
+ list: {
4294
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4295
+ state: string;
4296
+ }[];
4297
+ }, {
4298
+ code: number;
4299
+ list: {
4300
+ type: "url" | "flash" | "SD0" | "ftp" | "samba";
4301
+ state: string;
4302
+ }[];
4303
+ }>;
4304
+ export declare const fontStorageResponseSchema: z.ZodObject<{
4305
+ code: z.ZodNumber;
4306
+ list: z.ZodArray<z.ZodObject<{
4307
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4308
+ state: z.ZodString;
4309
+ }, "strip", z.ZodTypeAny, {
4310
+ type: "flash" | "SD0";
4311
+ state: string;
4312
+ }, {
4313
+ type: "flash" | "SD0";
4314
+ state: string;
4315
+ }>, "many">;
4316
+ }, "strip", z.ZodTypeAny, {
4317
+ code: number;
4318
+ list: {
4319
+ type: "flash" | "SD0";
4320
+ state: string;
4321
+ }[];
4322
+ }, {
4323
+ code: number;
4324
+ list: {
4325
+ type: "flash" | "SD0";
4326
+ state: string;
4327
+ }[];
4328
+ }>;
4329
+ export declare const getStorageResponseSchema: (fileType: TFileType) => z.ZodObject<{
4246
4330
  code: z.ZodNumber;
4247
4331
  list: z.ZodArray<z.ZodObject<{
4248
4332
  type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4266,9 +4350,35 @@ export declare const storageResponseSchema: z.ZodObject<{
4266
4350
  type: "url" | "flash" | "SD0" | "ftp" | "samba";
4267
4351
  state: string;
4268
4352
  }[];
4353
+ }> | z.ZodObject<{
4354
+ code: z.ZodNumber;
4355
+ list: z.ZodArray<z.ZodObject<{
4356
+ type: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4357
+ state: z.ZodString;
4358
+ }, "strip", z.ZodTypeAny, {
4359
+ type: "flash" | "SD0";
4360
+ state: string;
4361
+ }, {
4362
+ type: "flash" | "SD0";
4363
+ state: string;
4364
+ }>, "many">;
4365
+ }, "strip", z.ZodTypeAny, {
4366
+ code: number;
4367
+ list: {
4368
+ type: "flash" | "SD0";
4369
+ state: string;
4370
+ }[];
4371
+ }, {
4372
+ code: number;
4373
+ list: {
4374
+ type: "flash" | "SD0";
4375
+ state: string;
4376
+ }[];
4269
4377
  }>;
4270
- export type TStorageResponse = z.infer<typeof storageResponseSchema>;
4271
- export declare const fileSchema: z.ZodObject<{
4378
+ export type TImageStorageResponse = z.infer<typeof imageStorageResponseSchema>;
4379
+ export type TFontStorageResponse = z.infer<typeof fontStorageResponseSchema>;
4380
+ export type TStorageResponse<T extends TFileType> = T extends 'image' ? TImageStorageResponse : TFontStorageResponse;
4381
+ export declare const imageFileSchema: z.ZodObject<{
4272
4382
  name: z.ZodString;
4273
4383
  path: z.ZodString;
4274
4384
  storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4281,8 +4391,20 @@ export declare const fileSchema: z.ZodObject<{
4281
4391
  name: string;
4282
4392
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4283
4393
  }>;
4284
- export type TFile = z.infer<typeof fileSchema>;
4285
- export declare const fileListSchema: z.ZodArray<z.ZodObject<{
4394
+ export declare const fontFileSchema: z.ZodObject<{
4395
+ name: z.ZodString;
4396
+ path: z.ZodString;
4397
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4398
+ }, "strip", z.ZodTypeAny, {
4399
+ path: string;
4400
+ name: string;
4401
+ storage: "flash" | "SD0";
4402
+ }, {
4403
+ path: string;
4404
+ name: string;
4405
+ storage: "flash" | "SD0";
4406
+ }>;
4407
+ export declare const getFileSchema: (fileType: TFileType) => z.ZodObject<{
4286
4408
  name: z.ZodString;
4287
4409
  path: z.ZodString;
4288
4410
  storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
@@ -4294,9 +4416,77 @@ export declare const fileListSchema: z.ZodArray<z.ZodObject<{
4294
4416
  path: string;
4295
4417
  name: string;
4296
4418
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4419
+ }> | z.ZodObject<{
4420
+ name: z.ZodString;
4421
+ path: z.ZodString;
4422
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4423
+ }, "strip", z.ZodTypeAny, {
4424
+ path: string;
4425
+ name: string;
4426
+ storage: "flash" | "SD0";
4427
+ }, {
4428
+ path: string;
4429
+ name: string;
4430
+ storage: "flash" | "SD0";
4431
+ }>;
4432
+ export type TImageFile = z.infer<typeof imageFileSchema>;
4433
+ export type TFontFile = z.infer<typeof fontFileSchema>;
4434
+ export type TFile<T extends TFileType> = T extends 'image' ? TImageFile : TFontFile;
4435
+ export declare const imageFileListSchema: z.ZodArray<z.ZodObject<{
4436
+ name: z.ZodString;
4437
+ path: z.ZodString;
4438
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4439
+ }, "strip", z.ZodTypeAny, {
4440
+ path: string;
4441
+ name: string;
4442
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4443
+ }, {
4444
+ path: string;
4445
+ name: string;
4446
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4447
+ }>, "many">;
4448
+ export declare const fontFileListSchema: z.ZodArray<z.ZodObject<{
4449
+ name: z.ZodString;
4450
+ path: z.ZodString;
4451
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4452
+ }, "strip", z.ZodTypeAny, {
4453
+ path: string;
4454
+ name: string;
4455
+ storage: "flash" | "SD0";
4456
+ }, {
4457
+ path: string;
4458
+ name: string;
4459
+ storage: "flash" | "SD0";
4460
+ }>, "many">;
4461
+ export declare const getFileListSchema: (fileType: TFileType) => z.ZodArray<z.ZodObject<{
4462
+ name: z.ZodString;
4463
+ path: z.ZodString;
4464
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4465
+ }, "strip", z.ZodTypeAny, {
4466
+ path: string;
4467
+ name: string;
4468
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4469
+ }, {
4470
+ path: string;
4471
+ name: string;
4472
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4473
+ }>, "many"> | z.ZodArray<z.ZodObject<{
4474
+ name: z.ZodString;
4475
+ path: z.ZodString;
4476
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4477
+ }, "strip", z.ZodTypeAny, {
4478
+ path: string;
4479
+ name: string;
4480
+ storage: "flash" | "SD0";
4481
+ }, {
4482
+ path: string;
4483
+ name: string;
4484
+ storage: "flash" | "SD0";
4297
4485
  }>, "many">;
4298
- export type TFileList = z.infer<typeof fileListSchema>;
4299
- export declare const fileDataSchema: z.ZodObject<{
4486
+ export type TImageFileList = z.infer<typeof imageFileListSchema>;
4487
+ export type TFontFileList = z.infer<typeof fontFileListSchema>;
4488
+ export type TFileList<T extends TFileType> = T extends 'image' ? TImageFileList : TFontFileList;
4489
+ export declare const imageFileDataSchema: z.ZodObject<{
4300
4490
  code: z.ZodNumber;
4301
4491
  list: z.ZodArray<z.ZodObject<{
4302
4492
  name: z.ZodString;
@@ -4326,5 +4516,96 @@ export declare const fileDataSchema: z.ZodObject<{
4326
4516
  storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4327
4517
  }[];
4328
4518
  }>;
4329
- export type TFileData = z.infer<typeof fileDataSchema>;
4519
+ export declare const fontFileDataSchema: z.ZodObject<{
4520
+ code: z.ZodNumber;
4521
+ list: z.ZodArray<z.ZodObject<{
4522
+ name: z.ZodString;
4523
+ path: z.ZodString;
4524
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4525
+ }, "strip", z.ZodTypeAny, {
4526
+ path: string;
4527
+ name: string;
4528
+ storage: "flash" | "SD0";
4529
+ }, {
4530
+ path: string;
4531
+ name: string;
4532
+ storage: "flash" | "SD0";
4533
+ }>, "many">;
4534
+ }, "strip", z.ZodTypeAny, {
4535
+ code: number;
4536
+ list: {
4537
+ path: string;
4538
+ name: string;
4539
+ storage: "flash" | "SD0";
4540
+ }[];
4541
+ }, {
4542
+ code: number;
4543
+ list: {
4544
+ path: string;
4545
+ name: string;
4546
+ storage: "flash" | "SD0";
4547
+ }[];
4548
+ }>;
4549
+ export declare const getFileDataSchema: (fileType: TFileType) => z.ZodObject<{
4550
+ code: z.ZodNumber;
4551
+ list: z.ZodArray<z.ZodObject<{
4552
+ name: z.ZodString;
4553
+ path: z.ZodString;
4554
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">, z.ZodLiteral<"ftp">, z.ZodLiteral<"samba">, z.ZodLiteral<"url">]>;
4555
+ }, "strip", z.ZodTypeAny, {
4556
+ path: string;
4557
+ name: string;
4558
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4559
+ }, {
4560
+ path: string;
4561
+ name: string;
4562
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4563
+ }>, "many">;
4564
+ }, "strip", z.ZodTypeAny, {
4565
+ code: number;
4566
+ list: {
4567
+ path: string;
4568
+ name: string;
4569
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4570
+ }[];
4571
+ }, {
4572
+ code: number;
4573
+ list: {
4574
+ path: string;
4575
+ name: string;
4576
+ storage: "url" | "flash" | "SD0" | "ftp" | "samba";
4577
+ }[];
4578
+ }> | z.ZodObject<{
4579
+ code: z.ZodNumber;
4580
+ list: z.ZodArray<z.ZodObject<{
4581
+ name: z.ZodString;
4582
+ path: z.ZodString;
4583
+ storage: z.ZodUnion<[z.ZodLiteral<"flash">, z.ZodLiteral<"SD0">]>;
4584
+ }, "strip", z.ZodTypeAny, {
4585
+ path: string;
4586
+ name: string;
4587
+ storage: "flash" | "SD0";
4588
+ }, {
4589
+ path: string;
4590
+ name: string;
4591
+ storage: "flash" | "SD0";
4592
+ }>, "many">;
4593
+ }, "strip", z.ZodTypeAny, {
4594
+ code: number;
4595
+ list: {
4596
+ path: string;
4597
+ name: string;
4598
+ storage: "flash" | "SD0";
4599
+ }[];
4600
+ }, {
4601
+ code: number;
4602
+ list: {
4603
+ path: string;
4604
+ name: string;
4605
+ storage: "flash" | "SD0";
4606
+ }[];
4607
+ }>;
4608
+ export type TImageFileData = z.infer<typeof imageFileDataSchema>;
4609
+ export type TFontFileData = z.infer<typeof fontFileDataSchema>;
4610
+ export type TFileData<T extends TFileType> = T extends 'image' ? TImageFileData : TFontFileData;
4330
4611
  export type TOverlayListItem = z.infer<typeof overlaySchema>;