@camstack/addon-provider-hikvision 1.2.181 → 1.2.182

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.182] - 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
+
10
16
  ## [1.2.181] - 2026-11-04
11
17
 
12
18
  ### Changed
package/dist/addon.js CHANGED
@@ -6014,7 +6014,7 @@ var ZodIssueCode = {
6014
6014
  var ZodFirstPartyTypeKind;
6015
6015
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6016
6016
  //#endregion
6017
- //#region ../types/dist/sleep-Cv4Zmie9.mjs
6017
+ //#region ../types/dist/sleep-9TIHFj1w.mjs
6018
6018
  /**
6019
6019
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6020
6020
  * window to float samples (D455).
@@ -7958,10 +7958,9 @@ var BaseAddon = class {
7958
7958
  *
7959
7959
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
7960
7960
  * needs its connection fields, the default integration the addon's own sections. It is the
7961
- * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
7962
- * unchanged (`integrations.setSettings` for an account integration).
7961
+ * SHAPE of the form only — the values live on the instance record.
7963
7962
  */
7964
- async integrationSettingsSchema(_instance) {
7963
+ async integrationFormSchema(_instance) {
7965
7964
  return null;
7966
7965
  }
7967
7966
  /**
@@ -8007,7 +8006,7 @@ var BaseAddon = class {
8007
8006
  * per-instance schema when it declares one, else its global schema (what they always showed).
8008
8007
  */
8009
8008
  async getIntegrationFormSchema(instance, nodeId) {
8010
- const scoped = await this.integrationSettingsSchema(instance);
8009
+ const scoped = await this.integrationFormSchema(instance);
8011
8010
  if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
8012
8011
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
8013
8012
  }
@@ -9297,6 +9296,7 @@ function defineEntryKind(name, spec) {
9297
9296
  class: "config",
9298
9297
  writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9299
9298
  retention: { none: "an entry goes only when the operator deletes it" },
9299
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9300
9300
  ...spec.database === void 0 ? {} : { database: spec.database },
9301
9301
  ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9302
9302
  ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
@@ -11992,7 +11992,7 @@ function userError(code, params, englishFallback) {
11992
11992
  return new CamstackError(code, params, englishFallback);
11993
11993
  }
11994
11994
  //#endregion
11995
- //#region ../types/dist/composition-CRNwcFYY.mjs
11995
+ //#region ../types/dist/composition-pOHbTzRB.mjs
11996
11996
  /**
11997
11997
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11998
11998
  *
@@ -14720,20 +14720,28 @@ async function moveIntegrationRowsToRecords(ports, spec) {
14720
14720
  };
14721
14721
  }
14722
14722
  /**
14723
- * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416): an addon runs the move
14724
- * from its own process, so the legacy rows are reached through the hub (`ctx.api.integrations`:
14725
- * `list`, `getSettings` - which answers the OWNER its secrets resolved - and `clearSettings`) and
14726
- * the new record through the addon's own records handle. The hub deletes the rows and their
14727
- * keychain values; the addon never touches the registry.
14723
+ * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416). An addon runs the move
14724
+ * from its own process, so the leftover rows are reached through the migration-only door
14725
+ * (`migrations.readLegacyIntegrationRows` / `clearLegacyIntegrationRows`) on the hub's connection.
14726
+ * The door returns markers. This process is the owner, so it resolves and releases them with
14727
+ * `resolveSecretMarkers` — the same call the old settings door used — and only then asks the
14728
+ * door to delete the rows. The addon's own record kind is its records handle.
14728
14729
  */
14730
+ async function resolvedRows(stored, secrets) {
14731
+ if (secrets === null) return stored;
14732
+ const { value, unresolved } = await resolveSecretMarkers(stored, secrets);
14733
+ if (unresolved.length > 0) throw new Error(`${unresolved.length} secret(s) cannot be read from the keychain`);
14734
+ return value;
14735
+ }
14729
14736
  function integrationRowsPortsOverApi(deps) {
14737
+ const secrets = deps.secrets ?? null;
14730
14738
  return {
14731
14739
  warn: (message) => deps.log.warn(message),
14732
14740
  listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
14733
14741
  id: i.id,
14734
14742
  name: i.name
14735
14743
  })),
14736
- readRows: (integrationId) => deps.api.getSettings({ id: integrationId }),
14744
+ readRows: async (integrationId) => resolvedRows(await deps.api.readLegacyIntegrationRows({ integrationId }), secrets),
14737
14745
  putRecord: async (id, body) => {
14738
14746
  if (await deps.records.get(id) !== null) return "exists";
14739
14747
  try {
@@ -14752,7 +14760,9 @@ function integrationRowsPortsOverApi(deps) {
14752
14760
  await deps.records.delete(id);
14753
14761
  },
14754
14762
  clearRows: async (integrationId) => {
14755
- await deps.api.clearSettings({ id: integrationId });
14763
+ const refs = collectSecretMarkerRefs(await deps.api.readLegacyIntegrationRows({ integrationId }));
14764
+ if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
14765
+ await deps.api.clearLegacyIntegrationRows({ integrationId });
14756
14766
  }
14757
14767
  };
14758
14768
  }
@@ -14842,14 +14852,14 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
14842
14852
  * 2. `claim-devices` (tolerate): `claimDevicesToDefaultIntegration`; with no integration to claim
14843
14853
  * to it fails and is retried on the next boot.
14844
14854
  *
14845
- * Both run in the addon process through the hub API (`ctx.api`), BEFORE the addon registers its
14846
- * `integration-instances` provider: while a provider is registered the hub answers `getSettings`
14847
- * from the record, not from the rows.
14855
+ * Both run in the addon process through the hub API (`ctx.api`). The leftover rows are read
14856
+ * through the migration-only door, which answers empty once the store is gone.
14848
14857
  */
14849
14858
  function defaultIntegrationPortsOver(deps) {
14850
14859
  return {
14851
14860
  ...integrationRowsPortsOverApi({
14852
14861
  api: deps.api,
14862
+ ...deps.secrets !== void 0 ? { secrets: deps.secrets } : {},
14853
14863
  records: deps.records.kind({
14854
14864
  name: deps.kind.name,
14855
14865
  declaration: deps.kind.declaration,
@@ -14949,8 +14959,8 @@ function defaultIntegrationMigrations(spec) {
14949
14959
  function defaultIntegrationApiOver(api) {
14950
14960
  return {
14951
14961
  list: () => api.integrations.list.query(),
14952
- getSettings: (input) => api.integrations.getSettings.query(input),
14953
- clearSettings: (input) => api.integrations.clearSettings.mutate(input),
14962
+ readLegacyIntegrationRows: (input) => api.migrations.readLegacyIntegrationRows.query(input),
14963
+ clearLegacyIntegrationRows: (input) => api.migrations.clearLegacyIntegrationRows.mutate(input),
14954
14964
  listDevices: (addonId) => api.deviceManager.listAll.query({
14955
14965
  addonId,
14956
14966
  projection: "slim"
@@ -50848,6 +50858,9 @@ var RunningProposalEvidenceSchema = object({
50848
50858
  runsFound: number().int().nonnegative(),
50849
50859
  pausesFound: number().int().nonnegative(),
50850
50860
  longestPauseMs: number().nonnegative(),
50861
+ /** Episodes shorter than ~90 s (an anti-crease pulse, a display waking): never a run, never a pause. */
50862
+ pulsesFound: number().int().nonnegative(),
50863
+ longestPulseMs: number().nonnegative(),
50851
50864
  idleFloorW: number(),
50852
50865
  noiseCeilingW: number(),
50853
50866
  plateauW: number(),
@@ -56716,11 +56729,7 @@ var CreateIntegrationInputSchema = object({
56716
56729
  info: record(string(), unknown()).optional(),
56717
56730
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
56718
56731
  originStableId: string().optional(),
56719
- settings: record(string(), unknown()).optional(),
56720
- /** Keys of `settings` the form's schema declares secret (by type) — kept in
56721
- * the keychain, not the table (D787). */
56722
- secretKeys: array(string()).optional(),
56723
- skipRestart: boolean().optional()
56732
+ settings: record(string(), unknown()).optional()
56724
56733
  });
56725
56734
  var UpdateIntegrationInputSchema = object({
56726
56735
  id: string(),
@@ -56741,22 +56750,6 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
56741
56750
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
56742
56751
  kind: "mutation",
56743
56752
  auth: "admin"
56744
- }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
56745
- id: string(),
56746
- settings: record(string(), unknown()),
56747
- /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
56748
- secretKeys: array(string()).optional(),
56749
- /** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
56750
- skipRestart: boolean().optional()
56751
- }), object({ success: boolean() }), {
56752
- kind: "mutation",
56753
- auth: "admin"
56754
- }), method(object({ id: string() }), object({
56755
- rows: number().int().nonnegative(),
56756
- secrets: number().int().nonnegative()
56757
- }), {
56758
- kind: "mutation",
56759
- auth: "admin"
56760
56753
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
56761
56754
  addonId: string(),
56762
56755
  settings: record(string(), unknown())
@@ -59733,6 +59726,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
59733
59726
  }), {
59734
59727
  kind: "mutation",
59735
59728
  auth: "admin"
59729
+ }), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
59730
+ rows: number().int().nonnegative(),
59731
+ secrets: number().int().nonnegative()
59732
+ }), {
59733
+ kind: "mutation",
59734
+ auth: "admin"
59735
+ }), method(object({
59736
+ integrationId: string().min(1),
59737
+ patch: record(string(), unknown())
59738
+ }), object({ written: boolean() }), {
59739
+ kind: "mutation",
59740
+ auth: "admin"
59741
+ }), method(object({
59742
+ integrationId: string().min(1),
59743
+ keys: array(string().min(1))
59744
+ }), object({
59745
+ present: boolean(),
59746
+ removed: record(string(), unknown())
59747
+ }), {
59748
+ kind: "mutation",
59749
+ auth: "admin"
59736
59750
  });
59737
59751
  method(object({
59738
59752
  sourceUrl: string(),
@@ -82235,11 +82249,15 @@ discriminatedUnion("kind", [object({
82235
82249
  * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
82236
82250
  * near F. A device that is not near one level most of the time has no floor.
82237
82251
  * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
82238
- * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
82239
- * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
82252
+ * 3. an episode shorter than `PULSE_MAX_MS` is a PULSE (an anti-crease tumble, a
82253
+ * display waking): it is neither a run nor a pause. Among the remaining
82254
+ * episodes, gaps over `PAUSE_MAX_MS` always separate runs; the rest split in
82255
+ * two by the largest log-scale jump (>= 3x): the short ones are pauses INSIDE
82256
+ * a run (a soak), the long ones separate runs. A stretch under `MIN_RUN_MS`
82257
+ * is no run.
82240
82258
  * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
82241
- * grid a person would type; stop dwell covers the longest pause; start dwell
82242
- * covers the longest standby blip above T.
82259
+ * grid a person would type; stop dwell covers the longest pause and the
82260
+ * kind's floor; start dwell covers the longest pulse and standby blip above T.
82243
82261
  * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
82244
82262
  * run must hold exactly one true interval and nothing may flap outside.
82245
82263
  */
@@ -82250,6 +82268,10 @@ var MINUTE_MS$1 = 60 * SECOND_MS;
82250
82268
  30 * SECOND_MS;
82251
82269
  60 * SECOND_MS;
82252
82270
  20 * MINUTE_MS$1;
82271
+ 90 * SECOND_MS;
82272
+ 30 * MINUTE_MS$1;
82273
+ 10 * MINUTE_MS$1;
82274
+ DeviceType.Dryer, 3 * MINUTE_MS$1, DeviceType.Dishwasher, 3 * MINUTE_MS$1, DeviceType.Washer, 10 * MINUTE_MS$1;
82253
82275
  10 * SECOND_MS;
82254
82276
  10 * SECOND_MS;
82255
82277
  /**
@@ -87686,13 +87708,6 @@ Object.freeze({
87686
87708
  access: "create",
87687
87709
  role: "admin"
87688
87710
  },
87689
- "integrations.clearSettings": {
87690
- capName: "integrations",
87691
- capScope: "system",
87692
- addonId: null,
87693
- access: "delete",
87694
- role: "admin"
87695
- },
87696
87711
  "integrations.create": {
87697
87712
  capName: "integrations",
87698
87713
  capScope: "system",
@@ -87728,13 +87743,6 @@ Object.freeze({
87728
87743
  access: "view",
87729
87744
  role: "admin"
87730
87745
  },
87731
- "integrations.getSettings": {
87732
- capName: "integrations",
87733
- capScope: "system",
87734
- addonId: null,
87735
- access: "view",
87736
- role: "admin"
87737
- },
87738
87746
  "integrations.list": {
87739
87747
  capName: "integrations",
87740
87748
  capScope: "system",
@@ -87742,13 +87750,6 @@ Object.freeze({
87742
87750
  access: "view",
87743
87751
  role: "admin"
87744
87752
  },
87745
- "integrations.setSettings": {
87746
- capName: "integrations",
87747
- capScope: "system",
87748
- addonId: null,
87749
- access: "create",
87750
- role: "admin"
87751
- },
87752
87753
  "integrations.testConnection": {
87753
87754
  capName: "integrations",
87754
87755
  capScope: "system",
@@ -88743,6 +88744,13 @@ Object.freeze({
88743
88744
  access: "view",
88744
88745
  role: "admin"
88745
88746
  },
88747
+ "migrations.clearLegacyIntegrationRows": {
88748
+ capName: "migrations",
88749
+ capScope: "system",
88750
+ addonId: null,
88751
+ access: "delete",
88752
+ role: "admin"
88753
+ },
88746
88754
  "migrations.declareOwner": {
88747
88755
  capName: "migrations",
88748
88756
  capScope: "system",
@@ -88750,6 +88758,13 @@ Object.freeze({
88750
88758
  access: "create",
88751
88759
  role: "admin"
88752
88760
  },
88761
+ "migrations.deleteLegacyIntegrationRowKeys": {
88762
+ capName: "migrations",
88763
+ capScope: "system",
88764
+ addonId: null,
88765
+ access: "delete",
88766
+ role: "admin"
88767
+ },
88753
88768
  "migrations.dryRun": {
88754
88769
  capName: "migrations",
88755
88770
  capScope: "system",
@@ -88785,6 +88800,20 @@ Object.freeze({
88785
88800
  access: "create",
88786
88801
  role: "admin"
88787
88802
  },
88803
+ "migrations.patchLegacyIntegrationRows": {
88804
+ capName: "migrations",
88805
+ capScope: "system",
88806
+ addonId: null,
88807
+ access: "create",
88808
+ role: "admin"
88809
+ },
88810
+ "migrations.readLegacyIntegrationRows": {
88811
+ capName: "migrations",
88812
+ capScope: "system",
88813
+ addonId: null,
88814
+ access: "view",
88815
+ role: "admin"
88816
+ },
88788
88817
  "migrations.restorePreMigration": {
88789
88818
  capName: "migrations",
88790
88819
  capScope: "system",
@@ -112986,6 +113015,7 @@ var HikvisionProviderAddon = class extends BaseDeviceProvider {
112986
113015
  date: HIKVISION_MIGRATIONS_DATE
112987
113016
  }), defaultIntegrationPortsOver({
112988
113017
  api: defaultIntegrationApiOver(this.ctx.api),
113018
+ secrets: this.ctx.secrets ?? null,
112989
113019
  records,
112990
113020
  kind: hikvisionConnectionsEntryKind,
112991
113021
  info: (message) => this.ctx.logger.info(message),
package/dist/addon.mjs CHANGED
@@ -5989,7 +5989,7 @@ var ZodIssueCode = {
5989
5989
  var ZodFirstPartyTypeKind;
5990
5990
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5991
5991
  //#endregion
5992
- //#region ../types/dist/sleep-Cv4Zmie9.mjs
5992
+ //#region ../types/dist/sleep-9TIHFj1w.mjs
5993
5993
  /**
5994
5994
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5995
5995
  * window to float samples (D455).
@@ -7933,10 +7933,9 @@ var BaseAddon = class {
7933
7933
  *
7934
7934
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
7935
7935
  * needs its connection fields, the default integration the addon's own sections. It is the
7936
- * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
7937
- * unchanged (`integrations.setSettings` for an account integration).
7936
+ * SHAPE of the form only — the values live on the instance record.
7938
7937
  */
7939
- async integrationSettingsSchema(_instance) {
7938
+ async integrationFormSchema(_instance) {
7940
7939
  return null;
7941
7940
  }
7942
7941
  /**
@@ -7982,7 +7981,7 @@ var BaseAddon = class {
7982
7981
  * per-instance schema when it declares one, else its global schema (what they always showed).
7983
7982
  */
7984
7983
  async getIntegrationFormSchema(instance, nodeId) {
7985
- const scoped = await this.integrationSettingsSchema(instance);
7984
+ const scoped = await this.integrationFormSchema(instance);
7986
7985
  if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
7987
7986
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
7988
7987
  }
@@ -9272,6 +9271,7 @@ function defineEntryKind(name, spec) {
9272
9271
  class: "config",
9273
9272
  writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9274
9273
  retention: { none: "an entry goes only when the operator deletes it" },
9274
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9275
9275
  ...spec.database === void 0 ? {} : { database: spec.database },
9276
9276
  ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9277
9277
  ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
@@ -11967,7 +11967,7 @@ function userError(code, params, englishFallback) {
11967
11967
  return new CamstackError(code, params, englishFallback);
11968
11968
  }
11969
11969
  //#endregion
11970
- //#region ../types/dist/composition-CRNwcFYY.mjs
11970
+ //#region ../types/dist/composition-pOHbTzRB.mjs
11971
11971
  /**
11972
11972
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11973
11973
  *
@@ -14695,20 +14695,28 @@ async function moveIntegrationRowsToRecords(ports, spec) {
14695
14695
  };
14696
14696
  }
14697
14697
  /**
14698
- * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416): an addon runs the move
14699
- * from its own process, so the legacy rows are reached through the hub (`ctx.api.integrations`:
14700
- * `list`, `getSettings` - which answers the OWNER its secrets resolved - and `clearSettings`) and
14701
- * the new record through the addon's own records handle. The hub deletes the rows and their
14702
- * keychain values; the addon never touches the registry.
14698
+ * The addon-side ports of `moveIntegrationRowsToRecords` (planning#416). An addon runs the move
14699
+ * from its own process, so the leftover rows are reached through the migration-only door
14700
+ * (`migrations.readLegacyIntegrationRows` / `clearLegacyIntegrationRows`) on the hub's connection.
14701
+ * The door returns markers. This process is the owner, so it resolves and releases them with
14702
+ * `resolveSecretMarkers` — the same call the old settings door used — and only then asks the
14703
+ * door to delete the rows. The addon's own record kind is its records handle.
14703
14704
  */
14705
+ async function resolvedRows(stored, secrets) {
14706
+ if (secrets === null) return stored;
14707
+ const { value, unresolved } = await resolveSecretMarkers(stored, secrets);
14708
+ if (unresolved.length > 0) throw new Error(`${unresolved.length} secret(s) cannot be read from the keychain`);
14709
+ return value;
14710
+ }
14704
14711
  function integrationRowsPortsOverApi(deps) {
14712
+ const secrets = deps.secrets ?? null;
14705
14713
  return {
14706
14714
  warn: (message) => deps.log.warn(message),
14707
14715
  listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
14708
14716
  id: i.id,
14709
14717
  name: i.name
14710
14718
  })),
14711
- readRows: (integrationId) => deps.api.getSettings({ id: integrationId }),
14719
+ readRows: async (integrationId) => resolvedRows(await deps.api.readLegacyIntegrationRows({ integrationId }), secrets),
14712
14720
  putRecord: async (id, body) => {
14713
14721
  if (await deps.records.get(id) !== null) return "exists";
14714
14722
  try {
@@ -14727,7 +14735,9 @@ function integrationRowsPortsOverApi(deps) {
14727
14735
  await deps.records.delete(id);
14728
14736
  },
14729
14737
  clearRows: async (integrationId) => {
14730
- await deps.api.clearSettings({ id: integrationId });
14738
+ const refs = collectSecretMarkerRefs(await deps.api.readLegacyIntegrationRows({ integrationId }));
14739
+ if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
14740
+ await deps.api.clearLegacyIntegrationRows({ integrationId });
14731
14741
  }
14732
14742
  };
14733
14743
  }
@@ -14817,14 +14827,14 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
14817
14827
  * 2. `claim-devices` (tolerate): `claimDevicesToDefaultIntegration`; with no integration to claim
14818
14828
  * to it fails and is retried on the next boot.
14819
14829
  *
14820
- * Both run in the addon process through the hub API (`ctx.api`), BEFORE the addon registers its
14821
- * `integration-instances` provider: while a provider is registered the hub answers `getSettings`
14822
- * from the record, not from the rows.
14830
+ * Both run in the addon process through the hub API (`ctx.api`). The leftover rows are read
14831
+ * through the migration-only door, which answers empty once the store is gone.
14823
14832
  */
14824
14833
  function defaultIntegrationPortsOver(deps) {
14825
14834
  return {
14826
14835
  ...integrationRowsPortsOverApi({
14827
14836
  api: deps.api,
14837
+ ...deps.secrets !== void 0 ? { secrets: deps.secrets } : {},
14828
14838
  records: deps.records.kind({
14829
14839
  name: deps.kind.name,
14830
14840
  declaration: deps.kind.declaration,
@@ -14924,8 +14934,8 @@ function defaultIntegrationMigrations(spec) {
14924
14934
  function defaultIntegrationApiOver(api) {
14925
14935
  return {
14926
14936
  list: () => api.integrations.list.query(),
14927
- getSettings: (input) => api.integrations.getSettings.query(input),
14928
- clearSettings: (input) => api.integrations.clearSettings.mutate(input),
14937
+ readLegacyIntegrationRows: (input) => api.migrations.readLegacyIntegrationRows.query(input),
14938
+ clearLegacyIntegrationRows: (input) => api.migrations.clearLegacyIntegrationRows.mutate(input),
14929
14939
  listDevices: (addonId) => api.deviceManager.listAll.query({
14930
14940
  addonId,
14931
14941
  projection: "slim"
@@ -50823,6 +50833,9 @@ var RunningProposalEvidenceSchema = object({
50823
50833
  runsFound: number().int().nonnegative(),
50824
50834
  pausesFound: number().int().nonnegative(),
50825
50835
  longestPauseMs: number().nonnegative(),
50836
+ /** Episodes shorter than ~90 s (an anti-crease pulse, a display waking): never a run, never a pause. */
50837
+ pulsesFound: number().int().nonnegative(),
50838
+ longestPulseMs: number().nonnegative(),
50826
50839
  idleFloorW: number(),
50827
50840
  noiseCeilingW: number(),
50828
50841
  plateauW: number(),
@@ -56691,11 +56704,7 @@ var CreateIntegrationInputSchema = object({
56691
56704
  info: record(string(), unknown()).optional(),
56692
56705
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
56693
56706
  originStableId: string().optional(),
56694
- settings: record(string(), unknown()).optional(),
56695
- /** Keys of `settings` the form's schema declares secret (by type) — kept in
56696
- * the keychain, not the table (D787). */
56697
- secretKeys: array(string()).optional(),
56698
- skipRestart: boolean().optional()
56707
+ settings: record(string(), unknown()).optional()
56699
56708
  });
56700
56709
  var UpdateIntegrationInputSchema = object({
56701
56710
  id: string(),
@@ -56716,22 +56725,6 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
56716
56725
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
56717
56726
  kind: "mutation",
56718
56727
  auth: "admin"
56719
- }), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
56720
- id: string(),
56721
- settings: record(string(), unknown()),
56722
- /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
56723
- secretKeys: array(string()).optional(),
56724
- /** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
56725
- skipRestart: boolean().optional()
56726
- }), object({ success: boolean() }), {
56727
- kind: "mutation",
56728
- auth: "admin"
56729
- }), method(object({ id: string() }), object({
56730
- rows: number().int().nonnegative(),
56731
- secrets: number().int().nonnegative()
56732
- }), {
56733
- kind: "mutation",
56734
- auth: "admin"
56735
56728
  }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
56736
56729
  addonId: string(),
56737
56730
  settings: record(string(), unknown())
@@ -59708,6 +59701,27 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
59708
59701
  }), {
59709
59702
  kind: "mutation",
59710
59703
  auth: "admin"
59704
+ }), method(object({ integrationId: string().min(1) }), record(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
59705
+ rows: number().int().nonnegative(),
59706
+ secrets: number().int().nonnegative()
59707
+ }), {
59708
+ kind: "mutation",
59709
+ auth: "admin"
59710
+ }), method(object({
59711
+ integrationId: string().min(1),
59712
+ patch: record(string(), unknown())
59713
+ }), object({ written: boolean() }), {
59714
+ kind: "mutation",
59715
+ auth: "admin"
59716
+ }), method(object({
59717
+ integrationId: string().min(1),
59718
+ keys: array(string().min(1))
59719
+ }), object({
59720
+ present: boolean(),
59721
+ removed: record(string(), unknown())
59722
+ }), {
59723
+ kind: "mutation",
59724
+ auth: "admin"
59711
59725
  });
59712
59726
  method(object({
59713
59727
  sourceUrl: string(),
@@ -82210,11 +82224,15 @@ discriminatedUnion("kind", [object({
82210
82224
  * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
82211
82225
  * near F. A device that is not near one level most of the time has no floor.
82212
82226
  * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
82213
- * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
82214
- * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
82227
+ * 3. an episode shorter than `PULSE_MAX_MS` is a PULSE (an anti-crease tumble, a
82228
+ * display waking): it is neither a run nor a pause. Among the remaining
82229
+ * episodes, gaps over `PAUSE_MAX_MS` always separate runs; the rest split in
82230
+ * two by the largest log-scale jump (>= 3x): the short ones are pauses INSIDE
82231
+ * a run (a soak), the long ones separate runs. A stretch under `MIN_RUN_MS`
82232
+ * is no run.
82215
82233
  * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
82216
- * grid a person would type; stop dwell covers the longest pause; start dwell
82217
- * covers the longest standby blip above T.
82234
+ * grid a person would type; stop dwell covers the longest pause and the
82235
+ * kind's floor; start dwell covers the longest pulse and standby blip above T.
82218
82236
  * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
82219
82237
  * run must hold exactly one true interval and nothing may flap outside.
82220
82238
  */
@@ -82225,6 +82243,10 @@ var MINUTE_MS$1 = 60 * SECOND_MS;
82225
82243
  30 * SECOND_MS;
82226
82244
  60 * SECOND_MS;
82227
82245
  20 * MINUTE_MS$1;
82246
+ 90 * SECOND_MS;
82247
+ 30 * MINUTE_MS$1;
82248
+ 10 * MINUTE_MS$1;
82249
+ DeviceType.Dryer, 3 * MINUTE_MS$1, DeviceType.Dishwasher, 3 * MINUTE_MS$1, DeviceType.Washer, 10 * MINUTE_MS$1;
82228
82250
  10 * SECOND_MS;
82229
82251
  10 * SECOND_MS;
82230
82252
  /**
@@ -87661,13 +87683,6 @@ Object.freeze({
87661
87683
  access: "create",
87662
87684
  role: "admin"
87663
87685
  },
87664
- "integrations.clearSettings": {
87665
- capName: "integrations",
87666
- capScope: "system",
87667
- addonId: null,
87668
- access: "delete",
87669
- role: "admin"
87670
- },
87671
87686
  "integrations.create": {
87672
87687
  capName: "integrations",
87673
87688
  capScope: "system",
@@ -87703,13 +87718,6 @@ Object.freeze({
87703
87718
  access: "view",
87704
87719
  role: "admin"
87705
87720
  },
87706
- "integrations.getSettings": {
87707
- capName: "integrations",
87708
- capScope: "system",
87709
- addonId: null,
87710
- access: "view",
87711
- role: "admin"
87712
- },
87713
87721
  "integrations.list": {
87714
87722
  capName: "integrations",
87715
87723
  capScope: "system",
@@ -87717,13 +87725,6 @@ Object.freeze({
87717
87725
  access: "view",
87718
87726
  role: "admin"
87719
87727
  },
87720
- "integrations.setSettings": {
87721
- capName: "integrations",
87722
- capScope: "system",
87723
- addonId: null,
87724
- access: "create",
87725
- role: "admin"
87726
- },
87727
87728
  "integrations.testConnection": {
87728
87729
  capName: "integrations",
87729
87730
  capScope: "system",
@@ -88718,6 +88719,13 @@ Object.freeze({
88718
88719
  access: "view",
88719
88720
  role: "admin"
88720
88721
  },
88722
+ "migrations.clearLegacyIntegrationRows": {
88723
+ capName: "migrations",
88724
+ capScope: "system",
88725
+ addonId: null,
88726
+ access: "delete",
88727
+ role: "admin"
88728
+ },
88721
88729
  "migrations.declareOwner": {
88722
88730
  capName: "migrations",
88723
88731
  capScope: "system",
@@ -88725,6 +88733,13 @@ Object.freeze({
88725
88733
  access: "create",
88726
88734
  role: "admin"
88727
88735
  },
88736
+ "migrations.deleteLegacyIntegrationRowKeys": {
88737
+ capName: "migrations",
88738
+ capScope: "system",
88739
+ addonId: null,
88740
+ access: "delete",
88741
+ role: "admin"
88742
+ },
88728
88743
  "migrations.dryRun": {
88729
88744
  capName: "migrations",
88730
88745
  capScope: "system",
@@ -88760,6 +88775,20 @@ Object.freeze({
88760
88775
  access: "create",
88761
88776
  role: "admin"
88762
88777
  },
88778
+ "migrations.patchLegacyIntegrationRows": {
88779
+ capName: "migrations",
88780
+ capScope: "system",
88781
+ addonId: null,
88782
+ access: "create",
88783
+ role: "admin"
88784
+ },
88785
+ "migrations.readLegacyIntegrationRows": {
88786
+ capName: "migrations",
88787
+ capScope: "system",
88788
+ addonId: null,
88789
+ access: "view",
88790
+ role: "admin"
88791
+ },
88763
88792
  "migrations.restorePreMigration": {
88764
88793
  capName: "migrations",
88765
88794
  capScope: "system",
@@ -112961,6 +112990,7 @@ var HikvisionProviderAddon = class extends BaseDeviceProvider {
112961
112990
  date: HIKVISION_MIGRATIONS_DATE
112962
112991
  }), defaultIntegrationPortsOver({
112963
112992
  api: defaultIntegrationApiOver(this.ctx.api),
112993
+ secrets: this.ctx.secrets ?? null,
112964
112994
  records,
112965
112995
  kind: hikvisionConnectionsEntryKind,
112966
112996
  info: (message) => this.ctx.logger.info(message),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.181",
3
+ "version": "1.2.182",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",
@@ -88,7 +88,7 @@
88
88
  "werift"
89
89
  ],
90
90
  "requires": {
91
- "server": ">=1.2.764"
91
+ "server": ">=1.2.770"
92
92
  }
93
93
  },
94
94
  "files": [