@apocaliss92/nodelink-js 0.4.4 → 0.4.5
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 +2 -0
- package/dist/{chunk-UHFJPQA4.js → chunk-WDFKIHM5.js} +166 -16
- package/dist/chunk-WDFKIHM5.js.map +1 -0
- package/dist/cli/rtsp-server.cjs +165 -15
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +1 -1
- package/dist/index.cjs +165 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-UHFJPQA4.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1009,11 +1009,13 @@ interface ReolinkDayNightNotification {
|
|
|
1009
1009
|
timestamp?: number;
|
|
1010
1010
|
}
|
|
1011
1011
|
type ReolinkEvent = ReolinkMotionNotification | ReolinkAiNotification | ReolinkVisitorNotification | ReolinkDayNightNotification;
|
|
1012
|
-
type ReolinkSimpleEventType = "motion" | "doorbell" | "people" | "vehicle" | "animal" | "face" | "package" | "daynight" | "sleeping" | "awake" | "online" | "offline" | "other";
|
|
1012
|
+
type ReolinkSimpleEventType = "motion" | "doorbell" | "people" | "vehicle" | "animal" | "face" | "package" | "daynight" | "sleeping" | "awake" | "online" | "offline" | "battery" | "other";
|
|
1013
1013
|
interface ReolinkSimpleEvent {
|
|
1014
1014
|
type: ReolinkSimpleEventType;
|
|
1015
1015
|
channel: number;
|
|
1016
1016
|
timestamp: number;
|
|
1017
|
+
/** Present when type === "battery" — pushed by the camera via cmdId 252. */
|
|
1018
|
+
battery?: Partial<BatteryInfo>;
|
|
1017
1019
|
}
|
|
1018
1020
|
interface TwoWayAudioConfig {
|
|
1019
1021
|
channel: number;
|
|
@@ -1935,6 +1937,11 @@ declare class BaichuanClient extends EventEmitter<{
|
|
|
1935
1937
|
debug: [string, unknown?];
|
|
1936
1938
|
event: [ReolinkEvent];
|
|
1937
1939
|
channelInfo: [string];
|
|
1940
|
+
batteryPush: [BaichuanFrame];
|
|
1941
|
+
d2c_disc: [{
|
|
1942
|
+
host: string;
|
|
1943
|
+
atMs: number;
|
|
1944
|
+
}];
|
|
1938
1945
|
}> {
|
|
1939
1946
|
/**
|
|
1940
1947
|
* Process-wide streaming activity registry.
|
|
@@ -1946,6 +1953,14 @@ declare class BaichuanClient extends EventEmitter<{
|
|
|
1946
1953
|
* even if the current client instance is idle/disconnected.
|
|
1947
1954
|
*/
|
|
1948
1955
|
private static readonly streamingRegistry;
|
|
1956
|
+
/**
|
|
1957
|
+
* Per-host D2C_DISC backoff state that persists across client instance recreation.
|
|
1958
|
+
*
|
|
1959
|
+
* Why: when a D2C_DISC kills a client, the socket pool destroys the old instance
|
|
1960
|
+
* and creates a new one. Instance-level backoff variables would reset to zero,
|
|
1961
|
+
* allowing immediate reconnection and perpetuating the storm.
|
|
1962
|
+
*/
|
|
1963
|
+
private static readonly d2cDiscBackoff;
|
|
1949
1964
|
/**
|
|
1950
1965
|
* Global (process-wide) CoverPreview serialization.
|
|
1951
1966
|
*
|
|
@@ -4338,6 +4353,19 @@ declare class ReolinkBaichuanApi {
|
|
|
4338
4353
|
private readonly aiAlarmCandidateTypesCache;
|
|
4339
4354
|
private rtspServers;
|
|
4340
4355
|
private readonly activeVideoMsgNums;
|
|
4356
|
+
/** Timestamp of the most recent D2C_DISC from any client for this device. */
|
|
4357
|
+
private lastD2cDiscAtMs;
|
|
4358
|
+
/** Sliding window of recent D2C_DISC timestamps for storm detection. */
|
|
4359
|
+
private readonly d2cDiscTimestamps;
|
|
4360
|
+
/** Immediate cooldown (ms) applied to socket pool on every D2C_DISC.
|
|
4361
|
+
* Prevents reconnect attempts while the camera is transitioning to sleep. */
|
|
4362
|
+
private static readonly D2C_DISC_IMMEDIATE_COOLDOWN_MS;
|
|
4363
|
+
/** Number of D2C_DISCs within the storm window to trigger extended cooldown. */
|
|
4364
|
+
private static readonly D2C_DISC_STORM_THRESHOLD;
|
|
4365
|
+
/** Sliding window size (ms) for storm detection. */
|
|
4366
|
+
private static readonly D2C_DISC_STORM_WINDOW_MS;
|
|
4367
|
+
/** Extended cooldown (ms) applied to socket pool when a D2C_DISC storm is detected. */
|
|
4368
|
+
private static readonly D2C_DISC_STORM_COOLDOWN_MS;
|
|
4341
4369
|
private readonly nvrChannelsSummaryCache;
|
|
4342
4370
|
/**
|
|
4343
4371
|
* Cached device capabilities per channel.
|
|
@@ -4512,6 +4540,12 @@ declare class ReolinkBaichuanApi {
|
|
|
4512
4540
|
* @returns The socket pool tag to use
|
|
4513
4541
|
*/
|
|
4514
4542
|
private resolveSocketTag;
|
|
4543
|
+
/**
|
|
4544
|
+
* Attach a D2C_DISC listener to a BaichuanClient so that the API-level
|
|
4545
|
+
* grace period and storm detection are updated regardless of which
|
|
4546
|
+
* pool socket receives the disconnect.
|
|
4547
|
+
*/
|
|
4548
|
+
private attachD2cDiscListener;
|
|
4515
4549
|
/**
|
|
4516
4550
|
* Acquire a socket from the pool by tag.
|
|
4517
4551
|
* Creates a new socket if needed, or reuses an existing one.
|
|
@@ -5657,6 +5691,15 @@ declare class ReolinkBaichuanApi {
|
|
|
5657
5691
|
zoomToFactor(zoomFactor: number, channel?: number): Promise<void>;
|
|
5658
5692
|
zoomToFactor(channel: number, zoomFactor: number): Promise<void>;
|
|
5659
5693
|
private parseBatteryInfoXml;
|
|
5694
|
+
/**
|
|
5695
|
+
* Called when any BaichuanClient for this device receives a D2C_DISC.
|
|
5696
|
+
*
|
|
5697
|
+
* Two-tier response:
|
|
5698
|
+
* 1. **Immediate**: every D2C_DISC applies a short socket pool cooldown
|
|
5699
|
+
* (10 s) to prevent reconnect attempts while the camera transitions to sleep.
|
|
5700
|
+
* 2. **Storm**: ≥3 D2C_DISCs within 60 s triggers extended cooldown (120 s).
|
|
5701
|
+
*/
|
|
5702
|
+
private notifyD2cDisc;
|
|
5660
5703
|
/**
|
|
5661
5704
|
* Best-effort sleeping inference for battery/BCUDP cameras.
|
|
5662
5705
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -396,6 +396,11 @@ export declare class BaichuanClient extends EventEmitter<{
|
|
|
396
396
|
debug: [string, unknown?];
|
|
397
397
|
event: [ReolinkEvent];
|
|
398
398
|
channelInfo: [string];
|
|
399
|
+
batteryPush: [BaichuanFrame];
|
|
400
|
+
d2c_disc: [{
|
|
401
|
+
host: string;
|
|
402
|
+
atMs: number;
|
|
403
|
+
}];
|
|
399
404
|
}> {
|
|
400
405
|
/**
|
|
401
406
|
* Process-wide streaming activity registry.
|
|
@@ -407,6 +412,14 @@ export declare class BaichuanClient extends EventEmitter<{
|
|
|
407
412
|
* even if the current client instance is idle/disconnected.
|
|
408
413
|
*/
|
|
409
414
|
private static readonly streamingRegistry;
|
|
415
|
+
/**
|
|
416
|
+
* Per-host D2C_DISC backoff state that persists across client instance recreation.
|
|
417
|
+
*
|
|
418
|
+
* Why: when a D2C_DISC kills a client, the socket pool destroys the old instance
|
|
419
|
+
* and creates a new one. Instance-level backoff variables would reset to zero,
|
|
420
|
+
* allowing immediate reconnection and perpetuating the storm.
|
|
421
|
+
*/
|
|
422
|
+
private static readonly d2cDiscBackoff;
|
|
410
423
|
/**
|
|
411
424
|
* Global (process-wide) CoverPreview serialization.
|
|
412
425
|
*
|
|
@@ -5183,6 +5196,19 @@ export declare class ReolinkBaichuanApi {
|
|
|
5183
5196
|
private readonly aiAlarmCandidateTypesCache;
|
|
5184
5197
|
private rtspServers;
|
|
5185
5198
|
private readonly activeVideoMsgNums;
|
|
5199
|
+
/** Timestamp of the most recent D2C_DISC from any client for this device. */
|
|
5200
|
+
private lastD2cDiscAtMs;
|
|
5201
|
+
/** Sliding window of recent D2C_DISC timestamps for storm detection. */
|
|
5202
|
+
private readonly d2cDiscTimestamps;
|
|
5203
|
+
/** Immediate cooldown (ms) applied to socket pool on every D2C_DISC.
|
|
5204
|
+
* Prevents reconnect attempts while the camera is transitioning to sleep. */
|
|
5205
|
+
private static readonly D2C_DISC_IMMEDIATE_COOLDOWN_MS;
|
|
5206
|
+
/** Number of D2C_DISCs within the storm window to trigger extended cooldown. */
|
|
5207
|
+
private static readonly D2C_DISC_STORM_THRESHOLD;
|
|
5208
|
+
/** Sliding window size (ms) for storm detection. */
|
|
5209
|
+
private static readonly D2C_DISC_STORM_WINDOW_MS;
|
|
5210
|
+
/** Extended cooldown (ms) applied to socket pool when a D2C_DISC storm is detected. */
|
|
5211
|
+
private static readonly D2C_DISC_STORM_COOLDOWN_MS;
|
|
5186
5212
|
private readonly nvrChannelsSummaryCache;
|
|
5187
5213
|
/**
|
|
5188
5214
|
* Cached device capabilities per channel.
|
|
@@ -5357,6 +5383,12 @@ export declare class ReolinkBaichuanApi {
|
|
|
5357
5383
|
* @returns The socket pool tag to use
|
|
5358
5384
|
*/
|
|
5359
5385
|
private resolveSocketTag;
|
|
5386
|
+
/**
|
|
5387
|
+
* Attach a D2C_DISC listener to a BaichuanClient so that the API-level
|
|
5388
|
+
* grace period and storm detection are updated regardless of which
|
|
5389
|
+
* pool socket receives the disconnect.
|
|
5390
|
+
*/
|
|
5391
|
+
private attachD2cDiscListener;
|
|
5360
5392
|
/**
|
|
5361
5393
|
* Acquire a socket from the pool by tag.
|
|
5362
5394
|
* Creates a new socket if needed, or reuses an existing one.
|
|
@@ -6502,6 +6534,15 @@ export declare class ReolinkBaichuanApi {
|
|
|
6502
6534
|
zoomToFactor(zoomFactor: number, channel?: number): Promise<void>;
|
|
6503
6535
|
zoomToFactor(channel: number, zoomFactor: number): Promise<void>;
|
|
6504
6536
|
private parseBatteryInfoXml;
|
|
6537
|
+
/**
|
|
6538
|
+
* Called when any BaichuanClient for this device receives a D2C_DISC.
|
|
6539
|
+
*
|
|
6540
|
+
* Two-tier response:
|
|
6541
|
+
* 1. **Immediate**: every D2C_DISC applies a short socket pool cooldown
|
|
6542
|
+
* (10 s) to prevent reconnect attempts while the camera transitions to sleep.
|
|
6543
|
+
* 2. **Storm**: ≥3 D2C_DISCs within 60 s triggers extended cooldown (120 s).
|
|
6544
|
+
*/
|
|
6545
|
+
private notifyD2cDisc;
|
|
6505
6546
|
/**
|
|
6506
6547
|
* Best-effort sleeping inference for battery/BCUDP cameras.
|
|
6507
6548
|
*
|
|
@@ -8361,9 +8402,11 @@ export declare interface ReolinkSimpleEvent {
|
|
|
8361
8402
|
type: ReolinkSimpleEventType;
|
|
8362
8403
|
channel: number;
|
|
8363
8404
|
timestamp: number;
|
|
8405
|
+
/** Present when type === "battery" — pushed by the camera via cmdId 252. */
|
|
8406
|
+
battery?: Partial<BatteryInfo>;
|
|
8364
8407
|
}
|
|
8365
8408
|
|
|
8366
|
-
export declare type ReolinkSimpleEventType = "motion" | "doorbell" | "people" | "vehicle" | "animal" | "face" | "package" | "daynight" | "sleeping" | "awake" | "online" | "offline" | "other";
|
|
8409
|
+
export declare type ReolinkSimpleEventType = "motion" | "doorbell" | "people" | "vehicle" | "animal" | "face" | "package" | "daynight" | "sleeping" | "awake" | "online" | "offline" | "battery" | "other";
|
|
8367
8410
|
|
|
8368
8411
|
/**
|
|
8369
8412
|
* Complete media stream options with all available metadata.
|