camstreamerlib 4.0.27-c8f267f → 4.0.28-f67e7db

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.
@@ -9,6 +9,7 @@ const CamSwitcherAPI_1 = require("./types/CamSwitcherAPI");
9
9
  const common_1 = require("./types/common");
10
10
  const VapixAPI_1 = require("./VapixAPI");
11
11
  const BasicAPI_1 = require("./internal/BasicAPI");
12
+ const helpers_1 = require("./helpers");
12
13
  const BASE_PATH = '/local/camswitcher/api';
13
14
  class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
14
15
  CustomFormData;
@@ -273,20 +274,7 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
273
274
  if (data[paramName] === undefined) {
274
275
  throw new errors_1.ParameterNotFoundError(paramName);
275
276
  }
276
- if (data[paramName] === '') {
277
- return {};
278
- }
279
- try {
280
- return JSON.parse(data[paramName] + '');
281
- }
282
- catch {
283
- try {
284
- return JSON.parse(decodeURIComponent((data[paramName] + '').replaceAll('\\', '')));
285
- }
286
- catch (e) {
287
- throw new errors_1.JsonParseError(paramName, data[paramName]);
288
- }
289
- }
277
+ return (0, helpers_1.jsonParseCameraParam)(data[paramName] + '', paramName);
290
278
  }
291
279
  async getUploadedFileList(clipName, storage, options) {
292
280
  const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
@@ -40,7 +40,6 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
40
40
  cameraCalibrationProcessConfig: {
41
41
  nightSkyCalibrationEnabled: boolean;
42
42
  scheduleNightSkyCalibrationTimestamp: number;
43
- nightSkyCalibrationRepeatCount: number;
44
43
  nightSkyCalibrationFocusValue: number;
45
44
  focusCalibrationPoints: string;
46
45
  };
package/cjs/VapixAPI.js CHANGED
@@ -76,7 +76,13 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
76
76
  const jsonData = { apiVersion: '1.0', method: 'list' };
77
77
  const res = await this._postJsonEncoded(path, jsonData, undefined, options);
78
78
  const encoders = VapixAPI_1.audioSampleRatesResponseSchema.parse(await res.json()).data.encoders;
79
- return encoders.aac ?? encoders.AAC ?? [];
79
+ const data = encoders.aac ?? encoders.AAC ?? [];
80
+ return data.map((item) => {
81
+ return {
82
+ sampleRate: item.sample_rate,
83
+ bitRates: item.bit_rates,
84
+ };
85
+ });
80
86
  }
81
87
  async performAutofocus(options) {
82
88
  try {
@@ -0,0 +1 @@
1
+ export declare const jsonParseCameraParam: (param: string, paramName: string) => any;
package/cjs/helpers.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonParseCameraParam = void 0;
4
+ const errors_1 = require("./errors/errors");
5
+ const jsonParseCameraParam = (param, paramName) => {
6
+ if (param === '') {
7
+ return {};
8
+ }
9
+ try {
10
+ return JSON.parse(param);
11
+ }
12
+ catch {
13
+ try {
14
+ return JSON.parse(decodeURIComponent(param.replaceAll('\\', '')));
15
+ }
16
+ catch (e) {
17
+ throw new errors_1.JsonParseError(paramName, param);
18
+ }
19
+ }
20
+ };
21
+ exports.jsonParseCameraParam = jsonParseCameraParam;
package/cjs/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export { CamScripterAPI } from './CamScripterAPI';
26
26
  export * from './types/CamScripterAPI';
27
27
  export { VapixAPI } from './VapixAPI';
28
28
  export * from './types/VapixAPI';
29
+ export * from './helpers';
package/cjs/index.js CHANGED
@@ -53,3 +53,4 @@ __exportStar(require("./types/CamScripterAPI"), exports);
53
53
  var VapixAPI_1 = require("./VapixAPI");
54
54
  Object.defineProperty(exports, "VapixAPI", { enumerable: true, get: function () { return VapixAPI_1.VapixAPI; } });
55
55
  __exportStar(require("./types/VapixAPI"), exports);
56
+ __exportStar(require("./helpers"), exports);
@@ -77,7 +77,7 @@ const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
77
77
  const nbrOfChannels = video.nbrOfChannels ? (video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '') : '';
78
78
  const audioParams = `audio=${video.audio}${nbrOfChannels}`;
79
79
  const videoCodecParams = video.videoCodec === 'h264'
80
- ? `videocodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
80
+ ? `videocodec=${video.videoCodec}&h264profile=${video.h264Profile}`
81
81
  : `videocodec=${video.videoCodec}`;
82
82
  const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
83
83
  return [videoParams, bitrateParams, audioParams].join('&');
@@ -92,7 +92,7 @@ const parseVapixParamsToVideoOptions = (internalVapixParams) => {
92
92
  });
93
93
  let h264Profile = undefined;
94
94
  if (params['videocodec'] === 'h264') {
95
- h264Profile = (params['h264Profile'] ?? 'high');
95
+ h264Profile = (params['h264profile'] ?? params['h264Profile'] ?? 'high');
96
96
  }
97
97
  let nbrOfChannels = undefined;
98
98
  if (params['audio'] === '1') {
@@ -116,19 +116,16 @@ export declare const cameraSettingsSchema: z.ZodObject<{
116
116
  cameraCalibrationProcessConfig: z.ZodDefault<z.ZodObject<{
117
117
  nightSkyCalibrationEnabled: z.ZodBoolean;
118
118
  scheduleNightSkyCalibrationTimestamp: z.ZodNumber;
119
- nightSkyCalibrationRepeatCount: z.ZodDefault<z.ZodNumber>;
120
119
  nightSkyCalibrationFocusValue: z.ZodDefault<z.ZodNumber>;
121
120
  focusCalibrationPoints: z.ZodDefault<z.ZodString>;
122
121
  }, "strip", z.ZodTypeAny, {
123
122
  nightSkyCalibrationEnabled: boolean;
124
123
  scheduleNightSkyCalibrationTimestamp: number;
125
- nightSkyCalibrationRepeatCount: number;
126
124
  nightSkyCalibrationFocusValue: number;
127
125
  focusCalibrationPoints: string;
128
126
  }, {
129
127
  nightSkyCalibrationEnabled: boolean;
130
128
  scheduleNightSkyCalibrationTimestamp: number;
131
- nightSkyCalibrationRepeatCount?: number | undefined;
132
129
  nightSkyCalibrationFocusValue?: number | undefined;
133
130
  focusCalibrationPoints?: string | undefined;
134
131
  }>>;
@@ -455,7 +452,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
455
452
  cameraCalibrationProcessConfig: {
456
453
  nightSkyCalibrationEnabled: boolean;
457
454
  scheduleNightSkyCalibrationTimestamp: number;
458
- nightSkyCalibrationRepeatCount: number;
459
455
  nightSkyCalibrationFocusValue: number;
460
456
  focusCalibrationPoints: string;
461
457
  };
@@ -589,7 +585,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
589
585
  cameraCalibrationProcessConfig?: {
590
586
  nightSkyCalibrationEnabled: boolean;
591
587
  scheduleNightSkyCalibrationTimestamp: number;
592
- nightSkyCalibrationRepeatCount?: number | undefined;
593
588
  nightSkyCalibrationFocusValue?: number | undefined;
594
589
  focusCalibrationPoints?: string | undefined;
595
590
  } | undefined;
@@ -73,14 +73,12 @@ exports.cameraSettingsSchema = zod_1.z.object({
73
73
  .object({
74
74
  nightSkyCalibrationEnabled: zod_1.z.boolean(),
75
75
  scheduleNightSkyCalibrationTimestamp: zod_1.z.number(),
76
- nightSkyCalibrationRepeatCount: zod_1.z.number().int().min(1).max(6).default(1),
77
76
  nightSkyCalibrationFocusValue: zod_1.z.number().int().min(1).max(9999).default(9000),
78
77
  focusCalibrationPoints: zod_1.z.string().default(''),
79
78
  })
80
79
  .default({
81
80
  nightSkyCalibrationEnabled: false,
82
81
  scheduleNightSkyCalibrationTimestamp: 0,
83
- nightSkyCalibrationRepeatCount: 1,
84
82
  nightSkyCalibrationFocusValue: 9000,
85
83
  focusCalibrationPoints: '',
86
84
  }),
@@ -133,7 +133,7 @@ export declare const guardTourSchema: z.ZodObject<{
133
133
  timeBetweenSequences?: unknown;
134
134
  }>;
135
135
  export type TGuardTour = z.infer<typeof guardTourSchema>;
136
- declare const audioSampleRatesSchema: z.ZodEffects<z.ZodObject<{
136
+ declare const audioSampleRatesOutSchema: z.ZodEffects<z.ZodObject<{
137
137
  sample_rate: z.ZodNumber;
138
138
  bit_rates: z.ZodArray<z.ZodNumber, "many">;
139
139
  }, "strip", z.ZodTypeAny, {
@@ -149,7 +149,7 @@ declare const audioSampleRatesSchema: z.ZodEffects<z.ZodObject<{
149
149
  sample_rate: number;
150
150
  bit_rates: number[];
151
151
  }>;
152
- export type TAudioSampleRates = z.infer<typeof audioSampleRatesSchema>;
152
+ export type TAudioSampleRates = z.infer<typeof audioSampleRatesOutSchema>;
153
153
  export declare const sdCardWatchedStatuses: readonly ["OK", "connected", "disconnected"];
154
154
  export declare const sdCardInfoSchema: z.ZodObject<{
155
155
  status: z.ZodEnum<["OK", "connected", "disconnected"]>;
@@ -1666,7 +1666,7 @@ export declare const timeZoneSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObj
1666
1666
  export declare const audioSampleRatesResponseSchema: z.ZodObject<{
1667
1667
  data: z.ZodObject<{
1668
1668
  encoders: z.ZodObject<{
1669
- aac: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1669
+ aac: z.ZodOptional<z.ZodArray<z.ZodObject<{
1670
1670
  sample_rate: z.ZodNumber;
1671
1671
  bit_rates: z.ZodArray<z.ZodNumber, "many">;
1672
1672
  }, "strip", z.ZodTypeAny, {
@@ -1675,14 +1675,8 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
1675
1675
  }, {
1676
1676
  sample_rate: number;
1677
1677
  bit_rates: number[];
1678
- }>, {
1679
- sampleRate: number;
1680
- bitRates: number[];
1681
- }, {
1682
- sample_rate: number;
1683
- bit_rates: number[];
1684
1678
  }>, "many">>;
1685
- AAC: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1679
+ AAC: z.ZodOptional<z.ZodArray<z.ZodObject<{
1686
1680
  sample_rate: z.ZodNumber;
1687
1681
  bit_rates: z.ZodArray<z.ZodNumber, "many">;
1688
1682
  }, "strip", z.ZodTypeAny, {
@@ -1691,21 +1685,15 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
1691
1685
  }, {
1692
1686
  sample_rate: number;
1693
1687
  bit_rates: number[];
1694
- }>, {
1695
- sampleRate: number;
1696
- bitRates: number[];
1697
- }, {
1698
- sample_rate: number;
1699
- bit_rates: number[];
1700
1688
  }>, "many">>;
1701
1689
  }, "strip", z.ZodTypeAny, {
1702
1690
  aac?: {
1703
- sampleRate: number;
1704
- bitRates: number[];
1691
+ sample_rate: number;
1692
+ bit_rates: number[];
1705
1693
  }[] | undefined;
1706
1694
  AAC?: {
1707
- sampleRate: number;
1708
- bitRates: number[];
1695
+ sample_rate: number;
1696
+ bit_rates: number[];
1709
1697
  }[] | undefined;
1710
1698
  }, {
1711
1699
  aac?: {
@@ -1720,12 +1708,12 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
1720
1708
  }, "strip", z.ZodTypeAny, {
1721
1709
  encoders: {
1722
1710
  aac?: {
1723
- sampleRate: number;
1724
- bitRates: number[];
1711
+ sample_rate: number;
1712
+ bit_rates: number[];
1725
1713
  }[] | undefined;
1726
1714
  AAC?: {
1727
- sampleRate: number;
1728
- bitRates: number[];
1715
+ sample_rate: number;
1716
+ bit_rates: number[];
1729
1717
  }[] | undefined;
1730
1718
  };
1731
1719
  }, {
@@ -1744,12 +1732,12 @@ export declare const audioSampleRatesResponseSchema: z.ZodObject<{
1744
1732
  data: {
1745
1733
  encoders: {
1746
1734
  aac?: {
1747
- sampleRate: number;
1748
- bitRates: number[];
1735
+ sample_rate: number;
1736
+ bit_rates: number[];
1749
1737
  }[] | undefined;
1750
1738
  AAC?: {
1751
- sampleRate: number;
1752
- bitRates: number[];
1739
+ sample_rate: number;
1740
+ bit_rates: number[];
1753
1741
  }[] | undefined;
1754
1742
  };
1755
1743
  };
@@ -53,12 +53,11 @@ exports.guardTourSchema = zod_1.z.object({
53
53
  waitTimeViewType: zod_1.z.unknown(),
54
54
  })),
55
55
  });
56
- const audioSampleRatesSchema = zod_1.z
57
- .object({
56
+ const audioSampleRatesSchema = zod_1.z.object({
58
57
  sample_rate: zod_1.z.number(),
59
58
  bit_rates: zod_1.z.array(zod_1.z.number()),
60
- })
61
- .transform(transformers_1.toCamelCaseDeep);
59
+ });
60
+ const audioSampleRatesOutSchema = audioSampleRatesSchema.transform(transformers_1.toCamelCaseDeep);
62
61
  exports.sdCardWatchedStatuses = ['OK', 'connected', 'disconnected'];
63
62
  exports.sdCardInfoSchema = zod_1.z.object({
64
63
  status: zod_1.z.enum(exports.sdCardWatchedStatuses),