camstreamerlib 4.0.0-beta.2 → 4.0.0-beta.3
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.
- package/README.md +3 -1
- package/cjs/CamOverlayAPI.js +176 -0
- package/cjs/CamOverlayDrawingAPI.js +232 -0
- package/cjs/CamOverlayPainter/Frame.js +301 -0
- package/cjs/CamOverlayPainter/Painter.js +168 -0
- package/cjs/CamOverlayPainter/ResourceManager.js +50 -0
- package/cjs/CamScripterAPI.js +70 -0
- package/cjs/CamScripterAPICameraEventsGenerator.js +159 -0
- package/cjs/CamStreamerAPI.js +65 -0
- package/{CamSwitcherAPI.d.ts → cjs/CamSwitcherAPI.d.ts} +3 -3
- package/cjs/CamSwitcherAPI.js +354 -0
- package/{CamSwitcherEvents.d.ts → cjs/CamSwitcherEvents.d.ts} +1 -1
- package/cjs/CamSwitcherEvents.js +67 -0
- package/cjs/CreatePackage.js +106 -0
- package/cjs/VapixAPI.js +458 -0
- package/cjs/VapixEvents.js +88 -0
- package/cjs/errors/errors.js +79 -0
- package/cjs/events/AxisCameraStationEvents.js +48 -0
- package/cjs/events/GenetecAgent.js +123 -0
- package/cjs/index.d.ts +11 -0
- package/cjs/index.js +31 -0
- package/cjs/internal/Digest.js +42 -0
- package/cjs/internal/ProxyClient.js +44 -0
- package/{internal → cjs/internal}/common.d.ts +0 -1
- package/cjs/internal/common.js +27 -0
- package/cjs/internal/constants.js +4 -0
- package/cjs/internal/transformers.js +32 -0
- package/cjs/internal/utils.js +46 -0
- package/cjs/internal/versionCompare.js +53 -0
- package/cjs/node/DefaultClient.js +54 -0
- package/cjs/node/HttpRequestSender.js +89 -0
- package/cjs/node/HttpServer.js +96 -0
- package/cjs/node/WsClient.js +149 -0
- package/cjs/node/WsEventClient.js +22 -0
- package/cjs/node/index.d.ts +2 -0
- package/cjs/node/index.js +7 -0
- package/cjs/types/CamOverlayAPI.js +47 -0
- package/cjs/types/CamScripterAPI.js +20 -0
- package/cjs/types/CamStreamerAPI.js +28 -0
- package/cjs/types/CamSwitcherAPI.js +137 -0
- package/cjs/types/CamSwitcherEvents.js +62 -0
- package/cjs/types/VapixAPI.js +132 -0
- package/cjs/types/common.js +14 -0
- package/cjs/web/DefaultClient.js +20 -0
- package/cjs/web/WsClient.js +62 -0
- package/cjs/web/index.d.ts +2 -0
- package/cjs/web/index.js +7 -0
- package/esm/CamOverlayAPI.d.ts +31 -0
- package/esm/CamOverlayDrawingAPI.d.ts +86 -0
- package/esm/CamOverlayPainter/Frame.d.ts +96 -0
- package/esm/CamOverlayPainter/Painter.d.ts +37 -0
- package/esm/CamOverlayPainter/ResourceManager.d.ts +14 -0
- package/esm/CamScripterAPI.d.ts +19 -0
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +74 -0
- package/esm/CamStreamerAPI.d.ts +16 -0
- package/esm/CamSwitcherAPI.d.ts +48 -0
- package/{CamSwitcherAPI.js → esm/CamSwitcherAPI.js} +3 -3
- package/esm/CamSwitcherEvents.d.ts +18 -0
- package/{CamSwitcherEvents.js → esm/CamSwitcherEvents.js} +1 -1
- package/esm/CreatePackage.d.ts +1 -0
- package/esm/VapixAPI.d.ts +66 -0
- package/esm/VapixEvents.d.ts +43 -0
- package/esm/errors/errors.d.ts +34 -0
- package/esm/events/AxisCameraStationEvents.d.ts +9 -0
- package/esm/events/GenetecAgent.d.ts +174 -0
- package/esm/index.d.ts +11 -0
- package/esm/index.js +11 -0
- package/esm/internal/Digest.d.ts +4 -0
- package/esm/internal/ProxyClient.d.ts +11 -0
- package/esm/internal/common.d.ts +39 -0
- package/{internal → esm/internal}/common.js +0 -3
- package/esm/internal/constants.d.ts +1 -0
- package/esm/internal/transformers.d.ts +5 -0
- package/esm/internal/utils.d.ts +11 -0
- package/esm/internal/versionCompare.d.ts +6 -0
- package/esm/node/DefaultClient.d.ts +15 -0
- package/esm/node/HttpRequestSender.d.ts +28 -0
- package/esm/node/HttpServer.d.ts +21 -0
- package/esm/node/WsClient.d.ts +39 -0
- package/esm/node/WsEventClient.d.ts +13 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/types/CamOverlayAPI.d.ts +188 -0
- package/esm/types/CamScripterAPI.d.ts +67 -0
- package/esm/types/CamStreamerAPI.d.ts +139 -0
- package/esm/types/CamSwitcherAPI.d.ts +814 -0
- package/esm/types/CamSwitcherEvents.d.ts +491 -0
- package/esm/types/VapixAPI.d.ts +1704 -0
- package/esm/types/common.d.ts +37 -0
- package/esm/web/DefaultClient.d.ts +6 -0
- package/esm/web/WsClient.d.ts +13 -0
- package/esm/web/index.d.ts +2 -0
- package/esm/web/index.js +2 -0
- package/package.json +4 -4
- /package/{CamOverlayAPI.d.ts → cjs/CamOverlayAPI.d.ts} +0 -0
- /package/{CamOverlayDrawingAPI.d.ts → cjs/CamOverlayDrawingAPI.d.ts} +0 -0
- /package/{CamOverlayPainter → cjs/CamOverlayPainter}/Frame.d.ts +0 -0
- /package/{CamOverlayPainter → cjs/CamOverlayPainter}/Painter.d.ts +0 -0
- /package/{CamOverlayPainter → cjs/CamOverlayPainter}/ResourceManager.d.ts +0 -0
- /package/{CamScripterAPI.d.ts → cjs/CamScripterAPI.d.ts} +0 -0
- /package/{CamScripterAPICameraEventsGenerator.d.ts → cjs/CamScripterAPICameraEventsGenerator.d.ts} +0 -0
- /package/{CamStreamerAPI.d.ts → cjs/CamStreamerAPI.d.ts} +0 -0
- /package/{CreatePackage.d.ts → cjs/CreatePackage.d.ts} +0 -0
- /package/{VapixAPI.d.ts → cjs/VapixAPI.d.ts} +0 -0
- /package/{VapixEvents.d.ts → cjs/VapixEvents.d.ts} +0 -0
- /package/{errors → cjs/errors}/errors.d.ts +0 -0
- /package/{events → cjs/events}/AxisCameraStationEvents.d.ts +0 -0
- /package/{events → cjs/events}/GenetecAgent.d.ts +0 -0
- /package/{internal → cjs/internal}/Digest.d.ts +0 -0
- /package/{internal → cjs/internal}/ProxyClient.d.ts +0 -0
- /package/{internal → cjs/internal}/constants.d.ts +0 -0
- /package/{internal → cjs/internal}/transformers.d.ts +0 -0
- /package/{internal → cjs/internal}/utils.d.ts +0 -0
- /package/{internal → cjs/internal}/versionCompare.d.ts +0 -0
- /package/{node → cjs/node}/DefaultClient.d.ts +0 -0
- /package/{node → cjs/node}/HttpRequestSender.d.ts +0 -0
- /package/{node → cjs/node}/HttpServer.d.ts +0 -0
- /package/{node → cjs/node}/WsClient.d.ts +0 -0
- /package/{node → cjs/node}/WsEventClient.d.ts +0 -0
- /package/{types → cjs/types}/CamOverlayAPI.d.ts +0 -0
- /package/{types → cjs/types}/CamScripterAPI.d.ts +0 -0
- /package/{types → cjs/types}/CamStreamerAPI.d.ts +0 -0
- /package/{types → cjs/types}/CamSwitcherAPI.d.ts +0 -0
- /package/{types/CamswitcherEvents.d.ts → cjs/types/CamSwitcherEvents.d.ts} +0 -0
- /package/{types → cjs/types}/VapixAPI.d.ts +0 -0
- /package/{types → cjs/types}/common.d.ts +0 -0
- /package/{web → cjs/web}/DefaultClient.d.ts +0 -0
- /package/{web → cjs/web}/WsClient.d.ts +0 -0
- /package/{CamOverlayAPI.js → esm/CamOverlayAPI.js} +0 -0
- /package/{CamOverlayDrawingAPI.js → esm/CamOverlayDrawingAPI.js} +0 -0
- /package/{CamOverlayPainter → esm/CamOverlayPainter}/Frame.js +0 -0
- /package/{CamOverlayPainter → esm/CamOverlayPainter}/Painter.js +0 -0
- /package/{CamOverlayPainter → esm/CamOverlayPainter}/ResourceManager.js +0 -0
- /package/{CamScripterAPI.js → esm/CamScripterAPI.js} +0 -0
- /package/{CamScripterAPICameraEventsGenerator.js → esm/CamScripterAPICameraEventsGenerator.js} +0 -0
- /package/{CamStreamerAPI.js → esm/CamStreamerAPI.js} +0 -0
- /package/{CreatePackage.js → esm/CreatePackage.js} +0 -0
- /package/{VapixAPI.js → esm/VapixAPI.js} +0 -0
- /package/{VapixEvents.js → esm/VapixEvents.js} +0 -0
- /package/{errors → esm/errors}/errors.js +0 -0
- /package/{events → esm/events}/AxisCameraStationEvents.js +0 -0
- /package/{events → esm/events}/GenetecAgent.js +0 -0
- /package/{internal → esm/internal}/Digest.js +0 -0
- /package/{internal → esm/internal}/ProxyClient.js +0 -0
- /package/{internal → esm/internal}/constants.js +0 -0
- /package/{internal → esm/internal}/transformers.js +0 -0
- /package/{internal → esm/internal}/utils.js +0 -0
- /package/{internal → esm/internal}/versionCompare.js +0 -0
- /package/{node → esm/node}/DefaultClient.js +0 -0
- /package/{node → esm/node}/HttpRequestSender.js +0 -0
- /package/{node → esm/node}/HttpServer.js +0 -0
- /package/{node → esm/node}/WsClient.js +0 -0
- /package/{node → esm/node}/WsEventClient.js +0 -0
- /package/{types → esm/types}/CamOverlayAPI.js +0 -0
- /package/{types → esm/types}/CamScripterAPI.js +0 -0
- /package/{types → esm/types}/CamStreamerAPI.js +0 -0
- /package/{types → esm/types}/CamSwitcherAPI.js +0 -0
- /package/{types/CamswitcherEvents.js → esm/types/CamSwitcherEvents.js} +0 -0
- /package/{types → esm/types}/VapixAPI.js +0 -0
- /package/{types → esm/types}/common.js +0 -0
- /package/{web → esm/web}/DefaultClient.js +0 -0
- /package/{web → esm/web}/WsClient.js +0 -0
|
@@ -15,9 +15,9 @@ export class CamSwitcherAPI {
|
|
|
15
15
|
this.client = client;
|
|
16
16
|
this.vapixAgent = new VapixAPI(client, () => '');
|
|
17
17
|
}
|
|
18
|
-
static
|
|
19
|
-
static
|
|
20
|
-
static
|
|
18
|
+
static getProxyUrlPath = () => `${baseUrl}/proxy.cgi`;
|
|
19
|
+
static getWsEventsUrlPath = () => `/local/camswitcher/events`;
|
|
20
|
+
static getClipPreviewUrlPath = (id, storage) => `${baseUrl}/clip_preview.cgi?clip_name=${id}&storage=${storage}`;
|
|
21
21
|
async generateSilence(sampleRate, channels) {
|
|
22
22
|
await this.client.get(`${baseUrl}/generate_silence.cgi`, {
|
|
23
23
|
sample_rate: sampleRate.toString(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IWebsocket } from './internal/common';
|
|
2
|
+
import { TCamSwitcherEventOfType, TCamSwitcherEventType } from './types/CamSwitcherEvents';
|
|
3
|
+
type TListenerFunction<T extends TCamSwitcherEventType> = (data: TCamSwitcherEventOfType<T>, isInit: boolean) => void;
|
|
4
|
+
export declare class CamSwitcherEvents<Event extends {
|
|
5
|
+
data: string;
|
|
6
|
+
}> {
|
|
7
|
+
isDestroyed: boolean;
|
|
8
|
+
private ws;
|
|
9
|
+
private listeners;
|
|
10
|
+
setWebsocket(ws: IWebsocket<Event>): void;
|
|
11
|
+
resendInitData(): void;
|
|
12
|
+
addListener<T extends TCamSwitcherEventType>(type: T, listener: TListenerFunction<T>, id: string): void;
|
|
13
|
+
removeListener<T extends TCamSwitcherEventType>(type: T, id: string): void;
|
|
14
|
+
private onMessage;
|
|
15
|
+
private processMessage;
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/common';
|
|
2
|
+
import { TApplication, TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice } from './types/VapixAPI';
|
|
3
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
4
|
+
import { TCameraImageConfig, TProxyParam } from './types/common';
|
|
5
|
+
export declare class VapixAPI<Client extends IClient = IClient> {
|
|
6
|
+
client: ProxyClient<Client>;
|
|
7
|
+
constructor(client: Client, getProxyUrl: () => string);
|
|
8
|
+
getUrlEncoded(proxy: TProxyParam | undefined, path: string, parameters?: TParameters, headers?: Record<string, string>): Promise<TResponse>;
|
|
9
|
+
postJson(proxy: TProxyParam | undefined, path: string, jsonData: Record<string, any>, headers?: Record<string, string>): Promise<TResponse>;
|
|
10
|
+
getCameraImage(params: TCameraImageConfig, proxy?: TProxyParam): Promise<TResponse>;
|
|
11
|
+
getEventDeclarations(proxy?: TProxyParam): Promise<string>;
|
|
12
|
+
getSupportedAudioSampleRate(proxy?: TProxyParam): Promise<TAudioSampleRates[]>;
|
|
13
|
+
performAutofocus(proxy?: TProxyParam): Promise<void>;
|
|
14
|
+
checkSDCard(proxy?: TProxyParam): Promise<TSDCardInfo>;
|
|
15
|
+
mountSDCard(proxy?: TProxyParam): Promise<number>;
|
|
16
|
+
unmountSDCard(proxy?: TProxyParam): Promise<number>;
|
|
17
|
+
private _doSDCardMountAction;
|
|
18
|
+
fetchSDCardJobProgress(jobId: number, proxy?: TProxyParam): Promise<number>;
|
|
19
|
+
downloadCameraReport(proxy?: TProxyParam): Promise<TResponse>;
|
|
20
|
+
getSystemLog(proxy?: TProxyParam): Promise<TResponse>;
|
|
21
|
+
getMaxFps(channel: number, proxy?: TProxyParam): Promise<number>;
|
|
22
|
+
getTimezone(proxy?: TProxyParam): Promise<string>;
|
|
23
|
+
getDateTimeInfo(proxy?: TProxyParam): Promise<{
|
|
24
|
+
data: {
|
|
25
|
+
dateTime: string;
|
|
26
|
+
dstEnabled: boolean;
|
|
27
|
+
localDateTime: string;
|
|
28
|
+
posixTimeZone: string;
|
|
29
|
+
timeZone: string;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
getDevicesSettings(proxy?: TProxyParam): Promise<TAudioDevice[]>;
|
|
33
|
+
fetchRemoteDeviceInfo<T extends Record<string, any>>(payload: T, proxy?: TProxyParam): Promise<any>;
|
|
34
|
+
getHeaders(proxy?: TProxyParam): Promise<Record<string, string>>;
|
|
35
|
+
setHeaders(headers: Record<string, string>, proxy?: TProxyParam): Promise<TResponse>;
|
|
36
|
+
getParameter(paramNames: string | string[], proxy?: TProxyParam): Promise<Record<string, string>>;
|
|
37
|
+
setParameter(params: Record<string, string | number | boolean>, proxy?: TProxyParam): Promise<boolean>;
|
|
38
|
+
getGuardTourList(proxy?: TProxyParam): Promise<{
|
|
39
|
+
name: string;
|
|
40
|
+
id: string;
|
|
41
|
+
running: string;
|
|
42
|
+
tour: {
|
|
43
|
+
moveSpeed?: unknown;
|
|
44
|
+
position?: unknown;
|
|
45
|
+
presetNbr?: unknown;
|
|
46
|
+
waitTime?: unknown;
|
|
47
|
+
waitTimeViewType?: unknown;
|
|
48
|
+
}[];
|
|
49
|
+
camNbr?: unknown;
|
|
50
|
+
randomEnabled?: unknown;
|
|
51
|
+
timeBetweenSequences?: unknown;
|
|
52
|
+
}[]>;
|
|
53
|
+
setGuardTourEnabled(guardTourID: string, enable: boolean, proxy?: TProxyParam): Promise<boolean>;
|
|
54
|
+
getPTZPresetList(channel: number, proxy?: TProxyParam): Promise<string[]>;
|
|
55
|
+
listPTZ(camera: number, proxy?: TProxyParam): Promise<TCameraPTZItem[]>;
|
|
56
|
+
listPtzVideoSourceOverview(proxy?: TProxyParam): Promise<TPtzOverview>;
|
|
57
|
+
goToPreset(channel: number, presetName: string, proxy?: TProxyParam): Promise<TResponse>;
|
|
58
|
+
getPtzPosition(camera: number, proxy?: TProxyParam): Promise<TCameraPTZItemData>;
|
|
59
|
+
getInputState(port: number, proxy?: TProxyParam): Promise<boolean>;
|
|
60
|
+
setOutputState(port: number, active: boolean, proxy?: TProxyParam): Promise<TResponse>;
|
|
61
|
+
getApplicationList(proxy?: TProxyParam): Promise<TApplication[]>;
|
|
62
|
+
startApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
63
|
+
restartApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
64
|
+
stopApplication(applicationID: string, proxy?: TProxyParam): Promise<void>;
|
|
65
|
+
installApplication(data: Blob, fileName: string): Promise<void>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EventEmitter2 as EventEmitter } from 'eventemitter2';
|
|
2
|
+
import { WsOptions } from './internal/common';
|
|
3
|
+
export type VapixEventsOptions = WsOptions;
|
|
4
|
+
type TEventMessage = {
|
|
5
|
+
apiVersion: string;
|
|
6
|
+
method: string;
|
|
7
|
+
params: {
|
|
8
|
+
notification: {
|
|
9
|
+
timestamp: number;
|
|
10
|
+
topic: string;
|
|
11
|
+
message: {
|
|
12
|
+
source: Record<string, string>;
|
|
13
|
+
data: Record<string, string>;
|
|
14
|
+
key: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface VapixEvents {
|
|
20
|
+
on(event: 'open', listener: () => void): this;
|
|
21
|
+
on(event: 'close', listener: () => void): this;
|
|
22
|
+
on(event: 'error', listener: (err: Error) => void): this;
|
|
23
|
+
on(event: string, listener: (data: TEventMessage) => void): this;
|
|
24
|
+
emit(event: 'open'): boolean;
|
|
25
|
+
emit(event: 'close'): boolean;
|
|
26
|
+
emit(event: 'error', err: Error): boolean;
|
|
27
|
+
emit(event: string, msg: TEventMessage): boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare class VapixEvents extends EventEmitter {
|
|
30
|
+
private tls;
|
|
31
|
+
private tlsInsecure;
|
|
32
|
+
private ip;
|
|
33
|
+
private port;
|
|
34
|
+
private user;
|
|
35
|
+
private pass;
|
|
36
|
+
private ws;
|
|
37
|
+
constructor(options?: VapixEventsOptions);
|
|
38
|
+
connect(): void;
|
|
39
|
+
disconnect(): void;
|
|
40
|
+
private createWsClient;
|
|
41
|
+
private isReservedEventName;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare class ServiceUnavailableError extends Error {
|
|
2
|
+
constructor();
|
|
3
|
+
}
|
|
4
|
+
export declare class ServiceNotFoundError extends Error {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare class ParsingBlobError extends Error {
|
|
8
|
+
constructor(err: unknown);
|
|
9
|
+
}
|
|
10
|
+
type TApplicationAPIAction = 'START' | 'RESTART' | 'STOP';
|
|
11
|
+
export declare class ApplicationAPIError extends Error {
|
|
12
|
+
constructor(action: TApplicationAPIAction, res: string);
|
|
13
|
+
}
|
|
14
|
+
type TSDCardAction = 'MOUNT' | 'UNMOUNT';
|
|
15
|
+
export declare class SDCardActionError extends Error {
|
|
16
|
+
constructor(action: TSDCardAction, res: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class SDCardJobError extends Error {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
type TMaxFPSErrorType = 'MALFORMED_REPLY' | 'CHANNEL_NOT_FOUND' | 'CAPTURE_MODE_NOT_FOUND' | 'FPS_NOT_SPECIFIED';
|
|
22
|
+
export declare class MaxFPSError extends Error {
|
|
23
|
+
constructor(state: TMaxFPSErrorType);
|
|
24
|
+
}
|
|
25
|
+
export declare class NoDeviceInfoError extends Error {
|
|
26
|
+
constructor();
|
|
27
|
+
}
|
|
28
|
+
export declare class FetchDeviceInfoError extends Error {
|
|
29
|
+
constructor(err: unknown);
|
|
30
|
+
}
|
|
31
|
+
export declare class AddNewClipError extends Error {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IClient, HttpOptions } from '../internal/common';
|
|
2
|
+
export type AcsEventsOptions = HttpOptions;
|
|
3
|
+
export declare class AxisCameraStationEvents {
|
|
4
|
+
private sourceKey;
|
|
5
|
+
private client;
|
|
6
|
+
constructor(sourceKey: string, opt?: AcsEventsOptions | IClient);
|
|
7
|
+
sendEvent(data: Record<string, string>, eventType: string): Promise<void>;
|
|
8
|
+
private getDate;
|
|
9
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const cameraGuidsResponseSchema: z.ZodObject<{
|
|
3
|
+
Rsp: z.ZodObject<{
|
|
4
|
+
Status: z.ZodString;
|
|
5
|
+
Result: z.ZodArray<z.ZodObject<{
|
|
6
|
+
Guid: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
Guid: string;
|
|
9
|
+
}, {
|
|
10
|
+
Guid: string;
|
|
11
|
+
}>, "many">;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
Status: string;
|
|
14
|
+
Result: {
|
|
15
|
+
Guid: string;
|
|
16
|
+
}[];
|
|
17
|
+
}, {
|
|
18
|
+
Status: string;
|
|
19
|
+
Result: {
|
|
20
|
+
Guid: string;
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
Rsp: {
|
|
25
|
+
Status: string;
|
|
26
|
+
Result: {
|
|
27
|
+
Guid: string;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
Rsp: {
|
|
32
|
+
Status: string;
|
|
33
|
+
Result: {
|
|
34
|
+
Guid: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
export type TCameraGuidsResponse = z.infer<typeof cameraGuidsResponseSchema>;
|
|
39
|
+
declare const connectionResponseSchema: z.ZodObject<{
|
|
40
|
+
Rsp: z.ZodObject<{
|
|
41
|
+
Status: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
Status: string;
|
|
44
|
+
}, {
|
|
45
|
+
Status: string;
|
|
46
|
+
}>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
Rsp: {
|
|
49
|
+
Status: string;
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
Rsp: {
|
|
53
|
+
Status: string;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
export type TConnectionResponse = z.infer<typeof connectionResponseSchema>;
|
|
57
|
+
export declare const cameraDetailSchema: z.ZodObject<{
|
|
58
|
+
Guid: z.ZodOptional<z.ZodString>;
|
|
59
|
+
Name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
EntityType: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
Name?: string | undefined;
|
|
63
|
+
Guid?: string | undefined;
|
|
64
|
+
EntityType?: string | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
Name?: string | undefined;
|
|
67
|
+
Guid?: string | undefined;
|
|
68
|
+
EntityType?: string | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const cameraDetailsResponseSchema: z.ZodObject<{
|
|
71
|
+
Rsp: z.ZodObject<{
|
|
72
|
+
Status: z.ZodString;
|
|
73
|
+
Result: z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
74
|
+
Guid: z.ZodOptional<z.ZodString>;
|
|
75
|
+
Name: z.ZodOptional<z.ZodString>;
|
|
76
|
+
EntityType: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
Name?: string | undefined;
|
|
79
|
+
Guid?: string | undefined;
|
|
80
|
+
EntityType?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
Name?: string | undefined;
|
|
83
|
+
Guid?: string | undefined;
|
|
84
|
+
EntityType?: string | undefined;
|
|
85
|
+
}>, "many">, z.ZodObject<{
|
|
86
|
+
Guid: z.ZodOptional<z.ZodString>;
|
|
87
|
+
Name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
EntityType: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
Name?: string | undefined;
|
|
91
|
+
Guid?: string | undefined;
|
|
92
|
+
EntityType?: string | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
Name?: string | undefined;
|
|
95
|
+
Guid?: string | undefined;
|
|
96
|
+
EntityType?: string | undefined;
|
|
97
|
+
}>]>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
Status: string;
|
|
100
|
+
Result: {
|
|
101
|
+
Name?: string | undefined;
|
|
102
|
+
Guid?: string | undefined;
|
|
103
|
+
EntityType?: string | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
Name?: string | undefined;
|
|
106
|
+
Guid?: string | undefined;
|
|
107
|
+
EntityType?: string | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
}, {
|
|
110
|
+
Status: string;
|
|
111
|
+
Result: {
|
|
112
|
+
Name?: string | undefined;
|
|
113
|
+
Guid?: string | undefined;
|
|
114
|
+
EntityType?: string | undefined;
|
|
115
|
+
} | {
|
|
116
|
+
Name?: string | undefined;
|
|
117
|
+
Guid?: string | undefined;
|
|
118
|
+
EntityType?: string | undefined;
|
|
119
|
+
}[];
|
|
120
|
+
}>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
Rsp: {
|
|
123
|
+
Status: string;
|
|
124
|
+
Result: {
|
|
125
|
+
Name?: string | undefined;
|
|
126
|
+
Guid?: string | undefined;
|
|
127
|
+
EntityType?: string | undefined;
|
|
128
|
+
} | {
|
|
129
|
+
Name?: string | undefined;
|
|
130
|
+
Guid?: string | undefined;
|
|
131
|
+
EntityType?: string | undefined;
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
}, {
|
|
135
|
+
Rsp: {
|
|
136
|
+
Status: string;
|
|
137
|
+
Result: {
|
|
138
|
+
Name?: string | undefined;
|
|
139
|
+
Guid?: string | undefined;
|
|
140
|
+
EntityType?: string | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
Name?: string | undefined;
|
|
143
|
+
Guid?: string | undefined;
|
|
144
|
+
EntityType?: string | undefined;
|
|
145
|
+
}[];
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
export type TCameraDetailsResponse = z.infer<typeof cameraDetailsResponseSchema>;
|
|
149
|
+
export type TCameraDetail = z.infer<typeof cameraDetailSchema>;
|
|
150
|
+
export type TParams = Array<'Guid' | 'Name' | 'EntityType'>;
|
|
151
|
+
export type GenetecAgentOptions = {
|
|
152
|
+
protocol?: 'http' | 'https' | 'https_insecure';
|
|
153
|
+
ip?: string;
|
|
154
|
+
port?: number;
|
|
155
|
+
base_uri?: string;
|
|
156
|
+
user?: string;
|
|
157
|
+
pass?: string;
|
|
158
|
+
app_id?: string;
|
|
159
|
+
};
|
|
160
|
+
export declare class GenetecAgent {
|
|
161
|
+
private settings;
|
|
162
|
+
private baseUrl;
|
|
163
|
+
private credentials;
|
|
164
|
+
constructor(options?: GenetecAgentOptions);
|
|
165
|
+
checkConnection(): Promise<TConnectionResponse>;
|
|
166
|
+
getAllCameraGuids(): Promise<TCameraGuidsResponse>;
|
|
167
|
+
getCameraDetails(guids: {
|
|
168
|
+
Guid: string;
|
|
169
|
+
}[], parameters: TParams): Promise<TCameraDetail[]>;
|
|
170
|
+
sendBookmark(guids: string[], bookmarkText: string): Promise<Response>;
|
|
171
|
+
private getRequestOptions;
|
|
172
|
+
private getTimeStamp;
|
|
173
|
+
}
|
|
174
|
+
export {};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './internal/common';
|
|
2
|
+
export * from './internal/constants';
|
|
3
|
+
export * from './internal/utils';
|
|
4
|
+
export * from './internal/versionCompare';
|
|
5
|
+
export * from './types/common';
|
|
6
|
+
export { CamSwitcherAPI } from './CamSwitcherAPI';
|
|
7
|
+
export { CamSwitcherEvents } from './CamSwitcherEvents';
|
|
8
|
+
export { VapixAPI } from './VapixAPI';
|
|
9
|
+
export * from './types/CamSwitcherEvents';
|
|
10
|
+
export * from './types/CamSwitcherAPI';
|
|
11
|
+
export * from './types/VapixAPI';
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './internal/common';
|
|
2
|
+
export * from './internal/constants';
|
|
3
|
+
export * from './internal/utils';
|
|
4
|
+
export * from './internal/versionCompare';
|
|
5
|
+
export * from './types/common';
|
|
6
|
+
export { CamSwitcherAPI } from './CamSwitcherAPI';
|
|
7
|
+
export { CamSwitcherEvents } from './CamSwitcherEvents';
|
|
8
|
+
export { VapixAPI } from './VapixAPI';
|
|
9
|
+
export * from './types/CamSwitcherEvents';
|
|
10
|
+
export * from './types/CamSwitcherAPI';
|
|
11
|
+
export * from './types/VapixAPI';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IClient, TParameters } from './common';
|
|
3
|
+
import { TProxyParam } from '../types/common';
|
|
4
|
+
export declare class ProxyClient<Client extends IClient = IClient> {
|
|
5
|
+
client: Client;
|
|
6
|
+
getProxyUrl: () => string;
|
|
7
|
+
constructor(client: Client, getProxyUrl: () => string);
|
|
8
|
+
get: (proxy: TProxyParam, path: string, parameters?: TParameters, headers?: Record<string, string>) => Promise<import("./common").TResponse>;
|
|
9
|
+
post: (proxy: TProxyParam, path: string, data: string | Buffer | FormData, parameters?: TParameters, headers?: Record<string, string>) => Promise<import("./common").TResponse>;
|
|
10
|
+
private getReal;
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type Options = {
|
|
3
|
+
ip?: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
user?: string;
|
|
6
|
+
pass?: string;
|
|
7
|
+
tls?: boolean;
|
|
8
|
+
tlsInsecure?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type HttpOptions = Options & {
|
|
11
|
+
keepAlive?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type WsOptions = Options;
|
|
14
|
+
export type TResponse = {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
json: () => Promise<any>;
|
|
17
|
+
text: () => Promise<string>;
|
|
18
|
+
status: number;
|
|
19
|
+
body: any | null;
|
|
20
|
+
};
|
|
21
|
+
export type TParameters = Record<string, string | number | boolean | null | undefined>;
|
|
22
|
+
export type TGetFunction = (url: string, parameters?: TParameters, headers?: Record<string, string>) => Promise<TResponse>;
|
|
23
|
+
export type TPostFunction = (url: string, data: string | Buffer | FormData, parameters?: TParameters, headers?: Record<string, string>) => Promise<TResponse>;
|
|
24
|
+
export interface IClient {
|
|
25
|
+
get: TGetFunction;
|
|
26
|
+
post: TPostFunction;
|
|
27
|
+
}
|
|
28
|
+
export interface IWebsocket<Event extends {
|
|
29
|
+
readonly data: string;
|
|
30
|
+
}> {
|
|
31
|
+
destroy: () => void;
|
|
32
|
+
onmessage: null | ((event: Event) => void);
|
|
33
|
+
send: (data: string) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function isClient(arg?: Options | IClient): arg is IClient;
|
|
36
|
+
export declare function responseStringify(res: TResponse): Promise<string>;
|
|
37
|
+
export declare function pad(num: number, size: number): string;
|
|
38
|
+
export declare function isNullish<T>(value: T | undefined | null): value is undefined | null;
|
|
39
|
+
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export function isClient(arg = {}) {
|
|
2
2
|
return 'get' in arg && 'post' in arg;
|
|
3
3
|
}
|
|
4
|
-
export function isBrowserEnvironment() {
|
|
5
|
-
return typeof process === 'undefined' || !process.versions.node;
|
|
6
|
-
}
|
|
7
4
|
export async function responseStringify(res) {
|
|
8
5
|
return JSON.stringify({
|
|
9
6
|
status: res.status,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FIRMWARE_WITH_BITRATE_MODES_SUPPORT = "11.11.73";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CamelCasedProperties, CamelCasedPropertiesDeep, SnakeCasedProperties, SnakeCasedPropertiesDeep } from 'type-fest';
|
|
2
|
+
export declare const toCamelCase: <T extends object>(o: T) => CamelCasedProperties<T>;
|
|
3
|
+
export declare const toCamelCaseDeep: <T extends object>(o: T) => CamelCasedPropertiesDeep<T>;
|
|
4
|
+
export declare const toSnakeCase: <T extends object>(o: T) => SnakeCasedProperties<T>;
|
|
5
|
+
export declare const toSnakeCaseDeep: <T extends object>(o: T) => SnakeCasedPropertiesDeep<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TPlaylistPlayType } from '../types/CamSwitcherAPI';
|
|
2
|
+
import { TParameters } from './common';
|
|
3
|
+
export declare const addParametersToPath: (path: string, params?: TParameters) => string;
|
|
4
|
+
export declare const paramToUrl: (params?: TParameters) => string;
|
|
5
|
+
export declare const arrayToUrl: (arr: string | string[]) => string;
|
|
6
|
+
export declare const isCamera: (id?: string) => boolean;
|
|
7
|
+
export declare const isStream: (id?: string) => boolean;
|
|
8
|
+
export declare const isClip: (id?: string) => boolean;
|
|
9
|
+
export declare const isTracker: (id?: string) => boolean;
|
|
10
|
+
export declare const isPlaylist: (id?: string) => boolean;
|
|
11
|
+
export declare const isLoopPlayType: (playType: TPlaylistPlayType) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const assertVersionString: (s: string, msg?: string) => void;
|
|
2
|
+
export declare const isFirmwareVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
3
|
+
export declare const isVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
4
|
+
export declare const firmwareVersionCompare: (a: string, b: string) => 1 | -1 | 0;
|
|
5
|
+
export declare const versionCompare: (a: string, b: string) => 1 | -1 | 0;
|
|
6
|
+
export declare const fixVersionToDots: (version: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IClient, HttpOptions, TParameters } from '../internal/common';
|
|
3
|
+
export declare class DefaultClient implements IClient {
|
|
4
|
+
private tls;
|
|
5
|
+
private ip;
|
|
6
|
+
private port;
|
|
7
|
+
private user;
|
|
8
|
+
private pass;
|
|
9
|
+
private httpRequestSender;
|
|
10
|
+
constructor(opt?: HttpOptions);
|
|
11
|
+
get url(): string;
|
|
12
|
+
get(path: string, parameters?: TParameters, headers?: Record<string, string>): Promise<import("undici").Response>;
|
|
13
|
+
post(path: string, data: string | FormData | Buffer, parameters?: TParameters, headers?: Record<string, string>): Promise<import("undici").Response>;
|
|
14
|
+
private getBaseConnectionParams;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { FormData as UndiciFormData, Response as UndiciResponse } from 'undici';
|
|
3
|
+
export type HttpRequestOptions = {
|
|
4
|
+
method?: string;
|
|
5
|
+
protocol: string;
|
|
6
|
+
host: string;
|
|
7
|
+
port: number;
|
|
8
|
+
path: string;
|
|
9
|
+
user?: string;
|
|
10
|
+
pass?: string;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export type AgentOptions = {
|
|
15
|
+
rejectUnaurhorized?: boolean;
|
|
16
|
+
keepAlive?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare class HttpRequestSender {
|
|
19
|
+
private agent?;
|
|
20
|
+
private authData?;
|
|
21
|
+
constructor(agentOptions?: AgentOptions);
|
|
22
|
+
sendRequest(options: HttpRequestOptions, postData?: Buffer | string | UndiciFormData): Promise<UndiciResponse>;
|
|
23
|
+
private sendRequestWithAuth;
|
|
24
|
+
private static getURL;
|
|
25
|
+
private getAuthorization;
|
|
26
|
+
private invalidateAuthorization;
|
|
27
|
+
private static getAuthHeader;
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import * as http from 'http';
|
|
4
|
+
import * as EventEmitter from 'events';
|
|
5
|
+
export type HttpServerOptions = {
|
|
6
|
+
host?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
};
|
|
9
|
+
type TOnRequestCallback = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
|
10
|
+
export declare class HttpServer extends EventEmitter {
|
|
11
|
+
private host;
|
|
12
|
+
private port;
|
|
13
|
+
private registeredPaths;
|
|
14
|
+
private server;
|
|
15
|
+
private sockets;
|
|
16
|
+
constructor(options?: HttpServerOptions);
|
|
17
|
+
getServer(): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
18
|
+
onRequest(pathName: string, callback: TOnRequestCallback): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import * as EventEmitter from 'events';
|
|
4
|
+
import { WsOptions } from '../internal/common';
|
|
5
|
+
export type WsClientOptions = WsOptions & {
|
|
6
|
+
address: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
pingInterval?: number;
|
|
9
|
+
protocol?: string;
|
|
10
|
+
};
|
|
11
|
+
export interface WsClient {
|
|
12
|
+
on(event: 'open', listener: () => void): this;
|
|
13
|
+
on(event: 'close', listener: () => void): this;
|
|
14
|
+
on(event: 'message', listener: (data: Buffer) => void): this;
|
|
15
|
+
on(event: 'error', listener: (err: Error) => void): this;
|
|
16
|
+
emit(event: 'open'): boolean;
|
|
17
|
+
emit(event: 'close'): boolean;
|
|
18
|
+
emit(event: 'message', data: Buffer): boolean;
|
|
19
|
+
emit(event: 'error', err: Error): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class WsClient extends EventEmitter {
|
|
22
|
+
private user;
|
|
23
|
+
private pass;
|
|
24
|
+
private address;
|
|
25
|
+
private protocol?;
|
|
26
|
+
private pingInterval;
|
|
27
|
+
private wsOptions;
|
|
28
|
+
private digestAddress;
|
|
29
|
+
private isAlive;
|
|
30
|
+
private pingTimer?;
|
|
31
|
+
private ws?;
|
|
32
|
+
private isClosed;
|
|
33
|
+
constructor(options: WsClientOptions);
|
|
34
|
+
open(wwwAuthenticateHeader?: string): void;
|
|
35
|
+
send(data: Buffer | string): void;
|
|
36
|
+
close(): void;
|
|
37
|
+
reconnect(): void;
|
|
38
|
+
private closeWsConnection;
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IWebsocket } from '../internal/common';
|
|
2
|
+
import { WsClientOptions } from './WsClient';
|
|
3
|
+
type TEvent = {
|
|
4
|
+
data: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class WsEventClient implements IWebsocket<TEvent> {
|
|
7
|
+
private wsClient;
|
|
8
|
+
constructor(options: WsClientOptions);
|
|
9
|
+
send: (data: string) => void;
|
|
10
|
+
destroy: () => void;
|
|
11
|
+
onmessage: ((event: TEvent) => void) | null;
|
|
12
|
+
}
|
|
13
|
+
export {};
|