@camstack/server 1.2.181 → 1.2.183

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.
@@ -80,6 +80,7 @@ const lifecycle_runner_singleton_js_1 = require("../../core/lifecycle/lifecycle-
80
80
  const agent_installed_packages_js_1 = require("../../core/updates/agent-installed-packages.js");
81
81
  const http_request_census_singleton_js_1 = require("../trpc/http-request-census.singleton.js");
82
82
  const collection_preference_js_1 = require("./collection-preference.js");
83
+ const failure_contributions_js_1 = require("./failure-contributions.js");
83
84
  const load_contributions_js_1 = require("./load-contributions.js");
84
85
  const logging_settings_js_1 = require("./logging-settings.js");
85
86
  const request_census_settings_js_1 = require("./request-census-settings.js");
@@ -112,6 +113,12 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
112
113
  const loadContributions = (0, load_contributions_js_1.buildLoadContributionPlane)({ entries: () => registry?.getCollectionEntries('load-contribution') ?? [] }, (addonId, error) => {
113
114
  logger?.warn('load-contribution provider unreachable', { meta: { addonId, error } });
114
115
  });
116
+ // Every addon's OWN reported losses, per camera, with the denominator
117
+ // attached. Same enumeration, same reason: the addon that owns the failing
118
+ // path is the only thing that knows which camera it lost work for.
119
+ const failureContributions = (0, failure_contributions_js_1.buildFailureContributionPlane)({ entries: () => registry?.getCollectionEntries('failure-contribution') ?? [] }, (addonId, error) => {
120
+ logger?.warn('failure-contribution provider unreachable', { meta: { addonId, error } });
121
+ });
115
122
  const loggingSettings = new logging_settings_js_1.LoggingSettingsService({
116
123
  store,
117
124
  gate: (0, system_1.getLoggingGate)(),
@@ -139,6 +146,7 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
139
146
  return result;
140
147
  },
141
148
  getLoadContributions: async () => loadContributions.contributions(),
149
+ getFailureContributions: async () => failureContributions.contributions(),
142
150
  getRetentionConfig: async () => getRetention(registry)?.getConfig() ?? null,
143
151
  setRetentionConfig: async (input) => {
144
152
  getRetention(registry)?.setConfig(input);
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMPTY_FAILURE_CONTRIBUTION_PLANE = void 0;
4
+ exports.buildFailureContributionPlane = buildFailureContributionPlane;
5
+ const types_1 = require("@camstack/types");
6
+ /** A plane that reaches nothing. The shape of a hub with no addon booted yet. */
7
+ exports.EMPTY_FAILURE_CONTRIBUTION_PLANE = {
8
+ contributions: async () => [],
9
+ };
10
+ function buildFailureContributionPlane(source, onProviderError) {
11
+ return {
12
+ contributions: async () => {
13
+ const out = [];
14
+ for (const [addonId, provider] of source.entries()) {
15
+ try {
16
+ for (const entry of await provider.list()) {
17
+ out.push({ ...entry, addonId });
18
+ }
19
+ }
20
+ catch (err) {
21
+ onProviderError?.(addonId, (0, types_1.errMsg)(err));
22
+ }
23
+ }
24
+ return out;
25
+ },
26
+ };
27
+ }
@@ -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: 148 Skipped (legacy): 3
5
+ // Mounted: 149 Skipped (legacy): 3
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.LEGACY_SHAPE_SKIP = void 0;
8
8
  exports.mountAllCaps = mountAllCaps;
@@ -217,6 +217,22 @@ function mountAllCaps(services) {
217
217
  eventEmitter: (0, generated_cap_routers_js_1.createCapRouter_eventEmitter)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'event-emitter'), remoteCapProxy),
218
218
  events: (0, generated_cap_routers_js_1.createCapRouter_events)((_ctx) => reg?.getSingleton('events') ?? null, remoteCapProxy),
219
219
  faceGallery: (0, generated_cap_routers_js_1.createCapRouter_faceGallery)((_ctx) => reg?.getSingleton('face-gallery') ?? null, remoteCapProxy),
220
+ failureContribution: (0, generated_cap_routers_js_1.createCapRouter_failureContribution)((_ctx, addonId) => {
221
+ if (!reg)
222
+ return null;
223
+ if (addonId !== undefined) {
224
+ return reg.getProviderByAddonId('failure-contribution', addonId);
225
+ }
226
+ const entries = reg.getCollectionEntries('failure-contribution');
227
+ if (entries.length === 0)
228
+ return null;
229
+ const providers = entries.map(([, p]) => p);
230
+ const first = providers[0];
231
+ return {
232
+ ...first,
233
+ list: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'list'),
234
+ };
235
+ }, remoteCapProxy),
220
236
  fanControl: (0, generated_cap_routers_js_1.createCapRouter_fanControl)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'fan-control'), remoteCapProxy),
221
237
  featureProbe: (0, generated_cap_routers_js_1.createCapRouter_featureProbe)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'feature-probe'), remoteCapProxy),
222
238
  filesystemBrowse: (0, generated_cap_routers_js_1.createCapRouter_filesystemBrowse)((_ctx) => reg?.getSingleton('filesystem-browse') ??