@camera.ui/browser 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import type { SocketService } from '../../socket';
3
- import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, PrebufferType, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BaseLogger, FfmpegOptions, Input, CameraInput } from '../../../../../shared/types';
3
+ import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, PrebufferType, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BaseLogger, FfmpegOptions, Input } from '../../../../../shared/types';
4
4
  export declare class CameraDeviceClient implements CameraDevice {
5
5
  private socketService;
6
6
  private cameraSubject;
@@ -32,8 +32,8 @@ export declare class CameraDeviceClient implements CameraDevice {
32
32
  get hasPtz(): boolean;
33
33
  get sources(): Input[];
34
34
  constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
35
- snapshot(source?: CameraInput | Input): Promise<ArrayBuffer>;
36
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
35
+ snapshot(sourceName?: string): Promise<ArrayBuffer>;
36
+ setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType, fromCamera?: boolean): Promise<void>;
37
37
  getFfmpegPath(): Promise<string>;
38
38
  getIceServers(): Promise<RTCIceServer[]>;
39
39
  getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
@@ -1,6 +1,2 @@
1
- import type { CameraDevice } from '../../../../../shared/types';
2
- export interface ICameraDeviceClient extends CameraDevice {
3
- refreshStates(): Promise<void>;
4
- }
5
1
  declare let CameraDeviceImplementation: any;
6
2
  export default CameraDeviceImplementation;
@@ -1,6 +1,9 @@
1
1
  import type { DeviceManagerClient, PluginsManagerClient, SystemManagerClient } from './proxy';
2
- import type { BaseLogger } from '../../../shared/types';
2
+ import type { BaseLogger, CameraDevice } from '../../../shared/types';
3
3
  export type { BaseLogger, BasicPeerConnection, CameraConfig, CameraDevice, Camera, CameraInput, FfmpegOptions, Go2RtcIceCandidateMessage, Go2RtcOfferMessage, Go2RtcAnswerMessage, Go2RtcIncomingMessage, Go2RtcOutgoingMessage, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, } from '../../../shared/types';
4
+ export interface ICameraDeviceClient extends CameraDevice {
5
+ refreshStates(): Promise<void>;
6
+ }
4
7
  export type CameraUiClientConfig = WithCredentials | WithToken;
5
8
  export interface API {
6
9
  deviceManager: DeviceManagerClient;
@@ -4,5 +4,5 @@ export * from '../../src/api/database/types';
4
4
  export * from '../../src/plugins/types';
5
5
  export * from '../../src/api/ws/types';
6
6
  export * from '../../src/go2rtc/types';
7
- export type * from '../../src/camera/types';
8
- export type * from '../../src/proxy/types';
7
+ export * from '../../src/camera/types';
8
+ export * from '../../src/proxy/types';
@@ -36,8 +36,8 @@ export declare class CameraDeviceHub implements CameraDevice {
36
36
  get hasPtz(): boolean;
37
37
  get sources(): Input[];
38
38
  constructor(camera: Camera, logger?: BaseLogger, proxy?: ProxyServer);
39
- snapshot(source?: CameraInput | Input): Promise<ArrayBuffer>;
40
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
39
+ snapshot(sourceName?: string): Promise<ArrayBuffer>;
40
+ setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType, fromCamera?: boolean): Promise<void>;
41
41
  getFfmpegPath(): Promise<string>;
42
42
  getIceServers(): Promise<IceServer[]>;
43
43
  getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
@@ -55,7 +55,7 @@ export interface CameraDevice {
55
55
  onObjectDetected: Observable<ObjectState>;
56
56
  onDoorbellPressed: Observable<DoorbellState>;
57
57
  onSirenDetected: Observable<SirenState>;
58
- snapshot(): Promise<ArrayBuffer>;
58
+ snapshot(sourceName?: string): Promise<ArrayBuffer>;
59
59
  setPrebufferSource(sourceName: string, address: string | null, type: 'recording' | 'stream'): Promise<void>;
60
60
  getFfmpegPath(): Promise<string>;
61
61
  getIceServers(): Promise<RTCIceServer[]>;
@@ -11,6 +11,11 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
11
11
  private pluginsService;
12
12
  private proxyServer;
13
13
  constructor(proxyServer: ProxyServer);
14
+ snapshot(data: {
15
+ sourceName: string;
16
+ cameraId: string;
17
+ pluginId: string;
18
+ }): Promise<ArrayBuffer>;
14
19
  setPrebufferSource(data: {
15
20
  sourceName: string;
16
21
  address: string | null;
@@ -189,6 +189,11 @@ export interface CameraDeviceProxyMessageStructure {
189
189
  timestamp: number;
190
190
  }
191
191
  export interface CameraDeviceProxyMethods {
192
+ snapshot(data: {
193
+ sourceName: string;
194
+ cameraId: string;
195
+ pluginId: string;
196
+ }): Promise<ArrayBuffer>;
192
197
  setPrebufferSource(data: {
193
198
  sourceName: string;
194
199
  address: string | null;
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
- "main": "./dist/bundle.browser.js",
7
- "module": "./dist/bundle.browser.js",
6
+ "main": "./dist/bundle.js",
7
+ "module": "./dist/bundle.js",
8
8
  "types": "./dist/client/node/src/index.d.ts",
9
+ "type": "commonjs",
9
10
  "exports": {
10
11
  ".": {
11
- "default": "./dist/bundle.browser.js",
12
- "import": "./dist/bundle.browser.js",
12
+ "default": "./dist/bundle.js",
13
+ "import": "./dist/bundle.js",
13
14
  "types": "./dist/client/node/src/index.d.ts"
14
15
  }
15
16
  },
16
17
  "scripts": {
17
- "build": "rimraf dist && tsc && webpack --config webpack.config.js --env browser",
18
+ "build": "rimraf dist && tsc && webpack --config webpack.config.ts",
18
19
  "update": "updates --update ./",
19
20
  "install-updates": "npm i --save",
20
21
  "prepublishOnly": "npm run build"
@@ -0,0 +1,43 @@
1
+ import path from 'path';
2
+ import webpack, { type Configuration } from 'webpack';
3
+
4
+ const webpackConfiguration: Configuration = {
5
+ mode: 'production',
6
+ entry: '../node/src/index.ts',
7
+ output: {
8
+ path: path.resolve(__dirname, 'dist'),
9
+ filename: 'bundle.js',
10
+ library: {
11
+ name: 'CameraUiClient',
12
+ type: 'umd',
13
+ },
14
+ },
15
+ performance: {
16
+ hints: false,
17
+ maxEntrypointSize: 512000,
18
+ maxAssetSize: 512000,
19
+ },
20
+ optimization: {
21
+ splitChunks: {
22
+ minSize: 10000,
23
+ maxSize: 250000,
24
+ },
25
+ },
26
+ devtool: false,
27
+ resolve: {
28
+ extensions: ['.ts', '.js'],
29
+ },
30
+ target: 'web',
31
+ module: {
32
+ rules: [
33
+ {
34
+ test: /\.ts$/,
35
+ use: 'ts-loader',
36
+ exclude: /node_modules/,
37
+ },
38
+ ],
39
+ },
40
+ plugins: [new webpack.NormalModuleReplacementPlugin(/cameraDevice\.node/, path.resolve(__dirname, '../node/src/proxy/cameraDevice/cameraDevice.mock.ts'))],
41
+ };
42
+
43
+ export default webpackConfiguration;