@camstack/addon-provider-reolink 1.2.58 → 1.2.59
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/addon.js +44 -6
- package/dist/addon.mjs +44 -6
- package/package.json +3 -2
package/dist/addon.js
CHANGED
|
@@ -236221,10 +236221,12 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236221
236221
|
* descriptors served by the `stream-catalog` cap (broker PULLS via
|
|
236222
236222
|
* `registerStreamCatalogProvider`).
|
|
236223
236223
|
*
|
|
236224
|
-
* Returns `[]`
|
|
236225
|
-
*
|
|
236226
|
-
*
|
|
236227
|
-
*
|
|
236224
|
+
* Returns `[]` only when there is genuinely nothing to say: the
|
|
236225
|
+
* battery-sleep gate (logged at debug), or a camera that connected and
|
|
236226
|
+
* reported zero streams. An `ensureApi` / `buildVideoStreamOptions` failure
|
|
236227
|
+
* THROWS — `[]` and an error are not the same fact, and the broker needs
|
|
236228
|
+
* the difference to keep the device's existing entry and to schedule its
|
|
236229
|
+
* per-device backoff instead of treating the camera as stream-less.
|
|
236228
236230
|
*
|
|
236229
236231
|
* This method only BUILDS descriptors — it never opens an upstream
|
|
236230
236232
|
* session or touches the broker.
|
|
@@ -236352,10 +236354,22 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236352
236354
|
channel: ownChannel,
|
|
236353
236355
|
onNvr: true
|
|
236354
236356
|
} : void 0;
|
|
236357
|
+
const readStreamOptions = async (current) => withTimeout(buildOptions ? current.buildVideoStreamOptions(buildOptions) : current.buildVideoStreamOptions(), 1e4, "buildVideoStreamOptions");
|
|
236355
236358
|
try {
|
|
236356
|
-
streamOptions = await
|
|
236359
|
+
streamOptions = await readStreamOptions(api);
|
|
236357
236360
|
} catch (err) {
|
|
236358
|
-
throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
236361
|
+
if (isChild) throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
236362
|
+
this.ctx.logger.warn("buildStreamCatalog: stream options read failed — dropping the Baichuan session and retrying once", {
|
|
236363
|
+
tags: { deviceId: this.id },
|
|
236364
|
+
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
236365
|
+
});
|
|
236366
|
+
await this.dropBaichuanSession("stream-catalog-retry");
|
|
236367
|
+
try {
|
|
236368
|
+
streamOptions = await readStreamOptions(await withTimeout(this.ensureApi(), 1e4, "ensureApi"));
|
|
236369
|
+
} catch (retryErr) {
|
|
236370
|
+
throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id} (after one re-auth retry): ${retryErr instanceof Error ? retryErr.message : String(retryErr)}`, { cause: retryErr });
|
|
236371
|
+
}
|
|
236372
|
+
this.ctx.logger.info("buildStreamCatalog: stream options read recovered after re-auth", { tags: { deviceId: this.id } });
|
|
236359
236373
|
}
|
|
236360
236374
|
const channelCount = this.channelCount();
|
|
236361
236375
|
const desired = /* @__PURE__ */ new Map();
|
|
@@ -239237,6 +239251,30 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
239237
239251
|
* `awake` push (or a snapshot demand from the operator) will
|
|
239238
239252
|
* lazily call `ensureApi()` and re-establish the client.
|
|
239239
239253
|
*/
|
|
239254
|
+
/**
|
|
239255
|
+
* Close and forget the cached control-channel client so the NEXT
|
|
239256
|
+
* `ensureApi()` performs a fresh login.
|
|
239257
|
+
*
|
|
239258
|
+
* The one thing `scheduleReconnect` cannot express: an EXPIRED session on a
|
|
239259
|
+
* socket that is still open. No `close`/`error` ever fires, so the reconnect
|
|
239260
|
+
* ladder is never armed, and `ensureApi`'s `if (this.api) return this.api`
|
|
239261
|
+
* keeps handing back a client whose every request answers `responseCode
|
|
239262
|
+
* 400`. Callers that see an application-level rejection they believe is a
|
|
239263
|
+
* dead session call this and retry ONCE — they must never loop on it.
|
|
239264
|
+
*
|
|
239265
|
+
* Same teardown the `disconnectAll` / debug-options paths use: `close()`
|
|
239266
|
+
* best-effort, then null the field. Active RFC 4571 servers are untouched —
|
|
239267
|
+
* each owns a dedicated socket and survives a control-channel reset (see
|
|
239268
|
+
* `scheduleReconnect`).
|
|
239269
|
+
*/
|
|
239270
|
+
async dropBaichuanSession(reason) {
|
|
239271
|
+
const current = this.api;
|
|
239272
|
+
this.api = null;
|
|
239273
|
+
if (!current) return;
|
|
239274
|
+
try {
|
|
239275
|
+
await current.close({ reason });
|
|
239276
|
+
} catch {}
|
|
239277
|
+
}
|
|
239240
239278
|
scheduleReconnect(reason) {
|
|
239241
239279
|
if (this.reconnectTimer) return;
|
|
239242
239280
|
if (this.isBattery) {
|
package/dist/addon.mjs
CHANGED
|
@@ -236201,10 +236201,12 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236201
236201
|
* descriptors served by the `stream-catalog` cap (broker PULLS via
|
|
236202
236202
|
* `registerStreamCatalogProvider`).
|
|
236203
236203
|
*
|
|
236204
|
-
* Returns `[]`
|
|
236205
|
-
*
|
|
236206
|
-
*
|
|
236207
|
-
*
|
|
236204
|
+
* Returns `[]` only when there is genuinely nothing to say: the
|
|
236205
|
+
* battery-sleep gate (logged at debug), or a camera that connected and
|
|
236206
|
+
* reported zero streams. An `ensureApi` / `buildVideoStreamOptions` failure
|
|
236207
|
+
* THROWS — `[]` and an error are not the same fact, and the broker needs
|
|
236208
|
+
* the difference to keep the device's existing entry and to schedule its
|
|
236209
|
+
* per-device backoff instead of treating the camera as stream-less.
|
|
236208
236210
|
*
|
|
236209
236211
|
* This method only BUILDS descriptors — it never opens an upstream
|
|
236210
236212
|
* session or touches the broker.
|
|
@@ -236332,10 +236334,22 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236332
236334
|
channel: ownChannel,
|
|
236333
236335
|
onNvr: true
|
|
236334
236336
|
} : void 0;
|
|
236337
|
+
const readStreamOptions = async (current) => withTimeout(buildOptions ? current.buildVideoStreamOptions(buildOptions) : current.buildVideoStreamOptions(), 1e4, "buildVideoStreamOptions");
|
|
236335
236338
|
try {
|
|
236336
|
-
streamOptions = await
|
|
236339
|
+
streamOptions = await readStreamOptions(api);
|
|
236337
236340
|
} catch (err) {
|
|
236338
|
-
throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
236341
|
+
if (isChild) throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
236342
|
+
this.ctx.logger.warn("buildStreamCatalog: stream options read failed — dropping the Baichuan session and retrying once", {
|
|
236343
|
+
tags: { deviceId: this.id },
|
|
236344
|
+
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
236345
|
+
});
|
|
236346
|
+
await this.dropBaichuanSession("stream-catalog-retry");
|
|
236347
|
+
try {
|
|
236348
|
+
streamOptions = await readStreamOptions(await withTimeout(this.ensureApi(), 1e4, "ensureApi"));
|
|
236349
|
+
} catch (retryErr) {
|
|
236350
|
+
throw new Error(`buildStreamCatalog: buildVideoStreamOptions failed for device ${this.id} (after one re-auth retry): ${retryErr instanceof Error ? retryErr.message : String(retryErr)}`, { cause: retryErr });
|
|
236351
|
+
}
|
|
236352
|
+
this.ctx.logger.info("buildStreamCatalog: stream options read recovered after re-auth", { tags: { deviceId: this.id } });
|
|
236339
236353
|
}
|
|
236340
236354
|
const channelCount = this.channelCount();
|
|
236341
236355
|
const desired = /* @__PURE__ */ new Map();
|
|
@@ -239217,6 +239231,30 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
239217
239231
|
* `awake` push (or a snapshot demand from the operator) will
|
|
239218
239232
|
* lazily call `ensureApi()` and re-establish the client.
|
|
239219
239233
|
*/
|
|
239234
|
+
/**
|
|
239235
|
+
* Close and forget the cached control-channel client so the NEXT
|
|
239236
|
+
* `ensureApi()` performs a fresh login.
|
|
239237
|
+
*
|
|
239238
|
+
* The one thing `scheduleReconnect` cannot express: an EXPIRED session on a
|
|
239239
|
+
* socket that is still open. No `close`/`error` ever fires, so the reconnect
|
|
239240
|
+
* ladder is never armed, and `ensureApi`'s `if (this.api) return this.api`
|
|
239241
|
+
* keeps handing back a client whose every request answers `responseCode
|
|
239242
|
+
* 400`. Callers that see an application-level rejection they believe is a
|
|
239243
|
+
* dead session call this and retry ONCE — they must never loop on it.
|
|
239244
|
+
*
|
|
239245
|
+
* Same teardown the `disconnectAll` / debug-options paths use: `close()`
|
|
239246
|
+
* best-effort, then null the field. Active RFC 4571 servers are untouched —
|
|
239247
|
+
* each owns a dedicated socket and survives a control-channel reset (see
|
|
239248
|
+
* `scheduleReconnect`).
|
|
239249
|
+
*/
|
|
239250
|
+
async dropBaichuanSession(reason) {
|
|
239251
|
+
const current = this.api;
|
|
239252
|
+
this.api = null;
|
|
239253
|
+
if (!current) return;
|
|
239254
|
+
try {
|
|
239255
|
+
await current.close({ reason });
|
|
239256
|
+
} catch {}
|
|
239257
|
+
}
|
|
239220
239258
|
scheduleReconnect(reason) {
|
|
239221
239259
|
if (this.reconnectTimer) return;
|
|
239222
239260
|
if (this.isBattery) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-reolink",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.59",
|
|
4
4
|
"description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"mode": "standalone",
|
|
45
45
|
"execution": {
|
|
46
46
|
"placement": "hub-only",
|
|
47
|
-
"heapProfile": "heavy"
|
|
47
|
+
"heapProfile": "heavy",
|
|
48
|
+
"rssBudgetMb": 1024
|
|
48
49
|
},
|
|
49
50
|
"capabilities": [
|
|
50
51
|
{
|