@camera.ui/browser 0.0.91 → 0.0.93
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/dist/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +6 -6
- package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +2 -1
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +1 -2
- package/dist/types/packages/client/browser/src/types.d.ts +11 -3
- package/dist/types/packages/common/src/messaging/index.d.ts +48 -0
- package/dist/types/packages/common/src/nats/index.d.ts +30 -0
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/index.d.ts +4 -5
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +8 -0
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/interfaces/prebuffer.d.ts +3 -5
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/interfaces/ptz.d.ts +3 -5
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/iou.d.ts +1 -1
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/polygon.d.ts +1 -2
- package/dist/types/{server → packages/plugineer}/src/polyglot/node/plugins/schema.d.ts +1 -1
- package/dist/types/server/src/api/database/constants.d.ts +8 -0
- package/dist/types/server/src/api/database/index.d.ts +0 -8
- package/dist/types/server/src/api/database/types.d.ts +6 -6
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +117 -117
- package/dist/types/server/src/api/schemas/config.schema.d.ts +6 -6
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +84 -84
- package/dist/types/server/src/api/schemas/users.schema.d.ts +150 -150
- package/dist/types/server/src/api/types/index.d.ts +2 -2
- package/dist/types/server/src/api.d.ts +1 -7
- package/dist/types/server/src/camera/controller.d.ts +4 -6
- package/dist/types/server/src/camera/types.d.ts +140 -13
- package/dist/types/server/src/decoder/types.d.ts +1 -18
- package/dist/types/server/src/decoder/worker.d.ts +2 -2
- package/dist/types/server/src/nats/index.d.ts +3 -4
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -2
- package/dist/types/server/src/nats/proxy/coreManager.d.ts +2 -2
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +5 -5
- package/dist/types/server/src/nats/types.d.ts +17 -32
- package/dist/types/server/src/nats/utils.d.ts +1 -1
- package/dist/types/server/src/plugins/interfaces/base.d.ts +1 -1
- package/dist/types/server/src/plugins/plugin.d.ts +1 -1
- package/dist/types/server/src/plugins/types.d.ts +36 -3
- package/dist/types/server/src/services/config/index.d.ts +2 -0
- package/dist/types/server/src/services/logger/index.d.ts +4 -16
- package/dist/types/shared/types/index.d.ts +5 -3
- package/package.json +2 -2
- package/dist/types/server/src/camera/device.d.ts +0 -29
- package/dist/types/server/src/camera/interfaces/camera.d.ts +0 -10
- package/dist/types/server/src/camera/streaming/peer-connection.d.ts +0 -55
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +0 -35
- package/dist/types/server/src/camera/streaming/werift-session.d.ts +0 -41
- package/dist/types/server/src/camera/videoFrame.d.ts +0 -24
- package/dist/types/server/src/nats/connection.d.ts +0 -17
- package/dist/types/server/src/nats/constants.d.ts +0 -1
- package/dist/types/server/src/nats/error.d.ts +0 -9
- package/dist/types/server/src/nats/messageQueue.d.ts +0 -20
- package/dist/types/server/src/nats/subscription.d.ts +0 -12
- package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +0 -107
- package/dist/types/server/src/polyglot/node/plugins/configService.d.ts +0 -104
- package/dist/types/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -35
- package/dist/types/server/src/polyglot/node/plugins/pluginLogger.d.ts +0 -18
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +0 -69
- package/dist/types/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +0 -40
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +0 -47
- package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +0 -30
- package/dist/types/server/src/utils/ffmpeg.d.ts +0 -2
- package/dist/types/server/src/utils/network.d.ts +0 -12
- package/dist/types/server/src/utils/npm.d.ts +0 -4
- package/dist/types/server/src/utils/pythonInstaller.d.ts +0 -48
- package/dist/types/server/src/utils/utils.d.ts +0 -10
- /package/dist/types/{server/src/utils/packer.d.ts → packages/common/src/packer/index.d.ts} +0 -0
- /package/dist/types/{server → packages/common}/src/utils/subscribed.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AuthConfig } from '@camera.ui/common';
|
|
1
2
|
import type { Readable } from 'node:stream';
|
|
2
|
-
import type { AuthConfig } from '../../decoder/types.js';
|
|
3
3
|
import type { CameraExtension, PLUGIN_STATUS, PluginContract, RootSchema } from '../../plugins/types.js';
|
|
4
4
|
import type { LoggingLevel } from '../../services/config/types.js';
|
|
5
5
|
import type { CameraExtensions, CameraZone, DBCamera, DBCamviewLayout, DBRoles, DBUser } from '../database/types.js';
|
|
@@ -50,7 +50,7 @@ export interface ClientData {
|
|
|
50
50
|
address?: string;
|
|
51
51
|
device?: string;
|
|
52
52
|
}
|
|
53
|
-
export declare enum REFRESH_TOKEN {
|
|
53
|
+
export declare const enum REFRESH_TOKEN {
|
|
54
54
|
EXPIRES_IN = "7d"
|
|
55
55
|
}
|
|
56
56
|
export declare const PAGINATION_DEFAULTS: PaginationQuery;
|
|
@@ -3,14 +3,8 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import { CameraController } from './camera/controller.js';
|
|
4
4
|
import type { Camera, CameraExtensions } from './api/database/types.js';
|
|
5
5
|
import type { FrameWorker } from './decoder/worker.js';
|
|
6
|
-
import type { BasePlugin } from './plugins/interfaces/base.js';
|
|
7
6
|
import type { CameraExtension } from './plugins/types.js';
|
|
8
|
-
|
|
9
|
-
import type { PluginLogger } from './polyglot/node/plugins/pluginLogger.js';
|
|
10
|
-
export interface PluginConstructor {
|
|
11
|
-
new (logger: PluginLogger, api: API): BasePlugin;
|
|
12
|
-
}
|
|
13
|
-
export declare const enum API_EVENT {
|
|
7
|
+
export declare enum API_EVENT {
|
|
14
8
|
FINISH_LAUNCHING = "finishLaunching",
|
|
15
9
|
SHUTDOWN = "shutdown"
|
|
16
10
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CameraDevice } from '
|
|
2
|
-
import {
|
|
3
|
-
import { CameraPTZInterface } from './interfaces/ptz.js';
|
|
1
|
+
import { CameraDevice, CameraPrebufferInterface, CameraPTZInterface } from '@camera.ui/plugineer';
|
|
2
|
+
import type { Logger } from '@camera.ui/common/logger';
|
|
4
3
|
import type { Camera } from '../api/database/types.js';
|
|
5
|
-
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
6
4
|
import type { ProxyServer } from '../nats/index.js';
|
|
7
|
-
import type {
|
|
5
|
+
import type { CameraConfigInputSettings, CameraDelegate, CameraSource, MotionFrame, SetValues, VideoFrame } from './types.js';
|
|
8
6
|
export declare class CameraController extends CameraDevice {
|
|
9
7
|
proxy: ProxyServer;
|
|
10
8
|
private motionTimeout?;
|
|
@@ -17,7 +15,7 @@ export declare class CameraController extends CameraDevice {
|
|
|
17
15
|
protected prebufferDelegate: CameraPrebufferInterface;
|
|
18
16
|
get camera(): Camera;
|
|
19
17
|
get sources(): CameraSource[];
|
|
20
|
-
constructor(camera: Camera, logger:
|
|
18
|
+
constructor(camera: Camera, logger: Logger, proxy: ProxyServer);
|
|
21
19
|
setDelegate(): void;
|
|
22
20
|
getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
23
21
|
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
log: (...args: any[]) => void;
|
|
8
|
-
error: (...args: any[]) => void;
|
|
9
|
-
warn: (...args: any[]) => void;
|
|
10
|
-
debug: (...args: any[]) => void;
|
|
11
|
-
trace: (...args: any[]) => void;
|
|
12
|
-
attention: (...args: any[]) => void;
|
|
13
|
-
}
|
|
1
|
+
import type { CameraInterface, CameraPrebufferInterface, CameraPTZInterface, StreamingConnectionOptions } from '@camera.ui/plugineer';
|
|
2
|
+
import type { Observable, ReplaySubject, Subject, Subscription } from 'rxjs';
|
|
3
|
+
import type { ConnectionState, RTCSessionDescription, RtpPacket, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
|
|
4
|
+
import type { Camera, CameraActivitySettings, CameraFrameWorkerSettings, CameraInformation, CameraInput, CameraInputSettings, CameraType, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
|
|
5
|
+
import type { DecoderFormat, FrameBuffer, FrameData, FrameImage, FrameMetadata, ImageOptions } from '../decoder/types.js';
|
|
6
|
+
import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../plugins/types.js';
|
|
14
7
|
export type SpawnInput = string | number;
|
|
15
8
|
export interface FfmpegOptions {
|
|
16
9
|
ffmpegPath: string;
|
|
@@ -199,3 +192,137 @@ export interface CameraDelegates {
|
|
|
199
192
|
readonly prebufferDelegate: CameraPrebufferDelegate;
|
|
200
193
|
readonly ptzDelegate: CameraPTZDelegate;
|
|
201
194
|
}
|
|
195
|
+
export interface CameraStorage<T extends Record<string, any> = Record<string, any>> {
|
|
196
|
+
schema: JsonSchemaForm;
|
|
197
|
+
values: T;
|
|
198
|
+
initializeStorage(): void;
|
|
199
|
+
getValue<U = string>(path: string): Promise<U> | undefined;
|
|
200
|
+
getValue<U = string>(path: string, defaultValue: U): Promise<U>;
|
|
201
|
+
setValue<U = string>(path: string, newValue: U): Promise<void>;
|
|
202
|
+
hasValue(path: string): boolean;
|
|
203
|
+
getConfig(): Promise<SchemaConfig>;
|
|
204
|
+
setConfig(newConfig: T): Promise<void>;
|
|
205
|
+
addSchema(schema: JsonSchemaForm): Promise<void>;
|
|
206
|
+
addSchema(path: string, schema: JsonSchema): Promise<void>;
|
|
207
|
+
removeSchema(path: string): void;
|
|
208
|
+
changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
|
|
209
|
+
getSchema<U>(path: string): U | undefined;
|
|
210
|
+
hasSchema(path: string): boolean;
|
|
211
|
+
}
|
|
212
|
+
export interface StorageController {
|
|
213
|
+
createCameraStorage<T extends Record<string, any> = Record<string, any>>(instance: any, cameraId: string, schema?: JsonSchemaForm): CameraStorage<T>;
|
|
214
|
+
getCameraStorage<T extends Record<string, any> = Record<string, any>>(cameraId: string): CameraStorage<T> | undefined;
|
|
215
|
+
removeCameraStorage(cameraId: string): void;
|
|
216
|
+
}
|
|
217
|
+
export interface WeriftSession extends Subscribed {
|
|
218
|
+
readonly onCallEnded: ReplaySubject<void>;
|
|
219
|
+
readonly onVideoRtp: Subject<RtpPacket>;
|
|
220
|
+
readonly onAudioRtp: Subject<RtpPacket>;
|
|
221
|
+
readonly isUsingOpus: Promise<boolean>;
|
|
222
|
+
reservePort(bufferPorts?: number): Promise<number>;
|
|
223
|
+
startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
|
|
224
|
+
transcodeReturnAudio(ffmpegOptions: {
|
|
225
|
+
ffmpegPath: string;
|
|
226
|
+
input: SpawnInput[];
|
|
227
|
+
}): Promise<void>;
|
|
228
|
+
stop(): void;
|
|
229
|
+
sendAudioPacket(rtp: RtpPacket): void;
|
|
230
|
+
requestKeyFrame(): void;
|
|
231
|
+
}
|
|
232
|
+
export interface CameraDevice {
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly nativeId: string | undefined;
|
|
235
|
+
readonly pluginId: string;
|
|
236
|
+
readonly connected: boolean;
|
|
237
|
+
readonly disabled: boolean;
|
|
238
|
+
readonly name: string;
|
|
239
|
+
readonly type: CameraType;
|
|
240
|
+
readonly info: CameraInformation;
|
|
241
|
+
readonly isCloud: boolean;
|
|
242
|
+
readonly hasLight: boolean;
|
|
243
|
+
readonly hasSiren: boolean;
|
|
244
|
+
readonly hasBinarySensor: boolean;
|
|
245
|
+
readonly hasBattery: boolean;
|
|
246
|
+
readonly hasMotionDetector: boolean;
|
|
247
|
+
readonly hasAudioDetector: boolean;
|
|
248
|
+
readonly hasObjectDetector: boolean;
|
|
249
|
+
readonly hasPtz: boolean;
|
|
250
|
+
readonly hasPrebuffer: boolean;
|
|
251
|
+
readonly activityZones: DetectionZone[];
|
|
252
|
+
readonly activitySettings: CameraActivitySettings;
|
|
253
|
+
readonly frameWorkerSettings: CameraFrameWorkerSettings;
|
|
254
|
+
readonly streamSource: CameraSource;
|
|
255
|
+
readonly snapshotSource: CameraSource | undefined;
|
|
256
|
+
readonly highResolutionSource: CameraSource | undefined;
|
|
257
|
+
readonly midResolutionSource: CameraSource | undefined;
|
|
258
|
+
readonly lowResolutionSource: CameraSource | undefined;
|
|
259
|
+
readonly ptz: CameraPTZDelegate;
|
|
260
|
+
readonly sources: CameraSource[];
|
|
261
|
+
readonly onConnected: Observable<boolean>;
|
|
262
|
+
readonly onLightSwitched: Observable<LightState>;
|
|
263
|
+
readonly onMotionDetected: Observable<MotionState>;
|
|
264
|
+
readonly onAudioDetected: Observable<AudioState>;
|
|
265
|
+
readonly onObjectDetected: Observable<ObjectState>;
|
|
266
|
+
readonly onDoorbellPressed: Observable<DoorbellState>;
|
|
267
|
+
readonly onSirenDetected: Observable<SirenState>;
|
|
268
|
+
readonly onBatteryChanged: Observable<BatteryState>;
|
|
269
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer | undefined>;
|
|
270
|
+
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
271
|
+
newState: StateValues[T];
|
|
272
|
+
oldState: StateValues[T];
|
|
273
|
+
}>;
|
|
274
|
+
onPropertyChange<T extends keyof Camera>(property: T | T[]): Observable<{
|
|
275
|
+
property: T;
|
|
276
|
+
oldData: Camera[T];
|
|
277
|
+
newData: Camera[T];
|
|
278
|
+
}>;
|
|
279
|
+
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
280
|
+
setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
|
|
281
|
+
connect(): Promise<void>;
|
|
282
|
+
disconnect(): Promise<void>;
|
|
283
|
+
getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
|
|
284
|
+
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
285
|
+
updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
286
|
+
updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: VideoFrame): Promise<void>;
|
|
287
|
+
updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
288
|
+
updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
289
|
+
updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
290
|
+
updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
291
|
+
updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
292
|
+
addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
293
|
+
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
294
|
+
removeCameraSource(sourceId: string): Promise<void>;
|
|
295
|
+
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<WeriftSession>;
|
|
296
|
+
}
|
|
297
|
+
export interface VideoFrame {
|
|
298
|
+
readonly frameData: FrameData;
|
|
299
|
+
readonly metadata: FrameMetadata;
|
|
300
|
+
readonly inputWidth: number;
|
|
301
|
+
readonly inputHeight: number;
|
|
302
|
+
readonly inputFormat: DecoderFormat;
|
|
303
|
+
toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
|
|
304
|
+
toImage(options?: ImageOptions): Promise<FrameImage>;
|
|
305
|
+
save(path: string, options?: ImageOptions): Promise<void>;
|
|
306
|
+
}
|
|
307
|
+
export interface MotionFrame extends VideoFrame {
|
|
308
|
+
readonly motion: MotionState;
|
|
309
|
+
}
|
|
310
|
+
export interface BasicPeerConnection {
|
|
311
|
+
createOffer(): Promise<RTCSessionDescription>;
|
|
312
|
+
acceptAnswer(answer: {
|
|
313
|
+
type: 'answer';
|
|
314
|
+
sdp: string;
|
|
315
|
+
}): Promise<void>;
|
|
316
|
+
addIceCandidate(candidate: Partial<WeriftRTCICECandidate>): Promise<void>;
|
|
317
|
+
onIceCandidate: Subject<WeriftRTCICECandidate>;
|
|
318
|
+
onConnectionState: Observable<ConnectionState>;
|
|
319
|
+
close(): void;
|
|
320
|
+
requestKeyFrame?: () => void;
|
|
321
|
+
}
|
|
322
|
+
interface Subscribed {
|
|
323
|
+
addSubscriptions(...subscriptions: Subscription[]): void;
|
|
324
|
+
addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
|
|
325
|
+
unsubscribe(): void;
|
|
326
|
+
unsubscribeAdditional(): void;
|
|
327
|
+
}
|
|
328
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AuthConfig } from '@camera.ui/common';
|
|
1
2
|
import type { Sharp } from 'sharp';
|
|
2
|
-
import type { MotionState } from '../camera/types.js';
|
|
3
3
|
export type DecoderFormat = 'yuv' | 'rgb';
|
|
4
4
|
export interface ImageMetadata {
|
|
5
5
|
width: number;
|
|
@@ -56,23 +56,6 @@ export interface FrameImage {
|
|
|
56
56
|
image: Sharp;
|
|
57
57
|
info: ImageInformation;
|
|
58
58
|
}
|
|
59
|
-
export interface VideoFrame {
|
|
60
|
-
readonly frameData: FrameData;
|
|
61
|
-
readonly metadata: FrameMetadata;
|
|
62
|
-
readonly inputWidth: number;
|
|
63
|
-
readonly inputHeight: number;
|
|
64
|
-
readonly inputFormat: DecoderFormat;
|
|
65
|
-
toBuffer: (options?: ImageOptions) => Promise<FrameBuffer>;
|
|
66
|
-
toImage: (options?: ImageOptions) => Promise<FrameImage>;
|
|
67
|
-
save: (path: string, options?: ImageOptions) => Promise<void>;
|
|
68
|
-
}
|
|
69
|
-
export interface MotionFrame extends VideoFrame {
|
|
70
|
-
motion: MotionState;
|
|
71
|
-
}
|
|
72
|
-
export interface AuthConfig {
|
|
73
|
-
user: string;
|
|
74
|
-
password: string;
|
|
75
|
-
}
|
|
76
59
|
export interface BaseFrameWorkerConfig {
|
|
77
60
|
frameWorkerId: string;
|
|
78
61
|
cameraId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { AuthConfig } from '@camera.ui/common';
|
|
2
|
+
import { Subscribed } from '@camera.ui/common';
|
|
1
3
|
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
2
|
-
import { Subscribed } from '../utils/subscribed.js';
|
|
3
4
|
import type { CameraController } from '../camera/controller.js';
|
|
4
|
-
import type { AuthConfig } from './types.js';
|
|
5
5
|
export declare class FrameWorker extends Subscribed {
|
|
6
6
|
readonly frameWorkerId: string;
|
|
7
7
|
name: string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ProxyConnection } from '
|
|
1
|
+
import { ProxyConnection } from '@camera.ui/common';
|
|
2
2
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
3
3
|
import { CoreManagerProxy } from './proxy/coreManager.js';
|
|
4
4
|
import { DeviceManagerProxy } from './proxy/deviceManager.js';
|
|
5
5
|
import { NatsServer } from './server.js';
|
|
6
|
-
import type {
|
|
7
|
-
import type { CameraStorage } from '../
|
|
6
|
+
import type { ProxySubscription } from '@camera.ui/common/nats';
|
|
7
|
+
import type { CameraStorage, StateValues } from '../camera/types.js';
|
|
8
8
|
import type { MethodKeys, MethodType } from '../types.js';
|
|
9
|
-
import type { ProxySubscription } from './subscription.js';
|
|
10
9
|
import type { CameraDeviceListenerMessagePayload, CoreManagerProxyEvents, DeviceManagerProxyEvents, PluginMap, ProxyAuth } from './types.js';
|
|
11
10
|
import type { WebsocketProxy } from './websocket.js';
|
|
12
11
|
export declare class ProxyServer {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
|
|
1
2
|
import type { CameraConfigInputSettings, CameraInterfaces, SetValues } from '../../camera/types.js';
|
|
2
3
|
import type { MethodKeys, MethodType } from '../../types.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { CameraDeviceProxyMethods, ProxyMessageStructure, RefreshedStates } from '../types.js';
|
|
4
|
+
import type { CameraDeviceProxyMethods, RefreshedStates } from '../types.js';
|
|
5
5
|
export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
6
6
|
private api;
|
|
7
7
|
private configService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
|
|
1
2
|
import type { IceServer } from '../../services/config/types.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { CoreManagerProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
3
|
+
import type { CoreManagerProxyMethods } from '../types.js';
|
|
4
4
|
export declare class CoreManagerProxy implements CoreManagerProxyMethods {
|
|
5
5
|
private configService;
|
|
6
6
|
private pluginsService;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
|
|
1
2
|
import type { Camera } from '../../api/database/types.js';
|
|
2
3
|
import type { CameraConfig } from '../../camera/types.js';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export declare class DeviceManagerProxy implements DeviceManagerServerProxyMethods {
|
|
4
|
+
import type { DeviceManagerProxyMethods } from '../types.js';
|
|
5
|
+
export declare class DeviceManagerProxy implements DeviceManagerProxyMethods {
|
|
6
6
|
private camerasService;
|
|
7
7
|
private pluginsService;
|
|
8
8
|
private messageQueue;
|
|
9
9
|
constructor(messageQueue: MessageQueue);
|
|
10
|
-
getCameraByName(cameraName: string):
|
|
11
|
-
getCameraById(cameraId: string):
|
|
10
|
+
getCameraByName(cameraName: string): Promise<any>;
|
|
11
|
+
getCameraById(cameraId: string): Promise<any>;
|
|
12
12
|
createCamera(cameraConfig: CameraConfig, pluginId: string): Promise<Camera>;
|
|
13
13
|
removeCameraByName(cameraName: string, pluginId: string): Promise<void>;
|
|
14
14
|
removeCameraById(cameraId: string, pluginId: string): Promise<void>;
|
|
@@ -1,35 +1,13 @@
|
|
|
1
|
+
import type { AuthConfig } from '@camera.ui/common';
|
|
2
|
+
import type { CameraDevice } from '@camera.ui/plugineer';
|
|
1
3
|
import type { Camera, DBSystem, VideoStreamingMode } from '../api/database/types.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { CameraConfig, CameraConfigInputSettings, CameraDelegates, SetValues, StateValues } from '../camera/types.js';
|
|
4
|
-
import type { AuthConfig } from '../decoder/types.js';
|
|
4
|
+
import type { CameraConfig, CameraConfigInputSettings, SetValues, StateValues } from '../camera/types.js';
|
|
5
5
|
import type { AudioDetectionPlugin } from '../plugins/interfaces/audioDetection.js';
|
|
6
6
|
import type { BasePlugin } from '../plugins/interfaces/base.js';
|
|
7
7
|
import type { MotionDetectionPlugin } from '../plugins/interfaces/motionDetection.js';
|
|
8
8
|
import type { ObjectDetectionPlugin } from '../plugins/interfaces/objectDetection.js';
|
|
9
9
|
import type { CameraExtension } from '../plugins/types.js';
|
|
10
10
|
import type { IceServer } from '../services/config/types.js';
|
|
11
|
-
import type { DeserializedError, RemoteError } from './error.js';
|
|
12
|
-
export interface QueueItem {
|
|
13
|
-
message: ProxyMessageStructure;
|
|
14
|
-
resolve: (response: any) => void;
|
|
15
|
-
reject: (error: RemoteError) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface ProxyMessageStructure {
|
|
18
|
-
requestId: string;
|
|
19
|
-
cameraId?: string;
|
|
20
|
-
targetId: string;
|
|
21
|
-
targetName?: string;
|
|
22
|
-
pluginId: string;
|
|
23
|
-
type: 'request' | 'reply';
|
|
24
|
-
proxy: 'device' | 'camera' | 'plugin' | 'core';
|
|
25
|
-
client: 'cameraFn' | 'pluginFn' | 'deviceFn' | 'storageFn' | 'coreFn' | keyof CameraDelegates;
|
|
26
|
-
fn: string;
|
|
27
|
-
args: any[];
|
|
28
|
-
timeout: number;
|
|
29
|
-
timestamp: number;
|
|
30
|
-
response?: any;
|
|
31
|
-
error?: DeserializedError;
|
|
32
|
-
}
|
|
33
11
|
export interface ProxyAuth {
|
|
34
12
|
cluster: AuthConfig;
|
|
35
13
|
server: AuthConfig;
|
|
@@ -64,17 +42,17 @@ export interface CameraDeviceListenerMessagePayload {
|
|
|
64
42
|
type: 'removed' | 'updated' | 'cameraState';
|
|
65
43
|
data?: any;
|
|
66
44
|
}
|
|
67
|
-
export interface
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
45
|
+
export interface DeviceManager extends DeviceManagerProxyMethods {
|
|
46
|
+
on<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
47
|
+
once<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
48
|
+
off<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
49
|
+
removeListener<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
50
|
+
removeAllListeners<E extends keyof DeviceManagerProxyEventCallbacks>(event?: E): this;
|
|
73
51
|
}
|
|
74
52
|
export interface DeviceManagerProxyMethods {
|
|
53
|
+
createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
|
|
75
54
|
getCameraByName(cameraName: string): Promise<CameraDevice | undefined>;
|
|
76
55
|
getCameraById(cameraId: string): Promise<CameraDevice | undefined>;
|
|
77
|
-
createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
|
|
78
56
|
removeCameraByName(cameraName: string): Promise<void>;
|
|
79
57
|
removeCameraById(cameraId: string): Promise<void>;
|
|
80
58
|
}
|
|
@@ -100,6 +78,13 @@ export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerPro
|
|
|
100
78
|
type: K;
|
|
101
79
|
data: DeviceManagerProxyEvents[K];
|
|
102
80
|
}
|
|
81
|
+
export declare interface CoreManager extends CoreManagerProxyMethods {
|
|
82
|
+
on<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
83
|
+
once<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
84
|
+
off<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
85
|
+
removeListener<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
86
|
+
removeAllListeners<E extends keyof CoreManagerProxyEventCallbacks>(event?: E): this;
|
|
87
|
+
}
|
|
103
88
|
export interface CoreManagerProxyMethods {
|
|
104
89
|
getFFmpegPath(): Promise<string>;
|
|
105
90
|
getServerAddresses(): Promise<string[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AuthConfig } from '
|
|
1
|
+
import type { AuthConfig } from '@camera.ui/common';
|
|
2
2
|
export declare function generateCredentials(): AuthConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CameraDevice } from '
|
|
1
|
+
import type { CameraDevice } from '@camera.ui/plugineer';
|
|
2
2
|
import type { FormSubmitResponse } from '../types.js';
|
|
3
3
|
export declare abstract class BasePlugin {
|
|
4
4
|
abstract onFormSubmit(actionId: string, payload: any): Promise<FormSubmitResponse | void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PythonInstaller } from '
|
|
1
|
+
import { PythonInstaller } from '@camera.ui/common/python';
|
|
2
2
|
import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
|
|
3
3
|
import type { PluginContract } from './types.js';
|
|
4
4
|
export declare class Plugin {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Path } from 'object-path';
|
|
1
2
|
import type { Camera } from '../api/database/types.js';
|
|
2
|
-
import type { Detection } from '../camera/types.js';
|
|
3
|
+
import type { Detection, StorageController } from '../camera/types.js';
|
|
4
|
+
import type { CoreManager, DeviceManager } from '../nats/types.js';
|
|
3
5
|
export interface Context {
|
|
4
6
|
engines?: Record<string, string>;
|
|
5
7
|
dependencies?: Record<string, string>;
|
|
@@ -31,7 +33,7 @@ export interface PluginContractBase {
|
|
|
31
33
|
pythonVersion?: string;
|
|
32
34
|
}
|
|
33
35
|
export type PluginContract = PluginContractBase & ExtensionOrSupport;
|
|
34
|
-
export declare
|
|
36
|
+
export declare enum PLUGIN_STATUS {
|
|
35
37
|
READY = "ready",
|
|
36
38
|
STARTING = "starting",
|
|
37
39
|
STARTED = "started",
|
|
@@ -40,7 +42,7 @@ export declare const enum PLUGIN_STATUS {
|
|
|
40
42
|
UNKNOWN = "unknown",
|
|
41
43
|
DISABLED = "disabled"
|
|
42
44
|
}
|
|
43
|
-
export declare
|
|
45
|
+
export declare enum PLUGIN_COMMAND {
|
|
44
46
|
START = "start",
|
|
45
47
|
STOP = "stop"
|
|
46
48
|
}
|
|
@@ -151,4 +153,35 @@ export interface ObjectDetectionPluginResponse {
|
|
|
151
153
|
export interface AudioDetectionPluginResponse {
|
|
152
154
|
detected: boolean;
|
|
153
155
|
}
|
|
156
|
+
export interface PluginAPI {
|
|
157
|
+
on(event: 'finishLaunching', listener: () => void): this;
|
|
158
|
+
on(event: 'shutdown', listener: () => void): this;
|
|
159
|
+
once(event: 'finishLaunching', listener: () => void): this;
|
|
160
|
+
once(event: 'shutdown', listener: () => void): this;
|
|
161
|
+
off(event: 'finishLaunching', listener: () => void): this;
|
|
162
|
+
off(event: 'shutdown', listener: () => void): this;
|
|
163
|
+
removeListener(event: 'finishLaunching', listener: () => void): this;
|
|
164
|
+
removeListener(event: 'shutdown', listener: () => void): this;
|
|
165
|
+
removeAllListeners(event?: string): this;
|
|
166
|
+
readonly coreManager: CoreManager;
|
|
167
|
+
readonly deviceManager: DeviceManager;
|
|
168
|
+
readonly storageController: StorageController;
|
|
169
|
+
readonly configService: PluginConfigService;
|
|
170
|
+
readonly storagePath: string;
|
|
171
|
+
readonly configFile: string;
|
|
172
|
+
}
|
|
173
|
+
export interface PluginConfigService {
|
|
174
|
+
get(key: Path, defaultValue: JSONValue, validate: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
|
|
175
|
+
get(key: Path, defaultValue?: unknown, validate?: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
|
|
176
|
+
has(key: Path, refresh?: boolean): boolean;
|
|
177
|
+
ensureExists(key: Path, defaultValue: JSONValue, write?: boolean): void;
|
|
178
|
+
set(key: Path, value: any, write?: boolean): void;
|
|
179
|
+
insert(key: Path, value: any, at?: number, write?: boolean): void;
|
|
180
|
+
push(key: Path, write?: boolean, ...items: any[]): void;
|
|
181
|
+
delete(key: Path, write?: boolean): void;
|
|
182
|
+
all(refresh?: boolean): PluginConfig;
|
|
183
|
+
replace(config: PluginConfig, write?: boolean): void;
|
|
184
|
+
updateValue(path: string, searchKey: string, searchValue: any, targetKey: string, newValue: any, write?: boolean): void;
|
|
185
|
+
replaceOrAddItem(path: string, searchKey: string, searchValue: any, newItem: any, write?: boolean): void;
|
|
186
|
+
}
|
|
154
187
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
+
import type { LoggerOptions } from '@camera.ui/common/logger';
|
|
2
3
|
import type { DeepPartial } from '../../types.js';
|
|
3
4
|
import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
|
|
4
5
|
export declare class ConfigService {
|
|
@@ -38,6 +39,7 @@ export declare class ConfigService {
|
|
|
38
39
|
set config(newConfig: IConfig);
|
|
39
40
|
get go2rtcConfig(): Go2RtcConfig;
|
|
40
41
|
set go2rtcConfig(newConfig: Go2RtcConfig);
|
|
42
|
+
get loggerOptions(): LoggerOptions;
|
|
41
43
|
constructor(homePath?: string);
|
|
42
44
|
static extractVersion(str: string): string | null;
|
|
43
45
|
read(): void;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
+
import { Logger } from '@camera.ui/common/logger';
|
|
3
|
+
import type { LoggerOptions } from '@camera.ui/common/logger';
|
|
2
4
|
import type { UiNotification } from '../../api/types/index.js';
|
|
3
5
|
import type { LoggingLevel } from '../config/types.js';
|
|
4
|
-
export declare class Logger {
|
|
5
|
-
private _loggerPrefix;
|
|
6
|
-
debugEnabled: boolean;
|
|
7
|
-
traceEnabled: boolean;
|
|
8
|
-
disableTimestamps: boolean;
|
|
6
|
+
export declare class LoggerService extends Logger {
|
|
9
7
|
notifications: UiNotification[];
|
|
10
|
-
|
|
11
|
-
constructor();
|
|
12
|
-
log(...args: any[]): void;
|
|
13
|
-
error(...args: any[]): void;
|
|
14
|
-
warn(...args: any[]): void;
|
|
15
|
-
attention(...args: any[]): void;
|
|
16
|
-
debug(...args: any[]): void;
|
|
17
|
-
trace(...args: any[]): void;
|
|
8
|
+
constructor(options?: LoggerOptions);
|
|
18
9
|
notify(title: string, text: string, type: LoggingLevel, link: string): Promise<void>;
|
|
19
|
-
formatMessage(level: 'log' | 'warn' | 'error' | 'debug' | 'trace' | 'attention', ...args: any[]): string[];
|
|
20
|
-
private formattedArgs;
|
|
21
|
-
private formatDateTime;
|
|
22
10
|
private checkIfNotificationExists;
|
|
23
11
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type * from '../../packages/common/src/messaging/index.js';
|
|
2
|
+
export * from '../../packages/common/src/utils/subscribed.js';
|
|
3
|
+
export * from '../../packages/plugineer/src/polyglot/node/camera/polygon.js';
|
|
4
|
+
export * from '../../packages/plugineer/src/polyglot/node/plugins/schema.js';
|
|
1
5
|
export type * from '../../server/src/api/database/types.js';
|
|
2
6
|
export * from '../../server/src/api/schemas/cameras.schema.js';
|
|
3
7
|
export * from '../../server/src/api/schemas/plugins.schema.js';
|
|
@@ -5,14 +9,12 @@ export * from '../../server/src/api/schemas/system.schema.js';
|
|
|
5
9
|
export * from '../../server/src/api/schemas/users.schema.js';
|
|
6
10
|
export type * from '../../server/src/api/types/index.js';
|
|
7
11
|
export type * from '../../server/src/api/websocket/types.js';
|
|
8
|
-
export * from '../../server/src/camera/polygon.js';
|
|
9
12
|
export type * from '../../server/src/camera/types.js';
|
|
10
13
|
export type * from '../../server/src/decoder/types.js';
|
|
11
14
|
export * from '../../server/src/go2rtc/types.js';
|
|
12
15
|
export type * from '../../server/src/nats/types.js';
|
|
16
|
+
export * from '../../server/src/plugins/interfaces/base.js';
|
|
13
17
|
export * from '../../server/src/plugins/types.js';
|
|
14
|
-
export * from '../../server/src/polyglot/node/plugins/schema.js';
|
|
15
18
|
export * from '../../server/src/services/config/types.js';
|
|
16
19
|
export type * from '../../server/src/types.js';
|
|
17
20
|
export { names as cocoLabels } from '../../server/src/utils/cocoLabels.json';
|
|
18
|
-
export * from '../../server/src/utils/subscribed.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.93",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
6
6
|
"module": "./dist/bundle.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"lru-cache": "^11.0.
|
|
28
|
+
"lru-cache": "^11.0.1",
|
|
29
29
|
"rxjs": "^7.8.1",
|
|
30
30
|
"socket.io-client": "^4.7.5"
|
|
31
31
|
},
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
import { BaseCameraDevice } from './index.js';
|
|
3
|
-
import { WeriftSession } from './streaming/werift-session.js';
|
|
4
|
-
import type { Observable } from 'rxjs';
|
|
5
|
-
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
6
|
-
import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
|
|
7
|
-
import type { AudioSetEvent, BatterySetEvent, CameraConfigInputSettings, CameraDelegates, DoorbellSetEvent, FrameState, LightSetEvent, MotionSetEvent, ObjectSetEvent, SirenSetEvent } from './types.js';
|
|
8
|
-
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
9
|
-
protected readonly frameState: BehaviorSubject<FrameState>;
|
|
10
|
-
protected readonly onFrame: Observable<FrameState>;
|
|
11
|
-
abstract setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
|
|
12
|
-
abstract connect(): Promise<void>;
|
|
13
|
-
abstract disconnect(): Promise<void>;
|
|
14
|
-
abstract getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
|
|
15
|
-
abstract getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
16
|
-
abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
17
|
-
abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: VideoFrame): Promise<void>;
|
|
18
|
-
abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
19
|
-
abstract updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
20
|
-
abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
21
|
-
abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
22
|
-
abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
23
|
-
abstract addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
24
|
-
abstract updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
25
|
-
abstract removeCameraSource(sourceId: string): Promise<void>;
|
|
26
|
-
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<WeriftSession>;
|
|
27
|
-
protected removeAllListeners(): void;
|
|
28
|
-
private createMotionFrameObservable;
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CameraDelegate } from '../types.js';
|
|
2
|
-
import type { BaseLogger } from '../types.js';
|
|
3
|
-
export declare class CameraInterface extends CameraDelegate {
|
|
4
|
-
delegate?: CameraDelegate;
|
|
5
|
-
private onRequest;
|
|
6
|
-
private logger;
|
|
7
|
-
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
-
snapshot(): Promise<ArrayBuffer | undefined>;
|
|
9
|
-
private _onRequest;
|
|
10
|
-
}
|