@camstack/addon-export-google 0.1.122 → 0.1.123

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
+ ## [0.1.123] - 2026-11-02
11
+
12
+ ### Changed
13
+
14
+ - The retired public hub URL settings are now removed from the settings table where they are actually stored
15
+
10
16
  ## [0.1.122] - 2026-11-02
11
17
 
12
18
  ### Changed
@@ -5917,7 +5917,7 @@ var ZodIssueCode = {
5917
5917
  var ZodFirstPartyTypeKind;
5918
5918
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5919
5919
  //#endregion
5920
- //#region ../types/dist/sleep-Bei295Bz.mjs
5920
+ //#region ../types/dist/sleep-CdJHPm-k.mjs
5921
5921
  /**
5922
5922
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5923
5923
  * window to float samples (D455).
@@ -6034,7 +6034,7 @@ function isKeychainStoredField(field) {
6034
6034
  var SECRET_CLEAR = { $secretClear: true };
6035
6035
  /** The `'***'` token D634 redaction writes for non-admins. */
6036
6036
  var LEGACY_DEVICE_REDACTION = "***";
6037
- function isRecord$6(value) {
6037
+ function isRecord$7(value) {
6038
6038
  return typeof value === "object" && value !== null && !Array.isArray(value);
6039
6039
  }
6040
6040
  function makeSecretMarker(ref) {
@@ -6045,12 +6045,12 @@ function makeSecretMarker(ref) {
6045
6045
  }
6046
6046
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6047
6047
  function isSecretMarker(value) {
6048
- if (!isRecord$6(value)) return false;
6048
+ if (!isRecord$7(value)) return false;
6049
6049
  const ref = value["$secret"];
6050
6050
  return typeof ref === "string" && ref.length > 0;
6051
6051
  }
6052
6052
  function isSecretClear(value) {
6053
- return isRecord$6(value) && value["$secretClear"] === true;
6053
+ return isRecord$7(value) && value["$secretClear"] === true;
6054
6054
  }
6055
6055
  /**
6056
6056
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6803,7 +6803,7 @@ var KeychainWriteRefusedError = class extends Error {
6803
6803
  }
6804
6804
  };
6805
6805
  var KEEP = { kind: "keep" };
6806
- function isRecord$5(value) {
6806
+ function isRecord$6(value) {
6807
6807
  return typeof value === "object" && value !== null && !Array.isArray(value);
6808
6808
  }
6809
6809
  function defaultMintId() {
@@ -6816,7 +6816,7 @@ function collectSecretMarkerRefs(value, out = []) {
6816
6816
  return out;
6817
6817
  }
6818
6818
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6819
- else if (isRecord$5(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6819
+ else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6820
6820
  return out;
6821
6821
  }
6822
6822
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6871,7 +6871,7 @@ function rowId(row, idKey) {
6871
6871
  return null;
6872
6872
  }
6873
6873
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6874
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$5) : [];
6874
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
6875
6875
  if (!Array.isArray(incoming)) {
6876
6876
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6877
6877
  return {
@@ -6887,7 +6887,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6887
6887
  const kept = /* @__PURE__ */ new Set();
6888
6888
  const rows = [];
6889
6889
  for (const row of incoming) {
6890
- if (!isRecord$5(row)) {
6890
+ if (!isRecord$6(row)) {
6891
6891
  rows.push(row);
6892
6892
  continue;
6893
6893
  }
@@ -6912,7 +6912,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6912
6912
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6913
6913
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6914
6914
  case "object": {
6915
- if (!isRecord$5(incoming)) {
6915
+ if (!isRecord$6(incoming)) {
6916
6916
  if (incoming === void 0) return KEEP;
6917
6917
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6918
6918
  return {
@@ -6920,7 +6920,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6920
6920
  value: incoming
6921
6921
  };
6922
6922
  }
6923
- const storedObj = isRecord$5(stored) ? stored : {};
6923
+ const storedObj = isRecord$6(stored) ? stored : {};
6924
6924
  return {
6925
6925
  kind: "value",
6926
6926
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7043,7 +7043,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
7043
7043
  value: items
7044
7044
  };
7045
7045
  }
7046
- if (isRecord$5(v)) {
7046
+ if (isRecord$6(v)) {
7047
7047
  const out = {};
7048
7048
  for (const [k, child] of Object.entries(v)) {
7049
7049
  const s = substitute(child);
@@ -7075,7 +7075,7 @@ var SecretOverwriteRefusedError = class extends Error {
7075
7075
  this.name = "SecretOverwriteRefusedError";
7076
7076
  }
7077
7077
  };
7078
- function isRecord$4(value) {
7078
+ function isRecord$5(value) {
7079
7079
  return typeof value === "object" && value !== null && !Array.isArray(value);
7080
7080
  }
7081
7081
  function resolvedValue(pass, marker) {
@@ -7104,7 +7104,7 @@ function inArray(pass, incoming, stored) {
7104
7104
  return incoming.map((item, index) => {
7105
7105
  const twin = stored[index];
7106
7106
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7107
- if (isRecord$4(item) && isRecord$4(twin)) return inArrayRow(pass, item, twin);
7107
+ if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
7108
7108
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7109
7109
  return item;
7110
7110
  });
@@ -7115,7 +7115,7 @@ function inArrayRow(pass, incoming, stored) {
7115
7115
  const twin = stored[key];
7116
7116
  if (isSecretMarker(twin)) {
7117
7117
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7118
- } else if (isRecord$4(value) && isRecord$4(twin)) out[key] = inArrayRow(pass, value, twin);
7118
+ } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7119
7119
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7120
7120
  }
7121
7121
  return out;
@@ -7123,7 +7123,7 @@ function inArrayRow(pass, incoming, stored) {
7123
7123
  async function walk(pass, incoming, stored) {
7124
7124
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7125
7125
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7126
- if (!isRecord$4(incoming) || !isRecord$4(stored)) return incoming;
7126
+ if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7127
7127
  const out = { ...incoming };
7128
7128
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7129
7129
  return out;
@@ -7154,7 +7154,7 @@ async function restoreUnchangedSecrets(input) {
7154
7154
  function isJsonEqual(a, b) {
7155
7155
  if (Object.is(a, b)) return true;
7156
7156
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7157
- if (isRecord$4(a) && isRecord$4(b)) {
7157
+ if (isRecord$5(a) && isRecord$5(b)) {
7158
7158
  const keys = Object.keys(a);
7159
7159
  if (keys.length !== Object.keys(b).length) return false;
7160
7160
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7178,7 +7178,7 @@ function markerKeysOf(blob, owner) {
7178
7178
  }
7179
7179
  function nodeFromStored(value, owner) {
7180
7180
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7181
- if (!isRecord$4(value)) return null;
7181
+ if (!isRecord$5(value)) return null;
7182
7182
  const children = /* @__PURE__ */ new Map();
7183
7183
  for (const [key, child] of Object.entries(value)) {
7184
7184
  const node = nodeFromStored(child, owner);
@@ -7797,6 +7797,44 @@ var BaseAddon = class {
7797
7797
  return null;
7798
7798
  }
7799
7799
  /**
7800
+ * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
7801
+ * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
7802
+ * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
7803
+ * {@link nodeSettingsSchema} and of {@link deviceDefaultsSchema} are disjoint, and a key never
7804
+ * contains `@` (guard `check-scoped-settings-declared`). SHAPE only: values are read by scope.
7805
+ */
7806
+ async clusterSettingsSchema(_cap) {
7807
+ return null;
7808
+ }
7809
+ /**
7810
+ * D986: the form shape of the settings one capability owns PER NODE, or `null`. Stored as
7811
+ * `addon-settings` rows `<addonId>.<field>@<nodeId>` carrying `nodeId` in the row data, so a
7812
+ * forgotten node's rows go in one central delete.
7813
+ */
7814
+ async nodeSettingsSchema(_cap) {
7815
+ return null;
7816
+ }
7817
+ /**
7818
+ * D986: the form shape of the FLEET DEFAULTS of the per-device settings one capability owns,
7819
+ * or `null`. Stored as `addon-settings` rows `<addonId>.<field>`; a device resolves its value
7820
+ * as device row, then this default, then the schema default (`resolveDeviceSettings`).
7821
+ */
7822
+ async deviceDefaultsSchema(_cap) {
7823
+ return null;
7824
+ }
7825
+ /**
7826
+ * The host's read of the scoped declarations: the schema one capability declares for `scope`,
7827
+ * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
7828
+ * host asks this method.
7829
+ */
7830
+ async getScopedSettingsSchema(scope, cap) {
7831
+ switch (scope) {
7832
+ case "cluster": return this.clusterSettingsSchema(cap);
7833
+ case "node": return this.nodeSettingsSchema(cap);
7834
+ case "device-defaults": return this.deviceDefaultsSchema(cap);
7835
+ }
7836
+ }
7837
+ /**
7800
7838
  * What the create wizard and the integration edit page render for one instance: the addon's
7801
7839
  * per-instance schema when it declares one, else its global schema (what they always showed).
7802
7840
  */
@@ -8590,6 +8628,21 @@ function normalizeAddonInitResult(result) {
8590
8628
  if (Array.isArray(result)) return { providers: result };
8591
8629
  return result;
8592
8630
  }
8631
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8632
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
8633
+ var RECORD_DATABASES = ["settings", "events"];
8634
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8635
+ var RECORD_CLASSES = [
8636
+ "config",
8637
+ "ledger",
8638
+ "audit",
8639
+ "mirror",
8640
+ "ephemeral"
8641
+ ];
8642
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8643
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8644
+ var RECORD_BATCH_MAX = 1e3;
8645
+ var RECORD_QUERY_MAX = 1e3;
8593
8646
  /**
8594
8647
  * The share-view scope kinds a share-link token can carry. The hub mints
8595
8648
  * and validates them (`ShareViewGrantSchema` builds its
@@ -8614,21 +8667,6 @@ var PeerBytesTicketSchema = object({
8614
8667
  */
8615
8668
  declaredBytes: number().int().nonnegative().nullable()
8616
8669
  });
8617
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8618
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8619
- var RECORD_DATABASES = ["settings", "events"];
8620
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8621
- var RECORD_CLASSES = [
8622
- "config",
8623
- "ledger",
8624
- "audit",
8625
- "mirror",
8626
- "ephemeral"
8627
- ];
8628
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8629
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8630
- var RECORD_BATCH_MAX = 1e3;
8631
- var RECORD_QUERY_MAX = 1e3;
8632
8670
  /**
8633
8671
  * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8634
8672
  * Zod row schema that describes it, and the helper that turns the two into the
@@ -9410,6 +9448,7 @@ var CAP_NAMES = Object.freeze([
9410
9448
  "humidity-sensor",
9411
9449
  "image",
9412
9450
  "image-settings",
9451
+ "integration-instances",
9413
9452
  "integrations",
9414
9453
  "intercom",
9415
9454
  "ir-transmitter",
@@ -11343,7 +11382,7 @@ object({
11343
11382
  params: record(string(), union([string(), number()])).optional()
11344
11383
  });
11345
11384
  //#endregion
11346
- //#region ../types/dist/composition-kKKOdFIG.mjs
11385
+ //#region ../types/dist/composition-BDUoQsw9.mjs
11347
11386
  /**
11348
11387
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11349
11388
  *
@@ -20960,6 +20999,7 @@ var SYSTEM_CAP_VOCABULARY = {
20960
20999
  "load-contribution": system(INTERNAL),
20961
21000
  "local-network": system(NETWORK),
20962
21001
  "log-channels": system(INTERNAL),
21002
+ "integration-instances": system(INTERNAL),
20963
21003
  "log-destination": system(INTERNAL),
20964
21004
  "login-method": system(IDENTITY),
20965
21005
  "mesh-network": system(NETWORK),
@@ -43106,7 +43146,7 @@ var TargetKindCapsSchema = object({
43106
43146
  * the union is large and not meant for runtime validation here; the exported
43107
43147
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
43108
43148
  */
43109
- var ConfigSchemaPassthrough$3 = unknown();
43149
+ var ConfigSchemaPassthrough$4 = unknown();
43110
43150
  var TargetKindSchema = object({
43111
43151
  kind: string(),
43112
43152
  label: string(),
@@ -43143,7 +43183,7 @@ var TargetKindSchema = object({
43143
43183
  * its raster path, which is the safe default for an unknown image.
43144
43184
  */
43145
43185
  iconMediaType: string().optional(),
43146
- configSchema: ConfigSchemaPassthrough$3,
43186
+ configSchema: ConfigSchemaPassthrough$4,
43147
43187
  /**
43148
43188
  * The config keys that decide WHERE this kind's secrets are sent (server,
43149
43189
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -52891,9 +52931,15 @@ var AvailableIntegrationTypeSchema = object({
52891
52931
  * branch on CAP — never on addon name. `device-adoption` integrations
52892
52932
  * (Home Assistant, …) route through the broker step (Approach A);
52893
52933
  * `device-provider` integrations (Reolink/ONVIF) keep the
52894
- * legacy config → discovery flow.
52934
+ * legacy config → discovery flow. `connection` is an addon that only holds a
52935
+ * connection as typed records (`integration-instances`, D985): no devices,
52936
+ * no discovery.
52895
52937
  */
52896
- kind: _enum(["device-adoption", "device-provider"]),
52938
+ kind: _enum([
52939
+ "device-adoption",
52940
+ "device-provider",
52941
+ "connection"
52942
+ ]),
52897
52943
  /**
52898
52944
  * For `device-adoption` addons: the broker kind to create/link
52899
52945
  * (e.g. `home-assistant`), declared in the addon manifest. `null` for
@@ -53006,6 +53052,67 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53006
53052
  auth: "admin"
53007
53053
  });
53008
53054
  /**
53055
+ * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53056
+ * (an account, a relay, a destination) as typed records, shown on the
53057
+ * Integrations page like every other integration (D985, D986).
53058
+ *
53059
+ * A collection of providers: each addon that holds connections registers one
53060
+ * and the hub aggregator (`integrations.*`) reaches a provider with the pinned
53061
+ * `addonId`. It is internal and has no route: the operator-facing surface is
53062
+ * the `integrations` cap, which keeps ONE list.
53063
+ *
53064
+ * Identity: the instance id IS the `integrations` registry id (`int_NNNN`,
53065
+ * immutable, already in the `/integrations/<id>` URL). A second operator-chosen
53066
+ * slug would be a second authority over one identity (D224). `name` is the
53067
+ * editable label.
53068
+ *
53069
+ * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53070
+ * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
53071
+ * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
53072
+ * clears it.
53073
+ */
53074
+ var ConfigSchemaPassthrough$3 = custom();
53075
+ var IntegrationInstanceIdSchema = string().min(1);
53076
+ var IntegrationInstanceDescriptionSchema = object({
53077
+ /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53078
+ instanceMode: _enum(["single", "multiple"]),
53079
+ /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53080
+ kind: string(),
53081
+ /** True when `testInstance` really probes the remote. */
53082
+ canTest: boolean()
53083
+ });
53084
+ var IntegrationInstanceStatusSchema = object({
53085
+ state: _enum([
53086
+ "ok",
53087
+ "off",
53088
+ "error",
53089
+ "unknown"
53090
+ ]),
53091
+ detail: string().optional()
53092
+ });
53093
+ var IntegrationInstanceSchema = object({
53094
+ id: IntegrationInstanceIdSchema,
53095
+ name: string(),
53096
+ /** The addon's own rule (an URL is present, a client id is present...). */
53097
+ configured: boolean(),
53098
+ /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53099
+ formValues: record(string(), unknown()),
53100
+ status: IntegrationInstanceStatusSchema.optional()
53101
+ });
53102
+ var IntegrationInstancePatchSchema = object({
53103
+ id: IntegrationInstanceIdSchema,
53104
+ name: string().min(1).optional(),
53105
+ /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53106
+ values: record(string(), unknown())
53107
+ });
53108
+ method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
53109
+ id: IntegrationInstanceIdSchema,
53110
+ name: string().min(1)
53111
+ }), object({ id: string() }), { kind: "mutation" }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), { kind: "mutation" }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), { kind: "mutation" }), optionalMethod(object({
53112
+ id: IntegrationInstanceIdSchema.nullable(),
53113
+ values: record(string(), unknown())
53114
+ }), TestConnectionResultSchema$1, { kind: "mutation" });
53115
+ /**
53009
53116
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
53010
53117
  * session (server-initiated offer pattern, identical to the main
53011
53118
  * video WebRTC flow) and the browser captures the mic; the server
@@ -78382,6 +78489,62 @@ Object.freeze({
78382
78489
  access: "create",
78383
78490
  role: "admin"
78384
78491
  },
78492
+ "integrationInstances.createInstance": {
78493
+ capName: "integration-instances",
78494
+ capScope: "system",
78495
+ addonId: null,
78496
+ access: "create",
78497
+ role: "admin"
78498
+ },
78499
+ "integrationInstances.deleteInstance": {
78500
+ capName: "integration-instances",
78501
+ capScope: "system",
78502
+ addonId: null,
78503
+ access: "delete",
78504
+ role: "admin"
78505
+ },
78506
+ "integrationInstances.describe": {
78507
+ capName: "integration-instances",
78508
+ capScope: "system",
78509
+ addonId: null,
78510
+ access: "view",
78511
+ role: "admin"
78512
+ },
78513
+ "integrationInstances.getInstance": {
78514
+ capName: "integration-instances",
78515
+ capScope: "system",
78516
+ addonId: null,
78517
+ access: "view",
78518
+ role: "admin"
78519
+ },
78520
+ "integrationInstances.instanceFormSchema": {
78521
+ capName: "integration-instances",
78522
+ capScope: "system",
78523
+ addonId: null,
78524
+ access: "view",
78525
+ role: "admin"
78526
+ },
78527
+ "integrationInstances.listInstances": {
78528
+ capName: "integration-instances",
78529
+ capScope: "system",
78530
+ addonId: null,
78531
+ access: "view",
78532
+ role: "admin"
78533
+ },
78534
+ "integrationInstances.testInstance": {
78535
+ capName: "integration-instances",
78536
+ capScope: "system",
78537
+ addonId: null,
78538
+ access: "create",
78539
+ role: "admin"
78540
+ },
78541
+ "integrationInstances.updateInstance": {
78542
+ capName: "integration-instances",
78543
+ capScope: "system",
78544
+ addonId: null,
78545
+ access: "create",
78546
+ role: "admin"
78547
+ },
78385
78548
  "integrations.create": {
78386
78549
  capName: "integrations",
78387
78550
  capScope: "system",
@@ -90689,18 +90852,29 @@ function buildGoogleOauthIntegration() {
90689
90852
  *
90690
90853
  * Idempotent: a store without either key yields an empty plan, which writes nothing.
90691
90854
  */
90692
- /** The settings scope of this addon (`<addonId>:addon-settings`). */
90693
- var GOOGLE_SETTINGS_SCOPE = "export-google:addon-settings";
90855
+ /** The addon id, the prefix of its rows in the canonical settings table. */
90856
+ var GOOGLE_ADDON_ID = "export-google";
90857
+ /**
90858
+ * Where the addon's global settings live: the canonical `addon-settings` table, one row per
90859
+ * key, id `<addonId>.<key>`, data `{ addonId, key, value }` (never a per-addon scoped table,
90860
+ * which exists only when something lazily declared it).
90861
+ */
90862
+ var ADDON_SETTINGS_TABLE = "addon-settings";
90694
90863
  var RETIRED_PUBLIC_URL_KEYS = ["publicHubUrl", "detectedPublicHubUrl"];
90695
90864
  async function planDropPublicHubUrl(ports) {
90696
90865
  const stored = await ports.readStored();
90697
90866
  const present = RETIRED_PUBLIC_URL_KEYS.filter((key) => key in stored);
90698
90867
  if (present.length === 0) return { edits: [] };
90868
+ const rowId = (key) => `${GOOGLE_ADDON_ID}.${key}`;
90699
90869
  return { edits: [{
90700
90870
  op: "deleteKeys",
90701
- scope: GOOGLE_SETTINGS_SCOPE,
90702
- keys: [...present],
90703
- precondition: preconditionOf(Object.fromEntries(present.map((key) => [key, stored[key]])))
90871
+ scope: ADDON_SETTINGS_TABLE,
90872
+ keys: present.map(rowId),
90873
+ precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
90874
+ addonId: GOOGLE_ADDON_ID,
90875
+ key,
90876
+ value: stored[key]
90877
+ }])))
90704
90878
  }] };
90705
90879
  }
90706
90880
  //#endregion
@@ -5913,7 +5913,7 @@ var ZodIssueCode = {
5913
5913
  var ZodFirstPartyTypeKind;
5914
5914
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5915
5915
  //#endregion
5916
- //#region ../types/dist/sleep-Bei295Bz.mjs
5916
+ //#region ../types/dist/sleep-CdJHPm-k.mjs
5917
5917
  /**
5918
5918
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5919
5919
  * window to float samples (D455).
@@ -6030,7 +6030,7 @@ function isKeychainStoredField(field) {
6030
6030
  var SECRET_CLEAR = { $secretClear: true };
6031
6031
  /** The `'***'` token D634 redaction writes for non-admins. */
6032
6032
  var LEGACY_DEVICE_REDACTION = "***";
6033
- function isRecord$6(value) {
6033
+ function isRecord$7(value) {
6034
6034
  return typeof value === "object" && value !== null && !Array.isArray(value);
6035
6035
  }
6036
6036
  function makeSecretMarker(ref) {
@@ -6041,12 +6041,12 @@ function makeSecretMarker(ref) {
6041
6041
  }
6042
6042
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6043
6043
  function isSecretMarker(value) {
6044
- if (!isRecord$6(value)) return false;
6044
+ if (!isRecord$7(value)) return false;
6045
6045
  const ref = value["$secret"];
6046
6046
  return typeof ref === "string" && ref.length > 0;
6047
6047
  }
6048
6048
  function isSecretClear(value) {
6049
- return isRecord$6(value) && value["$secretClear"] === true;
6049
+ return isRecord$7(value) && value["$secretClear"] === true;
6050
6050
  }
6051
6051
  /**
6052
6052
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6799,7 +6799,7 @@ var KeychainWriteRefusedError = class extends Error {
6799
6799
  }
6800
6800
  };
6801
6801
  var KEEP = { kind: "keep" };
6802
- function isRecord$5(value) {
6802
+ function isRecord$6(value) {
6803
6803
  return typeof value === "object" && value !== null && !Array.isArray(value);
6804
6804
  }
6805
6805
  function defaultMintId() {
@@ -6812,7 +6812,7 @@ function collectSecretMarkerRefs(value, out = []) {
6812
6812
  return out;
6813
6813
  }
6814
6814
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6815
- else if (isRecord$5(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6815
+ else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6816
6816
  return out;
6817
6817
  }
6818
6818
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6867,7 +6867,7 @@ function rowId(row, idKey) {
6867
6867
  return null;
6868
6868
  }
6869
6869
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6870
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$5) : [];
6870
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
6871
6871
  if (!Array.isArray(incoming)) {
6872
6872
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6873
6873
  return {
@@ -6883,7 +6883,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6883
6883
  const kept = /* @__PURE__ */ new Set();
6884
6884
  const rows = [];
6885
6885
  for (const row of incoming) {
6886
- if (!isRecord$5(row)) {
6886
+ if (!isRecord$6(row)) {
6887
6887
  rows.push(row);
6888
6888
  continue;
6889
6889
  }
@@ -6908,7 +6908,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6908
6908
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6909
6909
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6910
6910
  case "object": {
6911
- if (!isRecord$5(incoming)) {
6911
+ if (!isRecord$6(incoming)) {
6912
6912
  if (incoming === void 0) return KEEP;
6913
6913
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6914
6914
  return {
@@ -6916,7 +6916,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6916
6916
  value: incoming
6917
6917
  };
6918
6918
  }
6919
- const storedObj = isRecord$5(stored) ? stored : {};
6919
+ const storedObj = isRecord$6(stored) ? stored : {};
6920
6920
  return {
6921
6921
  kind: "value",
6922
6922
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7039,7 +7039,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
7039
7039
  value: items
7040
7040
  };
7041
7041
  }
7042
- if (isRecord$5(v)) {
7042
+ if (isRecord$6(v)) {
7043
7043
  const out = {};
7044
7044
  for (const [k, child] of Object.entries(v)) {
7045
7045
  const s = substitute(child);
@@ -7071,7 +7071,7 @@ var SecretOverwriteRefusedError = class extends Error {
7071
7071
  this.name = "SecretOverwriteRefusedError";
7072
7072
  }
7073
7073
  };
7074
- function isRecord$4(value) {
7074
+ function isRecord$5(value) {
7075
7075
  return typeof value === "object" && value !== null && !Array.isArray(value);
7076
7076
  }
7077
7077
  function resolvedValue(pass, marker) {
@@ -7100,7 +7100,7 @@ function inArray(pass, incoming, stored) {
7100
7100
  return incoming.map((item, index) => {
7101
7101
  const twin = stored[index];
7102
7102
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7103
- if (isRecord$4(item) && isRecord$4(twin)) return inArrayRow(pass, item, twin);
7103
+ if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
7104
7104
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7105
7105
  return item;
7106
7106
  });
@@ -7111,7 +7111,7 @@ function inArrayRow(pass, incoming, stored) {
7111
7111
  const twin = stored[key];
7112
7112
  if (isSecretMarker(twin)) {
7113
7113
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7114
- } else if (isRecord$4(value) && isRecord$4(twin)) out[key] = inArrayRow(pass, value, twin);
7114
+ } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7115
7115
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7116
7116
  }
7117
7117
  return out;
@@ -7119,7 +7119,7 @@ function inArrayRow(pass, incoming, stored) {
7119
7119
  async function walk(pass, incoming, stored) {
7120
7120
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7121
7121
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7122
- if (!isRecord$4(incoming) || !isRecord$4(stored)) return incoming;
7122
+ if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7123
7123
  const out = { ...incoming };
7124
7124
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7125
7125
  return out;
@@ -7150,7 +7150,7 @@ async function restoreUnchangedSecrets(input) {
7150
7150
  function isJsonEqual(a, b) {
7151
7151
  if (Object.is(a, b)) return true;
7152
7152
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7153
- if (isRecord$4(a) && isRecord$4(b)) {
7153
+ if (isRecord$5(a) && isRecord$5(b)) {
7154
7154
  const keys = Object.keys(a);
7155
7155
  if (keys.length !== Object.keys(b).length) return false;
7156
7156
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7174,7 +7174,7 @@ function markerKeysOf(blob, owner) {
7174
7174
  }
7175
7175
  function nodeFromStored(value, owner) {
7176
7176
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7177
- if (!isRecord$4(value)) return null;
7177
+ if (!isRecord$5(value)) return null;
7178
7178
  const children = /* @__PURE__ */ new Map();
7179
7179
  for (const [key, child] of Object.entries(value)) {
7180
7180
  const node = nodeFromStored(child, owner);
@@ -7793,6 +7793,44 @@ var BaseAddon = class {
7793
7793
  return null;
7794
7794
  }
7795
7795
  /**
7796
+ * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
7797
+ * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
7798
+ * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
7799
+ * {@link nodeSettingsSchema} and of {@link deviceDefaultsSchema} are disjoint, and a key never
7800
+ * contains `@` (guard `check-scoped-settings-declared`). SHAPE only: values are read by scope.
7801
+ */
7802
+ async clusterSettingsSchema(_cap) {
7803
+ return null;
7804
+ }
7805
+ /**
7806
+ * D986: the form shape of the settings one capability owns PER NODE, or `null`. Stored as
7807
+ * `addon-settings` rows `<addonId>.<field>@<nodeId>` carrying `nodeId` in the row data, so a
7808
+ * forgotten node's rows go in one central delete.
7809
+ */
7810
+ async nodeSettingsSchema(_cap) {
7811
+ return null;
7812
+ }
7813
+ /**
7814
+ * D986: the form shape of the FLEET DEFAULTS of the per-device settings one capability owns,
7815
+ * or `null`. Stored as `addon-settings` rows `<addonId>.<field>`; a device resolves its value
7816
+ * as device row, then this default, then the schema default (`resolveDeviceSettings`).
7817
+ */
7818
+ async deviceDefaultsSchema(_cap) {
7819
+ return null;
7820
+ }
7821
+ /**
7822
+ * The host's read of the scoped declarations: the schema one capability declares for `scope`,
7823
+ * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
7824
+ * host asks this method.
7825
+ */
7826
+ async getScopedSettingsSchema(scope, cap) {
7827
+ switch (scope) {
7828
+ case "cluster": return this.clusterSettingsSchema(cap);
7829
+ case "node": return this.nodeSettingsSchema(cap);
7830
+ case "device-defaults": return this.deviceDefaultsSchema(cap);
7831
+ }
7832
+ }
7833
+ /**
7796
7834
  * What the create wizard and the integration edit page render for one instance: the addon's
7797
7835
  * per-instance schema when it declares one, else its global schema (what they always showed).
7798
7836
  */
@@ -8586,6 +8624,21 @@ function normalizeAddonInitResult(result) {
8586
8624
  if (Array.isArray(result)) return { providers: result };
8587
8625
  return result;
8588
8626
  }
8627
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8628
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
8629
+ var RECORD_DATABASES = ["settings", "events"];
8630
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8631
+ var RECORD_CLASSES = [
8632
+ "config",
8633
+ "ledger",
8634
+ "audit",
8635
+ "mirror",
8636
+ "ephemeral"
8637
+ ];
8638
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8639
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8640
+ var RECORD_BATCH_MAX = 1e3;
8641
+ var RECORD_QUERY_MAX = 1e3;
8589
8642
  /**
8590
8643
  * The share-view scope kinds a share-link token can carry. The hub mints
8591
8644
  * and validates them (`ShareViewGrantSchema` builds its
@@ -8610,21 +8663,6 @@ var PeerBytesTicketSchema = object({
8610
8663
  */
8611
8664
  declaredBytes: number().int().nonnegative().nullable()
8612
8665
  });
8613
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8614
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8615
- var RECORD_DATABASES = ["settings", "events"];
8616
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8617
- var RECORD_CLASSES = [
8618
- "config",
8619
- "ledger",
8620
- "audit",
8621
- "mirror",
8622
- "ephemeral"
8623
- ];
8624
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8625
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8626
- var RECORD_BATCH_MAX = 1e3;
8627
- var RECORD_QUERY_MAX = 1e3;
8628
8666
  /**
8629
8667
  * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8630
8668
  * Zod row schema that describes it, and the helper that turns the two into the
@@ -9406,6 +9444,7 @@ var CAP_NAMES = Object.freeze([
9406
9444
  "humidity-sensor",
9407
9445
  "image",
9408
9446
  "image-settings",
9447
+ "integration-instances",
9409
9448
  "integrations",
9410
9449
  "intercom",
9411
9450
  "ir-transmitter",
@@ -11339,7 +11378,7 @@ object({
11339
11378
  params: record(string(), union([string(), number()])).optional()
11340
11379
  });
11341
11380
  //#endregion
11342
- //#region ../types/dist/composition-kKKOdFIG.mjs
11381
+ //#region ../types/dist/composition-BDUoQsw9.mjs
11343
11382
  /**
11344
11383
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11345
11384
  *
@@ -20956,6 +20995,7 @@ var SYSTEM_CAP_VOCABULARY = {
20956
20995
  "load-contribution": system(INTERNAL),
20957
20996
  "local-network": system(NETWORK),
20958
20997
  "log-channels": system(INTERNAL),
20998
+ "integration-instances": system(INTERNAL),
20959
20999
  "log-destination": system(INTERNAL),
20960
21000
  "login-method": system(IDENTITY),
20961
21001
  "mesh-network": system(NETWORK),
@@ -43102,7 +43142,7 @@ var TargetKindCapsSchema = object({
43102
43142
  * the union is large and not meant for runtime validation here; the exported
43103
43143
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
43104
43144
  */
43105
- var ConfigSchemaPassthrough$3 = unknown();
43145
+ var ConfigSchemaPassthrough$4 = unknown();
43106
43146
  var TargetKindSchema = object({
43107
43147
  kind: string(),
43108
43148
  label: string(),
@@ -43139,7 +43179,7 @@ var TargetKindSchema = object({
43139
43179
  * its raster path, which is the safe default for an unknown image.
43140
43180
  */
43141
43181
  iconMediaType: string().optional(),
43142
- configSchema: ConfigSchemaPassthrough$3,
43182
+ configSchema: ConfigSchemaPassthrough$4,
43143
43183
  /**
43144
43184
  * The config keys that decide WHERE this kind's secrets are sent (server,
43145
43185
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -52887,9 +52927,15 @@ var AvailableIntegrationTypeSchema = object({
52887
52927
  * branch on CAP — never on addon name. `device-adoption` integrations
52888
52928
  * (Home Assistant, …) route through the broker step (Approach A);
52889
52929
  * `device-provider` integrations (Reolink/ONVIF) keep the
52890
- * legacy config → discovery flow.
52930
+ * legacy config → discovery flow. `connection` is an addon that only holds a
52931
+ * connection as typed records (`integration-instances`, D985): no devices,
52932
+ * no discovery.
52891
52933
  */
52892
- kind: _enum(["device-adoption", "device-provider"]),
52934
+ kind: _enum([
52935
+ "device-adoption",
52936
+ "device-provider",
52937
+ "connection"
52938
+ ]),
52893
52939
  /**
52894
52940
  * For `device-adoption` addons: the broker kind to create/link
52895
52941
  * (e.g. `home-assistant`), declared in the addon manifest. `null` for
@@ -53002,6 +53048,67 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53002
53048
  auth: "admin"
53003
53049
  });
53004
53050
  /**
53051
+ * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53052
+ * (an account, a relay, a destination) as typed records, shown on the
53053
+ * Integrations page like every other integration (D985, D986).
53054
+ *
53055
+ * A collection of providers: each addon that holds connections registers one
53056
+ * and the hub aggregator (`integrations.*`) reaches a provider with the pinned
53057
+ * `addonId`. It is internal and has no route: the operator-facing surface is
53058
+ * the `integrations` cap, which keeps ONE list.
53059
+ *
53060
+ * Identity: the instance id IS the `integrations` registry id (`int_NNNN`,
53061
+ * immutable, already in the `/integrations/<id>` URL). A second operator-chosen
53062
+ * slug would be a second authority over one identity (D224). `name` is the
53063
+ * editable label.
53064
+ *
53065
+ * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53066
+ * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
53067
+ * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
53068
+ * clears it.
53069
+ */
53070
+ var ConfigSchemaPassthrough$3 = custom();
53071
+ var IntegrationInstanceIdSchema = string().min(1);
53072
+ var IntegrationInstanceDescriptionSchema = object({
53073
+ /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53074
+ instanceMode: _enum(["single", "multiple"]),
53075
+ /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53076
+ kind: string(),
53077
+ /** True when `testInstance` really probes the remote. */
53078
+ canTest: boolean()
53079
+ });
53080
+ var IntegrationInstanceStatusSchema = object({
53081
+ state: _enum([
53082
+ "ok",
53083
+ "off",
53084
+ "error",
53085
+ "unknown"
53086
+ ]),
53087
+ detail: string().optional()
53088
+ });
53089
+ var IntegrationInstanceSchema = object({
53090
+ id: IntegrationInstanceIdSchema,
53091
+ name: string(),
53092
+ /** The addon's own rule (an URL is present, a client id is present...). */
53093
+ configured: boolean(),
53094
+ /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53095
+ formValues: record(string(), unknown()),
53096
+ status: IntegrationInstanceStatusSchema.optional()
53097
+ });
53098
+ var IntegrationInstancePatchSchema = object({
53099
+ id: IntegrationInstanceIdSchema,
53100
+ name: string().min(1).optional(),
53101
+ /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53102
+ values: record(string(), unknown())
53103
+ });
53104
+ method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
53105
+ id: IntegrationInstanceIdSchema,
53106
+ name: string().min(1)
53107
+ }), object({ id: string() }), { kind: "mutation" }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), { kind: "mutation" }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), { kind: "mutation" }), optionalMethod(object({
53108
+ id: IntegrationInstanceIdSchema.nullable(),
53109
+ values: record(string(), unknown())
53110
+ }), TestConnectionResultSchema$1, { kind: "mutation" });
53111
+ /**
53005
53112
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
53006
53113
  * session (server-initiated offer pattern, identical to the main
53007
53114
  * video WebRTC flow) and the browser captures the mic; the server
@@ -78378,6 +78485,62 @@ Object.freeze({
78378
78485
  access: "create",
78379
78486
  role: "admin"
78380
78487
  },
78488
+ "integrationInstances.createInstance": {
78489
+ capName: "integration-instances",
78490
+ capScope: "system",
78491
+ addonId: null,
78492
+ access: "create",
78493
+ role: "admin"
78494
+ },
78495
+ "integrationInstances.deleteInstance": {
78496
+ capName: "integration-instances",
78497
+ capScope: "system",
78498
+ addonId: null,
78499
+ access: "delete",
78500
+ role: "admin"
78501
+ },
78502
+ "integrationInstances.describe": {
78503
+ capName: "integration-instances",
78504
+ capScope: "system",
78505
+ addonId: null,
78506
+ access: "view",
78507
+ role: "admin"
78508
+ },
78509
+ "integrationInstances.getInstance": {
78510
+ capName: "integration-instances",
78511
+ capScope: "system",
78512
+ addonId: null,
78513
+ access: "view",
78514
+ role: "admin"
78515
+ },
78516
+ "integrationInstances.instanceFormSchema": {
78517
+ capName: "integration-instances",
78518
+ capScope: "system",
78519
+ addonId: null,
78520
+ access: "view",
78521
+ role: "admin"
78522
+ },
78523
+ "integrationInstances.listInstances": {
78524
+ capName: "integration-instances",
78525
+ capScope: "system",
78526
+ addonId: null,
78527
+ access: "view",
78528
+ role: "admin"
78529
+ },
78530
+ "integrationInstances.testInstance": {
78531
+ capName: "integration-instances",
78532
+ capScope: "system",
78533
+ addonId: null,
78534
+ access: "create",
78535
+ role: "admin"
78536
+ },
78537
+ "integrationInstances.updateInstance": {
78538
+ capName: "integration-instances",
78539
+ capScope: "system",
78540
+ addonId: null,
78541
+ access: "create",
78542
+ role: "admin"
78543
+ },
78381
78544
  "integrations.create": {
78382
78545
  capName: "integrations",
78383
78546
  capScope: "system",
@@ -90685,18 +90848,29 @@ function buildGoogleOauthIntegration() {
90685
90848
  *
90686
90849
  * Idempotent: a store without either key yields an empty plan, which writes nothing.
90687
90850
  */
90688
- /** The settings scope of this addon (`<addonId>:addon-settings`). */
90689
- var GOOGLE_SETTINGS_SCOPE = "export-google:addon-settings";
90851
+ /** The addon id, the prefix of its rows in the canonical settings table. */
90852
+ var GOOGLE_ADDON_ID = "export-google";
90853
+ /**
90854
+ * Where the addon's global settings live: the canonical `addon-settings` table, one row per
90855
+ * key, id `<addonId>.<key>`, data `{ addonId, key, value }` (never a per-addon scoped table,
90856
+ * which exists only when something lazily declared it).
90857
+ */
90858
+ var ADDON_SETTINGS_TABLE = "addon-settings";
90690
90859
  var RETIRED_PUBLIC_URL_KEYS = ["publicHubUrl", "detectedPublicHubUrl"];
90691
90860
  async function planDropPublicHubUrl(ports) {
90692
90861
  const stored = await ports.readStored();
90693
90862
  const present = RETIRED_PUBLIC_URL_KEYS.filter((key) => key in stored);
90694
90863
  if (present.length === 0) return { edits: [] };
90864
+ const rowId = (key) => `${GOOGLE_ADDON_ID}.${key}`;
90695
90865
  return { edits: [{
90696
90866
  op: "deleteKeys",
90697
- scope: GOOGLE_SETTINGS_SCOPE,
90698
- keys: [...present],
90699
- precondition: preconditionOf(Object.fromEntries(present.map((key) => [key, stored[key]])))
90867
+ scope: ADDON_SETTINGS_TABLE,
90868
+ keys: present.map(rowId),
90869
+ precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
90870
+ addonId: GOOGLE_ADDON_ID,
90871
+ key,
90872
+ value: stored[key]
90873
+ }])))
90700
90874
  }] };
90701
90875
  }
90702
90876
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.122",
3
+ "version": "0.1.123",
4
4
  "description": "Google Home Export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -58,7 +58,7 @@
58
58
  }
59
59
  ],
60
60
  "requires": {
61
- "server": ">=1.2.733"
61
+ "server": ">=1.2.738"
62
62
  }
63
63
  },
64
64
  "files": [