camstreamerlib 4.0.0-beta.150 → 4.0.0-beta.152

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.
@@ -162,4 +162,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
162
162
  downloadReport(options?: THttpRequestOptions): Promise<string>;
163
163
  private setParamFromCameraJSON;
164
164
  private getParamFromCameraAndJSONParse;
165
+ getUploadedFileList(clipName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<string[]>;
166
+ downloadClipFile(fileName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
167
+ uploadClipFiles(files: File[], storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
165
168
  }
@@ -285,6 +285,20 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
285
285
  }
286
286
  throw new errors_1.ParameterNotFoundError(paramName);
287
287
  }
288
+ async getUploadedFileList(clipName, storage, options) {
289
+ const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
290
+ return CamSwitcherAPI_1.clipFilesListSchema.parse(res).data.files;
291
+ }
292
+ async downloadClipFile(fileName, storage, options) {
293
+ return await this._getBlob(`${BASE_PATH}/clip_download_file.cgi`, { file_name: fileName, storage }, options);
294
+ }
295
+ async uploadClipFiles(files, storage, options) {
296
+ const formData = new FormData();
297
+ for (const file of files) {
298
+ formData.append(file.name, file);
299
+ }
300
+ await this._post(`${BASE_PATH}/clip_upload_file.cgi`, formData, { storage }, options);
301
+ }
288
302
  }
289
303
  exports.CamSwitcherAPI = CamSwitcherAPI;
290
304
  const CSW_PARAM_NAMES = {
package/cjs/VapixAPI.js CHANGED
@@ -377,7 +377,7 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
377
377
  method: 'getPorts',
378
378
  }, undefined, options);
379
379
  const portResponseParsed = VapixAPI_1.getPortsResponseSchema.parse(await res.json());
380
- return portResponseParsed.data.items;
380
+ return portResponseParsed.data.items ?? [];
381
381
  }
382
382
  async setPorts(ports, options) {
383
383
  await this._postJsonEncoded('/axis-cgi/io/portmanagement.cgi', {
@@ -871,4 +871,28 @@ export declare const secondaryAudioSettingsSchema: z.ZodObject<{
871
871
  clipName?: string | undefined;
872
872
  }>;
873
873
  export type TSecondaryAudioSettings = z.infer<typeof secondaryAudioSettingsSchema>;
874
+ export declare const clipFilesListSchema: z.ZodObject<{
875
+ status: z.ZodNumber;
876
+ message: z.ZodString;
877
+ data: z.ZodObject<{
878
+ files: z.ZodArray<z.ZodString, "many">;
879
+ }, "strip", z.ZodTypeAny, {
880
+ files: string[];
881
+ }, {
882
+ files: string[];
883
+ }>;
884
+ }, "strip", z.ZodTypeAny, {
885
+ status: number;
886
+ message: string;
887
+ data: {
888
+ files: string[];
889
+ };
890
+ }, {
891
+ status: number;
892
+ message: string;
893
+ data: {
894
+ files: string[];
895
+ };
896
+ }>;
897
+ export type TClipFilesList = z.infer<typeof clipFilesListSchema>;
874
898
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.clipListSchema = exports.playlistQueueSchema = exports.trackerSaveLoadSchema = exports.trackerSaveSchema = exports.playlistSaveLoadSchema = exports.clipSaveLoadSchema = exports.clipSaveSchema = exports.streamSaveLoadSchema = exports.audioPushInfoSchema = exports.outputInfoSchema = exports.storageInfoListSchema = void 0;
3
+ exports.clipFilesListSchema = exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.clipListSchema = exports.playlistQueueSchema = exports.trackerSaveLoadSchema = exports.trackerSaveSchema = exports.playlistSaveLoadSchema = exports.clipSaveLoadSchema = exports.clipSaveSchema = exports.streamSaveLoadSchema = exports.audioPushInfoSchema = exports.outputInfoSchema = exports.storageInfoListSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const transformers_1 = require("../internal/transformers");
6
6
  const common_1 = require("./common");
@@ -165,3 +165,10 @@ exports.secondaryAudioSettingsSchema = zod_1.z.object({
165
165
  secondaryAudioLevel: zod_1.z.number(),
166
166
  masterAudioLevel: zod_1.z.number(),
167
167
  });
168
+ exports.clipFilesListSchema = zod_1.z.object({
169
+ status: zod_1.z.number(),
170
+ message: zod_1.z.string(),
171
+ data: zod_1.z.object({
172
+ files: zod_1.z.array(zod_1.z.string()),
173
+ }),
174
+ });
@@ -1742,7 +1742,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1742
1742
  method: z.ZodLiteral<"getPorts">;
1743
1743
  data: z.ZodObject<{
1744
1744
  numberOfPorts: z.ZodNumber;
1745
- items: z.ZodArray<z.ZodObject<{
1745
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
1746
1746
  port: z.ZodString;
1747
1747
  state: z.ZodEnum<["open", "closed"]>;
1748
1748
  configurable: z.ZodBoolean;
@@ -1769,10 +1769,10 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1769
1769
  usage: string;
1770
1770
  normalState: "open" | "closed";
1771
1771
  readonly?: boolean | undefined;
1772
- }>, "many">;
1772
+ }>, "many">>;
1773
1773
  }, "strip", z.ZodTypeAny, {
1774
1774
  numberOfPorts: number;
1775
- items: {
1775
+ items?: {
1776
1776
  name: string;
1777
1777
  port: string;
1778
1778
  direction: "output" | "input";
@@ -1781,10 +1781,10 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1781
1781
  usage: string;
1782
1782
  normalState: "open" | "closed";
1783
1783
  readonly?: boolean | undefined;
1784
- }[];
1784
+ }[] | undefined;
1785
1785
  }, {
1786
1786
  numberOfPorts: number;
1787
- items: {
1787
+ items?: {
1788
1788
  name: string;
1789
1789
  port: string;
1790
1790
  direction: "output" | "input";
@@ -1793,12 +1793,12 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1793
1793
  usage: string;
1794
1794
  normalState: "open" | "closed";
1795
1795
  readonly?: boolean | undefined;
1796
- }[];
1796
+ }[] | undefined;
1797
1797
  }>;
1798
1798
  }, "strip", z.ZodTypeAny, {
1799
1799
  data: {
1800
1800
  numberOfPorts: number;
1801
- items: {
1801
+ items?: {
1802
1802
  name: string;
1803
1803
  port: string;
1804
1804
  direction: "output" | "input";
@@ -1807,7 +1807,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1807
1807
  usage: string;
1808
1808
  normalState: "open" | "closed";
1809
1809
  readonly?: boolean | undefined;
1810
- }[];
1810
+ }[] | undefined;
1811
1811
  };
1812
1812
  apiVersion: string;
1813
1813
  context: string;
@@ -1815,7 +1815,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1815
1815
  }, {
1816
1816
  data: {
1817
1817
  numberOfPorts: number;
1818
- items: {
1818
+ items?: {
1819
1819
  name: string;
1820
1820
  port: string;
1821
1821
  direction: "output" | "input";
@@ -1824,7 +1824,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1824
1824
  usage: string;
1825
1825
  normalState: "open" | "closed";
1826
1826
  readonly?: boolean | undefined;
1827
- }[];
1827
+ }[] | undefined;
1828
1828
  };
1829
1829
  apiVersion: string;
1830
1830
  context: string;
@@ -172,7 +172,7 @@ exports.getPortsResponseSchema = zod_1.z.object({
172
172
  method: zod_1.z.literal('getPorts'),
173
173
  data: zod_1.z.object({
174
174
  numberOfPorts: zod_1.z.number(),
175
- items: zod_1.z.array(exports.portStatusSchema),
175
+ items: zod_1.z.array(exports.portStatusSchema).optional(),
176
176
  }),
177
177
  });
178
178
  exports.portSetSchema = zod_1.z.object({
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { AddNewClipError, JsonParseError, ParameterNotFoundError } from './errors/errors';
3
3
  import { parseBitrateOptionsToVapixParams, parseVapixParamsToBitrateOptions } from './internal/convertors';
4
4
  import { isClip, isNullish } from './internal/utils';
5
- import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, } from './types/CamSwitcherAPI';
5
+ import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, clipFilesListSchema, } from './types/CamSwitcherAPI';
6
6
  import { networkCameraListSchema, } from './types/common';
7
7
  import { VapixAPI } from './VapixAPI';
8
8
  import { BasicAPI } from './internal/BasicAPI';
@@ -282,6 +282,20 @@ export class CamSwitcherAPI extends BasicAPI {
282
282
  }
283
283
  throw new ParameterNotFoundError(paramName);
284
284
  }
285
+ async getUploadedFileList(clipName, storage, options) {
286
+ const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
287
+ return clipFilesListSchema.parse(res).data.files;
288
+ }
289
+ async downloadClipFile(fileName, storage, options) {
290
+ return await this._getBlob(`${BASE_PATH}/clip_download_file.cgi`, { file_name: fileName, storage }, options);
291
+ }
292
+ async uploadClipFiles(files, storage, options) {
293
+ const formData = new FormData();
294
+ for (const file of files) {
295
+ formData.append(file.name, file);
296
+ }
297
+ await this._post(`${BASE_PATH}/clip_upload_file.cgi`, formData, { storage }, options);
298
+ }
285
299
  }
286
300
  const CSW_PARAM_NAMES = {
287
301
  SETTINGS: 'Camswitcher.Settings',
package/esm/VapixAPI.js CHANGED
@@ -374,7 +374,7 @@ export class VapixAPI extends BasicAPI {
374
374
  method: 'getPorts',
375
375
  }, undefined, options);
376
376
  const portResponseParsed = getPortsResponseSchema.parse(await res.json());
377
- return portResponseParsed.data.items;
377
+ return portResponseParsed.data.items ?? [];
378
378
  }
379
379
  async setPorts(ports, options) {
380
380
  await this._postJsonEncoded('/axis-cgi/io/portmanagement.cgi', {
@@ -162,3 +162,10 @@ export const secondaryAudioSettingsSchema = z.object({
162
162
  secondaryAudioLevel: z.number(),
163
163
  masterAudioLevel: z.number(),
164
164
  });
165
+ export const clipFilesListSchema = z.object({
166
+ status: z.number(),
167
+ message: z.string(),
168
+ data: z.object({
169
+ files: z.array(z.string()),
170
+ }),
171
+ });
@@ -169,7 +169,7 @@ export const getPortsResponseSchema = z.object({
169
169
  method: z.literal('getPorts'),
170
170
  data: z.object({
171
171
  numberOfPorts: z.number(),
172
- items: z.array(portStatusSchema),
172
+ items: z.array(portStatusSchema).optional(),
173
173
  }),
174
174
  });
175
175
  export const portSetSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.150",
3
+ "version": "4.0.0-beta.152",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -162,4 +162,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
162
162
  downloadReport(options?: THttpRequestOptions): Promise<string>;
163
163
  private setParamFromCameraJSON;
164
164
  private getParamFromCameraAndJSONParse;
165
+ getUploadedFileList(clipName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<string[]>;
166
+ downloadClipFile(fileName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
167
+ uploadClipFiles(files: File[], storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
165
168
  }
@@ -871,4 +871,28 @@ export declare const secondaryAudioSettingsSchema: z.ZodObject<{
871
871
  clipName?: string | undefined;
872
872
  }>;
873
873
  export type TSecondaryAudioSettings = z.infer<typeof secondaryAudioSettingsSchema>;
874
+ export declare const clipFilesListSchema: z.ZodObject<{
875
+ status: z.ZodNumber;
876
+ message: z.ZodString;
877
+ data: z.ZodObject<{
878
+ files: z.ZodArray<z.ZodString, "many">;
879
+ }, "strip", z.ZodTypeAny, {
880
+ files: string[];
881
+ }, {
882
+ files: string[];
883
+ }>;
884
+ }, "strip", z.ZodTypeAny, {
885
+ status: number;
886
+ message: string;
887
+ data: {
888
+ files: string[];
889
+ };
890
+ }, {
891
+ status: number;
892
+ message: string;
893
+ data: {
894
+ files: string[];
895
+ };
896
+ }>;
897
+ export type TClipFilesList = z.infer<typeof clipFilesListSchema>;
874
898
  export {};
@@ -1742,7 +1742,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1742
1742
  method: z.ZodLiteral<"getPorts">;
1743
1743
  data: z.ZodObject<{
1744
1744
  numberOfPorts: z.ZodNumber;
1745
- items: z.ZodArray<z.ZodObject<{
1745
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
1746
1746
  port: z.ZodString;
1747
1747
  state: z.ZodEnum<["open", "closed"]>;
1748
1748
  configurable: z.ZodBoolean;
@@ -1769,10 +1769,10 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1769
1769
  usage: string;
1770
1770
  normalState: "open" | "closed";
1771
1771
  readonly?: boolean | undefined;
1772
- }>, "many">;
1772
+ }>, "many">>;
1773
1773
  }, "strip", z.ZodTypeAny, {
1774
1774
  numberOfPorts: number;
1775
- items: {
1775
+ items?: {
1776
1776
  name: string;
1777
1777
  port: string;
1778
1778
  direction: "output" | "input";
@@ -1781,10 +1781,10 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1781
1781
  usage: string;
1782
1782
  normalState: "open" | "closed";
1783
1783
  readonly?: boolean | undefined;
1784
- }[];
1784
+ }[] | undefined;
1785
1785
  }, {
1786
1786
  numberOfPorts: number;
1787
- items: {
1787
+ items?: {
1788
1788
  name: string;
1789
1789
  port: string;
1790
1790
  direction: "output" | "input";
@@ -1793,12 +1793,12 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1793
1793
  usage: string;
1794
1794
  normalState: "open" | "closed";
1795
1795
  readonly?: boolean | undefined;
1796
- }[];
1796
+ }[] | undefined;
1797
1797
  }>;
1798
1798
  }, "strip", z.ZodTypeAny, {
1799
1799
  data: {
1800
1800
  numberOfPorts: number;
1801
- items: {
1801
+ items?: {
1802
1802
  name: string;
1803
1803
  port: string;
1804
1804
  direction: "output" | "input";
@@ -1807,7 +1807,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1807
1807
  usage: string;
1808
1808
  normalState: "open" | "closed";
1809
1809
  readonly?: boolean | undefined;
1810
- }[];
1810
+ }[] | undefined;
1811
1811
  };
1812
1812
  apiVersion: string;
1813
1813
  context: string;
@@ -1815,7 +1815,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1815
1815
  }, {
1816
1816
  data: {
1817
1817
  numberOfPorts: number;
1818
- items: {
1818
+ items?: {
1819
1819
  name: string;
1820
1820
  port: string;
1821
1821
  direction: "output" | "input";
@@ -1824,7 +1824,7 @@ export declare const getPortsResponseSchema: z.ZodObject<{
1824
1824
  usage: string;
1825
1825
  normalState: "open" | "closed";
1826
1826
  readonly?: boolean | undefined;
1827
- }[];
1827
+ }[] | undefined;
1828
1828
  };
1829
1829
  apiVersion: string;
1830
1830
  context: string;