@camstack/server 1.2.768 → 1.2.770
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 +16 -0
- package/dist/api/core/cap-providers.js +4 -193
- package/dist/api/trpc/generated-cap-routers.js +40 -30
- package/dist/core/addon/integration-visibility.js +0 -5
- package/package.json +36 -12
- package/system/dist/addon-runner.js +7 -1
- package/system/dist/addon-runner.mjs +7 -1
- package/system/dist/{agent-https-D03iyjJk.mjs → agent-https-BGRPCKwT.mjs} +1 -1
- package/system/dist/{agent-https-D62iihRo.js → agent-https-mq6d71iq.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.d.ts +15 -0
- package/system/dist/builtins/alerts/alerts.addon.js +104 -4
- package/system/dist/builtins/alerts/alerts.addon.mjs +104 -4
- package/system/dist/builtins/alerts/cluster-state-alerts.d.ts +32 -0
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +5 -4
- package/system/dist/builtins/composer/composer.addon.mjs +5 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +17 -10
- package/system/dist/builtins/keychain/index.mjs +17 -10
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +3 -10
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +1 -11
- package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +13 -15
- package/system/dist/builtins/sqlite-storage/migrations/legacy-integration-rows-door.d.ts +31 -0
- package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +39 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +48 -5
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +48 -5
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-BpoL1zQ0.js → capture-engine--FQ8NUHh.js} +1 -1
- package/system/dist/{capture-engine-CYmRx0Ce.mjs → capture-engine-Cmx7DIzV.mjs} +1 -1
- package/system/dist/{composition-sources-CknQxftO.mjs → composition-sources-Bd09D5f4.mjs} +1 -1
- package/system/dist/{composition-sources-B7VyYbEU.js → composition-sources-cvZAN87H.js} +1 -1
- package/system/dist/{constants-C9Gxs1jW.mjs → constants-Dce28BAx.mjs} +1 -1
- package/system/dist/{constants-DJqUggkW.js → constants-gM9xHjyj.js} +1 -1
- package/system/dist/{device-ca-9BTS4o-T.js → device-ca-BmeH6Y9E.js} +1 -1
- package/system/dist/{device-ca-D76OqRnW.mjs → device-ca-DcMuT-Yp.mjs} +1 -1
- package/system/dist/{dist-BhR34kF8.mjs → dist-C3WXy3Ix.mjs} +185 -84
- package/system/dist/{dist-DLVfdGSW.js → dist-Dtw1sIeQ.js} +185 -84
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-DimaT9WQ.js → hub-mdns-ciao-C49eqyby.js} +2 -2
- package/system/dist/{hub-mdns-ciao-i31GIYWP.mjs → hub-mdns-ciao-Dfue_0kR.mjs} +2 -2
- package/system/dist/index.d.ts +1 -1
- package/system/dist/index.js +49 -231
- package/system/dist/index.mjs +58 -240
- package/system/dist/legacy-integration-rows-door-B8_XCqUX.js +290 -0
- package/system/dist/legacy-integration-rows-door-DK42Bh2Q.mjs +255 -0
- package/system/dist/migrations/hub/2026-11-05-drop-integration-settings.d.ts +16 -0
- package/system/dist/{restore-archive-nWi73iy0.mjs → restore-archive-C0YDO-qd.mjs} +82 -82
- package/system/dist/{restore-archive-BkiXu43U.js → restore-archive-DuktQtye.js} +1 -1
- package/system/dist/{wal-maintenance-UQEtPem2.js → wal-maintenance-BEo-y-cQ.js} +0 -0
- package/system/dist/{wal-maintenance-DG2bwMif.mjs → wal-maintenance-DhuvKiGK.mjs} +0 -0
- package/system/package.json +1 -1
- package/dist/api/core/integration-secrets.js +0 -96
package/system/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("./dist-
|
|
4
|
-
const require_device_ca = require("./device-ca-
|
|
3
|
+
const require_dist = require("./dist-Dtw1sIeQ.js");
|
|
4
|
+
const require_device_ca = require("./device-ca-BmeH6Y9E.js");
|
|
5
5
|
const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
|
|
6
6
|
const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
|
|
7
7
|
require("./builtins/alerts/index.js");
|
|
@@ -26,21 +26,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
|
|
|
26
26
|
const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
|
|
27
27
|
const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
|
|
28
28
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
|
|
29
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
29
|
+
const require_wal_maintenance = require("./wal-maintenance-BEo-y-cQ.js");
|
|
30
|
+
const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-B8_XCqUX.js");
|
|
30
31
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
|
|
31
32
|
const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
|
|
32
33
|
const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
|
|
33
34
|
require("./builtins/storage-orchestrator/index.js");
|
|
34
|
-
const require_agent_https = require("./agent-https-
|
|
35
|
-
const require_constants = require("./constants-
|
|
35
|
+
const require_agent_https = require("./agent-https-mq6d71iq.js");
|
|
36
|
+
const require_constants = require("./constants-gM9xHjyj.js");
|
|
36
37
|
const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
|
|
37
38
|
require("./builtins/system-config/index.js");
|
|
38
39
|
const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
|
|
39
40
|
const require_custom_action_registry = require("./custom-action-registry-JuMHGKEc.js");
|
|
40
|
-
const require_hub_mdns_ciao = require("./hub-mdns-ciao-
|
|
41
|
+
const require_hub_mdns_ciao = require("./hub-mdns-ciao-C49eqyby.js");
|
|
41
42
|
const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
|
|
42
43
|
const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
|
|
43
|
-
const require_restore_archive = require("./restore-archive-
|
|
44
|
+
const require_restore_archive = require("./restore-archive-DuktQtye.js");
|
|
44
45
|
const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
|
|
45
46
|
let zod = require("zod");
|
|
46
47
|
let node_crypto = require("node:crypto");
|
|
@@ -5674,9 +5675,11 @@ var AgentMdnsAdvertiser = class {
|
|
|
5674
5675
|
var import_read_all_rows = require_read_all_rows$1.require_read_all_rows();
|
|
5675
5676
|
/**
|
|
5676
5677
|
* Record kinds owned by integration-registry (phase 4).
|
|
5678
|
+
*
|
|
5679
|
+
* An integration's configuration is the addon's own instance record. This owner
|
|
5680
|
+
* keeps only the registry row (id, addon, name, enabled, info).
|
|
5677
5681
|
*/
|
|
5678
5682
|
var INTEGRATIONS_LEGACY = "integrations";
|
|
5679
|
-
var INTEGRATION_SETTINGS_LEGACY = "integration_settings";
|
|
5680
5683
|
var IntegrationBodySchema = zod.z.object({
|
|
5681
5684
|
addonId: zod.z.string(),
|
|
5682
5685
|
name: zod.z.string(),
|
|
@@ -5686,86 +5689,22 @@ var IntegrationBodySchema = zod.z.object({
|
|
|
5686
5689
|
createdAt: zod.z.number(),
|
|
5687
5690
|
updatedAt: zod.z.number()
|
|
5688
5691
|
});
|
|
5689
|
-
var
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
at: "none",
|
|
5702
|
-
indexes: [{
|
|
5703
|
-
name: "addon_id",
|
|
5704
|
-
fields: ["addonId"]
|
|
5705
|
-
}],
|
|
5706
|
-
retention: { none: "deleteIntegration only" }
|
|
5707
|
-
},
|
|
5708
|
-
"integration-settings": {
|
|
5709
|
-
schema: IntegrationSettingBodySchema,
|
|
5710
|
-
class: "config",
|
|
5711
|
-
writeTrigger: "setIntegrationSetting — one row per (integrationId, key)",
|
|
5712
|
-
device: "none",
|
|
5713
|
-
at: "none",
|
|
5714
|
-
indexes: [{
|
|
5715
|
-
name: "integration_id",
|
|
5716
|
-
fields: ["integrationId"]
|
|
5717
|
-
}],
|
|
5718
|
-
retention: { none: "cascade on deleteIntegration" }
|
|
5719
|
-
}
|
|
5720
|
-
});
|
|
5692
|
+
var _integrationRegistryRecordKinds = require_dist.defineRecordKinds({ integrations: {
|
|
5693
|
+
schema: IntegrationBodySchema,
|
|
5694
|
+
class: "config",
|
|
5695
|
+
writeTrigger: "createIntegration / updateIntegration / deleteIntegration",
|
|
5696
|
+
device: "none",
|
|
5697
|
+
at: "none",
|
|
5698
|
+
indexes: [{
|
|
5699
|
+
name: "addon_id",
|
|
5700
|
+
fields: ["addonId"]
|
|
5701
|
+
}],
|
|
5702
|
+
retention: { none: "deleteIntegration only" }
|
|
5703
|
+
} });
|
|
5721
5704
|
var integrationRegistryRecordKinds = _integrationRegistryRecordKinds;
|
|
5722
5705
|
_integrationRegistryRecordKinds.integrations;
|
|
5723
|
-
_integrationRegistryRecordKinds["integration-settings"];
|
|
5724
5706
|
//#endregion
|
|
5725
5707
|
//#region src/builtins/sqlite-storage/integration-registry.ts
|
|
5726
|
-
function serializeSetting(value) {
|
|
5727
|
-
if (typeof value === "number") return {
|
|
5728
|
-
value: String(value),
|
|
5729
|
-
valueType: "number"
|
|
5730
|
-
};
|
|
5731
|
-
if (typeof value === "boolean") return {
|
|
5732
|
-
value: String(value),
|
|
5733
|
-
valueType: "boolean"
|
|
5734
|
-
};
|
|
5735
|
-
if (typeof value === "string") return {
|
|
5736
|
-
value,
|
|
5737
|
-
valueType: "string"
|
|
5738
|
-
};
|
|
5739
|
-
return {
|
|
5740
|
-
value: JSON.stringify(value),
|
|
5741
|
-
valueType: "json"
|
|
5742
|
-
};
|
|
5743
|
-
}
|
|
5744
|
-
/**
|
|
5745
|
-
* Decode a settings row back to its value.
|
|
5746
|
-
*
|
|
5747
|
-
* `raw` is `unknown`, not `string`, on purpose: the collection surface parses
|
|
5748
|
-
* any TEXT column whose value starts with `{` or `[`, so a `json` setting
|
|
5749
|
-
* arrives here ALREADY an object. Coercing it with `String(...)` first — which
|
|
5750
|
-
* is what a straight port of the `table*` version did — produced the literal
|
|
5751
|
-
* `"[object Object]"`.
|
|
5752
|
-
*/
|
|
5753
|
-
function deserializeSetting(raw, valueType) {
|
|
5754
|
-
if (valueType === "json") {
|
|
5755
|
-
if (typeof raw !== "string") return raw;
|
|
5756
|
-
try {
|
|
5757
|
-
return JSON.parse(raw);
|
|
5758
|
-
} catch {
|
|
5759
|
-
return raw;
|
|
5760
|
-
}
|
|
5761
|
-
}
|
|
5762
|
-
const value = String(raw);
|
|
5763
|
-
switch (valueType) {
|
|
5764
|
-
case "number": return Number(value);
|
|
5765
|
-
case "boolean": return value === "true";
|
|
5766
|
-
default: return value;
|
|
5767
|
-
}
|
|
5768
|
-
}
|
|
5769
5708
|
/**
|
|
5770
5709
|
* Read an `info` blob off a row.
|
|
5771
5710
|
*
|
|
@@ -5833,29 +5772,6 @@ var INTEGRATIONS_INDEXES = [{
|
|
|
5833
5772
|
name: "idx_integrations_addon",
|
|
5834
5773
|
columns: ["addon_id"]
|
|
5835
5774
|
}];
|
|
5836
|
-
var INTEGRATION_SETTINGS_COLUMNS = [
|
|
5837
|
-
{
|
|
5838
|
-
name: "integration_id",
|
|
5839
|
-
type: "TEXT",
|
|
5840
|
-
notNull: true
|
|
5841
|
-
},
|
|
5842
|
-
{
|
|
5843
|
-
name: "key",
|
|
5844
|
-
type: "TEXT",
|
|
5845
|
-
notNull: true
|
|
5846
|
-
},
|
|
5847
|
-
{
|
|
5848
|
-
name: "value",
|
|
5849
|
-
type: "TEXT",
|
|
5850
|
-
notNull: true
|
|
5851
|
-
},
|
|
5852
|
-
{
|
|
5853
|
-
name: "value_type",
|
|
5854
|
-
type: "TEXT",
|
|
5855
|
-
notNull: true,
|
|
5856
|
-
defaultValue: "string"
|
|
5857
|
-
}
|
|
5858
|
-
];
|
|
5859
5775
|
/**
|
|
5860
5776
|
* @durable class=config owner=integration-registry
|
|
5861
5777
|
* write="`createIntegration` — an operator adds a provider, or an addon declares
|
|
@@ -5866,16 +5782,9 @@ var INTEGRATION_SETTINGS_COLUMNS = [
|
|
|
5866
5782
|
*/
|
|
5867
5783
|
var INTEGRATIONS = INTEGRATIONS_LEGACY;
|
|
5868
5784
|
/**
|
|
5869
|
-
* @durable class=config owner=integration-registry
|
|
5870
|
-
* write="`setIntegrationSetting` — one row per (integration_id, key), deleted and
|
|
5871
|
-
* re-inserted on every write; this is the operator's per-integration intent"
|
|
5872
|
-
* retention="cascade only — `deleteIntegration` removes the parent's rows. There
|
|
5873
|
-
* is no sweep, so a key an addon stops declaring stays on disk forever."
|
|
5874
|
-
*/
|
|
5875
|
-
var INTEGRATION_SETTINGS = INTEGRATION_SETTINGS_LEGACY;
|
|
5876
|
-
/**
|
|
5877
5785
|
* The persisted INTEGRATIONS — one row per provider instance an operator (or a
|
|
5878
|
-
* declaring addon) added
|
|
5786
|
+
* declaring addon) added. The instance's configuration lives on the addon's own
|
|
5787
|
+
* record, not here.
|
|
5879
5788
|
*
|
|
5880
5789
|
* It had a device half once: `devices` + `device_settings_kv`, `dev_NNNN` ids,
|
|
5881
5790
|
* `createDevice` / `listCameras` / `setDeviceSetting`. It was removed on
|
|
@@ -5907,23 +5816,14 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
5907
5816
|
this.recordStores = recordStores;
|
|
5908
5817
|
}
|
|
5909
5818
|
static recordStoresOf(records) {
|
|
5910
|
-
return {
|
|
5911
|
-
integrations: records.kind(integrationRegistryRecordKinds.integrations),
|
|
5912
|
-
settings: records.kind(integrationRegistryRecordKinds["integration-settings"])
|
|
5913
|
-
};
|
|
5819
|
+
return { integrations: records.kind(integrationRegistryRecordKinds.integrations) };
|
|
5914
5820
|
}
|
|
5915
5821
|
async initialize() {
|
|
5916
|
-
if (this.recordStores === void 0) {
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
});
|
|
5922
|
-
await this.store.declareCollection({
|
|
5923
|
-
collection: INTEGRATION_SETTINGS,
|
|
5924
|
-
columns: INTEGRATION_SETTINGS_COLUMNS
|
|
5925
|
-
});
|
|
5926
|
-
}
|
|
5822
|
+
if (this.recordStores === void 0) await this.store.declareCollection({
|
|
5823
|
+
collection: INTEGRATIONS,
|
|
5824
|
+
columns: INTEGRATIONS_COLUMNS,
|
|
5825
|
+
indexes: INTEGRATIONS_INDEXES
|
|
5826
|
+
});
|
|
5927
5827
|
await this.resumeCounter();
|
|
5928
5828
|
}
|
|
5929
5829
|
async resumeCounter() {
|
|
@@ -5991,7 +5891,6 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
5991
5891
|
}
|
|
5992
5892
|
}
|
|
5993
5893
|
});
|
|
5994
|
-
if (input.settings) await this.setIntegrationSettings(id, input.settings);
|
|
5995
5894
|
return {
|
|
5996
5895
|
id,
|
|
5997
5896
|
addonId: input.addonId,
|
|
@@ -6095,97 +5994,17 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
6095
5994
|
async deleteIntegration(id) {
|
|
6096
5995
|
const integration = await this.getIntegration(id);
|
|
6097
5996
|
if (integration !== null && IntegrationRegistry.isFixed(integration)) throw new Error(`integration "${id}" is fixed — it belongs to the addon that declared it and cannot be deleted`);
|
|
6098
|
-
const settingsKind = this.recordStores?.settings;
|
|
6099
5997
|
const integrationsKind = this.recordStores?.integrations;
|
|
6100
|
-
if (
|
|
6101
|
-
for (const row of await (0, import_read_all_rows.readAllRows)(settingsKind)) if (row.data.integrationId === id) await settingsKind.delete(row.id);
|
|
5998
|
+
if (integrationsKind !== void 0) {
|
|
6102
5999
|
await integrationsKind.delete(id);
|
|
6103
6000
|
return true;
|
|
6104
6001
|
}
|
|
6105
|
-
await this.store.deleteWhere({
|
|
6106
|
-
collection: INTEGRATION_SETTINGS,
|
|
6107
|
-
filter: { where: { integration_id: id } }
|
|
6108
|
-
});
|
|
6109
6002
|
await this.store.deleteWhere({
|
|
6110
6003
|
collection: INTEGRATIONS,
|
|
6111
6004
|
filter: { where: { id } }
|
|
6112
6005
|
});
|
|
6113
6006
|
return true;
|
|
6114
6007
|
}
|
|
6115
|
-
async getIntegrationSettings(integrationId) {
|
|
6116
|
-
const result = {};
|
|
6117
|
-
const kind = this.recordStores?.settings;
|
|
6118
|
-
if (kind !== void 0) {
|
|
6119
|
-
for (const row of await (0, import_read_all_rows.readAllRows)(kind)) {
|
|
6120
|
-
if (row.data.integrationId !== integrationId) continue;
|
|
6121
|
-
result[row.data.key] = deserializeSetting(row.data.value, row.data.valueType);
|
|
6122
|
-
}
|
|
6123
|
-
return result;
|
|
6124
|
-
}
|
|
6125
|
-
const rows = await this.store.query({
|
|
6126
|
-
collection: INTEGRATION_SETTINGS,
|
|
6127
|
-
filter: { where: { integration_id: integrationId } }
|
|
6128
|
-
});
|
|
6129
|
-
for (const row of rows) result[String(row.data["key"])] = deserializeSetting(row.data["value"], String(row.data["value_type"]));
|
|
6130
|
-
return result;
|
|
6131
|
-
}
|
|
6132
|
-
/**
|
|
6133
|
-
* Delete every legacy setting row of an integration and answer the keychain refs the rows
|
|
6134
|
-
* carried, so the caller (the rows-to-record migration) releases them after the rows are gone.
|
|
6135
|
-
* The integration itself stays.
|
|
6136
|
-
*/
|
|
6137
|
-
async clearIntegrationSettings(integrationId) {
|
|
6138
|
-
const refs = require_dist.collectSecretMarkerRefs(await this.getIntegrationSettings(integrationId));
|
|
6139
|
-
const kind = this.recordStores?.settings;
|
|
6140
|
-
if (kind !== void 0) {
|
|
6141
|
-
for (const row of await (0, import_read_all_rows.readAllRows)(kind)) if (row.data.integrationId === integrationId) await kind.delete(row.id);
|
|
6142
|
-
return refs;
|
|
6143
|
-
}
|
|
6144
|
-
await this.store.deleteWhere({
|
|
6145
|
-
collection: INTEGRATION_SETTINGS,
|
|
6146
|
-
filter: { where: { integration_id: integrationId } }
|
|
6147
|
-
});
|
|
6148
|
-
return refs;
|
|
6149
|
-
}
|
|
6150
|
-
async setIntegrationSetting(integrationId, key, value) {
|
|
6151
|
-
const s = serializeSetting(value);
|
|
6152
|
-
const rowId = `${integrationId}:${key}`;
|
|
6153
|
-
const kind = this.recordStores?.settings;
|
|
6154
|
-
if (kind !== void 0) {
|
|
6155
|
-
await kind.put({
|
|
6156
|
-
id: rowId,
|
|
6157
|
-
data: {
|
|
6158
|
-
integrationId,
|
|
6159
|
-
key,
|
|
6160
|
-
value: s.value,
|
|
6161
|
-
valueType: s.valueType
|
|
6162
|
-
}
|
|
6163
|
-
});
|
|
6164
|
-
return;
|
|
6165
|
-
}
|
|
6166
|
-
await this.store.deleteWhere({
|
|
6167
|
-
collection: INTEGRATION_SETTINGS,
|
|
6168
|
-
filter: { where: {
|
|
6169
|
-
integration_id: integrationId,
|
|
6170
|
-
key
|
|
6171
|
-
} }
|
|
6172
|
-
});
|
|
6173
|
-
await this.store.insert({
|
|
6174
|
-
collection: INTEGRATION_SETTINGS,
|
|
6175
|
-
record: {
|
|
6176
|
-
id: rowId,
|
|
6177
|
-
data: {
|
|
6178
|
-
integration_id: integrationId,
|
|
6179
|
-
key,
|
|
6180
|
-
value: s.value,
|
|
6181
|
-
value_type: s.valueType
|
|
6182
|
-
}
|
|
6183
|
-
}
|
|
6184
|
-
});
|
|
6185
|
-
}
|
|
6186
|
-
async setIntegrationSettings(integrationId, settings) {
|
|
6187
|
-
for (const [key, value] of Object.entries(settings)) await this.setIntegrationSetting(integrationId, key, value);
|
|
6188
|
-
}
|
|
6189
6008
|
mapIntegration(row) {
|
|
6190
6009
|
return {
|
|
6191
6010
|
id: String(row["id"]),
|
|
@@ -6202,25 +6021,19 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
6202
6021
|
//#endregion
|
|
6203
6022
|
//#region src/builtins/sqlite-storage/integration-rows-ports.ts
|
|
6204
6023
|
/**
|
|
6205
|
-
* The system-side ports of `moveIntegrationRowsToRecords` (planning#416)
|
|
6206
|
-
*
|
|
6207
|
-
* integration's OWNER keychain
|
|
6208
|
-
*
|
|
6024
|
+
* The system-side ports of `moveIntegrationRowsToRecords` (planning#416). The leftover rows are
|
|
6025
|
+
* read on the settings connection by the migration-only door, and their secrets are resolved
|
|
6026
|
+
* through the integration's OWNER keychain handle (never exposed further) and cleared together
|
|
6027
|
+
* with the rows. The addon's own record kind is reached through its records handle.
|
|
6209
6028
|
*/
|
|
6210
6029
|
/**
|
|
6211
|
-
*
|
|
6212
|
-
*
|
|
6213
|
-
* no-op. Counts only; never a value.
|
|
6030
|
+
* Delete one integration's leftover rows AND the keychain values they pointed at (values first,
|
|
6031
|
+
* so a failed delete leaves the rows to retry). A missing store is a no-op. Counts only.
|
|
6214
6032
|
*/
|
|
6215
|
-
async function clearIntegrationRows(
|
|
6216
|
-
const
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
await deps.registry.clearIntegrationSettings(integrationId);
|
|
6220
|
-
return {
|
|
6221
|
-
rows: Object.keys(stored).length,
|
|
6222
|
-
secrets: refs.length
|
|
6223
|
-
};
|
|
6033
|
+
async function clearIntegrationRows(db, secrets, integrationId) {
|
|
6034
|
+
const refs = require_dist.collectSecretMarkerRefs(require_legacy_integration_rows_door.readLegacyIntegrationRows(db, integrationId));
|
|
6035
|
+
if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
|
|
6036
|
+
return require_legacy_integration_rows_door.clearLegacyIntegrationRows(db, integrationId);
|
|
6224
6037
|
}
|
|
6225
6038
|
//#endregion
|
|
6226
6039
|
//#region src/builtins/cluster-agent/record-kinds.ts
|
|
@@ -17016,7 +16829,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
17016
16829
|
}
|
|
17017
16830
|
const lifecycleHost = device;
|
|
17018
16831
|
const shrinkGate = new AccessoryShrinkGate();
|
|
17019
|
-
const
|
|
16832
|
+
const runReconcileNow = async () => {
|
|
17020
16833
|
try {
|
|
17021
16834
|
await callDeviceManager(api, "registerDevice", {
|
|
17022
16835
|
addonId,
|
|
@@ -17126,6 +16939,12 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
17126
16939
|
});
|
|
17127
16940
|
}
|
|
17128
16941
|
};
|
|
16942
|
+
let reconcileChain = Promise.resolve();
|
|
16943
|
+
const runReconcile = () => {
|
|
16944
|
+
const run = reconcileChain.then(runReconcileNow, runReconcileNow);
|
|
16945
|
+
reconcileChain = run.then(() => void 0, () => void 0);
|
|
16946
|
+
return run;
|
|
16947
|
+
};
|
|
17129
16948
|
const PROBE_TIMEOUT_MS = 3e4;
|
|
17130
16949
|
const runProbe = async () => {
|
|
17131
16950
|
if (typeof lifecycleHost.onProbe !== "function") return;
|
|
@@ -28313,7 +28132,6 @@ exports.HubNodeRegistry = HubNodeRegistry;
|
|
|
28313
28132
|
exports.HubPairing = require_builtins_system_config_system_config_addon.HubPairing;
|
|
28314
28133
|
exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
|
|
28315
28134
|
exports.INTEGRATIONS_LEGACY = INTEGRATIONS_LEGACY;
|
|
28316
|
-
exports.INTEGRATION_SETTINGS_LEGACY = INTEGRATION_SETTINGS_LEGACY;
|
|
28317
28135
|
exports.IntegrationRegistry = IntegrationRegistry;
|
|
28318
28136
|
exports.InvalidCorsOriginError = require_builtins_system_config_system_config_addon.InvalidCorsOriginError;
|
|
28319
28137
|
exports.JWT_SIGNING_KEY_REF = require_device_ca.JWT_SIGNING_KEY_REF;
|