@camstack/addon-provider-reolink 1.2.223 → 1.2.225

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.225] - 2026-11-05
11
+
12
+ ### Changed
13
+
14
+ - Copying an integration into its record reads the leftover rows through the migration-only door and resolves their secrets in this addon
15
+
16
+ ## [1.2.224] - 2026-11-04
17
+
18
+ ### Changed
19
+
20
+ - Reolink starts again after the update: its integration migrations are offered in order, so the move of the connection settings runs
21
+
10
22
  ## [1.2.223] - 2026-11-04
11
23
 
12
24
  ### Changed
package/dist/addon.js CHANGED
@@ -106677,7 +106677,7 @@ var ZodIssueCode = {
106677
106677
  var ZodFirstPartyTypeKind;
106678
106678
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106679
106679
  //#endregion
106680
- //#region ../types/dist/sleep-D1jjWAr8.mjs
106680
+ //#region ../types/dist/sleep-9TIHFj1w.mjs
106681
106681
  /**
106682
106682
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106683
106683
  * window to float samples (D455).
@@ -108621,10 +108621,9 @@ var BaseAddon = class {
108621
108621
  *
108622
108622
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
108623
108623
  * needs its connection fields, the default integration the addon's own sections. It is the
108624
- * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
108625
- * unchanged (`integrations.setSettings` for an account integration).
108624
+ * SHAPE of the form only — the values live on the instance record.
108626
108625
  */
108627
- async integrationSettingsSchema(_instance) {
108626
+ async integrationFormSchema(_instance) {
108628
108627
  return null;
108629
108628
  }
108630
108629
  /**
@@ -108670,7 +108669,7 @@ var BaseAddon = class {
108670
108669
  * per-instance schema when it declares one, else its global schema (what they always showed).
108671
108670
  */
108672
108671
  async getIntegrationFormSchema(instance, nodeId) {
108673
- const scoped = await this.integrationSettingsSchema(instance);
108672
+ const scoped = await this.integrationFormSchema(instance);
108674
108673
  if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
108675
108674
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
108676
108675
  }
@@ -112777,7 +112776,7 @@ function sleep(ms) {
112777
112776
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
112778
112777
  }
112779
112778
  //#endregion
112780
- //#region ../types/dist/composition-CRNwcFYY.mjs
112779
+ //#region ../types/dist/composition-pOHbTzRB.mjs
112781
112780
  /**
112782
112781
  * The ffmpeg build every CamStack node downloads, per platform and arch.
112783
112782
  *
@@ -115536,20 +115535,28 @@ async function moveIntegrationRowsToRecords(ports, spec) {
115536
115535
  };
115537
115536
  }
115538
115537
  /**
115539
- * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416): an addon runs the move
115540
- * from its own process, so the legacy rows are reached through the hub (`ctx.api.integrations`:
115541
- * `list`, `getSettings` - which answers the OWNER its secrets resolved - and `clearSettings`) and
115542
- * the new record through the addon's own records handle. The hub deletes the rows and their
115543
- * keychain values; the addon never touches the registry.
115538
+ * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416). An addon runs the move
115539
+ * from its own process, so the leftover rows are reached through the migration-only door
115540
+ * (`migrations.readLegacyIntegrationRows` / `clearLegacyIntegrationRows`) on the hub's connection.
115541
+ * The door returns markers. This process is the owner, so it resolves and releases them with
115542
+ * `resolveSecretMarkers` — the same call the old settings door used — and only then asks the
115543
+ * door to delete the rows. The addon's own record kind is its records handle.
115544
115544
  */
115545
+ async function resolvedRows(stored, secrets) {
115546
+ if (secrets === null) return stored;
115547
+ const { value, unresolved } = await resolveSecretMarkers(stored, secrets);
115548
+ if (unresolved.length > 0) throw new Error(`${unresolved.length} secret(s) cannot be read from the keychain`);
115549
+ return value;
115550
+ }
115545
115551
  function integrationRowsPortsOverApi(deps) {
115552
+ const secrets = deps.secrets ?? null;
115546
115553
  return {
115547
115554
  warn: (message) => deps.log.warn(message),
115548
115555
  listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
115549
115556
  id: i.id,
115550
115557
  name: i.name
115551
115558
  })),
115552
- readRows: (integrationId) => deps.api.getSettings({ id: integrationId }),
115559
+ readRows: async (integrationId) => resolvedRows(await deps.api.readLegacyIntegrationRows({ integrationId }), secrets),
115553
115560
  putRecord: async (id, body) => {
115554
115561
  if (await deps.records.get(id) !== null) return "exists";
115555
115562
  try {
@@ -115568,7 +115575,9 @@ function integrationRowsPortsOverApi(deps) {
115568
115575
  await deps.records.delete(id);
115569
115576
  },
115570
115577
  clearRows: async (integrationId) => {
115571
- await deps.api.clearSettings({ id: integrationId });
115578
+ const refs = collectSecretMarkerRefs(await deps.api.readLegacyIntegrationRows({ integrationId }));
115579
+ if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
115580
+ await deps.api.clearLegacyIntegrationRows({ integrationId });
115572
115581
  }
115573
115582
  };
115574
115583
  }
@@ -115658,14 +115667,14 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
115658
115667
  * 2. `claim-devices` (tolerate): `claimDevicesToDefaultIntegration`; with no integration to claim
115659
115668
  * to it fails and is retried on the next boot.
115660
115669
  *
115661
- * Both run in the addon process through the hub API (`ctx.api`), BEFORE the addon registers its
115662
- * `integration-instances` provider: while a provider is registered the hub answers `getSettings`
115663
- * from the record, not from the rows.
115670
+ * Both run in the addon process through the hub API (`ctx.api`). The leftover rows are read
115671
+ * through the migration-only door, which answers empty once the store is gone.
115664
115672
  */
115665
115673
  function defaultIntegrationPortsOver(deps) {
115666
115674
  return {
115667
115675
  ...integrationRowsPortsOverApi({
115668
115676
  api: deps.api,
115677
+ ...deps.secrets !== void 0 ? { secrets: deps.secrets } : {},
115669
115678
  records: deps.records.kind({
115670
115679
  name: deps.kind.name,
115671
115680
  declaration: deps.kind.declaration,
@@ -115730,8 +115739,8 @@ function claimDevicesMigration(spec) {
115730
115739
  function defaultIntegrationApiOver(api) {
115731
115740
  return {
115732
115741
  list: () => api.integrations.list.query(),
115733
- getSettings: (input) => api.integrations.getSettings.query(input),
115734
- clearSettings: (input) => api.integrations.clearSettings.mutate(input),
115742
+ readLegacyIntegrationRows: (input) => api.migrations.readLegacyIntegrationRows.query(input),
115743
+ clearLegacyIntegrationRows: (input) => api.migrations.clearLegacyIntegrationRows.mutate(input),
115735
115744
  listDevices: (addonId) => api.deviceManager.listAll.query({
115736
115745
  addonId,
115737
115746
  projection: "slim"
@@ -151882,6 +151891,9 @@ var RunningProposalEvidenceSchema = object({
151882
151891
  runsFound: number().int().nonnegative(),
151883
151892
  pausesFound: number().int().nonnegative(),
151884
151893
  longestPauseMs: number().nonnegative(),
151894
+ /** Episodes shorter than ~90 s (an anti-crease pulse, a display waking): never a run, never a pause. */
151895
+ pulsesFound: number().int().nonnegative(),
151896
+ longestPulseMs: number().nonnegative(),
151885
151897
  idleFloorW: number(),
151886
151898
  noiseCeilingW: number(),
151887
151899
  plateauW: number(),
@@ -157780,11 +157792,7 @@ var CreateIntegrationInputSchema = object({
157780
157792
  info: record(string(), unknown()).optional(),
157781
157793
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
157782
157794
  originStableId: string().optional(),
157783
- settings: record(string(), unknown()).optional(),
157784
- /** Keys of `settings` the form's schema declares secret (by type) — kept in
157785
- * the keychain, not the table (D787). */
157786
- secretKeys: array(string()).optional(),
157787
- skipRestart: boolean().optional()
157795
+ settings: record(string(), unknown()).optional()
157788
157796
  });
157789
157797
  var UpdateIntegrationInputSchema = object({
157790
157798
  id: string(),
@@ -157805,22 +157813,6 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
157805
157813
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
157806
157814
  kind: "mutation",
157807
157815
  auth: "admin"
157808
- }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
157809
- id: string(),
157810
- settings: record(string(), unknown()),
157811
- /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
157812
- secretKeys: array(string()).optional(),
157813
- /** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
157814
- skipRestart: boolean().optional()
157815
- }), object({ success: boolean() }), {
157816
- kind: "mutation",
157817
- auth: "admin"
157818
- }), method(object({ id: string() }), object({
157819
- rows: number().int().nonnegative(),
157820
- secrets: number().int().nonnegative()
157821
- }), {
157822
- kind: "mutation",
157823
- auth: "admin"
157824
157816
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
157825
157817
  addonId: string(),
157826
157818
  settings: record(string(), unknown())
@@ -160818,6 +160810,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
160818
160810
  }), {
160819
160811
  kind: "mutation",
160820
160812
  auth: "admin"
160813
+ }), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
160814
+ rows: number().int().nonnegative(),
160815
+ secrets: number().int().nonnegative()
160816
+ }), {
160817
+ kind: "mutation",
160818
+ auth: "admin"
160819
+ }), method(object({
160820
+ integrationId: string().min(1),
160821
+ patch: record(string(), unknown())
160822
+ }), object({ written: boolean() }), {
160823
+ kind: "mutation",
160824
+ auth: "admin"
160825
+ }), method(object({
160826
+ integrationId: string().min(1),
160827
+ keys: array(string().min(1))
160828
+ }), object({
160829
+ present: boolean(),
160830
+ removed: record(string(), unknown())
160831
+ }), {
160832
+ kind: "mutation",
160833
+ auth: "admin"
160821
160834
  });
160822
160835
  method(object({
160823
160836
  sourceUrl: string(),
@@ -183329,11 +183342,15 @@ discriminatedUnion("kind", [object({
183329
183342
  * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
183330
183343
  * near F. A device that is not near one level most of the time has no floor.
183331
183344
  * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
183332
- * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
183333
- * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
183345
+ * 3. an episode shorter than `PULSE_MAX_MS` is a PULSE (an anti-crease tumble, a
183346
+ * display waking): it is neither a run nor a pause. Among the remaining
183347
+ * episodes, gaps over `PAUSE_MAX_MS` always separate runs; the rest split in
183348
+ * two by the largest log-scale jump (>= 3x): the short ones are pauses INSIDE
183349
+ * a run (a soak), the long ones separate runs. A stretch under `MIN_RUN_MS`
183350
+ * is no run.
183334
183351
  * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
183335
- * grid a person would type; stop dwell covers the longest pause; start dwell
183336
- * covers the longest standby blip above T.
183352
+ * grid a person would type; stop dwell covers the longest pause and the
183353
+ * kind's floor; start dwell covers the longest pulse and standby blip above T.
183337
183354
  * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
183338
183355
  * run must hold exactly one true interval and nothing may flap outside.
183339
183356
  */
@@ -183344,6 +183361,10 @@ var MINUTE_MS$1 = 60 * SECOND_MS;
183344
183361
  30 * SECOND_MS;
183345
183362
  60 * SECOND_MS;
183346
183363
  20 * MINUTE_MS$1;
183364
+ 90 * SECOND_MS;
183365
+ 30 * MINUTE_MS$1;
183366
+ 10 * MINUTE_MS$1;
183367
+ DeviceType.Dryer, 3 * MINUTE_MS$1, DeviceType.Dishwasher, 3 * MINUTE_MS$1, DeviceType.Washer, 10 * MINUTE_MS$1;
183347
183368
  10 * SECOND_MS;
183348
183369
  10 * SECOND_MS;
183349
183370
  /**
@@ -188776,13 +188797,6 @@ Object.freeze({
188776
188797
  access: "create",
188777
188798
  role: "admin"
188778
188799
  },
188779
- "integrations.clearSettings": {
188780
- capName: "integrations",
188781
- capScope: "system",
188782
- addonId: null,
188783
- access: "delete",
188784
- role: "admin"
188785
- },
188786
188800
  "integrations.create": {
188787
188801
  capName: "integrations",
188788
188802
  capScope: "system",
@@ -188818,13 +188832,6 @@ Object.freeze({
188818
188832
  access: "view",
188819
188833
  role: "admin"
188820
188834
  },
188821
- "integrations.getSettings": {
188822
- capName: "integrations",
188823
- capScope: "system",
188824
- addonId: null,
188825
- access: "view",
188826
- role: "admin"
188827
- },
188828
188835
  "integrations.list": {
188829
188836
  capName: "integrations",
188830
188837
  capScope: "system",
@@ -188832,13 +188839,6 @@ Object.freeze({
188832
188839
  access: "view",
188833
188840
  role: "admin"
188834
188841
  },
188835
- "integrations.setSettings": {
188836
- capName: "integrations",
188837
- capScope: "system",
188838
- addonId: null,
188839
- access: "create",
188840
- role: "admin"
188841
- },
188842
188842
  "integrations.testConnection": {
188843
188843
  capName: "integrations",
188844
188844
  capScope: "system",
@@ -189833,6 +189833,13 @@ Object.freeze({
189833
189833
  access: "view",
189834
189834
  role: "admin"
189835
189835
  },
189836
+ "migrations.clearLegacyIntegrationRows": {
189837
+ capName: "migrations",
189838
+ capScope: "system",
189839
+ addonId: null,
189840
+ access: "delete",
189841
+ role: "admin"
189842
+ },
189836
189843
  "migrations.declareOwner": {
189837
189844
  capName: "migrations",
189838
189845
  capScope: "system",
@@ -189840,6 +189847,13 @@ Object.freeze({
189840
189847
  access: "create",
189841
189848
  role: "admin"
189842
189849
  },
189850
+ "migrations.deleteLegacyIntegrationRowKeys": {
189851
+ capName: "migrations",
189852
+ capScope: "system",
189853
+ addonId: null,
189854
+ access: "delete",
189855
+ role: "admin"
189856
+ },
189843
189857
  "migrations.dryRun": {
189844
189858
  capName: "migrations",
189845
189859
  capScope: "system",
@@ -189875,6 +189889,20 @@ Object.freeze({
189875
189889
  access: "create",
189876
189890
  role: "admin"
189877
189891
  },
189892
+ "migrations.patchLegacyIntegrationRows": {
189893
+ capName: "migrations",
189894
+ capScope: "system",
189895
+ addonId: null,
189896
+ access: "create",
189897
+ role: "admin"
189898
+ },
189899
+ "migrations.readLegacyIntegrationRows": {
189900
+ capName: "migrations",
189901
+ capScope: "system",
189902
+ addonId: null,
189903
+ access: "view",
189904
+ role: "admin"
189905
+ },
189878
189906
  "migrations.restorePreMigration": {
189879
189907
  capName: "migrations",
189880
189908
  capScope: "system",
@@ -221495,17 +221523,17 @@ var REOLINK_MIGRATIONS = [{
221495
221523
  plan: planDropWebhookIntakeSettings
221496
221524
  }];
221497
221525
  /**
221498
- * Every persisted camera that names no integration is claimed to the addon's default one. The
221499
- * integration a hub migration created is never the default, so it is not eligible. The integration
221500
- * settings themselves stay where they are until this addon's own wave moves them.
221526
+ * The integration wave (D1007) in declaration order, which must follow `seq`: the device claim
221527
+ * shipped first (seq 3) and the rows move follows it (seq 4). The engine refuses the whole
221528
+ * catalogue when a seq does not increase, and the addon then does not start.
221501
221529
  */
221502
- var REOLINK_CLAIM_MIGRATION = claimDevicesMigration({
221530
+ var REOLINK_INTEGRATION_MIGRATIONS = [claimDevicesMigration({
221503
221531
  addonId: "provider-reolink",
221504
221532
  date: "2026-11-04",
221505
221533
  seq: 3,
221506
221534
  dependsOn: [],
221507
221535
  eligible: (integration) => integration.info[MIGRATED_FROM_HUB_KEY] === void 0
221508
- });
221536
+ }), REOLINK_ROWS_TO_RECORD_MIGRATION];
221509
221537
  //#endregion
221510
221538
  //#region src/reolink-adoption-provider.ts
221511
221539
  var DEVICES_FILTER = {
@@ -222621,6 +222649,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
222621
222649
  await records.declare(reolinkRecordKinds);
222622
222650
  const integrationPorts = defaultIntegrationPortsOver({
222623
222651
  api: defaultIntegrationApiOver(this.ctx.api),
222652
+ secrets: this.ctx.secrets ?? null,
222624
222653
  records,
222625
222654
  kind: reolinkConnectionsEntryKind,
222626
222655
  info: (message) => this.ctx.logger.info(message),
@@ -222647,11 +222676,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
222647
222676
  registryEvidenceOf
222648
222677
  });
222649
222678
  this.instances = instances;
222650
- await this.runMigrations([
222651
- ...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()),
222652
- ...defineAddonMigrations([REOLINK_ROWS_TO_RECORD_MIGRATION], integrationPorts),
222653
- ...defineAddonMigrations([REOLINK_CLAIM_MIGRATION], integrationPorts)
222654
- ]);
222679
+ await this.runMigrations([...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()), ...defineAddonMigrations(REOLINK_INTEGRATION_MIGRATIONS, integrationPorts)]);
222655
222680
  this.wireEmailBridge();
222656
222681
  const wireSleepPushResolvers = (event, via) => {
222657
222682
  const data = event.data;
package/dist/addon.mjs CHANGED
@@ -106669,7 +106669,7 @@ var ZodIssueCode = {
106669
106669
  var ZodFirstPartyTypeKind;
106670
106670
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106671
106671
  //#endregion
106672
- //#region ../types/dist/sleep-D1jjWAr8.mjs
106672
+ //#region ../types/dist/sleep-9TIHFj1w.mjs
106673
106673
  /**
106674
106674
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106675
106675
  * window to float samples (D455).
@@ -108613,10 +108613,9 @@ var BaseAddon = class {
108613
108613
  *
108614
108614
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
108615
108615
  * needs its connection fields, the default integration the addon's own sections. It is the
108616
- * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
108617
- * unchanged (`integrations.setSettings` for an account integration).
108616
+ * SHAPE of the form only — the values live on the instance record.
108618
108617
  */
108619
- async integrationSettingsSchema(_instance) {
108618
+ async integrationFormSchema(_instance) {
108620
108619
  return null;
108621
108620
  }
108622
108621
  /**
@@ -108662,7 +108661,7 @@ var BaseAddon = class {
108662
108661
  * per-instance schema when it declares one, else its global schema (what they always showed).
108663
108662
  */
108664
108663
  async getIntegrationFormSchema(instance, nodeId) {
108665
- const scoped = await this.integrationSettingsSchema(instance);
108664
+ const scoped = await this.integrationFormSchema(instance);
108666
108665
  if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
108667
108666
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
108668
108667
  }
@@ -112769,7 +112768,7 @@ function sleep(ms) {
112769
112768
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
112770
112769
  }
112771
112770
  //#endregion
112772
- //#region ../types/dist/composition-CRNwcFYY.mjs
112771
+ //#region ../types/dist/composition-pOHbTzRB.mjs
112773
112772
  /**
112774
112773
  * The ffmpeg build every CamStack node downloads, per platform and arch.
112775
112774
  *
@@ -115528,20 +115527,28 @@ async function moveIntegrationRowsToRecords(ports, spec) {
115528
115527
  };
115529
115528
  }
115530
115529
  /**
115531
- * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416): an addon runs the move
115532
- * from its own process, so the legacy rows are reached through the hub (`ctx.api.integrations`:
115533
- * `list`, `getSettings` - which answers the OWNER its secrets resolved - and `clearSettings`) and
115534
- * the new record through the addon's own records handle. The hub deletes the rows and their
115535
- * keychain values; the addon never touches the registry.
115530
+ * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416). An addon runs the move
115531
+ * from its own process, so the leftover rows are reached through the migration-only door
115532
+ * (`migrations.readLegacyIntegrationRows` / `clearLegacyIntegrationRows`) on the hub's connection.
115533
+ * The door returns markers. This process is the owner, so it resolves and releases them with
115534
+ * `resolveSecretMarkers` — the same call the old settings door used — and only then asks the
115535
+ * door to delete the rows. The addon's own record kind is its records handle.
115536
115536
  */
115537
+ async function resolvedRows(stored, secrets) {
115538
+ if (secrets === null) return stored;
115539
+ const { value, unresolved } = await resolveSecretMarkers(stored, secrets);
115540
+ if (unresolved.length > 0) throw new Error(`${unresolved.length} secret(s) cannot be read from the keychain`);
115541
+ return value;
115542
+ }
115537
115543
  function integrationRowsPortsOverApi(deps) {
115544
+ const secrets = deps.secrets ?? null;
115538
115545
  return {
115539
115546
  warn: (message) => deps.log.warn(message),
115540
115547
  listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
115541
115548
  id: i.id,
115542
115549
  name: i.name
115543
115550
  })),
115544
- readRows: (integrationId) => deps.api.getSettings({ id: integrationId }),
115551
+ readRows: async (integrationId) => resolvedRows(await deps.api.readLegacyIntegrationRows({ integrationId }), secrets),
115545
115552
  putRecord: async (id, body) => {
115546
115553
  if (await deps.records.get(id) !== null) return "exists";
115547
115554
  try {
@@ -115560,7 +115567,9 @@ function integrationRowsPortsOverApi(deps) {
115560
115567
  await deps.records.delete(id);
115561
115568
  },
115562
115569
  clearRows: async (integrationId) => {
115563
- await deps.api.clearSettings({ id: integrationId });
115570
+ const refs = collectSecretMarkerRefs(await deps.api.readLegacyIntegrationRows({ integrationId }));
115571
+ if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
115572
+ await deps.api.clearLegacyIntegrationRows({ integrationId });
115564
115573
  }
115565
115574
  };
115566
115575
  }
@@ -115650,14 +115659,14 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
115650
115659
  * 2. `claim-devices` (tolerate): `claimDevicesToDefaultIntegration`; with no integration to claim
115651
115660
  * to it fails and is retried on the next boot.
115652
115661
  *
115653
- * Both run in the addon process through the hub API (`ctx.api`), BEFORE the addon registers its
115654
- * `integration-instances` provider: while a provider is registered the hub answers `getSettings`
115655
- * from the record, not from the rows.
115662
+ * Both run in the addon process through the hub API (`ctx.api`). The leftover rows are read
115663
+ * through the migration-only door, which answers empty once the store is gone.
115656
115664
  */
115657
115665
  function defaultIntegrationPortsOver(deps) {
115658
115666
  return {
115659
115667
  ...integrationRowsPortsOverApi({
115660
115668
  api: deps.api,
115669
+ ...deps.secrets !== void 0 ? { secrets: deps.secrets } : {},
115661
115670
  records: deps.records.kind({
115662
115671
  name: deps.kind.name,
115663
115672
  declaration: deps.kind.declaration,
@@ -115722,8 +115731,8 @@ function claimDevicesMigration(spec) {
115722
115731
  function defaultIntegrationApiOver(api) {
115723
115732
  return {
115724
115733
  list: () => api.integrations.list.query(),
115725
- getSettings: (input) => api.integrations.getSettings.query(input),
115726
- clearSettings: (input) => api.integrations.clearSettings.mutate(input),
115734
+ readLegacyIntegrationRows: (input) => api.migrations.readLegacyIntegrationRows.query(input),
115735
+ clearLegacyIntegrationRows: (input) => api.migrations.clearLegacyIntegrationRows.mutate(input),
115727
115736
  listDevices: (addonId) => api.deviceManager.listAll.query({
115728
115737
  addonId,
115729
115738
  projection: "slim"
@@ -151874,6 +151883,9 @@ var RunningProposalEvidenceSchema = object({
151874
151883
  runsFound: number().int().nonnegative(),
151875
151884
  pausesFound: number().int().nonnegative(),
151876
151885
  longestPauseMs: number().nonnegative(),
151886
+ /** Episodes shorter than ~90 s (an anti-crease pulse, a display waking): never a run, never a pause. */
151887
+ pulsesFound: number().int().nonnegative(),
151888
+ longestPulseMs: number().nonnegative(),
151877
151889
  idleFloorW: number(),
151878
151890
  noiseCeilingW: number(),
151879
151891
  plateauW: number(),
@@ -157772,11 +157784,7 @@ var CreateIntegrationInputSchema = object({
157772
157784
  info: record(string(), unknown()).optional(),
157773
157785
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
157774
157786
  originStableId: string().optional(),
157775
- settings: record(string(), unknown()).optional(),
157776
- /** Keys of `settings` the form's schema declares secret (by type) — kept in
157777
- * the keychain, not the table (D787). */
157778
- secretKeys: array(string()).optional(),
157779
- skipRestart: boolean().optional()
157787
+ settings: record(string(), unknown()).optional()
157780
157788
  });
157781
157789
  var UpdateIntegrationInputSchema = object({
157782
157790
  id: string(),
@@ -157797,22 +157805,6 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
157797
157805
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
157798
157806
  kind: "mutation",
157799
157807
  auth: "admin"
157800
- }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
157801
- id: string(),
157802
- settings: record(string(), unknown()),
157803
- /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
157804
- secretKeys: array(string()).optional(),
157805
- /** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
157806
- skipRestart: boolean().optional()
157807
- }), object({ success: boolean() }), {
157808
- kind: "mutation",
157809
- auth: "admin"
157810
- }), method(object({ id: string() }), object({
157811
- rows: number().int().nonnegative(),
157812
- secrets: number().int().nonnegative()
157813
- }), {
157814
- kind: "mutation",
157815
- auth: "admin"
157816
157808
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
157817
157809
  addonId: string(),
157818
157810
  settings: record(string(), unknown())
@@ -160810,6 +160802,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
160810
160802
  }), {
160811
160803
  kind: "mutation",
160812
160804
  auth: "admin"
160805
+ }), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
160806
+ rows: number().int().nonnegative(),
160807
+ secrets: number().int().nonnegative()
160808
+ }), {
160809
+ kind: "mutation",
160810
+ auth: "admin"
160811
+ }), method(object({
160812
+ integrationId: string().min(1),
160813
+ patch: record(string(), unknown())
160814
+ }), object({ written: boolean() }), {
160815
+ kind: "mutation",
160816
+ auth: "admin"
160817
+ }), method(object({
160818
+ integrationId: string().min(1),
160819
+ keys: array(string().min(1))
160820
+ }), object({
160821
+ present: boolean(),
160822
+ removed: record(string(), unknown())
160823
+ }), {
160824
+ kind: "mutation",
160825
+ auth: "admin"
160813
160826
  });
160814
160827
  method(object({
160815
160828
  sourceUrl: string(),
@@ -183321,11 +183334,15 @@ discriminatedUnion("kind", [object({
183321
183334
  * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
183322
183335
  * near F. A device that is not near one level most of the time has no floor.
183323
183336
  * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
183324
- * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
183325
- * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
183337
+ * 3. an episode shorter than `PULSE_MAX_MS` is a PULSE (an anti-crease tumble, a
183338
+ * display waking): it is neither a run nor a pause. Among the remaining
183339
+ * episodes, gaps over `PAUSE_MAX_MS` always separate runs; the rest split in
183340
+ * two by the largest log-scale jump (>= 3x): the short ones are pauses INSIDE
183341
+ * a run (a soak), the long ones separate runs. A stretch under `MIN_RUN_MS`
183342
+ * is no run.
183326
183343
  * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
183327
- * grid a person would type; stop dwell covers the longest pause; start dwell
183328
- * covers the longest standby blip above T.
183344
+ * grid a person would type; stop dwell covers the longest pause and the
183345
+ * kind's floor; start dwell covers the longest pulse and standby blip above T.
183329
183346
  * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
183330
183347
  * run must hold exactly one true interval and nothing may flap outside.
183331
183348
  */
@@ -183336,6 +183353,10 @@ var MINUTE_MS$1 = 60 * SECOND_MS;
183336
183353
  30 * SECOND_MS;
183337
183354
  60 * SECOND_MS;
183338
183355
  20 * MINUTE_MS$1;
183356
+ 90 * SECOND_MS;
183357
+ 30 * MINUTE_MS$1;
183358
+ 10 * MINUTE_MS$1;
183359
+ DeviceType.Dryer, 3 * MINUTE_MS$1, DeviceType.Dishwasher, 3 * MINUTE_MS$1, DeviceType.Washer, 10 * MINUTE_MS$1;
183339
183360
  10 * SECOND_MS;
183340
183361
  10 * SECOND_MS;
183341
183362
  /**
@@ -188768,13 +188789,6 @@ Object.freeze({
188768
188789
  access: "create",
188769
188790
  role: "admin"
188770
188791
  },
188771
- "integrations.clearSettings": {
188772
- capName: "integrations",
188773
- capScope: "system",
188774
- addonId: null,
188775
- access: "delete",
188776
- role: "admin"
188777
- },
188778
188792
  "integrations.create": {
188779
188793
  capName: "integrations",
188780
188794
  capScope: "system",
@@ -188810,13 +188824,6 @@ Object.freeze({
188810
188824
  access: "view",
188811
188825
  role: "admin"
188812
188826
  },
188813
- "integrations.getSettings": {
188814
- capName: "integrations",
188815
- capScope: "system",
188816
- addonId: null,
188817
- access: "view",
188818
- role: "admin"
188819
- },
188820
188827
  "integrations.list": {
188821
188828
  capName: "integrations",
188822
188829
  capScope: "system",
@@ -188824,13 +188831,6 @@ Object.freeze({
188824
188831
  access: "view",
188825
188832
  role: "admin"
188826
188833
  },
188827
- "integrations.setSettings": {
188828
- capName: "integrations",
188829
- capScope: "system",
188830
- addonId: null,
188831
- access: "create",
188832
- role: "admin"
188833
- },
188834
188834
  "integrations.testConnection": {
188835
188835
  capName: "integrations",
188836
188836
  capScope: "system",
@@ -189825,6 +189825,13 @@ Object.freeze({
189825
189825
  access: "view",
189826
189826
  role: "admin"
189827
189827
  },
189828
+ "migrations.clearLegacyIntegrationRows": {
189829
+ capName: "migrations",
189830
+ capScope: "system",
189831
+ addonId: null,
189832
+ access: "delete",
189833
+ role: "admin"
189834
+ },
189828
189835
  "migrations.declareOwner": {
189829
189836
  capName: "migrations",
189830
189837
  capScope: "system",
@@ -189832,6 +189839,13 @@ Object.freeze({
189832
189839
  access: "create",
189833
189840
  role: "admin"
189834
189841
  },
189842
+ "migrations.deleteLegacyIntegrationRowKeys": {
189843
+ capName: "migrations",
189844
+ capScope: "system",
189845
+ addonId: null,
189846
+ access: "delete",
189847
+ role: "admin"
189848
+ },
189835
189849
  "migrations.dryRun": {
189836
189850
  capName: "migrations",
189837
189851
  capScope: "system",
@@ -189867,6 +189881,20 @@ Object.freeze({
189867
189881
  access: "create",
189868
189882
  role: "admin"
189869
189883
  },
189884
+ "migrations.patchLegacyIntegrationRows": {
189885
+ capName: "migrations",
189886
+ capScope: "system",
189887
+ addonId: null,
189888
+ access: "create",
189889
+ role: "admin"
189890
+ },
189891
+ "migrations.readLegacyIntegrationRows": {
189892
+ capName: "migrations",
189893
+ capScope: "system",
189894
+ addonId: null,
189895
+ access: "view",
189896
+ role: "admin"
189897
+ },
189870
189898
  "migrations.restorePreMigration": {
189871
189899
  capName: "migrations",
189872
189900
  capScope: "system",
@@ -221487,17 +221515,17 @@ var REOLINK_MIGRATIONS = [{
221487
221515
  plan: planDropWebhookIntakeSettings
221488
221516
  }];
221489
221517
  /**
221490
- * Every persisted camera that names no integration is claimed to the addon's default one. The
221491
- * integration a hub migration created is never the default, so it is not eligible. The integration
221492
- * settings themselves stay where they are until this addon's own wave moves them.
221518
+ * The integration wave (D1007) in declaration order, which must follow `seq`: the device claim
221519
+ * shipped first (seq 3) and the rows move follows it (seq 4). The engine refuses the whole
221520
+ * catalogue when a seq does not increase, and the addon then does not start.
221493
221521
  */
221494
- var REOLINK_CLAIM_MIGRATION = claimDevicesMigration({
221522
+ var REOLINK_INTEGRATION_MIGRATIONS = [claimDevicesMigration({
221495
221523
  addonId: "provider-reolink",
221496
221524
  date: "2026-11-04",
221497
221525
  seq: 3,
221498
221526
  dependsOn: [],
221499
221527
  eligible: (integration) => integration.info[MIGRATED_FROM_HUB_KEY] === void 0
221500
- });
221528
+ }), REOLINK_ROWS_TO_RECORD_MIGRATION];
221501
221529
  //#endregion
221502
221530
  //#region src/reolink-adoption-provider.ts
221503
221531
  var DEVICES_FILTER = {
@@ -222613,6 +222641,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
222613
222641
  await records.declare(reolinkRecordKinds);
222614
222642
  const integrationPorts = defaultIntegrationPortsOver({
222615
222643
  api: defaultIntegrationApiOver(this.ctx.api),
222644
+ secrets: this.ctx.secrets ?? null,
222616
222645
  records,
222617
222646
  kind: reolinkConnectionsEntryKind,
222618
222647
  info: (message) => this.ctx.logger.info(message),
@@ -222639,11 +222668,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
222639
222668
  registryEvidenceOf
222640
222669
  });
222641
222670
  this.instances = instances;
222642
- await this.runMigrations([
222643
- ...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()),
222644
- ...defineAddonMigrations([REOLINK_ROWS_TO_RECORD_MIGRATION], integrationPorts),
222645
- ...defineAddonMigrations([REOLINK_CLAIM_MIGRATION], integrationPorts)
222646
- ]);
222671
+ await this.runMigrations([...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()), ...defineAddonMigrations(REOLINK_INTEGRATION_MIGRATIONS, integrationPorts)]);
222647
222672
  this.wireEmailBridge();
222648
222673
  const wireSleepPushResolvers = (event, via) => {
222649
222674
  const data = event.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.223",
3
+ "version": "1.2.225",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",
@@ -96,7 +96,7 @@
96
96
  "werift"
97
97
  ],
98
98
  "requires": {
99
- "server": ">=1.2.765"
99
+ "server": ">=1.2.770"
100
100
  }
101
101
  },
102
102
  "files": [