@camstack/server 1.2.594 → 1.2.595
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 +50 -11
- package/dist/agent/addon-scan.js +44 -6
- package/dist/agent/agent-addon-runtime.js +8 -3
- package/dist/agent/agent-addon-updates.js +52 -12
- package/dist/agent/agent-cap-dispatch-service.js +5 -3
- package/dist/agent/agent-config.js +42 -7
- package/dist/agent/agent-deploy-swap.js +41 -5
- package/dist/agent/agent-group-runner.js +47 -8
- package/dist/agent/agent-http-auth.js +22 -10
- package/dist/agent/agent-http.js +113 -64
- package/dist/agent/agent-hub-addon-update.js +16 -10
- package/dist/agent/agent-hub-registration.js +7 -4
- package/dist/agent/agent-infra-capabilities.js +9 -5
- package/dist/agent/agent-json-file.js +42 -5
- package/dist/agent/agent-mesh-gate.js +8 -5
- package/dist/agent/agent-node-certificates.js +28 -25
- package/dist/agent/agent-pairing-local.js +47 -10
- package/dist/agent/agent-pairing-routes.js +20 -16
- package/dist/agent/agent-pairing-store.js +58 -18
- package/dist/agent/agent-reconnect.js +4 -1
- package/dist/agent/agent-service.js +71 -35
- package/dist/agent/agent-sniffing-listener.js +48 -11
- package/dist/agent/agent-undeploy.js +41 -5
- package/dist/agent/agent-update-routes.js +19 -14
- package/dist/agent/agent-update-service.js +80 -38
- package/dist/agent/apply-model-distribution.js +4 -1
- package/dist/agent/apply-stage-dev-uploads.js +9 -6
- package/dist/agent/derive-hub-url.js +8 -3
- package/dist/agent/fetch-bundle-from-hub.js +9 -6
- package/dist/agent/hubs-found.js +43 -6
- package/dist/agent/infra-boot-guard.js +4 -1
- package/dist/agent/infra-boot-plan.js +6 -2
- package/dist/agent/main.js +183 -148
- package/dist/agent/register-agent-cap-dispatch.js +6 -3
- package/dist/agent/serial-queue.js +7 -2
- package/dist/agent-status-page.js +4 -1
- package/dist/api/addon-upload.js +61 -22
- package/dist/api/agent-addon-delivery.js +11 -6
- package/dist/api/auth-whoami.js +4 -1
- package/dist/api/backup-download-pump.js +9 -5
- package/dist/api/backup-download.js +10 -7
- package/dist/api/core/addon-settings.router.js +19 -16
- package/dist/api/core/agent-pairing.router.js +79 -76
- package/dist/api/core/agents.router.js +24 -21
- package/dist/api/core/auth-admin-tokens.procedures.js +52 -48
- package/dist/api/core/auth-device-cert.procedures.js +67 -62
- package/dist/api/core/auth-limits.js +25 -16
- package/dist/api/core/auth-reauth.procedures.js +37 -32
- package/dist/api/core/auth-revoke-credentials.procedures.js +26 -22
- package/dist/api/core/auth-sessions.procedures.js +56 -52
- package/dist/api/core/auth.router.js +304 -300
- package/dist/api/core/cap-providers.js +121 -74
- package/dist/api/core/capabilities.router.js +37 -34
- package/dist/api/core/capability-preference-writes.js +17 -10
- package/dist/api/core/certificates.router.js +109 -106
- package/dist/api/core/cluster-nodes.router.js +18 -15
- package/dist/api/core/collection-preference.js +6 -2
- package/dist/api/core/event-bus-proxy.router.js +37 -34
- package/dist/api/core/failure-contributions.js +8 -4
- package/dist/api/core/hwaccel.router.js +20 -17
- package/dist/api/core/integration-secrets.js +12 -8
- package/dist/api/core/lifecycle-job-runner.js +49 -13
- package/dist/api/core/live-events.router.js +32 -29
- package/dist/api/core/load-contributions.js +8 -4
- package/dist/api/core/logging-settings.js +43 -30
- package/dist/api/core/logs.router.js +43 -40
- package/dist/api/core/notifications.router.js +18 -15
- package/dist/api/core/public-event-filter.js +8 -4
- package/dist/api/core/repl.router.js +21 -18
- package/dist/api/core/request-census-settings.js +16 -11
- package/dist/api/core/server-management.provider.js +4 -1
- package/dist/api/core/server-name.js +17 -9
- package/dist/api/core/site-location.js +24 -16
- package/dist/api/core/stream-probe.router.js +24 -21
- package/dist/api/core/system-events.router.js +26 -23
- package/dist/api/cors/cors-policy.js +29 -20
- package/dist/api/cors/register-cors-policy.js +14 -9
- package/dist/api/deploy-stage-registry.js +10 -6
- package/dist/api/dev-uploads-bundle.js +50 -12
- package/dist/api/health/adaptive-probe.routes.js +13 -9
- package/dist/api/health/health.routes.js +13 -8
- package/dist/api/hub-cluster-url.js +9 -3
- package/dist/api/model-distributor.js +50 -12
- package/dist/api/oauth2/consent-page.js +13 -10
- package/dist/api/oauth2/oauth2-routes.js +25 -17
- package/dist/api/oauth2/private-host.js +4 -1
- package/dist/api/server-upload-propagate.js +51 -15
- package/dist/api/server-upload.js +50 -13
- package/dist/api/sse-no-compression.js +4 -1
- package/dist/api/static/frame-policy.js +9 -4
- package/dist/api/static/precompressed-asset.js +57 -15
- package/dist/api/static/spa-mount.js +47 -8
- package/dist/api/static/spa-static.js +12 -5
- package/dist/api/tarball-manifest.js +44 -7
- package/dist/api/trpc/cap-mount-helpers.js +12 -7
- package/dist/api/trpc/cap-route-error-formatter.js +13 -10
- package/dist/api/trpc/cap-router-runtime.js +51 -40
- package/dist/api/trpc/client-ip.js +20 -9
- package/dist/api/trpc/core-cap-bridge.js +42 -32
- package/dist/api/trpc/device-collection-dispatch.js +27 -23
- package/dist/api/trpc/device-config-secret-redaction.js +40 -24
- package/dist/api/trpc/generated-cap-mounts.js +222 -218
- package/dist/api/trpc/generated-cap-routers.js +4856 -4676
- package/dist/api/trpc/http-request-census-hook.js +11 -8
- package/dist/api/trpc/http-request-census.js +41 -34
- package/dist/api/trpc/http-request-census.singleton.js +8 -4
- package/dist/api/trpc/localized-schema-paths.js +4 -1
- package/dist/api/trpc/principal-visibility.js +22 -14
- package/dist/api/trpc/remote-addon-update-grant.js +4 -1
- package/dist/api/trpc/scope-access.js +15 -10
- package/dist/api/trpc/server-provided-caps.js +7 -3
- package/dist/api/trpc/share-view-access.js +14 -6
- package/dist/api/trpc/trpc-error-device-tags.js +6 -3
- package/dist/api/trpc/trpc-error-principal.js +6 -2
- package/dist/api/trpc/trpc.context.js +25 -20
- package/dist/api/trpc/trpc.middleware.js +46 -38
- package/dist/api/trpc/trpc.router.js +99 -58
- package/dist/api/trpc/user-error.js +8 -5
- package/dist/api/trpc/ws-request-census.js +24 -17
- package/dist/api/trpc/ws-slow-consumer-guard.js +16 -11
- package/dist/api/upload-auth.js +9 -5
- package/dist/auth/addon-route-jwt-gate.js +7 -4
- package/dist/auth/addon-route-share-gate.js +12 -7
- package/dist/auth/app-confirm-page.js +22 -17
- package/dist/auth/app-confirm-routes.js +31 -26
- package/dist/auth/app-confirmations.js +44 -7
- package/dist/auth/app-page-shell.js +30 -17
- package/dist/auth/app-page-strings.js +17 -11
- package/dist/auth/app-passkey-page.js +21 -16
- package/dist/auth/app-passkey-routes.js +41 -37
- package/dist/auth/app-refused-route.js +18 -13
- package/dist/auth/auth-network-policy.js +15 -11
- package/dist/auth/auth-provider-gate.js +9 -4
- package/dist/auth/auth-rate-limit.js +7 -3
- package/dist/auth/client-address.js +9 -6
- package/dist/auth/device-enroll-proofs.js +43 -6
- package/dist/auth/external-link-intents.js +7 -3
- package/dist/auth/hub-sessions.js +12 -6
- package/dist/auth/native-link-completions.js +11 -7
- package/dist/auth/native-return.js +13 -9
- package/dist/auth/passkey-provider.js +32 -26
- package/dist/auth/second-factors.js +10 -6
- package/dist/auth/session-connections.js +12 -6
- package/dist/auth/session-cookie.js +23 -12
- package/dist/auth/session-lifetimes.js +12 -8
- package/dist/auth/session-mint.js +11 -4
- package/dist/auth/sso-finish-app.js +16 -13
- package/dist/auth/sso-finish-deps.js +27 -21
- package/dist/auth/sso-finish.js +38 -28
- package/dist/auth/sso-routes.js +25 -22
- package/dist/auth/used-bridge-ids.js +5 -1
- package/dist/boot/boot-config.js +55 -16
- package/dist/boot/init-sequence.js +4 -1
- package/dist/boot/integration-id-backfill.js +8 -3
- package/dist/boot/platform-keychain-key.js +42 -5
- package/dist/boot/post-boot.service.js +18 -14
- package/dist/boot/reconcile-lifecycle-jobs.js +6 -3
- package/dist/boot/retired-public-url-env.js +8 -4
- package/dist/bootstrap-packages.js +4 -1
- package/dist/closure-node-modules.js +38 -2
- package/dist/core/addon/addon-call-gateway.js +5 -1
- package/dist/core/addon/addon-package.service.js +123 -83
- package/dist/core/addon/addon-process-view.js +6 -2
- package/dist/core/addon/addon-realign-plan.js +4 -1
- package/dist/core/addon/addon-registry.service.js +187 -146
- package/dist/core/addon/addon-row-manifest.js +4 -1
- package/dist/core/addon/addon-search.service.js +7 -3
- package/dist/core/addon/addon-settings-provider.js +3 -1
- package/dist/core/addon/addon-uninstall.js +11 -4
- package/dist/core/addon/addon.tokens.js +5 -2
- package/dist/core/addon/device-meta-mirror.js +13 -8
- package/dist/core/addon/forked-custom-actions.js +11 -6
- package/dist/core/addon/integration-visibility.js +6 -3
- package/dist/core/addon/materialize-route-path.js +4 -1
- package/dist/core/addon/package-dir-utils.js +45 -8
- package/dist/core/addon/prune-misplaced-addons.js +43 -5
- package/dist/core/addon/runner-convergence.js +4 -1
- package/dist/core/addon/runner-serialization.js +4 -1
- package/dist/core/addon/runner-spawn-fanout.js +8 -3
- package/dist/core/addon/settings-door-wiring.js +8 -5
- package/dist/core/addon/single-flight-refresh.js +4 -1
- package/dist/core/addon-bridge/addon-bridge.service.js +44 -7
- package/dist/core/addon-pages/addon-pages.service.js +40 -3
- package/dist/core/addon-widgets/addon-widgets.service.js +42 -4
- package/dist/core/agent/agent-addon-backfill.js +17 -9
- package/dist/core/agent/agent-delivery-ledger.js +7 -3
- package/dist/core/agent/agent-liveness-event.js +6 -2
- package/dist/core/agent/agent-pairing-http.js +45 -41
- package/dist/core/agent/agent-registry.service.js +89 -50
- package/dist/core/agent/cluster-node-history-mirror.js +7 -3
- package/dist/core/agent/cluster-node-history-store.js +35 -31
- package/dist/core/agent/hub-agent-pairing.js +5 -1
- package/dist/core/agent/node-certificates-client.js +6 -3
- package/dist/core/agent/node-directory.js +4 -1
- package/dist/core/app-links/well-known-app-links.js +6 -2
- package/dist/core/auth/auth.service.js +8 -3
- package/dist/core/auth/handoff-code.service.js +49 -11
- package/dist/core/auth/record-kinds.js +19 -16
- package/dist/core/auth/share-token.service.js +79 -42
- package/dist/core/capability/capability.service.js +5 -1
- package/dist/core/config/config.schema.js +6 -1
- package/dist/core/config/config.service.js +6 -2
- package/dist/core/events/event-bus.service.js +7 -3
- package/dist/core/feature/feature.service.js +6 -2
- package/dist/core/lifecycle/lifecycle-runner.singleton.js +10 -5
- package/dist/core/lifecycle/lifecycle-state-machine.js +5 -1
- package/dist/core/logging/log-ring-buffer.js +5 -1
- package/dist/core/logging/logging.service.js +9 -5
- package/dist/core/logging/scoped-logger.js +5 -1
- package/dist/core/moleculer/agent-readiness-pull.js +4 -1
- package/dist/core/moleculer/agent-registration-request.js +7 -3
- package/dist/core/moleculer/cap-call-fn.js +7 -4
- package/dist/core/moleculer/cap-route-authority.js +8 -3
- package/dist/core/moleculer/hub-mesh-guard.js +9 -5
- package/dist/core/moleculer/moleculer.service.js +86 -79
- package/dist/core/network/network-quality.service.js +6 -2
- package/dist/core/notification/notification-wrapper.service.js +7 -3
- package/dist/core/notification/toast-wrapper.service.js +7 -3
- package/dist/core/provider/provider.tokens.js +4 -1
- package/dist/core/repl/repl-engine.service.js +8 -4
- package/dist/core/runner-health/runner-boot-check.js +15 -7
- package/dist/core/runner-health/update-preflight.js +14 -9
- package/dist/core/server-update/server-update.service.js +49 -12
- package/dist/core/server-update/system-apply-closure-patches.js +42 -6
- package/dist/core/server-update/system-ensure-prebuilds.js +6 -3
- package/dist/core/server-update/system-exec-npm.js +5 -2
- package/dist/core/storage/fs-storage-backend.js +5 -1
- package/dist/core/storage/storage-location-manager.js +5 -1
- package/dist/core/storage/storage.service.js +6 -2
- package/dist/core/streaming/ffmpeg-stream-info.js +8 -3
- package/dist/core/streaming/stream-probe.service.js +16 -12
- package/dist/core/streaming/ttl-cache.js +5 -1
- package/dist/core/topology/topology-emitter.service.js +23 -19
- package/dist/core/update-availability-emitter.js +7 -3
- package/dist/core/update-availability-store.js +45 -8
- package/dist/core/updates/agent-installed-packages.js +9 -5
- package/dist/core/updates/restart-marker.js +8 -3
- package/dist/core/updates/update-check-scheduler.js +18 -13
- package/dist/core/updates/wrapper-update-checker.js +7 -3
- package/dist/first-boot-addon-plan.js +6 -2
- package/dist/framework-nodepath.js +38 -2
- package/dist/i18n/request-lang.js +11 -7
- package/dist/launcher.js +65 -30
- package/dist/lifecycle-journal-path.js +38 -2
- package/dist/main.js +324 -286
- package/dist/manual-boot.js +156 -117
- package/dist/node-role.js +4 -1
- package/dist/package-inventory.js +48 -7
- package/dist/pending-restore.js +43 -7
- package/dist/single-copy-cleanup-runner.js +45 -9
- package/dist/single-copy-cleanup.js +15 -7
- package/dist/sqlite-restore.js +48 -9
- package/dist/starter.js +39 -4
- package/dist/ui-serving/lazy-ui-serving.js +39 -3
- package/package.json +1 -1
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunnerBootCheckService = exports.RUNNER_BOOT_CHECK_DELAY_MS = void 0;
|
|
4
|
+
exports.evaluateRunnerBootCheck = evaluateRunnerBootCheck;
|
|
5
|
+
exports.isRunnerBootCheckSettled = isRunnerBootCheckSettled;
|
|
6
|
+
exports.isRunnerBootCheckDegraded = isRunnerBootCheckDegraded;
|
|
7
|
+
exports.describeRunnerBootCheck = describeRunnerBootCheck;
|
|
1
8
|
/**
|
|
2
9
|
* Pure verdict. A planned runner is `running`, `refused` (typed Init refusal),
|
|
3
10
|
* `missing` (the process service has no entry), or `failed` - which here means
|
|
4
11
|
* "has an entry and is none of the above": the D6 breaker's terminal state, a
|
|
5
12
|
* crash waiting on its backoff, a stop, or a start that never reached READY.
|
|
6
13
|
*/
|
|
7
|
-
|
|
14
|
+
function evaluateRunnerBootCheck(input) {
|
|
8
15
|
const byName = new Map(input.processes.map((p) => [p.name, p]));
|
|
9
16
|
const expectedIds = input.planned ?? input.processes.map((p) => p.name);
|
|
10
17
|
const failed = [];
|
|
@@ -48,16 +55,16 @@ export function evaluateRunnerBootCheck(input) {
|
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
/** True when no runner is still on its way - only a settled verdict is pushed. */
|
|
51
|
-
|
|
58
|
+
function isRunnerBootCheckSettled(check) {
|
|
52
59
|
return (check.pending ?? []).length === 0;
|
|
53
60
|
}
|
|
54
61
|
/** True when the check found anything an operator has to act on. */
|
|
55
|
-
|
|
62
|
+
function isRunnerBootCheckDegraded(check) {
|
|
56
63
|
return (check !== undefined &&
|
|
57
64
|
(check.failed.length > 0 || check.refused.length > 0 || check.missing.length > 0));
|
|
58
65
|
}
|
|
59
66
|
/** One sentence naming the findings, for a log line or an alert. */
|
|
60
|
-
|
|
67
|
+
function describeRunnerBootCheck(check) {
|
|
61
68
|
const parts = [];
|
|
62
69
|
if (check.failed.length > 0)
|
|
63
70
|
parts.push(`failed: ${check.failed.join(', ')}`);
|
|
@@ -70,8 +77,8 @@ export function describeRunnerBootCheck(check) {
|
|
|
70
77
|
parts.push(`still starting: ${(check.pending ?? []).join(', ')}`);
|
|
71
78
|
return `${check.running}/${check.expected} runners running${parts.length > 0 ? ` - ${parts.join(' - ')}` : ''}`;
|
|
72
79
|
}
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
exports.RUNNER_BOOT_CHECK_DELAY_MS = 60_000;
|
|
81
|
+
class RunnerBootCheckService {
|
|
75
82
|
options;
|
|
76
83
|
latest;
|
|
77
84
|
timer = null;
|
|
@@ -83,7 +90,7 @@ export class RunnerBootCheckService {
|
|
|
83
90
|
return this.latest;
|
|
84
91
|
}
|
|
85
92
|
/** Arm the one-shot check. A second call while armed is a no-op. */
|
|
86
|
-
scheduleAfterBoot(delayMs = RUNNER_BOOT_CHECK_DELAY_MS) {
|
|
93
|
+
scheduleAfterBoot(delayMs = exports.RUNNER_BOOT_CHECK_DELAY_MS) {
|
|
87
94
|
if (this.timer !== null)
|
|
88
95
|
return;
|
|
89
96
|
this.timer = setTimeout(() => {
|
|
@@ -165,3 +172,4 @@ export class RunnerBootCheckService {
|
|
|
165
172
|
return check;
|
|
166
173
|
}
|
|
167
174
|
}
|
|
175
|
+
exports.RunnerBootCheckService = RunnerBootCheckService;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEGACY_BLOB_GUARD_SINCE = void 0;
|
|
4
|
+
exports.buildUpdatePreflight = buildUpdatePreflight;
|
|
5
|
+
exports.legacyGuardClientOf = legacyGuardClientOf;
|
|
1
6
|
/**
|
|
2
7
|
* The `applyServerUpdate` pre-flight (D877).
|
|
3
8
|
*
|
|
@@ -15,13 +20,13 @@
|
|
|
15
20
|
* the refusals listed here - a new deterministic Init refusal has to be added
|
|
16
21
|
* to this module to be pre-checked.
|
|
17
22
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const system_1 = require("@camstack/system");
|
|
24
|
+
const index_js_1 = require("../../server-root/index.js");
|
|
20
25
|
/** The first server version whose addons run `assertLegacyBlobsMigrated` at Init. */
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
exports.LEGACY_BLOB_GUARD_SINCE = '1.2.585';
|
|
27
|
+
function buildUpdatePreflight(deps) {
|
|
23
28
|
return async (targetVersion) => {
|
|
24
|
-
if (compareSemver(targetVersion, LEGACY_BLOB_GUARD_SINCE) < 0)
|
|
29
|
+
if ((0, index_js_1.compareSemver)(targetVersion, exports.LEGACY_BLOB_GUARD_SINCE) < 0)
|
|
25
30
|
return [];
|
|
26
31
|
const store = deps.store();
|
|
27
32
|
if (store === null) {
|
|
@@ -30,17 +35,17 @@ export function buildUpdatePreflight(deps) {
|
|
|
30
35
|
const blockers = [];
|
|
31
36
|
for (const addonId of deps.forkedAddonIds()) {
|
|
32
37
|
try {
|
|
33
|
-
await assertLegacyBlobsMigrated(store, addonId, deps.logger);
|
|
38
|
+
await (0, system_1.assertLegacyBlobsMigrated)(store, addonId, deps.logger);
|
|
34
39
|
}
|
|
35
40
|
catch (err) {
|
|
36
41
|
// A refusal is the finding; any other error is "could not ask" and the
|
|
37
42
|
// caller treats a throw as exactly that (it never blocks on it).
|
|
38
|
-
if (!(err instanceof UnmigratedSettingsError))
|
|
43
|
+
if (!(err instanceof system_1.UnmigratedSettingsError))
|
|
39
44
|
throw err;
|
|
40
45
|
blockers.push({
|
|
41
46
|
addonId,
|
|
42
47
|
reason: err.message,
|
|
43
|
-
remedy: UNMIGRATED_SETTINGS_REMEDY,
|
|
48
|
+
remedy: system_1.UNMIGRATED_SETTINGS_REMEDY,
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
}
|
|
@@ -48,7 +53,7 @@ export function buildUpdatePreflight(deps) {
|
|
|
48
53
|
};
|
|
49
54
|
}
|
|
50
55
|
/** The three store calls the guard makes, over the hub's `settings-store` provider. */
|
|
51
|
-
|
|
56
|
+
function legacyGuardClientOf(store) {
|
|
52
57
|
return {
|
|
53
58
|
query: { query: (input) => store.query(input) },
|
|
54
59
|
get: { query: (input) => store.get(input) },
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ServerUpdateService = void 0;
|
|
1
37
|
/**
|
|
2
38
|
* ServerUpdateService — hub-side adapter over the SHARED `RootUpdateService`
|
|
3
39
|
* (`@camstack/node-root`, bundled into `dist/server-root/index.js`).
|
|
@@ -15,13 +51,13 @@
|
|
|
15
51
|
*
|
|
16
52
|
* Spec: docs/superpowers/specs/2026-07-18-single-framework-copy-collapse-design.md
|
|
17
53
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
54
|
+
const path = __importStar(require("node:path"));
|
|
55
|
+
const index_js_1 = require("../../server-root/index.js");
|
|
56
|
+
const update_availability_emitter_js_1 = require("../update-availability-emitter.js");
|
|
57
|
+
const system_ensure_prebuilds_js_1 = require("./system-ensure-prebuilds.js");
|
|
58
|
+
const system_apply_closure_patches_js_1 = require("./system-apply-closure-patches.js");
|
|
59
|
+
const system_exec_npm_js_1 = require("./system-exec-npm.js");
|
|
60
|
+
class ServerUpdateService extends index_js_1.RootUpdateService {
|
|
25
61
|
updateAvailability;
|
|
26
62
|
nodeId;
|
|
27
63
|
constructor(options) {
|
|
@@ -34,7 +70,7 @@ export class ServerUpdateService extends RootUpdateService {
|
|
|
34
70
|
// the availability emitter.
|
|
35
71
|
const nodeId = options.nodeId ?? 'hub';
|
|
36
72
|
super({
|
|
37
|
-
spec: HUB_ROOT_SPEC,
|
|
73
|
+
spec: index_js_1.HUB_ROOT_SPEC,
|
|
38
74
|
nodeId,
|
|
39
75
|
envNames: {
|
|
40
76
|
bootMode: 'CAMSTACK_SERVER_BOOT_MODE',
|
|
@@ -52,19 +88,19 @@ export class ServerUpdateService extends RootUpdateService {
|
|
|
52
88
|
// packaged desktop app with a bare bundled Node) can still stage a root
|
|
53
89
|
// update. `cacheDir` mirrors AddonInstaller's `<dataDir>/addons/.npm-bootstrap`.
|
|
54
90
|
execNpm: options.execNpm ??
|
|
55
|
-
buildSystemExecNpm({
|
|
91
|
+
(0, system_exec_npm_js_1.buildSystemExecNpm)({
|
|
56
92
|
cacheDir: path.join(dataDir, 'addons', '.npm-bootstrap'),
|
|
57
93
|
logger: options.logger,
|
|
58
94
|
}),
|
|
59
95
|
// Fetch a missing `better-sqlite3` prebuild for the running ABI before the
|
|
60
96
|
// native-prebuild validator refuses the swap (toolchain-less packaged
|
|
61
97
|
// desktop). No-op on docker where the install already carried it.
|
|
62
|
-
ensureNativePrebuilds: options.ensureNativePrebuilds ?? buildSystemEnsureNativePrebuilds(options.logger),
|
|
98
|
+
ensureNativePrebuilds: options.ensureNativePrebuilds ?? (0, system_ensure_prebuilds_js_1.buildSystemEnsureNativePrebuilds)(options.logger),
|
|
63
99
|
// Apply the closure patches ourselves. npm 12 blocks the root package's
|
|
64
100
|
// postinstall by default, and a silently-unpatched closure is refused by
|
|
65
101
|
// the validator — an update that can never apply. Idempotent, so this
|
|
66
102
|
// costs nothing where npm did run the lifecycle.
|
|
67
|
-
applyClosurePatches: options.applyClosurePatches ?? buildSystemApplyClosurePatches(options.logger),
|
|
103
|
+
applyClosurePatches: options.applyClosurePatches ?? (0, system_apply_closure_patches_js_1.buildSystemApplyClosurePatches)(options.logger),
|
|
68
104
|
env: options.env,
|
|
69
105
|
now: options.now,
|
|
70
106
|
...(options.updatePreflight !== undefined
|
|
@@ -76,7 +112,7 @@ export class ServerUpdateService extends RootUpdateService {
|
|
|
76
112
|
});
|
|
77
113
|
this.updateAvailability =
|
|
78
114
|
options.eventBus !== undefined
|
|
79
|
-
? new UpdateAvailabilityEmitter(options.eventBus, { type: 'core', id: 'server-update-service' }, options.updateAvailabilityStore)
|
|
115
|
+
? new update_availability_emitter_js_1.UpdateAvailabilityEmitter(options.eventBus, { type: 'core', id: 'server-update-service' }, options.updateAvailabilityStore)
|
|
80
116
|
: null;
|
|
81
117
|
this.nodeId = nodeId;
|
|
82
118
|
}
|
|
@@ -99,3 +135,4 @@ export class ServerUpdateService extends RootUpdateService {
|
|
|
99
135
|
return result;
|
|
100
136
|
}
|
|
101
137
|
}
|
|
138
|
+
exports.ServerUpdateService = ServerUpdateService;
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.buildSystemApplyClosurePatches = buildSystemApplyClosurePatches;
|
|
1
37
|
/**
|
|
2
38
|
* `buildSystemApplyClosurePatches` — run the root package's OWN shipped patch
|
|
3
39
|
* applier inside a staged closure, without going through npm.
|
|
@@ -33,16 +69,16 @@
|
|
|
33
69
|
* with `PATH=/usr/bin:/bin:/usr/sbin:/sbin`), so resolving `node` by name would
|
|
34
70
|
* ENOENT on exactly the host this was written for.
|
|
35
71
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const execFileAsync = promisify(execFile);
|
|
72
|
+
const node_child_process_1 = require("node:child_process");
|
|
73
|
+
const fs = __importStar(require("node:fs"));
|
|
74
|
+
const path = __importStar(require("node:path"));
|
|
75
|
+
const node_util_1 = require("node:util");
|
|
76
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
41
77
|
/** Where the published root package keeps its applier, inside a closure. */
|
|
42
78
|
const APPLIER_REL = ['node_modules', '@camstack', 'server', 'scripts', 'closure-postinstall.mjs'];
|
|
43
79
|
/** A patch pass must never be the slow part of an update. */
|
|
44
80
|
const APPLY_TIMEOUT_MS = 60_000;
|
|
45
|
-
|
|
81
|
+
function buildSystemApplyClosurePatches(logger) {
|
|
46
82
|
return async (closureDir) => {
|
|
47
83
|
const applier = path.join(closureDir, ...APPLIER_REL);
|
|
48
84
|
if (!fs.existsSync(applier)) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSystemEnsureNativePrebuilds = buildSystemEnsureNativePrebuilds;
|
|
1
4
|
/**
|
|
2
5
|
* `buildSystemEnsureNativePrebuilds` — the `@camstack/system`-backed
|
|
3
6
|
* `ensureNativePrebuilds` adapter the shared `RootUpdateService` uses as its
|
|
@@ -11,9 +14,9 @@
|
|
|
11
14
|
* already landed → a no-op); it only acts on a toolchain-less packaged desktop
|
|
12
15
|
* whose `npm install` left `better-sqlite3` source-only.
|
|
13
16
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
const system_1 = require("@camstack/system");
|
|
18
|
+
function buildSystemEnsureNativePrebuilds(logger) {
|
|
16
19
|
return async (closureDir) => {
|
|
17
|
-
await ensureNativePrebuilds(closureDir, { logger });
|
|
20
|
+
await (0, system_1.ensureNativePrebuilds)(closureDir, { logger });
|
|
18
21
|
};
|
|
19
22
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSystemExecNpm = buildSystemExecNpm;
|
|
1
4
|
/**
|
|
2
5
|
* `buildSystemExecNpm` — the runNpm-backed `execNpm` the shared
|
|
3
6
|
* `RootUpdateService` uses to shell out to npm when staging a root-package
|
|
@@ -15,8 +18,8 @@
|
|
|
15
18
|
* `runNpmFn` is a module-level DI seam (defaults to the real `runNpm`) so the
|
|
16
19
|
* arg/cwd/timeout mapping is unit-testable without touching the network.
|
|
17
20
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const system_1 = require("@camstack/system");
|
|
22
|
+
function buildSystemExecNpm(options, runNpmFn = system_1.runNpm) {
|
|
20
23
|
return async (args, opts) => {
|
|
21
24
|
const { stdout } = await runNpmFn(args, {
|
|
22
25
|
cacheDir: options.cacheDir,
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FsStorageBackend = void 0;
|
|
1
4
|
// Re-export from @camstack/system
|
|
2
|
-
|
|
5
|
+
var system_1 = require("@camstack/system");
|
|
6
|
+
Object.defineProperty(exports, "FsStorageBackend", { enumerable: true, get: function () { return system_1.FsStorageBackend; } });
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageLocationManager = void 0;
|
|
1
4
|
// Re-export from @camstack/system
|
|
2
|
-
|
|
5
|
+
var system_1 = require("@camstack/system");
|
|
6
|
+
Object.defineProperty(exports, "StorageLocationManager", { enumerable: true, get: function () { return system_1.StorageLocationManager; } });
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageService = void 0;
|
|
4
|
+
const system_1 = require("@camstack/system");
|
|
5
|
+
class StorageService extends system_1.StorageManager {
|
|
3
6
|
}
|
|
7
|
+
exports.StorageService = StorageService;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildStreamProbeArgs = buildStreamProbeArgs;
|
|
4
|
+
exports.probeFoundAStream = probeFoundAStream;
|
|
5
|
+
exports.parseFfmpegStreamInfo = parseFfmpegStreamInfo;
|
|
1
6
|
/** How long the probe waits on a network input, in µs (ffmpeg's unit). */
|
|
2
7
|
const PROBE_INPUT_TIMEOUT_US = '5000000';
|
|
3
8
|
/**
|
|
@@ -9,7 +14,7 @@ const PROBE_INPUT_TIMEOUT_US = '5000000';
|
|
|
9
14
|
* `-timeout` is an http and rtsp option, is unknown to a file, and on rtmp
|
|
10
15
|
* would mean LISTEN mode. So each scheme gets exactly what it consumes.
|
|
11
16
|
*/
|
|
12
|
-
|
|
17
|
+
function buildStreamProbeArgs(url) {
|
|
13
18
|
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(url)?.[1]?.toLowerCase() ?? '';
|
|
14
19
|
const input = [];
|
|
15
20
|
if (scheme === 'rtsp' || scheme === 'rtsps') {
|
|
@@ -21,7 +26,7 @@ export function buildStreamProbeArgs(url) {
|
|
|
21
26
|
return ['-hide_banner', '-nostdin', ...input, '-i', url];
|
|
22
27
|
}
|
|
23
28
|
/** Did the probe find anything at all? An empty result is a failed probe. */
|
|
24
|
-
|
|
29
|
+
function probeFoundAStream(meta) {
|
|
25
30
|
return meta.codec !== undefined || meta.audio !== undefined;
|
|
26
31
|
}
|
|
27
32
|
/** Codec aliases normalised to canonical names. */
|
|
@@ -115,7 +120,7 @@ function readAudio(body) {
|
|
|
115
120
|
return audio;
|
|
116
121
|
}
|
|
117
122
|
/** The FIRST video and FIRST audio stream of `ffmpeg -i`'s report. */
|
|
118
|
-
|
|
123
|
+
function parseFfmpegStreamInfo(stderr) {
|
|
119
124
|
const meta = {};
|
|
120
125
|
// CRLF too: `(.*)$` cannot cross a `\r`, and a Windows build or a captured
|
|
121
126
|
// log hands one over.
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamProbeService = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const ttl_cache_1 = require("./ttl-cache");
|
|
6
|
+
const types_1 = require("@camstack/types");
|
|
7
|
+
const ffmpeg_stream_info_1 = require("./ffmpeg-stream-info");
|
|
5
8
|
const CACHE_TTL_MS = 3_600_000; // 1 hour
|
|
6
9
|
const PROBE_TIMEOUT_MS = 5_000;
|
|
7
10
|
/**
|
|
@@ -19,7 +22,7 @@ const CACHE_MAX_ENTRIES = 512;
|
|
|
19
22
|
function redactUrl(text) {
|
|
20
23
|
return text.replace(/\/\/[^@/\s]*@/g, '//***@');
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
class StreamProbeService {
|
|
23
26
|
resolveFfmpeg;
|
|
24
27
|
logger;
|
|
25
28
|
/**
|
|
@@ -29,7 +32,7 @@ export class StreamProbeService {
|
|
|
29
32
|
* was probed again — so an entry nobody asked about a second time was never
|
|
30
33
|
* found expired and never removed. See {@link TtlCache}.
|
|
31
34
|
*/
|
|
32
|
-
cache = new TtlCache({
|
|
35
|
+
cache = new ttl_cache_1.TtlCache({
|
|
33
36
|
ttlMs: CACHE_TTL_MS,
|
|
34
37
|
maxEntries: CACHE_MAX_ENTRIES,
|
|
35
38
|
});
|
|
@@ -54,7 +57,7 @@ export class StreamProbeService {
|
|
|
54
57
|
// Only an ANSWER is cached. An empty result is a probe that failed (no
|
|
55
58
|
// binary, a timeout, a refused dial), and caching it for an hour made one
|
|
56
59
|
// bad moment the answer for an hour.
|
|
57
|
-
if (probeFoundAStream(metadata))
|
|
60
|
+
if ((0, ffmpeg_stream_info_1.probeFoundAStream)(metadata))
|
|
58
61
|
this.cache.set(url, metadata);
|
|
59
62
|
return metadata;
|
|
60
63
|
}
|
|
@@ -121,7 +124,7 @@ export class StreamProbeService {
|
|
|
121
124
|
// We aborted intentionally after reading headers — that's success
|
|
122
125
|
return { status: 'ok', labels: ['Reachable'] };
|
|
123
126
|
}
|
|
124
|
-
const msg = errMsg(err);
|
|
127
|
+
const msg = (0, types_1.errMsg)(err);
|
|
125
128
|
return { status: 'error', error: `Unreachable: ${msg}` };
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -146,7 +149,7 @@ export class StreamProbeService {
|
|
|
146
149
|
}
|
|
147
150
|
catch (err) {
|
|
148
151
|
this.logger.error('stream probe refused — no pinned ffmpeg on this node (D540)', {
|
|
149
|
-
meta: { url: redactUrl(url), error: errMsg(err) },
|
|
152
|
+
meta: { url: redactUrl(url), error: (0, types_1.errMsg)(err) },
|
|
150
153
|
});
|
|
151
154
|
return {};
|
|
152
155
|
}
|
|
@@ -154,10 +157,10 @@ export class StreamProbeService {
|
|
|
154
157
|
// exits non-zero for want of an output. That exit is the expected one, so
|
|
155
158
|
// the report is read whatever the code; an empty report is the failure.
|
|
156
159
|
const stderr = await new Promise((resolve) => {
|
|
157
|
-
execFile(ffmpeg, buildStreamProbeArgs(url), { timeout: PROBE_TIMEOUT_MS, encoding: 'utf8' }, (_err, _stdout, errText) => resolve(errText));
|
|
160
|
+
(0, child_process_1.execFile)(ffmpeg, (0, ffmpeg_stream_info_1.buildStreamProbeArgs)(url), { timeout: PROBE_TIMEOUT_MS, encoding: 'utf8' }, (_err, _stdout, errText) => resolve(errText));
|
|
158
161
|
});
|
|
159
|
-
const metadata = parseFfmpegStreamInfo(stderr);
|
|
160
|
-
if (!probeFoundAStream(metadata)) {
|
|
162
|
+
const metadata = (0, ffmpeg_stream_info_1.parseFfmpegStreamInfo)(stderr);
|
|
163
|
+
if (!(0, ffmpeg_stream_info_1.probeFoundAStream)(metadata)) {
|
|
161
164
|
this.logger.error('stream probe found no stream', {
|
|
162
165
|
meta: { url: redactUrl(url), stderr: redactUrl(stderr.trim().slice(-500)) },
|
|
163
166
|
});
|
|
@@ -165,3 +168,4 @@ export class StreamProbeService {
|
|
|
165
168
|
return metadata;
|
|
166
169
|
}
|
|
167
170
|
}
|
|
171
|
+
exports.StreamProbeService = StreamProbeService;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TtlCache = void 0;
|
|
4
|
+
class TtlCache {
|
|
2
5
|
entries = new Map();
|
|
3
6
|
ttlMs;
|
|
4
7
|
maxEntries;
|
|
@@ -66,3 +69,4 @@ export class TtlCache {
|
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
}
|
|
72
|
+
exports.TtlCache = TtlCache;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TopologyEmitterService = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* TopologyEmitterService — push the cluster topology over the event bus.
|
|
3
6
|
*
|
|
@@ -12,26 +15,26 @@
|
|
|
12
15
|
* subscribe to the snapshot category and read state directly from the
|
|
13
16
|
* payload — zero round-trip.
|
|
14
17
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const node_crypto_1 = require("node:crypto");
|
|
19
|
+
const types_1 = require("@camstack/types");
|
|
20
|
+
const cap_providers_1 = require("../../api/core/cap-providers");
|
|
18
21
|
const DEBOUNCE_MS = 200;
|
|
19
22
|
const HEARTBEAT_MS = 30_000;
|
|
20
23
|
const LIFECYCLE_CATEGORIES = [
|
|
21
|
-
EventCategory.AgentOnline,
|
|
22
|
-
EventCategory.AgentOffline,
|
|
23
|
-
EventCategory.WorkerOnline,
|
|
24
|
-
EventCategory.WorkerOffline,
|
|
25
|
-
EventCategory.AgentUnregistered,
|
|
26
|
-
EventCategory.AddonStarted,
|
|
27
|
-
EventCategory.AddonStopped,
|
|
28
|
-
EventCategory.AddonRestarted,
|
|
29
|
-
EventCategory.AddonInstalled,
|
|
30
|
-
EventCategory.AddonUninstalled,
|
|
31
|
-
EventCategory.AddonUpdated,
|
|
32
|
-
EventCategory.AddonCrashed,
|
|
24
|
+
types_1.EventCategory.AgentOnline,
|
|
25
|
+
types_1.EventCategory.AgentOffline,
|
|
26
|
+
types_1.EventCategory.WorkerOnline,
|
|
27
|
+
types_1.EventCategory.WorkerOffline,
|
|
28
|
+
types_1.EventCategory.AgentUnregistered,
|
|
29
|
+
types_1.EventCategory.AddonStarted,
|
|
30
|
+
types_1.EventCategory.AddonStopped,
|
|
31
|
+
types_1.EventCategory.AddonRestarted,
|
|
32
|
+
types_1.EventCategory.AddonInstalled,
|
|
33
|
+
types_1.EventCategory.AddonUninstalled,
|
|
34
|
+
types_1.EventCategory.AddonUpdated,
|
|
35
|
+
types_1.EventCategory.AddonCrashed,
|
|
33
36
|
];
|
|
34
|
-
|
|
37
|
+
class TopologyEmitterService {
|
|
35
38
|
eventBus;
|
|
36
39
|
agentRegistry;
|
|
37
40
|
addonRegistry;
|
|
@@ -90,12 +93,12 @@ export class TopologyEmitterService {
|
|
|
90
93
|
return;
|
|
91
94
|
this.emitting = true;
|
|
92
95
|
try {
|
|
93
|
-
const { nodes, liveNodes } = await computeTopologyPass(this.agentRegistry, this.addonRegistry, this.getNodeRootPackage, this.isNodeRegistered);
|
|
96
|
+
const { nodes, liveNodes } = await (0, cap_providers_1.computeTopologyPass)(this.agentRegistry, this.addonRegistry, this.getNodeRootPackage, this.isNodeRegistered);
|
|
94
97
|
this.eventBus.emit({
|
|
95
|
-
id: randomUUID(),
|
|
98
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
96
99
|
timestamp: new Date(),
|
|
97
100
|
source: { type: 'core', id: 'topology-emitter' },
|
|
98
|
-
category: EventCategory.ClusterTopologySnapshot,
|
|
101
|
+
category: types_1.EventCategory.ClusterTopologySnapshot,
|
|
99
102
|
data: { nodes, timestamp: Date.now() },
|
|
100
103
|
});
|
|
101
104
|
// The durable capture rides THIS pass, not an operator's read (D317).
|
|
@@ -114,3 +117,4 @@ export class TopologyEmitterService {
|
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
}
|
|
120
|
+
exports.TopologyEmitterService = TopologyEmitterService;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateAvailabilityEmitter = void 0;
|
|
4
|
+
const types_1 = require("@camstack/types");
|
|
2
5
|
/**
|
|
3
6
|
* Emits update availability only when a successful check changes an observed
|
|
4
7
|
* `latestVersion` (or first-sees a package/node that has one). Repeated polls
|
|
@@ -23,7 +26,7 @@ import { EventCategory } from '@camstack/types';
|
|
|
23
26
|
* genuinely newer version still announces. Without one the emitter stays
|
|
24
27
|
* RAM-only (the shape every unit test uses).
|
|
25
28
|
*/
|
|
26
|
-
|
|
29
|
+
class UpdateAvailabilityEmitter {
|
|
27
30
|
eventBus;
|
|
28
31
|
source;
|
|
29
32
|
store;
|
|
@@ -141,7 +144,7 @@ export class UpdateAvailabilityEmitter {
|
|
|
141
144
|
.join(',')}`,
|
|
142
145
|
timestamp: new Date(),
|
|
143
146
|
source: this.source,
|
|
144
|
-
category: EventCategory.UpdateAvailable,
|
|
147
|
+
category: types_1.EventCategory.UpdateAvailable,
|
|
145
148
|
data: {
|
|
146
149
|
target,
|
|
147
150
|
packageName: head.packageName,
|
|
@@ -158,6 +161,7 @@ export class UpdateAvailabilityEmitter {
|
|
|
158
161
|
return `${candidate.target}:${scopeOf(candidate)}:${candidate.packageName}`;
|
|
159
162
|
}
|
|
160
163
|
}
|
|
164
|
+
exports.UpdateAvailabilityEmitter = UpdateAvailabilityEmitter;
|
|
161
165
|
/** The node an availability row belongs to. A row without one is the hub's. */
|
|
162
166
|
function scopeOf(candidate) {
|
|
163
167
|
return candidate.nodeId ?? 'hub';
|