@camstack/server 1.2.592 → 1.2.594
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/dist/addon-root-inventory.js +11 -50
- package/dist/agent/addon-scan.js +6 -44
- package/dist/agent/agent-addon-runtime.js +3 -8
- package/dist/agent/agent-addon-updates.js +12 -52
- package/dist/agent/agent-cap-dispatch-service.js +3 -5
- package/dist/agent/agent-config.js +7 -42
- package/dist/agent/agent-deploy-swap.js +5 -41
- package/dist/agent/agent-group-runner.js +8 -47
- package/dist/agent/agent-http-auth.js +10 -22
- package/dist/agent/agent-http.js +69 -115
- package/dist/agent/agent-hub-addon-update.js +10 -16
- package/dist/agent/agent-hub-registration.js +4 -7
- package/dist/agent/agent-infra-capabilities.js +5 -9
- package/dist/agent/agent-json-file.js +5 -42
- package/dist/agent/agent-mesh-gate.js +5 -8
- package/dist/agent/agent-node-certificates.js +25 -28
- package/dist/agent/agent-pairing-local.js +10 -47
- package/dist/agent/agent-pairing-routes.js +16 -20
- package/dist/agent/agent-pairing-store.js +18 -58
- package/dist/agent/agent-reconnect.js +1 -4
- package/dist/agent/agent-service.js +42 -78
- package/dist/agent/agent-sniffing-listener.js +11 -48
- package/dist/agent/agent-undeploy.js +5 -41
- package/dist/agent/agent-update-routes.js +14 -19
- package/dist/agent/agent-update-service.js +38 -80
- package/dist/agent/apply-model-distribution.js +1 -4
- package/dist/agent/apply-stage-dev-uploads.js +6 -9
- package/dist/agent/derive-hub-url.js +3 -8
- package/dist/agent/fetch-bundle-from-hub.js +6 -9
- package/dist/agent/hubs-found.js +6 -43
- package/dist/agent/infra-boot-guard.js +1 -4
- package/dist/agent/infra-boot-plan.js +2 -6
- package/dist/agent/main.js +158 -186
- package/dist/agent/register-agent-cap-dispatch.js +3 -6
- package/dist/agent/serial-queue.js +2 -7
- package/dist/agent-status-page.js +1 -4
- package/dist/api/addon-upload.js +22 -61
- package/dist/api/agent-addon-delivery.js +6 -11
- package/dist/api/auth-whoami.js +1 -4
- package/dist/api/backup-download-pump.js +5 -9
- package/dist/api/backup-download.js +7 -10
- package/dist/api/core/addon-settings.router.js +16 -19
- package/dist/api/core/agent-pairing.router.js +76 -79
- package/dist/api/core/agents.router.js +21 -24
- package/dist/api/core/auth-admin-tokens.procedures.js +48 -52
- package/dist/api/core/auth-device-cert.procedures.js +62 -67
- package/dist/api/core/auth-limits.js +16 -25
- package/dist/api/core/auth-reauth.procedures.js +32 -37
- package/dist/api/core/auth-revoke-credentials.procedures.js +22 -26
- package/dist/api/core/auth-sessions.procedures.js +52 -56
- package/dist/api/core/auth.router.js +300 -304
- package/dist/api/core/cap-providers.js +74 -121
- package/dist/api/core/capabilities.router.js +34 -37
- package/dist/api/core/capability-preference-writes.js +10 -17
- package/dist/api/core/certificates.router.js +106 -109
- package/dist/api/core/cluster-nodes.router.js +15 -18
- package/dist/api/core/collection-preference.js +2 -6
- package/dist/api/core/event-bus-proxy.router.js +34 -37
- package/dist/api/core/failure-contributions.js +4 -8
- package/dist/api/core/hwaccel.router.js +17 -20
- package/dist/api/core/integration-secrets.js +8 -12
- package/dist/api/core/lifecycle-job-runner.js +13 -49
- package/dist/api/core/live-events.router.js +29 -32
- package/dist/api/core/load-contributions.js +4 -8
- package/dist/api/core/logging-settings.js +30 -43
- package/dist/api/core/logs.router.js +40 -43
- package/dist/api/core/notifications.router.js +15 -18
- package/dist/api/core/public-event-filter.js +4 -8
- package/dist/api/core/repl.router.js +18 -21
- package/dist/api/core/request-census-settings.js +11 -16
- package/dist/api/core/server-management.provider.js +1 -4
- package/dist/api/core/server-name.js +9 -17
- package/dist/api/core/site-location.js +16 -24
- package/dist/api/core/stream-probe.router.js +21 -24
- package/dist/api/core/system-events.router.js +23 -26
- package/dist/api/cors/cors-policy.js +20 -29
- package/dist/api/cors/register-cors-policy.js +9 -14
- package/dist/api/deploy-stage-registry.js +6 -10
- package/dist/api/dev-uploads-bundle.js +12 -50
- package/dist/api/health/adaptive-probe.routes.js +9 -13
- package/dist/api/health/health.routes.js +8 -13
- package/dist/api/hub-cluster-url.js +3 -9
- package/dist/api/model-distributor.js +12 -50
- package/dist/api/oauth2/consent-page.js +10 -13
- package/dist/api/oauth2/oauth2-routes.js +17 -25
- package/dist/api/oauth2/private-host.js +1 -4
- package/dist/api/server-upload-propagate.js +15 -51
- package/dist/api/server-upload.js +13 -50
- package/dist/api/sse-no-compression.js +1 -4
- package/dist/api/static/frame-policy.js +4 -9
- package/dist/api/static/precompressed-asset.js +15 -57
- package/dist/api/static/spa-mount.js +8 -47
- package/dist/api/static/spa-static.js +5 -12
- package/dist/api/tarball-manifest.js +7 -44
- package/dist/api/trpc/cap-mount-helpers.js +7 -12
- package/dist/api/trpc/cap-route-error-formatter.js +10 -13
- package/dist/api/trpc/cap-router-runtime.js +40 -51
- package/dist/api/trpc/client-ip.js +9 -20
- package/dist/api/trpc/core-cap-bridge.js +32 -42
- package/dist/api/trpc/device-collection-dispatch.js +23 -27
- package/dist/api/trpc/device-config-secret-redaction.js +24 -40
- package/dist/api/trpc/generated-cap-mounts.js +219 -221
- package/dist/api/trpc/generated-cap-routers.js +4878 -4726
- package/dist/api/trpc/http-request-census-hook.js +8 -11
- package/dist/api/trpc/http-request-census.js +34 -41
- package/dist/api/trpc/http-request-census.singleton.js +4 -8
- package/dist/api/trpc/localized-schema-paths.js +1 -4
- package/dist/api/trpc/principal-visibility.js +14 -22
- package/dist/api/trpc/remote-addon-update-grant.js +1 -4
- package/dist/api/trpc/scope-access.js +10 -15
- package/dist/api/trpc/server-provided-caps.js +3 -7
- package/dist/api/trpc/share-view-access.js +6 -14
- package/dist/api/trpc/trpc-error-device-tags.js +3 -6
- package/dist/api/trpc/trpc-error-principal.js +2 -6
- package/dist/api/trpc/trpc.context.js +20 -25
- package/dist/api/trpc/trpc.middleware.js +38 -46
- package/dist/api/trpc/trpc.router.js +58 -99
- package/dist/api/trpc/user-error.js +5 -8
- package/dist/api/trpc/ws-request-census.js +17 -24
- package/dist/api/trpc/ws-slow-consumer-guard.js +11 -16
- package/dist/api/upload-auth.js +5 -9
- package/dist/auth/addon-route-jwt-gate.js +4 -7
- package/dist/auth/addon-route-share-gate.js +7 -12
- package/dist/auth/app-confirm-page.js +17 -22
- package/dist/auth/app-confirm-routes.js +26 -31
- package/dist/auth/app-confirmations.js +7 -44
- package/dist/auth/app-page-shell.js +17 -30
- package/dist/auth/app-page-strings.js +11 -17
- package/dist/auth/app-passkey-page.js +16 -21
- package/dist/auth/app-passkey-routes.js +37 -41
- package/dist/auth/app-refused-route.js +13 -18
- package/dist/auth/auth-network-policy.js +11 -15
- package/dist/auth/auth-provider-gate.js +4 -9
- package/dist/auth/auth-rate-limit.js +3 -7
- package/dist/auth/client-address.js +6 -9
- package/dist/auth/device-enroll-proofs.js +6 -43
- package/dist/auth/external-link-intents.js +3 -7
- package/dist/auth/hub-sessions.js +6 -12
- package/dist/auth/native-link-completions.js +7 -11
- package/dist/auth/native-return.js +9 -13
- package/dist/auth/passkey-provider.js +26 -32
- package/dist/auth/second-factors.js +6 -10
- package/dist/auth/session-connections.js +6 -12
- package/dist/auth/session-cookie.js +12 -23
- package/dist/auth/session-lifetimes.js +8 -12
- package/dist/auth/session-mint.js +4 -11
- package/dist/auth/sso-finish-app.js +13 -16
- package/dist/auth/sso-finish-deps.js +21 -27
- package/dist/auth/sso-finish.js +28 -38
- package/dist/auth/sso-routes.js +22 -25
- package/dist/auth/used-bridge-ids.js +1 -5
- package/dist/boot/boot-config.js +16 -55
- package/dist/boot/init-sequence.js +1 -4
- package/dist/boot/integration-id-backfill.js +3 -8
- package/dist/boot/platform-keychain-key.js +5 -42
- package/dist/boot/post-boot.service.js +14 -18
- package/dist/boot/reconcile-lifecycle-jobs.js +3 -6
- package/dist/boot/retired-public-url-env.js +4 -8
- package/dist/bootstrap-packages.js +1 -4
- package/dist/closure-node-modules.js +2 -38
- package/dist/closure-patches/patch-reach.json +6 -2
- package/dist/core/addon/addon-call-gateway.js +1 -5
- package/dist/core/addon/addon-package.service.js +83 -123
- package/dist/core/addon/addon-process-view.js +2 -6
- package/dist/core/addon/addon-realign-plan.js +1 -4
- package/dist/core/addon/addon-registry.service.js +254 -197
- package/dist/core/addon/addon-row-manifest.js +1 -4
- package/dist/core/addon/addon-search.service.js +3 -7
- package/dist/core/addon/addon-settings-provider.js +1 -3
- package/dist/core/addon/addon-uninstall.js +4 -11
- package/dist/core/addon/addon.tokens.js +2 -5
- package/dist/core/addon/device-meta-mirror.js +8 -13
- package/dist/core/addon/forked-custom-actions.js +6 -11
- package/dist/core/addon/integration-visibility.js +3 -6
- package/dist/core/addon/materialize-route-path.js +1 -4
- package/dist/core/addon/package-dir-utils.js +8 -45
- package/dist/core/addon/prune-misplaced-addons.js +5 -43
- package/dist/core/addon/runner-convergence.js +1 -4
- package/dist/core/addon/runner-serialization.js +1 -4
- package/dist/core/addon/runner-spawn-fanout.js +3 -8
- package/dist/core/addon/settings-door-wiring.js +5 -8
- package/dist/core/addon/single-flight-refresh.js +1 -4
- package/dist/core/addon-bridge/addon-bridge.service.js +7 -44
- package/dist/core/addon-pages/addon-pages.service.js +3 -40
- package/dist/core/addon-widgets/addon-widgets.service.js +4 -42
- package/dist/core/agent/agent-addon-backfill.js +9 -17
- package/dist/core/agent/agent-delivery-ledger.js +3 -7
- package/dist/core/agent/agent-liveness-event.js +2 -6
- package/dist/core/agent/agent-pairing-http.js +41 -45
- package/dist/core/agent/agent-registry.service.js +53 -92
- package/dist/core/agent/cluster-node-history-mirror.js +3 -7
- package/dist/core/agent/cluster-node-history-store.js +113 -58
- package/dist/core/agent/hub-agent-pairing.js +1 -5
- package/dist/core/agent/node-certificates-client.js +3 -6
- package/dist/core/agent/node-directory.js +1 -4
- package/dist/core/app-links/well-known-app-links.js +2 -6
- package/dist/core/auth/auth.service.js +3 -8
- package/dist/core/auth/handoff-code.service.js +11 -49
- package/dist/core/auth/record-kinds.js +35 -0
- package/dist/core/auth/share-token.service.js +174 -122
- package/dist/core/capability/capability.service.js +1 -5
- package/dist/core/config/config.schema.js +1 -6
- package/dist/core/config/config.service.js +2 -6
- package/dist/core/events/event-bus.service.js +3 -7
- package/dist/core/feature/feature.service.js +2 -6
- package/dist/core/lifecycle/lifecycle-runner.singleton.js +5 -10
- package/dist/core/lifecycle/lifecycle-state-machine.js +1 -5
- package/dist/core/logging/log-ring-buffer.js +1 -5
- package/dist/core/logging/logging.service.js +5 -9
- package/dist/core/logging/scoped-logger.js +1 -5
- package/dist/core/moleculer/agent-readiness-pull.js +1 -4
- package/dist/core/moleculer/agent-registration-request.js +3 -7
- package/dist/core/moleculer/cap-call-fn.js +39 -5
- package/dist/core/moleculer/cap-route-authority.js +3 -8
- package/dist/core/moleculer/hub-mesh-guard.js +5 -9
- package/dist/core/moleculer/moleculer.service.js +108 -119
- package/dist/core/network/network-quality.service.js +2 -6
- package/dist/core/notification/notification-wrapper.service.js +3 -7
- package/dist/core/notification/toast-wrapper.service.js +3 -7
- package/dist/core/provider/provider.tokens.js +1 -4
- package/dist/core/repl/repl-engine.service.js +4 -8
- package/dist/core/runner-health/runner-boot-check.js +7 -15
- package/dist/core/runner-health/update-preflight.js +9 -14
- package/dist/core/server-update/server-update.service.js +12 -49
- package/dist/core/server-update/system-apply-closure-patches.js +6 -42
- package/dist/core/server-update/system-ensure-prebuilds.js +3 -6
- package/dist/core/server-update/system-exec-npm.js +2 -5
- package/dist/core/storage/fs-storage-backend.js +1 -5
- package/dist/core/storage/storage-location-manager.js +1 -5
- package/dist/core/storage/storage.service.js +2 -6
- package/dist/core/streaming/ffmpeg-stream-info.js +3 -8
- package/dist/core/streaming/stream-probe.service.js +12 -16
- package/dist/core/streaming/ttl-cache.js +1 -5
- package/dist/core/topology/topology-emitter.service.js +19 -23
- package/dist/core/update-availability-emitter.js +3 -7
- package/dist/core/update-availability-store.js +8 -45
- package/dist/core/updates/agent-installed-packages.js +5 -9
- package/dist/core/updates/restart-marker.js +3 -8
- package/dist/core/updates/update-check-scheduler.js +13 -18
- package/dist/core/updates/wrapper-update-checker.js +3 -7
- package/dist/first-boot-addon-plan.js +2 -6
- package/dist/framework-nodepath.js +2 -38
- package/dist/i18n/request-lang.js +7 -11
- package/dist/launcher.js +30 -65
- package/dist/lifecycle-journal-path.js +2 -38
- package/dist/main.js +287 -324
- package/dist/manual-boot.js +120 -157
- package/dist/node-role.js +1 -4
- package/dist/package-inventory.js +7 -48
- package/dist/pending-restore.js +7 -43
- package/dist/single-copy-cleanup-runner.js +9 -45
- package/dist/single-copy-cleanup.js +7 -15
- package/dist/sqlite-restore.js +9 -48
- package/dist/starter.js +4 -39
- package/dist/ui-serving/lazy-ui-serving.js +3 -39
- package/package.json +13 -13
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* The logging settings DOCUMENT — one authority over log levels and armed
|
|
4
3
|
* diagnostics, read and written whole through `system.getLoggingSettings` /
|
|
@@ -60,24 +59,13 @@
|
|
|
60
59
|
* this service is its only caller, so there is exactly one write authority
|
|
61
60
|
* over the window (D245).
|
|
62
61
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
exports.buildLogChannelPlane = buildLogChannelPlane;
|
|
66
|
-
exports.toLoggingSettingsRecord = toLoggingSettingsRecord;
|
|
67
|
-
exports.resolveLevel = resolveLevel;
|
|
68
|
-
exports.describeLayers = describeLayers;
|
|
69
|
-
exports.mergeLevel = mergeLevel;
|
|
70
|
-
exports.validateChannelPatch = validateChannelPatch;
|
|
71
|
-
exports.mergeChannelWindows = mergeChannelWindows;
|
|
72
|
-
exports.liveChannelWindows = liveChannelWindows;
|
|
73
|
-
exports.describeChannelWindows = describeChannelWindows;
|
|
74
|
-
const types_1 = require("@camstack/types");
|
|
75
|
-
const system_1 = require("@camstack/system");
|
|
62
|
+
import { errMsg, } from '@camstack/types';
|
|
63
|
+
import { DEFAULT_LOG_LEVEL } from '@camstack/system';
|
|
76
64
|
/** The `system-settings` row this module owns. */
|
|
77
|
-
|
|
65
|
+
export const LOGGING_SETTINGS_KEY = 'logging-settings';
|
|
78
66
|
const SYSTEM_SETTINGS_COLLECTION = 'system-settings';
|
|
79
67
|
/** The node a hub speaks for when a caller does not name one. */
|
|
80
|
-
|
|
68
|
+
export const HUB_NODE_ID = 'hub';
|
|
81
69
|
const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
|
|
82
70
|
/**
|
|
83
71
|
* The persisted row. Every field optional — an older row must still read, and
|
|
@@ -94,9 +82,9 @@ const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
|
|
|
94
82
|
* sweep". That reasoning is why the value stays 30 by default; it was never a
|
|
95
83
|
* reason for the value to be unreachable.
|
|
96
84
|
*/
|
|
97
|
-
|
|
85
|
+
export const OPS_LOG_RETENTION_DEFAULT_DAYS = 30;
|
|
98
86
|
/** A plane that reaches nothing. The shape of a hub with no addon booted yet. */
|
|
99
|
-
|
|
87
|
+
export const EMPTY_LOG_CHANNEL_PLANE = {
|
|
100
88
|
declarations: async () => [],
|
|
101
89
|
apply: async () => { },
|
|
102
90
|
};
|
|
@@ -113,7 +101,7 @@ exports.EMPTY_LOG_CHANNEL_PLANE = {
|
|
|
113
101
|
* own, a failure is reported to `onProviderError` (a branch that drops work
|
|
114
102
|
* logs it), and the remaining providers still get the value.
|
|
115
103
|
*/
|
|
116
|
-
function buildLogChannelPlane(source, onProviderError) {
|
|
104
|
+
export function buildLogChannelPlane(source, onProviderError) {
|
|
117
105
|
return {
|
|
118
106
|
declarations: async () => {
|
|
119
107
|
const seen = new Map();
|
|
@@ -129,7 +117,7 @@ function buildLogChannelPlane(source, onProviderError) {
|
|
|
129
117
|
}
|
|
130
118
|
}
|
|
131
119
|
catch (err) {
|
|
132
|
-
onProviderError?.(addonId, 'list',
|
|
120
|
+
onProviderError?.(addonId, 'list', errMsg(err));
|
|
133
121
|
}
|
|
134
122
|
}
|
|
135
123
|
return [...seen.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -140,7 +128,7 @@ function buildLogChannelPlane(source, onProviderError) {
|
|
|
140
128
|
await provider.apply({ windows });
|
|
141
129
|
}
|
|
142
130
|
catch (err) {
|
|
143
|
-
onProviderError?.(addonId, 'apply',
|
|
131
|
+
onProviderError?.(addonId, 'apply', errMsg(err));
|
|
144
132
|
}
|
|
145
133
|
}
|
|
146
134
|
},
|
|
@@ -151,8 +139,8 @@ function buildLogChannelPlane(source, onProviderError) {
|
|
|
151
139
|
* for the same reason: a diagnostic you can leave on becomes a tax nobody
|
|
152
140
|
* remembers enabling.
|
|
153
141
|
*/
|
|
154
|
-
|
|
155
|
-
class LoggingSettingsService {
|
|
142
|
+
export const MAX_CHANNEL_WINDOW_MS = 30 * 60_000;
|
|
143
|
+
export class LoggingSettingsService {
|
|
156
144
|
store;
|
|
157
145
|
gate;
|
|
158
146
|
requestCensus;
|
|
@@ -164,10 +152,10 @@ class LoggingSettingsService {
|
|
|
164
152
|
this.store = deps.store;
|
|
165
153
|
this.gate = deps.gate;
|
|
166
154
|
this.requestCensus = deps.requestCensus;
|
|
167
|
-
this.localNodeId = deps.localNodeId ??
|
|
155
|
+
this.localNodeId = deps.localNodeId ?? HUB_NODE_ID;
|
|
168
156
|
this.logger = deps.logger;
|
|
169
157
|
this.now = deps.now ?? Date.now;
|
|
170
|
-
this.channels = deps.channels ??
|
|
158
|
+
this.channels = deps.channels ?? EMPTY_LOG_CHANNEL_PLANE;
|
|
171
159
|
}
|
|
172
160
|
/**
|
|
173
161
|
* The document as it stands, resolved for `nodeId` (absent = the cluster).
|
|
@@ -293,7 +281,7 @@ class LoggingSettingsService {
|
|
|
293
281
|
}
|
|
294
282
|
catch (err) {
|
|
295
283
|
this.logger?.warn('log channel windows written but NOT pushed to every gate', {
|
|
296
|
-
meta: { error:
|
|
284
|
+
meta: { error: errMsg(err) },
|
|
297
285
|
});
|
|
298
286
|
}
|
|
299
287
|
}
|
|
@@ -307,7 +295,7 @@ class LoggingSettingsService {
|
|
|
307
295
|
activeWindows: await this.describeWindows(),
|
|
308
296
|
channels: await this.declaredChannels(),
|
|
309
297
|
activeChannels: describeChannelWindows(record ?? {}, this.now()),
|
|
310
|
-
opsLogRetentionDays: record?.opsLogRetentionDays ??
|
|
298
|
+
opsLogRetentionDays: record?.opsLogRetentionDays ?? OPS_LOG_RETENTION_DEFAULT_DAYS,
|
|
311
299
|
persisted: record !== null,
|
|
312
300
|
};
|
|
313
301
|
}
|
|
@@ -326,7 +314,7 @@ class LoggingSettingsService {
|
|
|
326
314
|
}
|
|
327
315
|
catch (err) {
|
|
328
316
|
this.logger?.warn('log channel declarations unreadable - reporting none', {
|
|
329
|
-
meta: { error:
|
|
317
|
+
meta: { error: errMsg(err) },
|
|
330
318
|
});
|
|
331
319
|
return [];
|
|
332
320
|
}
|
|
@@ -364,13 +352,13 @@ class LoggingSettingsService {
|
|
|
364
352
|
try {
|
|
365
353
|
const raw = await this.store.get({
|
|
366
354
|
collection: SYSTEM_SETTINGS_COLLECTION,
|
|
367
|
-
key:
|
|
355
|
+
key: LOGGING_SETTINGS_KEY,
|
|
368
356
|
});
|
|
369
357
|
return toLoggingSettingsRecord(raw);
|
|
370
358
|
}
|
|
371
359
|
catch (err) {
|
|
372
360
|
this.logger?.warn('logging settings read failed - mirror left untouched', {
|
|
373
|
-
meta: { error:
|
|
361
|
+
meta: { error: errMsg(err) },
|
|
374
362
|
});
|
|
375
363
|
return null;
|
|
376
364
|
}
|
|
@@ -379,21 +367,20 @@ class LoggingSettingsService {
|
|
|
379
367
|
try {
|
|
380
368
|
await this.store.set({
|
|
381
369
|
collection: SYSTEM_SETTINGS_COLLECTION,
|
|
382
|
-
key:
|
|
370
|
+
key: LOGGING_SETTINGS_KEY,
|
|
383
371
|
value: record,
|
|
384
372
|
});
|
|
385
373
|
return true;
|
|
386
374
|
}
|
|
387
375
|
catch (err) {
|
|
388
|
-
this.logger?.warn('logging settings applied in memory but NOT persisted - they will not survive a restart', { meta: { error:
|
|
376
|
+
this.logger?.warn('logging settings applied in memory but NOT persisted - they will not survive a restart', { meta: { error: errMsg(err) } });
|
|
389
377
|
return false;
|
|
390
378
|
}
|
|
391
379
|
}
|
|
392
380
|
}
|
|
393
|
-
exports.LoggingSettingsService = LoggingSettingsService;
|
|
394
381
|
// ── pure helpers ────────────────────────────────────────────────────
|
|
395
382
|
/** Structural read of the stored row. Anything unrecognised reads as absent. */
|
|
396
|
-
function toLoggingSettingsRecord(value) {
|
|
383
|
+
export function toLoggingSettingsRecord(value) {
|
|
397
384
|
if (typeof value !== 'object' || value === null)
|
|
398
385
|
return {};
|
|
399
386
|
const clusterLevel = asLogLevel(Reflect.get(value, 'clusterLevel'));
|
|
@@ -424,7 +411,7 @@ function toLoggingSettingsRecord(value) {
|
|
|
424
411
|
* `stream-broker.webrtc` louder" is the request; "this node's level, but only
|
|
425
412
|
* where it is not a channel" is not a request anybody makes.
|
|
426
413
|
*/
|
|
427
|
-
function resolveLevel(record, nodeId, component = null) {
|
|
414
|
+
export function resolveLevel(record, nodeId, component = null) {
|
|
428
415
|
const componentLevel = component === null ? undefined : record.componentLevels?.[component];
|
|
429
416
|
if (componentLevel !== undefined)
|
|
430
417
|
return { level: componentLevel, source: 'component' };
|
|
@@ -433,13 +420,13 @@ function resolveLevel(record, nodeId, component = null) {
|
|
|
433
420
|
return { level: nodeLevel, source: 'node' };
|
|
434
421
|
if (record.clusterLevel !== undefined)
|
|
435
422
|
return { level: record.clusterLevel, source: 'cluster' };
|
|
436
|
-
return { level:
|
|
423
|
+
return { level: DEFAULT_LOG_LEVEL, source: 'default' };
|
|
437
424
|
}
|
|
438
425
|
/**
|
|
439
426
|
* The layers as they stand, general → specific. `level: null` means the layer
|
|
440
427
|
* carries no explicit value and inherits.
|
|
441
428
|
*/
|
|
442
|
-
function describeLayers(record, nodeId, component = null) {
|
|
429
|
+
export function describeLayers(record, nodeId, component = null) {
|
|
443
430
|
const layers = [
|
|
444
431
|
{ scope: 'cluster', nodeId: null, component: null, level: record.clusterLevel ?? null },
|
|
445
432
|
];
|
|
@@ -472,7 +459,7 @@ function describeLayers(record, nodeId, component = null) {
|
|
|
472
459
|
* addressing the component layer, because a component level is cluster-wide
|
|
473
460
|
* and the node selector has no meaning there.
|
|
474
461
|
*/
|
|
475
|
-
function mergeLevel(record, nodeId, component, next, updatedAt) {
|
|
462
|
+
export function mergeLevel(record, nodeId, component, next, updatedAt) {
|
|
476
463
|
if (component !== null) {
|
|
477
464
|
const { [component]: _clearedComponent, ...otherComponents } = record.componentLevels ?? {};
|
|
478
465
|
const componentLevels = {
|
|
@@ -511,7 +498,7 @@ function mergeLevel(record, nodeId, component, next, updatedAt) {
|
|
|
511
498
|
* worse: the operator would believe per-camera filtering works there, and
|
|
512
499
|
* conclude from the first unrelated line that the wrong camera is at fault.
|
|
513
500
|
*/
|
|
514
|
-
function validateChannelPatch(patches, declared) {
|
|
501
|
+
export function validateChannelPatch(patches, declared) {
|
|
515
502
|
const byName = new Map(declared.map((d) => [d.name, d]));
|
|
516
503
|
const reasons = [];
|
|
517
504
|
for (const patch of patches) {
|
|
@@ -538,7 +525,7 @@ function validateChannelPatch(patches, declared) {
|
|
|
538
525
|
* whatever window it had, so the Levels page and the Diagnostics page cannot
|
|
539
526
|
* disarm each other's work.
|
|
540
527
|
*/
|
|
541
|
-
function mergeChannelWindows(record, patches, nowMs) {
|
|
528
|
+
export function mergeChannelWindows(record, patches, nowMs) {
|
|
542
529
|
const windows = { ...record.channelWindows };
|
|
543
530
|
for (const patch of patches) {
|
|
544
531
|
if (patch.armMs <= 0) {
|
|
@@ -547,7 +534,7 @@ function mergeChannelWindows(record, patches, nowMs) {
|
|
|
547
534
|
}
|
|
548
535
|
const ids = patch.deviceIds;
|
|
549
536
|
windows[patch.channel] = {
|
|
550
|
-
armedUntilMs: nowMs + Math.min(patch.armMs,
|
|
537
|
+
armedUntilMs: nowMs + Math.min(patch.armMs, MAX_CHANNEL_WINDOW_MS),
|
|
551
538
|
deviceIds: ids === undefined || ids === null || ids.length === 0 ? null : [...ids],
|
|
552
539
|
};
|
|
553
540
|
}
|
|
@@ -560,7 +547,7 @@ function mergeChannelWindows(record, patches, nowMs) {
|
|
|
560
547
|
* restore from re-arming a diagnostic somebody forgot months ago, which is the
|
|
561
548
|
* one failure a deadline exists to prevent.
|
|
562
549
|
*/
|
|
563
|
-
function liveChannelWindows(record, nowMs) {
|
|
550
|
+
export function liveChannelWindows(record, nowMs) {
|
|
564
551
|
const out = [];
|
|
565
552
|
for (const [channel, window] of Object.entries(record.channelWindows ?? {})) {
|
|
566
553
|
if (window.armedUntilMs <= nowMs)
|
|
@@ -570,7 +557,7 @@ function liveChannelWindows(record, nowMs) {
|
|
|
570
557
|
return out.sort((a, b) => a.channel.localeCompare(b.channel));
|
|
571
558
|
}
|
|
572
559
|
/** The windows as the page shows them: deadline plus time left, never a flag. */
|
|
573
|
-
function describeChannelWindows(record, nowMs) {
|
|
560
|
+
export function describeChannelWindows(record, nowMs) {
|
|
574
561
|
const out = [];
|
|
575
562
|
for (const [channel, window] of Object.entries(record.channelWindows ?? {})) {
|
|
576
563
|
const armed = window.armedUntilMs > nowMs;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLogsRouter = createLogsRouter;
|
|
4
1
|
/**
|
|
5
2
|
* Logs router — fixed core API (not a capability).
|
|
6
3
|
*
|
|
@@ -9,25 +6,25 @@ exports.createLogsRouter = createLogsRouter;
|
|
|
9
6
|
* everything; viewers/protected users only see entries matching their
|
|
10
7
|
* allowed providers scope (filtered in `query`).
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const LogLevelSchema =
|
|
16
|
-
const LogTagsSchema =
|
|
17
|
-
agentId:
|
|
18
|
-
nodeId:
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { trpcRouter, adminProcedure, iterableSubscription } from '../trpc/trpc.middleware.js';
|
|
11
|
+
import { bareAddonId } from '@camstack/types';
|
|
12
|
+
const LogLevelSchema = z.enum(['debug', 'info', 'warn', 'error']);
|
|
13
|
+
const LogTagsSchema = z.object({
|
|
14
|
+
agentId: z.string().optional(),
|
|
15
|
+
nodeId: z.string().optional(),
|
|
19
16
|
/** Numeric progressive id (or its string form for legacy callers). */
|
|
20
|
-
deviceId:
|
|
17
|
+
deviceId: z.union([z.string(), z.number()]).optional(),
|
|
21
18
|
/** Parent container id — set on every accessory child's logs (and on the
|
|
22
19
|
* container's own logs). Filtering by it returns the whole container subtree
|
|
23
20
|
* (container + all children) in one query. */
|
|
24
|
-
containerDeviceId:
|
|
25
|
-
deviceName:
|
|
26
|
-
integrationId:
|
|
27
|
-
addonId:
|
|
28
|
-
streamId:
|
|
29
|
-
streamName:
|
|
30
|
-
sessionId:
|
|
21
|
+
containerDeviceId: z.union([z.string(), z.number()]).optional(),
|
|
22
|
+
deviceName: z.string().optional(),
|
|
23
|
+
integrationId: z.string().optional(),
|
|
24
|
+
addonId: z.string().optional(),
|
|
25
|
+
streamId: z.string().optional(),
|
|
26
|
+
streamName: z.string().optional(),
|
|
27
|
+
sessionId: z.string().optional(),
|
|
31
28
|
/**
|
|
32
29
|
* Correlation id used to scope a single short-lived operation
|
|
33
30
|
* (e.g. a `testCreationField` probe). The Add-Device modal generates
|
|
@@ -35,32 +32,32 @@ const LogTagsSchema = zod_1.z.object({
|
|
|
35
32
|
* modal can stream test logs without a deviceId (the device doesn't
|
|
36
33
|
* exist yet).
|
|
37
34
|
*/
|
|
38
|
-
requestId:
|
|
35
|
+
requestId: z.string().optional(),
|
|
39
36
|
});
|
|
40
37
|
/** Wire shape of a log entry — timestamp is serialised to ISO string by tRPC. */
|
|
41
|
-
const LogEntrySchema =
|
|
42
|
-
timestamp:
|
|
43
|
-
level:
|
|
44
|
-
scope:
|
|
45
|
-
message:
|
|
46
|
-
tags:
|
|
38
|
+
const LogEntrySchema = z.object({
|
|
39
|
+
timestamp: z.string(),
|
|
40
|
+
level: z.string(),
|
|
41
|
+
scope: z.string().optional(),
|
|
42
|
+
message: z.string(),
|
|
43
|
+
tags: z.record(z.string(), z.string().optional()).optional(),
|
|
47
44
|
/**
|
|
48
45
|
* Ad-hoc structured payload attached to the log call (e.g.
|
|
49
46
|
* `{error, brokerId, sourceType, url}` for stream-broker errors).
|
|
50
47
|
* Tags are filterable structural fields; meta is the per-call
|
|
51
48
|
* payload operators read in the expanded LogStream row.
|
|
52
49
|
*/
|
|
53
|
-
meta:
|
|
50
|
+
meta: z.record(z.string(), z.unknown()).optional(),
|
|
54
51
|
});
|
|
55
|
-
const LogEntryArraySchema =
|
|
56
|
-
function createLogsRouter(logging) {
|
|
57
|
-
return
|
|
58
|
-
query:
|
|
59
|
-
.input(
|
|
52
|
+
const LogEntryArraySchema = z.array(LogEntrySchema);
|
|
53
|
+
export function createLogsRouter(logging) {
|
|
54
|
+
return trpcRouter({
|
|
55
|
+
query: adminProcedure
|
|
56
|
+
.input(z.object({
|
|
60
57
|
level: LogLevelSchema.optional(),
|
|
61
|
-
since:
|
|
62
|
-
until:
|
|
63
|
-
limit:
|
|
58
|
+
since: z.number().optional(),
|
|
59
|
+
until: z.number().optional(),
|
|
60
|
+
limit: z.number().optional(),
|
|
64
61
|
tags: LogTagsSchema.optional(),
|
|
65
62
|
}))
|
|
66
63
|
.output(LogEntryArraySchema)
|
|
@@ -85,7 +82,7 @@ function createLogsRouter(logging) {
|
|
|
85
82
|
if (typeof addonId !== 'string')
|
|
86
83
|
return false;
|
|
87
84
|
return allowed.some((p) => {
|
|
88
|
-
const bare =
|
|
85
|
+
const bare = bareAddonId(p);
|
|
89
86
|
return addonId === bare || addonId.startsWith(bare);
|
|
90
87
|
});
|
|
91
88
|
});
|
|
@@ -118,14 +115,14 @@ function createLogsRouter(logging) {
|
|
|
118
115
|
* `query`. Admin-only so a viewer can't wipe context other ops
|
|
119
116
|
* are reading.
|
|
120
117
|
*/
|
|
121
|
-
clear:
|
|
122
|
-
.input(
|
|
118
|
+
clear: adminProcedure
|
|
119
|
+
.input(z.object({
|
|
123
120
|
level: LogLevelSchema.optional(),
|
|
124
|
-
since:
|
|
125
|
-
until:
|
|
121
|
+
since: z.number().optional(),
|
|
122
|
+
until: z.number().optional(),
|
|
126
123
|
tags: LogTagsSchema.optional(),
|
|
127
124
|
}))
|
|
128
|
-
.output(
|
|
125
|
+
.output(z.object({ removed: z.number().int().nonnegative() }))
|
|
129
126
|
.mutation(({ input }) => {
|
|
130
127
|
const filter = {};
|
|
131
128
|
if (input.level)
|
|
@@ -145,13 +142,13 @@ function createLogsRouter(logging) {
|
|
|
145
142
|
// `adminProcedure`; `subscribe` was the one non-admin door onto the same
|
|
146
143
|
// data, so it is gated to match. (A scoped, device-projected log view is a
|
|
147
144
|
// later, larger change — not a security hotfix.)
|
|
148
|
-
subscribe:
|
|
149
|
-
.input(
|
|
145
|
+
subscribe: adminProcedure
|
|
146
|
+
.input(z.object({
|
|
150
147
|
level: LogLevelSchema.optional(),
|
|
151
148
|
tags: LogTagsSchema.optional(),
|
|
152
149
|
}))
|
|
153
150
|
.subscription(({ input }) => {
|
|
154
|
-
return
|
|
151
|
+
return iterableSubscription((push) => {
|
|
155
152
|
return logging.subscribe({
|
|
156
153
|
level: input.level,
|
|
157
154
|
tags: input.tags,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNotificationsRouter = createNotificationsRouter;
|
|
4
1
|
/**
|
|
5
2
|
* Notifications router — fixed core API (not a capability).
|
|
6
3
|
*
|
|
@@ -11,17 +8,17 @@ exports.createNotificationsRouter = createNotificationsRouter;
|
|
|
11
8
|
* test panel live on the cap surface (`api.notificationOutput.*`); this
|
|
12
9
|
* legacy router only exposes category→target routing.
|
|
13
10
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const NotificationTargetRefSchema =
|
|
17
|
-
addonId:
|
|
18
|
-
targetId:
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { trpcRouter, protectedProcedure, adminProcedure } from '../trpc/trpc.middleware.js';
|
|
13
|
+
const NotificationTargetRefSchema = z.object({
|
|
14
|
+
addonId: z.string(),
|
|
15
|
+
targetId: z.string(),
|
|
19
16
|
});
|
|
20
|
-
function createNotificationsRouter(ns) {
|
|
21
|
-
return
|
|
22
|
-
getRouting:
|
|
23
|
-
.input(
|
|
24
|
-
.output(
|
|
17
|
+
export function createNotificationsRouter(ns) {
|
|
18
|
+
return trpcRouter({
|
|
19
|
+
getRouting: protectedProcedure
|
|
20
|
+
.input(z.void())
|
|
21
|
+
.output(z.record(z.string(), z.array(NotificationTargetRefSchema)))
|
|
25
22
|
.query(() => {
|
|
26
23
|
if (!ns)
|
|
27
24
|
return {};
|
|
@@ -32,12 +29,12 @@ function createNotificationsRouter(ns) {
|
|
|
32
29
|
}
|
|
33
30
|
return result;
|
|
34
31
|
}),
|
|
35
|
-
setRouting:
|
|
36
|
-
.input(
|
|
37
|
-
category:
|
|
38
|
-
targets:
|
|
32
|
+
setRouting: adminProcedure
|
|
33
|
+
.input(z.object({
|
|
34
|
+
category: z.string(),
|
|
35
|
+
targets: z.array(NotificationTargetRefSchema),
|
|
39
36
|
}))
|
|
40
|
-
.output(
|
|
37
|
+
.output(z.void())
|
|
41
38
|
.mutation(({ input }) => {
|
|
42
39
|
if (!ns)
|
|
43
40
|
throw new Error('Notification service unavailable');
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPublicEvent = isPublicEvent;
|
|
4
|
-
exports.publicRecent = publicRecent;
|
|
5
1
|
/**
|
|
6
2
|
* The one predicate every public event procedure applies before an event
|
|
7
3
|
* leaves the hub (D224, D663): an owner-only category — today the native
|
|
@@ -14,11 +10,11 @@ exports.publicRecent = publicRecent;
|
|
|
14
10
|
* never costs the caller a slot. The ring is bounded (`MAX_RECENT_EVENTS`), so
|
|
15
11
|
* reading it whole and cutting afterwards is one bounded pass.
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
|
-
function isPublicEvent(evt) {
|
|
19
|
-
return !
|
|
13
|
+
import { isOwnerOnlyEventCategory } from '@camstack/types';
|
|
14
|
+
export function isPublicEvent(evt) {
|
|
15
|
+
return !isOwnerOnlyEventCategory(evt.category);
|
|
20
16
|
}
|
|
21
|
-
function publicRecent(source, filter, limit, keep) {
|
|
17
|
+
export function publicRecent(source, filter, limit, keep) {
|
|
22
18
|
const visible = source
|
|
23
19
|
.getRecent(filter)
|
|
24
20
|
.filter((evt) => isPublicEvent(evt) && (keep === null || keep(evt)));
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createReplRouter = createReplRouter;
|
|
4
1
|
/**
|
|
5
2
|
* REPL router — fixed core API (not a capability).
|
|
6
3
|
*
|
|
@@ -8,28 +5,28 @@ exports.createReplRouter = createReplRouter;
|
|
|
8
5
|
* (`ReplEngineService` extends `ReplEngine` from `@camstack/system`).
|
|
9
6
|
* Only super_admin can execute code.
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const ReplScopeSchema =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { trpcRouter, adminProcedure } from '../trpc/trpc.middleware.js';
|
|
10
|
+
const ReplScopeSchema = z.discriminatedUnion('type', [
|
|
11
|
+
z.object({ type: z.literal('system') }),
|
|
12
|
+
z.object({ type: z.literal('device'), deviceId: z.number() }),
|
|
13
|
+
z.object({ type: z.literal('provider'), providerId: z.string() }),
|
|
14
|
+
z.object({ type: z.literal('addon'), addonId: z.string() }),
|
|
18
15
|
]);
|
|
19
|
-
const ReplResultSchema =
|
|
20
|
-
output:
|
|
21
|
-
error:
|
|
22
|
-
duration:
|
|
16
|
+
const ReplResultSchema = z.object({
|
|
17
|
+
output: z.string(),
|
|
18
|
+
error: z.string().optional(),
|
|
19
|
+
duration: z.number().optional(),
|
|
23
20
|
});
|
|
24
|
-
function createReplRouter(repl) {
|
|
25
|
-
return
|
|
26
|
-
execute:
|
|
27
|
-
.input(
|
|
21
|
+
export function createReplRouter(repl) {
|
|
22
|
+
return trpcRouter({
|
|
23
|
+
execute: adminProcedure
|
|
24
|
+
.input(z.object({ code: z.string().max(10000), scope: ReplScopeSchema }))
|
|
28
25
|
.output(ReplResultSchema)
|
|
29
26
|
.mutation(({ input }) => repl.execute(input.code, { scope: input.scope, variables: {} })),
|
|
30
|
-
completions:
|
|
31
|
-
.input(
|
|
32
|
-
.output(
|
|
27
|
+
completions: adminProcedure
|
|
28
|
+
.input(z.object({ partial: z.string(), scope: ReplScopeSchema }))
|
|
29
|
+
.output(z.array(z.string()).readonly())
|
|
33
30
|
.query(({ input }) => repl.getCompletions(input.partial, { scope: input.scope, variables: {} })),
|
|
34
31
|
});
|
|
35
32
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* The switch for the TRANSPORT census - a SYSTEM SETTING, not an env var.
|
|
4
3
|
*
|
|
@@ -38,18 +37,15 @@
|
|
|
38
37
|
* cached flag it cannot claim a window survives a restart when the write that
|
|
39
38
|
* would have made it survive failed.
|
|
40
39
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exports.toRecord = toRecord;
|
|
44
|
-
const types_1 = require("@camstack/types");
|
|
45
|
-
const http_request_census_js_1 = require("../trpc/http-request-census.js");
|
|
40
|
+
import { errMsg } from '@camstack/types';
|
|
41
|
+
import { DEFAULT_REPORT_EVERY_MS } from '../trpc/http-request-census.js';
|
|
46
42
|
/** The `system-settings` row this module owns. */
|
|
47
|
-
|
|
43
|
+
export const REQUEST_CENSUS_KEY = 'http-request-census';
|
|
48
44
|
const SYSTEM_SETTINGS_COLLECTION = 'system-settings';
|
|
49
45
|
/**
|
|
50
46
|
* Arm / disarm / read the census, keeping the persisted deadline in step.
|
|
51
47
|
*/
|
|
52
|
-
class RequestCensusService {
|
|
48
|
+
export class RequestCensusService {
|
|
53
49
|
census;
|
|
54
50
|
store;
|
|
55
51
|
logger;
|
|
@@ -75,7 +71,7 @@ class RequestCensusService {
|
|
|
75
71
|
* a restart, and blamed on the instrument.
|
|
76
72
|
*/
|
|
77
73
|
async set(input) {
|
|
78
|
-
const reportEveryMs = input.reportEveryMs ??
|
|
74
|
+
const reportEveryMs = input.reportEveryMs ?? DEFAULT_REPORT_EVERY_MS;
|
|
79
75
|
if (input.armMs <= 0)
|
|
80
76
|
this.census.disarm('operator-disarmed');
|
|
81
77
|
else
|
|
@@ -116,7 +112,7 @@ class RequestCensusService {
|
|
|
116
112
|
});
|
|
117
113
|
return false;
|
|
118
114
|
}
|
|
119
|
-
this.census.arm(remainingMs, record?.reportEveryMs ??
|
|
115
|
+
this.census.arm(remainingMs, record?.reportEveryMs ?? DEFAULT_REPORT_EVERY_MS);
|
|
120
116
|
this.logger?.info('transport census restored from system-settings', {
|
|
121
117
|
meta: { remainingMs, armedUntilMs: this.census.armedUntilMs },
|
|
122
118
|
});
|
|
@@ -131,7 +127,7 @@ class RequestCensusService {
|
|
|
131
127
|
try {
|
|
132
128
|
const raw = await this.store.get({
|
|
133
129
|
collection: SYSTEM_SETTINGS_COLLECTION,
|
|
134
|
-
key:
|
|
130
|
+
key: REQUEST_CENSUS_KEY,
|
|
135
131
|
});
|
|
136
132
|
return toRecord(raw);
|
|
137
133
|
}
|
|
@@ -140,7 +136,7 @@ class RequestCensusService {
|
|
|
140
136
|
// census. It is logged because a branch that drops work silently reads
|
|
141
137
|
// as "never happened".
|
|
142
138
|
this.logger?.warn('transport census settings read failed', {
|
|
143
|
-
meta: { error:
|
|
139
|
+
meta: { error: errMsg(err) },
|
|
144
140
|
});
|
|
145
141
|
return null;
|
|
146
142
|
}
|
|
@@ -149,20 +145,19 @@ class RequestCensusService {
|
|
|
149
145
|
try {
|
|
150
146
|
await this.store.set({
|
|
151
147
|
collection: SYSTEM_SETTINGS_COLLECTION,
|
|
152
|
-
key:
|
|
148
|
+
key: REQUEST_CENSUS_KEY,
|
|
153
149
|
value: record,
|
|
154
150
|
});
|
|
155
151
|
return true;
|
|
156
152
|
}
|
|
157
153
|
catch (err) {
|
|
158
|
-
this.logger?.warn('transport census armed in memory but NOT persisted - it will not survive a restart', { meta: { error:
|
|
154
|
+
this.logger?.warn('transport census armed in memory but NOT persisted - it will not survive a restart', { meta: { error: errMsg(err) } });
|
|
159
155
|
return false;
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
}
|
|
163
|
-
exports.RequestCensusService = RequestCensusService;
|
|
164
159
|
/** Structural read of the stored row. Anything unrecognised reads as absent. */
|
|
165
|
-
function toRecord(value) {
|
|
160
|
+
export function toRecord(value) {
|
|
166
161
|
if (typeof value !== 'object' || value === null)
|
|
167
162
|
return null;
|
|
168
163
|
const armedUntilMs = Reflect.get(value, 'armedUntilMs');
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildServerManagementProvider = buildServerManagementProvider;
|
|
4
|
-
function buildServerManagementProvider(service) {
|
|
1
|
+
export function buildServerManagementProvider(service) {
|
|
5
2
|
if (service === null)
|
|
6
3
|
return null;
|
|
7
4
|
return {
|