@camstack/server 1.2.741 → 1.2.742
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 +7 -0
- package/dist/api/core/cap-providers.js +167 -43
- package/dist/api/core/integration-role.js +20 -0
- package/dist/api/trpc/generated-cap-mounts.js +18 -1
- package/dist/api/trpc/generated-cap-routers.js +2427 -2381
- package/package.json +14 -12
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-CNf7_i1z.js → agent-https-CsDhLoui.js} +1 -1
- package/system/dist/{agent-https-BtTMjLgk.mjs → agent-https-lgka7y2l.mjs} +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 +4 -4
- 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 +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +4 -4
- package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
- 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 +5 -5
- 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 +4 -4
- package/system/dist/builtins/camera-grid/index.mjs +4 -4
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- 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 +193 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +193 -3
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -0
- package/system/dist/builtins/core-blocks/migrations/pump-cycle-split.d.ts +43 -0
- 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 +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- 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 +5 -5
- 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 +30 -27
- package/system/dist/builtins/loki-logging/index.mjs +30 -27
- package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +7 -0
- package/system/dist/builtins/loki-logging/migrations/index.d.ts +7 -0
- package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +8 -23
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- 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 +20 -20
- 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-registry.d.ts +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- 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 +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-DUmnnLrw.mjs → composition-sources-BE6yrVCB.mjs} +1 -1
- package/system/dist/{composition-sources-D9GBwT5d.js → composition-sources-ny5MCbhd.js} +1 -1
- package/system/dist/{constants-Cy5svHxz.js → constants-BbgVaoOX.js} +1 -1
- package/system/dist/{constants-BkiDA8Cf.mjs → constants-DiDTdj26.mjs} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
- package/system/dist/{device-ca-CxlqxrvG.js → device-ca-BdgE_3J6.js} +1 -1
- package/system/dist/{device-ca-Cxu7j6aY.mjs → device-ca-CVcZIfhA.mjs} +1 -1
- package/system/dist/{dist-C5sQPOZX.mjs → dist-BqlGZK-1.mjs} +297 -132
- package/system/dist/{dist-Cyc4oyGh.js → dist-DdlfeOQx.js} +302 -131
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CTPWSgwo.mjs → hub-mdns-ciao-BZsVTXQ7.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-YxQ97aHW.js → hub-mdns-ciao-D3ZQMWjg.js} +2 -2
- package/system/dist/index.js +14 -9
- package/system/dist/index.mjs +225 -220
- package/system/dist/migrations/hub/2026-11-02-integration-addon-id-bare.d.ts +3 -0
- package/system/dist/{restore-archive-08Uthry1.mjs → restore-archive-BFem7ZuS.mjs} +94 -94
- package/system/dist/{restore-archive-b5rBXY1e.js → restore-archive-Ch76C3VQ.js} +1 -1
- package/system/dist/{retention-i8aZ6vE5.mjs → retention-D5Vk8FXc.mjs} +1 -1
- package/system/dist/{retention-DWCHp91p.js → retention-DWsfcaKe.js} +1 -1
- package/system/dist/{wal-maintenance-CEi8PqMh.mjs → wal-maintenance-CS-Wtg9w.mjs} +0 -0
- package/system/dist/{wal-maintenance-DNE7RTcS.js → wal-maintenance-DcVdVWDD.js} +0 -0
- package/system/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.742] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Integrations page lists an addon by its declared integrationRole; a dual entry (devices and service instances) is no longer hidden
|
|
15
|
+
- Generated capability routers include the pump-cycle capability
|
|
16
|
+
|
|
10
17
|
## [1.2.741] - 2026-11-02
|
|
11
18
|
|
|
12
19
|
### Changed
|
|
@@ -70,6 +70,7 @@ exports.buildNodesProvider = buildNodesProvider;
|
|
|
70
70
|
exports.buildIntegrationsProvider = buildIntegrationsProvider;
|
|
71
71
|
exports.dispatchCustomAction = dispatchCustomAction;
|
|
72
72
|
exports.buildAddonsProvider = buildAddonsProvider;
|
|
73
|
+
const integration_role_js_1 = require("./integration-role.js");
|
|
73
74
|
const integration_instances_provider_js_1 = require("../../core/addon/integration-instances-provider.js");
|
|
74
75
|
const integration_secrets_1 = require("./integration-secrets");
|
|
75
76
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -98,7 +99,10 @@ function getRetention(registry) {
|
|
|
98
99
|
function buildSystemProvider(feature, registry, logger, census = (0, http_request_census_singleton_js_1.getHttpRequestCensus)()) {
|
|
99
100
|
const siteLocation = buildSiteLocationService(registry, logger);
|
|
100
101
|
const store = buildSettingsStoreGateway(registry);
|
|
101
|
-
const serverName = new server_name_js_1.ServerNameReader({
|
|
102
|
+
const serverName = new server_name_js_1.ServerNameReader({
|
|
103
|
+
store,
|
|
104
|
+
...(logger !== undefined ? { logger } : {}),
|
|
105
|
+
});
|
|
102
106
|
const requestCensus = new request_census_settings_js_1.RequestCensusService({
|
|
103
107
|
census,
|
|
104
108
|
store,
|
|
@@ -112,19 +116,29 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
|
|
|
112
116
|
// reached through the registry's per-provider proxies — hub-main never keeps
|
|
113
117
|
// a hand-written list, which would rot at the first addon that adds one.
|
|
114
118
|
const channels = (0, logging_settings_js_1.buildLogChannelPlane)({ entries: () => registry?.getCollectionEntries('log-channels') ?? [] }, (addonId, phase, error) => {
|
|
115
|
-
logger?.warn('log-channels provider unreachable', {
|
|
119
|
+
logger?.warn('log-channels provider unreachable', {
|
|
120
|
+
meta: { addonId, phase, error },
|
|
121
|
+
});
|
|
116
122
|
});
|
|
117
123
|
// Every addon's OWN reported cost, assembled by enumeration. Nothing here
|
|
118
124
|
// knows which pid belongs to which camera — the addon that spawned the child
|
|
119
125
|
// does, and it is the one that says so.
|
|
120
|
-
const loadContributions = (0, load_contributions_js_1.buildLoadContributionPlane)({
|
|
121
|
-
|
|
126
|
+
const loadContributions = (0, load_contributions_js_1.buildLoadContributionPlane)({
|
|
127
|
+
entries: () => registry?.getCollectionEntries('load-contribution') ?? [],
|
|
128
|
+
}, (addonId, error) => {
|
|
129
|
+
logger?.warn('load-contribution provider unreachable', {
|
|
130
|
+
meta: { addonId, error },
|
|
131
|
+
});
|
|
122
132
|
});
|
|
123
133
|
// Every addon's OWN reported losses, per camera, with the denominator
|
|
124
134
|
// attached. Same enumeration, same reason: the addon that owns the failing
|
|
125
135
|
// path is the only thing that knows which camera it lost work for.
|
|
126
|
-
const failureContributions = (0, failure_contributions_js_1.buildFailureContributionPlane)({
|
|
127
|
-
|
|
136
|
+
const failureContributions = (0, failure_contributions_js_1.buildFailureContributionPlane)({
|
|
137
|
+
entries: () => registry?.getCollectionEntries('failure-contribution') ?? [],
|
|
138
|
+
}, (addonId, error) => {
|
|
139
|
+
logger?.warn('failure-contribution provider unreachable', {
|
|
140
|
+
meta: { addonId, error },
|
|
141
|
+
});
|
|
128
142
|
});
|
|
129
143
|
const loggingSettings = new logging_settings_js_1.LoggingSettingsService({
|
|
130
144
|
store,
|
|
@@ -134,7 +148,10 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
|
|
|
134
148
|
...(logger !== undefined ? { logger } : {}),
|
|
135
149
|
});
|
|
136
150
|
return {
|
|
137
|
-
info: async () => ({
|
|
151
|
+
info: async () => ({
|
|
152
|
+
...feature.getManifest(),
|
|
153
|
+
serverName: await serverName.read(),
|
|
154
|
+
}),
|
|
138
155
|
health: async () => ({ status: 'ok', uptime: process.uptime() }),
|
|
139
156
|
featureFlags: async () => feature.getManifest(),
|
|
140
157
|
networkAddresses: async () => {
|
|
@@ -323,7 +340,11 @@ async function computeTopologyInternal(agentRegistry, addonRegistry, getNodeRoot
|
|
|
323
340
|
const allNodeAddons = node.isHub
|
|
324
341
|
? allAddons.map((a) => {
|
|
325
342
|
const id = a.manifest?.id ?? 'unknown';
|
|
326
|
-
return {
|
|
343
|
+
return {
|
|
344
|
+
id,
|
|
345
|
+
capabilities: [...(addonCaps.get(id) ?? [])],
|
|
346
|
+
status: 'running',
|
|
347
|
+
};
|
|
327
348
|
})
|
|
328
349
|
: agentAddonIds.map((addonId) => ({
|
|
329
350
|
id: addonId,
|
|
@@ -392,7 +413,12 @@ async function computeTopologyInternal(agentRegistry, addonRegistry, getNodeRoot
|
|
|
392
413
|
for (const a of allNodeAddons) {
|
|
393
414
|
const category = addonCategory.get(a.id) ?? 'system';
|
|
394
415
|
const procInfo = procByAddon.get(a.id);
|
|
395
|
-
const entry = byCategory.get(category) ?? {
|
|
416
|
+
const entry = byCategory.get(category) ?? {
|
|
417
|
+
category,
|
|
418
|
+
total: 0,
|
|
419
|
+
healthy: 0,
|
|
420
|
+
addons: [],
|
|
421
|
+
};
|
|
396
422
|
const status = procInfo?.state ?? a.status;
|
|
397
423
|
entry.total += 1;
|
|
398
424
|
if (status === 'running')
|
|
@@ -648,7 +674,13 @@ function buildNodesProvider(agentRegistry, moleculer, addonRegistry, getNodeRoot
|
|
|
648
674
|
for (const [addonId, hubAddon] of hubMap) {
|
|
649
675
|
const hubVersion = hubAddon.manifest.packageVersion;
|
|
650
676
|
const addonNodes = [
|
|
651
|
-
{
|
|
677
|
+
{
|
|
678
|
+
nodeId: 'hub',
|
|
679
|
+
name: 'hub',
|
|
680
|
+
version: hubVersion,
|
|
681
|
+
status: 'running',
|
|
682
|
+
synced: true,
|
|
683
|
+
},
|
|
652
684
|
];
|
|
653
685
|
for (const remote of remoteStatuses) {
|
|
654
686
|
const remoteAddon = remote.addons.find((a) => a.id === addonId);
|
|
@@ -695,7 +727,10 @@ function buildNodesProvider(agentRegistry, moleculer, addonRegistry, getNodeRoot
|
|
|
695
727
|
},
|
|
696
728
|
});
|
|
697
729
|
}
|
|
698
|
-
return reg.getGraph({
|
|
730
|
+
return reg.getGraph({
|
|
731
|
+
windowSeconds: input.windowSeconds,
|
|
732
|
+
nowMs: Date.now(),
|
|
733
|
+
});
|
|
699
734
|
},
|
|
700
735
|
setProcessLogLevel: async (input) => {
|
|
701
736
|
// E2: for hub-local children, try the UDS path first (fire-and-forget);
|
|
@@ -735,7 +770,10 @@ async function integrationSecretKeys(ar, addonId, logger) {
|
|
|
735
770
|
const provider = ar
|
|
736
771
|
.getCapabilityRegistry()
|
|
737
772
|
.getSingleton('addon-settings');
|
|
738
|
-
const schema = await provider?.getGlobalSettings({
|
|
773
|
+
const schema = await provider?.getGlobalSettings({
|
|
774
|
+
addonId,
|
|
775
|
+
nodeId: 'hub',
|
|
776
|
+
});
|
|
739
777
|
return (0, types_1.collectKeychainStoredKeys)(schema ?? null);
|
|
740
778
|
}
|
|
741
779
|
catch (err) {
|
|
@@ -805,7 +843,10 @@ async function runConnectionTest(ar, addonId, settings, logger) {
|
|
|
805
843
|
instances.testInstance !== undefined &&
|
|
806
844
|
(await instances.describe()).canTest) {
|
|
807
845
|
try {
|
|
808
|
-
const result = await instances.testInstance({
|
|
846
|
+
const result = await instances.testInstance({
|
|
847
|
+
id: null,
|
|
848
|
+
values: settings,
|
|
849
|
+
});
|
|
809
850
|
const status = result.status ?? (result.success ? 'validated' : 'rejected');
|
|
810
851
|
return {
|
|
811
852
|
status,
|
|
@@ -843,7 +884,11 @@ async function runConnectionTest(ar, addonId, settings, logger) {
|
|
|
843
884
|
if (outcome.outcome === 'rejected') {
|
|
844
885
|
return { status: 'rejected', error: outcome.error, testedBy: addonId };
|
|
845
886
|
}
|
|
846
|
-
return {
|
|
887
|
+
return {
|
|
888
|
+
status: 'inconclusive',
|
|
889
|
+
error: outcome.error,
|
|
890
|
+
testedBy: addonId,
|
|
891
|
+
};
|
|
847
892
|
}
|
|
848
893
|
catch (err) {
|
|
849
894
|
logger.warn('connection test could not run', {
|
|
@@ -876,7 +921,11 @@ async function runConnectionTest(ar, addonId, settings, logger) {
|
|
|
876
921
|
try {
|
|
877
922
|
const result = await brokerProvider.testConnection({ id: brokerId });
|
|
878
923
|
return result.ok
|
|
879
|
-
? {
|
|
924
|
+
? {
|
|
925
|
+
status: 'validated',
|
|
926
|
+
latencyMs: result.latencyMs,
|
|
927
|
+
testedBy: addonId,
|
|
928
|
+
}
|
|
880
929
|
: { status: 'rejected', error: result.error, testedBy: addonId };
|
|
881
930
|
}
|
|
882
931
|
catch (err) {
|
|
@@ -916,14 +965,20 @@ async function runConnectionTest(ar, addonId, settings, logger) {
|
|
|
916
965
|
*/
|
|
917
966
|
exports.INTEGRATION_CAP_MARKERS = new Set(['device-provider', 'device-adoption']);
|
|
918
967
|
/**
|
|
919
|
-
* An
|
|
920
|
-
* from its
|
|
921
|
-
*
|
|
922
|
-
*
|
|
968
|
+
* An entry that brings only service connections (`integrationRole: 'services'`, or derived
|
|
969
|
+
* from `integration-instances`) is configured from its function page (D996): it is neither
|
|
970
|
+
* an integration type nor a row of the Integrations list. A dual entry declares `both` and
|
|
971
|
+
* is listed for its devices. Decided from the manifest, so a not-yet-registered provider does
|
|
972
|
+
* not flash a row in. A row it already has stays in the registry and reachable by id.
|
|
923
973
|
*/
|
|
924
|
-
function
|
|
974
|
+
function hidesFromIntegrations(ar, addonId) {
|
|
925
975
|
const addon = ar.listAddons().find((a) => a.manifest.id === addonId);
|
|
926
|
-
|
|
976
|
+
if (addon === undefined)
|
|
977
|
+
return false;
|
|
978
|
+
return !(0, integration_role_js_1.bringsDevices)((0, integration_role_js_1.resolveIntegrationRole)({
|
|
979
|
+
integrationRole: addon.declaration?.integrationRole ?? addon.manifest.integrationRole,
|
|
980
|
+
capabilities: addon.manifest.capabilities,
|
|
981
|
+
}));
|
|
927
982
|
}
|
|
928
983
|
function getInstancesProvider(ar, addonId) {
|
|
929
984
|
return (0, integration_instances_provider_js_1.findInstancesProvider)(ar.getCapabilityRegistry(), addonId);
|
|
@@ -937,7 +992,7 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
937
992
|
return {
|
|
938
993
|
list: async () => {
|
|
939
994
|
const integrations = await requireIntegrationRegistry(ar).listIntegrations();
|
|
940
|
-
return integrations.filter((i) => !
|
|
995
|
+
return integrations.filter((i) => !hidesFromIntegrations(ar, i.addonId)).map(withProcessState);
|
|
941
996
|
},
|
|
942
997
|
get: async (input) => {
|
|
943
998
|
const integration = await requireIntegrationRegistry(ar).getIntegration(input.id);
|
|
@@ -989,7 +1044,11 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
989
1044
|
if (verdict.status === 'rejected') {
|
|
990
1045
|
logger.warn('rejected — connection test refused the settings', {
|
|
991
1046
|
tags: { addonId: input.addonId },
|
|
992
|
-
meta: {
|
|
1047
|
+
meta: {
|
|
1048
|
+
phase: 'create',
|
|
1049
|
+
status: verdict.status,
|
|
1050
|
+
testedBy: verdict.testedBy,
|
|
1051
|
+
},
|
|
993
1052
|
});
|
|
994
1053
|
throw new server_1.TRPCError({
|
|
995
1054
|
code: 'BAD_REQUEST',
|
|
@@ -1005,7 +1064,11 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1005
1064
|
else {
|
|
1006
1065
|
logger.warn('creating without validation — the settings were not validated', {
|
|
1007
1066
|
tags: { addonId: input.addonId },
|
|
1008
|
-
meta: {
|
|
1067
|
+
meta: {
|
|
1068
|
+
phase: 'create',
|
|
1069
|
+
status: verdict.status,
|
|
1070
|
+
reason: verdict.error,
|
|
1071
|
+
},
|
|
1009
1072
|
});
|
|
1010
1073
|
}
|
|
1011
1074
|
const integration = await reg.createIntegration(payload);
|
|
@@ -1013,9 +1076,15 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1013
1076
|
// The connection is a typed record keyed by the registry id. A refusal
|
|
1014
1077
|
// deletes the row: a registry entry with no record is an orphan.
|
|
1015
1078
|
try {
|
|
1016
|
-
await instances.createInstance({
|
|
1079
|
+
await instances.createInstance({
|
|
1080
|
+
id: integration.id,
|
|
1081
|
+
name: integration.name,
|
|
1082
|
+
});
|
|
1017
1083
|
if (settings !== undefined && Object.keys(settings).length > 0) {
|
|
1018
|
-
await instances.updateInstance({
|
|
1084
|
+
await instances.updateInstance({
|
|
1085
|
+
id: integration.id,
|
|
1086
|
+
values: settings,
|
|
1087
|
+
});
|
|
1019
1088
|
}
|
|
1020
1089
|
}
|
|
1021
1090
|
catch (err) {
|
|
@@ -1026,12 +1095,18 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1026
1095
|
catch (rollbackErr) {
|
|
1027
1096
|
// The rollback failing must not hide WHY the create was refused.
|
|
1028
1097
|
logger.warn('instance record refused — registry row could not be removed', {
|
|
1029
|
-
tags: {
|
|
1098
|
+
tags: {
|
|
1099
|
+
integrationId: integration.id,
|
|
1100
|
+
addonId: integration.addonId,
|
|
1101
|
+
},
|
|
1030
1102
|
meta: { phase: 'create-rollback', error: (0, types_1.errMsg)(rollbackErr) },
|
|
1031
1103
|
});
|
|
1032
1104
|
}
|
|
1033
1105
|
logger.warn('instance record refused — registry row removed', {
|
|
1034
|
-
tags: {
|
|
1106
|
+
tags: {
|
|
1107
|
+
integrationId: integration.id,
|
|
1108
|
+
addonId: integration.addonId,
|
|
1109
|
+
},
|
|
1035
1110
|
meta: { phase: 'create', error: (0, types_1.errMsg)(err) },
|
|
1036
1111
|
});
|
|
1037
1112
|
throw err;
|
|
@@ -1083,7 +1158,10 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1083
1158
|
const reg = requireIntegrationRegistry(ar);
|
|
1084
1159
|
const previous = await reg.getIntegration(input.id);
|
|
1085
1160
|
if (!previous) {
|
|
1086
|
-
logger.warn('not found', {
|
|
1161
|
+
logger.warn('not found', {
|
|
1162
|
+
tags: { integrationId: input.id },
|
|
1163
|
+
meta: { phase: 'update' },
|
|
1164
|
+
});
|
|
1087
1165
|
throw new Error(`Integration "${input.id}" not found`);
|
|
1088
1166
|
}
|
|
1089
1167
|
const { id, ...updates } = input;
|
|
@@ -1116,7 +1194,11 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1116
1194
|
if (input.name !== undefined && input.name !== previous.name) {
|
|
1117
1195
|
logger.info('renamed', {
|
|
1118
1196
|
tags: { integrationId: result.id },
|
|
1119
|
-
meta: {
|
|
1197
|
+
meta: {
|
|
1198
|
+
phase: 'update',
|
|
1199
|
+
previousName: previous.name,
|
|
1200
|
+
newName: input.name,
|
|
1201
|
+
},
|
|
1120
1202
|
});
|
|
1121
1203
|
}
|
|
1122
1204
|
const infoChanged = input.info !== undefined;
|
|
@@ -1132,16 +1214,24 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1132
1214
|
});
|
|
1133
1215
|
}
|
|
1134
1216
|
else {
|
|
1135
|
-
logger.info('no restart needed (only enabled/name changed)', {
|
|
1217
|
+
logger.info('no restart needed (only enabled/name changed)', {
|
|
1218
|
+
meta: { phase: 'update' },
|
|
1219
|
+
});
|
|
1136
1220
|
}
|
|
1137
1221
|
return result;
|
|
1138
1222
|
},
|
|
1139
1223
|
delete: async (input) => {
|
|
1140
1224
|
const reg = requireIntegrationRegistry(ar);
|
|
1141
|
-
logger.info('request', {
|
|
1225
|
+
logger.info('request', {
|
|
1226
|
+
tags: { integrationId: input.id },
|
|
1227
|
+
meta: { phase: 'delete' },
|
|
1228
|
+
});
|
|
1142
1229
|
const integration = await reg.getIntegration(input.id);
|
|
1143
1230
|
if (!integration) {
|
|
1144
|
-
logger.warn('not found', {
|
|
1231
|
+
logger.warn('not found', {
|
|
1232
|
+
tags: { integrationId: input.id },
|
|
1233
|
+
meta: { phase: 'delete' },
|
|
1234
|
+
});
|
|
1145
1235
|
throw new Error(`Integration "${input.id}" not found`);
|
|
1146
1236
|
}
|
|
1147
1237
|
// REFUSE BEFORE MUTATING ANYTHING.
|
|
@@ -1205,7 +1295,9 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1205
1295
|
}
|
|
1206
1296
|
if (dm?.removeByIntegration) {
|
|
1207
1297
|
try {
|
|
1208
|
-
const result = await dm.removeByIntegration({
|
|
1298
|
+
const result = await dm.removeByIntegration({
|
|
1299
|
+
integrationId: input.id,
|
|
1300
|
+
});
|
|
1209
1301
|
logger.info('cascade-removed devices', {
|
|
1210
1302
|
tags: { integrationId: input.id },
|
|
1211
1303
|
meta: { phase: 'delete', removed: result.removed },
|
|
@@ -1226,7 +1318,9 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1226
1318
|
}
|
|
1227
1319
|
// The record and its keychain refs go first; a refusal stops here, with
|
|
1228
1320
|
// the registry row still naming what was not removed.
|
|
1229
|
-
await getInstancesProvider(ar, integration.addonId)?.deleteInstance({
|
|
1321
|
+
await getInstancesProvider(ar, integration.addonId)?.deleteInstance({
|
|
1322
|
+
id: input.id,
|
|
1323
|
+
});
|
|
1230
1324
|
await reg.deleteIntegration(input.id);
|
|
1231
1325
|
eb.emit({
|
|
1232
1326
|
id: `integration-deleted-${Date.now()}`,
|
|
@@ -1265,7 +1359,10 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1265
1359
|
const secretKeys = forOwner
|
|
1266
1360
|
? undefined
|
|
1267
1361
|
: await integrationSecretKeys(ar, integration.addonId, logger);
|
|
1268
|
-
return (0, integration_secrets_1.readIntegrationSettings)({
|
|
1362
|
+
return (0, integration_secrets_1.readIntegrationSettings)({
|
|
1363
|
+
registry: reg,
|
|
1364
|
+
secrets: forOwner ? ownerSecrets(ar, integration.addonId) : null,
|
|
1365
|
+
}, {
|
|
1269
1366
|
integrationId: input.id,
|
|
1270
1367
|
forOwner,
|
|
1271
1368
|
...(secretKeys !== undefined ? { secretKeys } : {}),
|
|
@@ -1273,7 +1370,12 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1273
1370
|
? 'integration secret is "[object Object]" — a keychain marker was coerced to text; the addon is sending it as the credential; re-type it'
|
|
1274
1371
|
: 'integration secret stored as PLAINTEXT under a keychain-declared key — withheld from the form; re-type it to move it into the keychain', {
|
|
1275
1372
|
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1276
|
-
meta: {
|
|
1373
|
+
meta: {
|
|
1374
|
+
phase: 'getSettings',
|
|
1375
|
+
key: suspect.key,
|
|
1376
|
+
kind: suspect.kind,
|
|
1377
|
+
forOwner,
|
|
1378
|
+
},
|
|
1277
1379
|
}),
|
|
1278
1380
|
});
|
|
1279
1381
|
},
|
|
@@ -1295,7 +1397,10 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1295
1397
|
const instances = getInstancesProvider(ar, integration.addonId);
|
|
1296
1398
|
if (instances !== null) {
|
|
1297
1399
|
// The addon re-applies the change itself (its `onChanged`): no respawn.
|
|
1298
|
-
await instances.updateInstance({
|
|
1400
|
+
await instances.updateInstance({
|
|
1401
|
+
id: input.id,
|
|
1402
|
+
values: input.settings,
|
|
1403
|
+
});
|
|
1299
1404
|
logger.info('persisted as an instance record (no restart)', {
|
|
1300
1405
|
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1301
1406
|
meta: { phase: 'setSettings' },
|
|
@@ -1352,6 +1457,7 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1352
1457
|
// in the module-level `INTEGRATION_CAP_MARKERS` set (exported so the
|
|
1353
1458
|
// integration-markers spec can assert the recognised caps).
|
|
1354
1459
|
const providerAddons = addons.filter((a) => a.process?.state !== 'failed' &&
|
|
1460
|
+
!hidesFromIntegrations(ar, a.manifest.id) &&
|
|
1355
1461
|
a.manifest.capabilities?.some((c) => {
|
|
1356
1462
|
const name = typeof c === 'string' ? c : c.name;
|
|
1357
1463
|
return typeof name === 'string' && exports.INTEGRATION_CAP_MARKERS.has(name);
|
|
@@ -1433,7 +1539,11 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1433
1539
|
const verdict = await runConnectionTest(ar, input.addonId, input.settings, logger);
|
|
1434
1540
|
logger.info('connection test', {
|
|
1435
1541
|
tags: { addonId: input.addonId },
|
|
1436
|
-
meta: {
|
|
1542
|
+
meta: {
|
|
1543
|
+
phase: 'test',
|
|
1544
|
+
status: verdict.status,
|
|
1545
|
+
testedBy: verdict.testedBy,
|
|
1546
|
+
},
|
|
1437
1547
|
});
|
|
1438
1548
|
return {
|
|
1439
1549
|
success: verdict.status === 'validated',
|
|
@@ -1461,7 +1571,10 @@ function ensureCustomActionAuth(ctx, level) {
|
|
|
1461
1571
|
return;
|
|
1462
1572
|
if (level === 'admin') {
|
|
1463
1573
|
if (!ctx.user.isAdmin) {
|
|
1464
|
-
throw new server_1.TRPCError({
|
|
1574
|
+
throw new server_1.TRPCError({
|
|
1575
|
+
code: 'FORBIDDEN',
|
|
1576
|
+
message: 'custom action requires admin',
|
|
1577
|
+
});
|
|
1465
1578
|
}
|
|
1466
1579
|
return;
|
|
1467
1580
|
}
|
|
@@ -1521,7 +1634,10 @@ function formatNames(names) {
|
|
|
1521
1634
|
async function dispatchCustomAction(registry, ctx, input) {
|
|
1522
1635
|
const entry = registry.resolve(input.addonId, input.action);
|
|
1523
1636
|
if (!entry) {
|
|
1524
|
-
throw new server_1.TRPCError({
|
|
1637
|
+
throw new server_1.TRPCError({
|
|
1638
|
+
code: 'NOT_FOUND',
|
|
1639
|
+
message: describeUnresolved(registry, input),
|
|
1640
|
+
});
|
|
1525
1641
|
}
|
|
1526
1642
|
ensureCustomActionAuth(ctx, entry.spec.auth);
|
|
1527
1643
|
const parsedInput = entry.spec.input.parse(input.input);
|
|
@@ -1729,7 +1845,10 @@ function buildAddonsProvider(ar, ps, ls, moleculer, configService, ctx, agentReg
|
|
|
1729
1845
|
const updates = nodeId === undefined || isHubNode(nodeId)
|
|
1730
1846
|
? await ps.checkUpdates()
|
|
1731
1847
|
: await ps.checkUpdatesForInstalled(await (0, agent_installed_packages_js_1.fetchAgentInstalledPackages)(broker, nodeId), nodeId);
|
|
1732
|
-
return updates.map((u) => ({
|
|
1848
|
+
return updates.map((u) => ({
|
|
1849
|
+
...u,
|
|
1850
|
+
isSystem: frameworkAllowSet.has(u.name),
|
|
1851
|
+
}));
|
|
1733
1852
|
},
|
|
1734
1853
|
updatePackage: async (input) => {
|
|
1735
1854
|
const nodeId = input.nodeId;
|
|
@@ -1802,7 +1921,12 @@ function buildAddonsProvider(ar, ps, ls, moleculer, configService, ctx, agentReg
|
|
|
1802
1921
|
await deployPackedToAgent(nodeId, input.name, packed.buffer);
|
|
1803
1922
|
// An operator's explicit delivery lifts the node's tombstone (D982).
|
|
1804
1923
|
await agentRegistry?.noteExplicitDelivery(nodeId, input.name);
|
|
1805
|
-
return {
|
|
1924
|
+
return {
|
|
1925
|
+
success: true,
|
|
1926
|
+
name: input.name,
|
|
1927
|
+
version: packed.version,
|
|
1928
|
+
nodeId,
|
|
1929
|
+
};
|
|
1806
1930
|
},
|
|
1807
1931
|
rollbackPackage: async (input) => ps.rollbackPackage(input.name),
|
|
1808
1932
|
forceRefresh: async (input) => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveIntegrationRole = resolveIntegrationRole;
|
|
4
|
+
exports.bringsDevices = bringsDevices;
|
|
5
|
+
const INSTANCES_CAP = 'integration-instances';
|
|
6
|
+
/**
|
|
7
|
+
* What an addon entry brings. The explicit `integrationRole` wins; absent, it is derived from
|
|
8
|
+
* the capabilities the entry declares (`integration-instances` means service connections,
|
|
9
|
+
* anything else devices). A dual entry is never derived — it declares `both`.
|
|
10
|
+
*/
|
|
11
|
+
function resolveIntegrationRole(source) {
|
|
12
|
+
if (source.integrationRole !== undefined)
|
|
13
|
+
return source.integrationRole;
|
|
14
|
+
const keepsInstances = (source.capabilities ?? []).some((c) => (typeof c === 'string' ? c : c.name) === INSTANCES_CAP);
|
|
15
|
+
return keepsInstances ? 'services' : 'devices';
|
|
16
|
+
}
|
|
17
|
+
/** True when the entry's devices belong on the Integrations page. */
|
|
18
|
+
function bringsDevices(role) {
|
|
19
|
+
return role === 'devices' || role === 'both';
|
|
20
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// AUTO-GENERATED by scripts/generate-cap-mounts.ts — DO NOT EDIT
|
|
3
3
|
// Re-run: npx tsx scripts/generate-cap-mounts.ts
|
|
4
4
|
//
|
|
5
|
-
// Mounted:
|
|
5
|
+
// Mounted: 200 Skipped (legacy): 3
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.LEGACY_SHAPE_SKIP = void 0;
|
|
8
8
|
exports.mountAllCaps = mountAllCaps;
|
|
@@ -106,6 +106,22 @@ function mountAllCaps(services) {
|
|
|
106
106
|
backup: (0, generated_cap_routers_js_1.createCapRouter_backup)((_ctx) => reg?.getSingleton('backup') ?? null, remoteCapProxy),
|
|
107
107
|
battery: (0, generated_cap_routers_js_1.createCapRouter_battery)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'battery'), remoteCapProxy),
|
|
108
108
|
binary: (0, generated_cap_routers_js_1.createCapRouter_binary)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'binary'), remoteCapProxy),
|
|
109
|
+
boardKeySource: (0, generated_cap_routers_js_1.createCapRouter_boardKeySource)((_ctx, addonId) => {
|
|
110
|
+
if (!reg)
|
|
111
|
+
return null;
|
|
112
|
+
if (addonId !== undefined) {
|
|
113
|
+
return reg.getProviderByAddonId('board-key-source', addonId);
|
|
114
|
+
}
|
|
115
|
+
const entries = reg.getCollectionEntries('board-key-source');
|
|
116
|
+
if (entries.length === 0)
|
|
117
|
+
return null;
|
|
118
|
+
const providers = entries.map(([, p]) => p);
|
|
119
|
+
const first = providers[0];
|
|
120
|
+
return {
|
|
121
|
+
...first,
|
|
122
|
+
listSources: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listSources'),
|
|
123
|
+
};
|
|
124
|
+
}, remoteCapProxy),
|
|
109
125
|
brightness: (0, generated_cap_routers_js_1.createCapRouter_brightness)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'brightness'), remoteCapProxy),
|
|
110
126
|
broker: (0, generated_cap_routers_js_1.createCapRouter_broker)((_ctx, addonId) => {
|
|
111
127
|
if (!reg)
|
|
@@ -541,6 +557,7 @@ function mountAllCaps(services) {
|
|
|
541
557
|
privacyMask: (0, generated_cap_routers_js_1.createCapRouter_privacyMask)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'privacy-mask'), remoteCapProxy),
|
|
542
558
|
ptz: (0, generated_cap_routers_js_1.createCapRouter_ptz)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'ptz'), remoteCapProxy),
|
|
543
559
|
ptzAutotrack: (0, generated_cap_routers_js_1.createCapRouter_ptzAutotrack)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'ptz-autotrack'), remoteCapProxy),
|
|
560
|
+
pumpCycle: (0, generated_cap_routers_js_1.createCapRouter_pumpCycle)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'pump-cycle'), remoteCapProxy),
|
|
544
561
|
reboot: (0, generated_cap_routers_js_1.createCapRouter_reboot)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'reboot'), remoteCapProxy),
|
|
545
562
|
recordEntries: (0, generated_cap_routers_js_1.createCapRouter_recordEntries)((_ctx) => reg?.getSingleton('record-entries') ?? null, remoteCapProxy),
|
|
546
563
|
recording: (0, generated_cap_routers_js_1.createCapRouter_recording)((_ctx) => (0, device_collection_dispatch_js_1.requireDeviceCollection)(reg, 'recording'), remoteCapProxy),
|