@camstack/server 1.2.594 → 1.2.596
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 +225 -219
- package/dist/api/trpc/generated-cap-routers.js +5167 -4852
- 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 +7 -7
|
@@ -1,30 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.AddonPackageService = exports.FRAMEWORK_PACKAGES = exports.AUTO_UPDATE_EXCLUDED_PACKAGES = exports.SYSTEM_PACKAGE = void 0;
|
|
37
|
+
exports.isVersionNewer = isVersionNewer;
|
|
38
|
+
exports.isFrameworkPackage = isFrameworkPackage;
|
|
39
|
+
exports.extractTgzStripped = extractTgzStripped;
|
|
40
|
+
const types_1 = require("@camstack/types");
|
|
41
|
+
const node_child_process_1 = require("node:child_process");
|
|
42
|
+
const node_crypto_1 = require("node:crypto");
|
|
43
|
+
const fs = __importStar(require("node:fs"));
|
|
44
|
+
const os = __importStar(require("node:os"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const node_util_1 = require("node:util");
|
|
47
|
+
const system_1 = require("@camstack/system");
|
|
48
|
+
const types_2 = require("@camstack/types");
|
|
49
|
+
const update_availability_emitter_js_1 = require("../update-availability-emitter.js");
|
|
50
|
+
const update_check_scheduler_js_1 = require("../updates/update-check-scheduler.js");
|
|
51
|
+
const restart_marker_js_1 = require("../updates/restart-marker.js");
|
|
52
|
+
const package_dir_utils_js_1 = require("./package-dir-utils.js");
|
|
53
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
15
54
|
/**
|
|
16
55
|
* The primary host-provided framework package (kernel + core). Kept as a named
|
|
17
56
|
* export because `lifecycle-job-runner` + several tests reference it directly.
|
|
18
57
|
*/
|
|
19
|
-
|
|
58
|
+
exports.SYSTEM_PACKAGE = '@camstack/system';
|
|
20
59
|
/**
|
|
21
60
|
* Packages the npm auto-updater must NEVER touch: the framework/system tier
|
|
22
61
|
* ships exclusively via `applyServerUpdate` (single-copy collapse). Listed
|
|
23
62
|
* explicitly (not via a manifest flag) because the updater runs against
|
|
24
63
|
* `listInstalled()` package names before any manifest is loaded.
|
|
25
64
|
*/
|
|
26
|
-
|
|
27
|
-
SYSTEM_PACKAGE,
|
|
65
|
+
exports.AUTO_UPDATE_EXCLUDED_PACKAGES = new Set([
|
|
66
|
+
exports.SYSTEM_PACKAGE,
|
|
28
67
|
'@camstack/types',
|
|
29
68
|
'@camstack/kernel',
|
|
30
69
|
'@camstack/core',
|
|
@@ -40,7 +79,7 @@ export const AUTO_UPDATE_EXCLUDED_PACKAGES = new Set([
|
|
|
40
79
|
* 1.2.6); when both carry prereleases they compare lexicographically.
|
|
41
80
|
* Unparseable versions are never "newer" (fail safe: no update).
|
|
42
81
|
*/
|
|
43
|
-
|
|
82
|
+
function isVersionNewer(target, current) {
|
|
44
83
|
const parse = (v) => {
|
|
45
84
|
const m = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
|
|
46
85
|
if (!m)
|
|
@@ -81,8 +120,8 @@ export function isVersionNewer(target, current) {
|
|
|
81
120
|
* flag (`@camstack/types` declares `system: false` yet is a framework package
|
|
82
121
|
* here) — that flag drives Admin-UI grouping; this gate drives upload routing.
|
|
83
122
|
*/
|
|
84
|
-
|
|
85
|
-
SYSTEM_PACKAGE,
|
|
123
|
+
exports.FRAMEWORK_PACKAGES = [
|
|
124
|
+
exports.SYSTEM_PACKAGE,
|
|
86
125
|
'@camstack/types',
|
|
87
126
|
'@camstack/sdk',
|
|
88
127
|
];
|
|
@@ -90,8 +129,8 @@ export const FRAMEWORK_PACKAGES = [
|
|
|
90
129
|
* Returns true for a host-provided framework package (special-cased by the
|
|
91
130
|
* addon-upload route — never installed as a normal addon).
|
|
92
131
|
*/
|
|
93
|
-
|
|
94
|
-
return FRAMEWORK_PACKAGES.includes(packageName);
|
|
132
|
+
function isFrameworkPackage(packageName) {
|
|
133
|
+
return exports.FRAMEWORK_PACKAGES.includes(packageName);
|
|
95
134
|
}
|
|
96
135
|
// ---------------------------------------------------------------------------
|
|
97
136
|
// Typed JSON helpers
|
|
@@ -138,7 +177,7 @@ function asRecord(value) {
|
|
|
138
177
|
// ---------------------------------------------------------------------------
|
|
139
178
|
/** Core packages that live in the server's own node_modules */
|
|
140
179
|
const CORE_MANAGED_PACKAGES = ['@camstack/system', '@camstack/types'];
|
|
141
|
-
|
|
180
|
+
class AddonPackageService {
|
|
142
181
|
loggingService;
|
|
143
182
|
eventBusService;
|
|
144
183
|
configService;
|
|
@@ -161,7 +200,7 @@ export class AddonPackageService {
|
|
|
161
200
|
global: {
|
|
162
201
|
channel: 'off',
|
|
163
202
|
intervalSeconds: 21600,
|
|
164
|
-
updateCheckIntervalSeconds: DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
203
|
+
updateCheckIntervalSeconds: update_check_scheduler_js_1.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
165
204
|
},
|
|
166
205
|
overrides: {},
|
|
167
206
|
};
|
|
@@ -197,12 +236,12 @@ export class AddonPackageService {
|
|
|
197
236
|
this.notificationService = notificationService;
|
|
198
237
|
this.toastService = toastService;
|
|
199
238
|
this.logger = this.loggingService.createLogger('AddonPackageService');
|
|
200
|
-
this.updateAvailability = new UpdateAvailabilityEmitter(this.eventBusService, { type: 'core', id: 'addon-package-service' }, updateAvailabilityStore);
|
|
239
|
+
this.updateAvailability = new update_availability_emitter_js_1.UpdateAvailabilityEmitter(this.eventBusService, { type: 'core', id: 'addon-package-service' }, updateAvailabilityStore);
|
|
201
240
|
// Initialize installer eagerly (no async needed).
|
|
202
241
|
// Ensures install/uninstall works before full module init completes.
|
|
203
242
|
try {
|
|
204
243
|
const addonsDir = this.resolveAddonsDir();
|
|
205
|
-
const workspacePackagesDir = detectWorkspacePackagesDir(__dirname);
|
|
244
|
+
const workspacePackagesDir = (0, system_1.detectWorkspacePackagesDir)(__dirname);
|
|
206
245
|
// `CAMSTACK_NPM_REGISTRY` override exists primarily for the e2e
|
|
207
246
|
// harness — it points the installer at a sandboxed verdaccio so
|
|
208
247
|
// the CLI-vs-npm version-interaction tests don't hit the public
|
|
@@ -211,15 +250,15 @@ export class AddonPackageService {
|
|
|
211
250
|
// AddonInstaller). Both the `npm install` shell-out AND the
|
|
212
251
|
// metadata HTTPS fetch honour this value.
|
|
213
252
|
const registry = process.env['CAMSTACK_NPM_REGISTRY'];
|
|
214
|
-
this.installer = new AddonInstaller({
|
|
253
|
+
this.installer = new system_1.AddonInstaller({
|
|
215
254
|
addonsDir,
|
|
216
255
|
workspacePackagesDir: workspacePackagesDir ?? undefined,
|
|
217
256
|
...(registry ? { registry } : {}),
|
|
218
257
|
});
|
|
219
|
-
ensureDir(addonsDir);
|
|
258
|
+
(0, system_1.ensureDir)(addonsDir);
|
|
220
259
|
}
|
|
221
260
|
catch (error) {
|
|
222
|
-
const msg = errMsg(error);
|
|
261
|
+
const msg = (0, types_2.errMsg)(error);
|
|
223
262
|
this.logger.warn('Installer init failed', { meta: { error: msg } });
|
|
224
263
|
}
|
|
225
264
|
// Load auto-update config from disk
|
|
@@ -263,7 +302,7 @@ export class AddonPackageService {
|
|
|
263
302
|
}
|
|
264
303
|
catch (err) {
|
|
265
304
|
this.logger.debug('Non-fatal: failed to write .install-source marker', {
|
|
266
|
-
meta: { error: errMsg(err) },
|
|
305
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
267
306
|
});
|
|
268
307
|
}
|
|
269
308
|
this.installer.manifest.upsert(result.name, {
|
|
@@ -288,9 +327,9 @@ export class AddonPackageService {
|
|
|
288
327
|
async rollbackPackage(name) {
|
|
289
328
|
this.requireInstaller();
|
|
290
329
|
if (!this.isAllowedPackage(name)) {
|
|
291
|
-
throw userError('server.package-not-allowed', { name: String(name) }, `Package "${name}" is not an allowed @camstack/* package`);
|
|
330
|
+
throw (0, types_1.userError)('server.package-not-allowed', { name: String(name) }, `Package "${name}" is not an allowed @camstack/* package`);
|
|
292
331
|
}
|
|
293
|
-
if (AUTO_UPDATE_EXCLUDED_PACKAGES.has(name)) {
|
|
332
|
+
if (exports.AUTO_UPDATE_EXCLUDED_PACKAGES.has(name)) {
|
|
294
333
|
throw new Error(`"${name}" is a framework package — roll it back via serverManagement, not the addon-package path`);
|
|
295
334
|
}
|
|
296
335
|
const previousVersion = this.getInstalledPackageVersion(name);
|
|
@@ -319,7 +358,7 @@ export class AddonPackageService {
|
|
|
319
358
|
}
|
|
320
359
|
catch (reloadError) {
|
|
321
360
|
this.logger.warn('Restart failed after rollback', {
|
|
322
|
-
meta: { name, error: errMsg(reloadError) },
|
|
361
|
+
meta: { name, error: (0, types_2.errMsg)(reloadError) },
|
|
323
362
|
});
|
|
324
363
|
}
|
|
325
364
|
// Clear update cache so the UI reflects the new state.
|
|
@@ -330,7 +369,7 @@ export class AddonPackageService {
|
|
|
330
369
|
async uninstall(name) {
|
|
331
370
|
this.requireInstaller();
|
|
332
371
|
if (this.isProtected(name)) {
|
|
333
|
-
throw userError('server.package-protected', { name: String(name) }, `Cannot uninstall protected package "${name}"`);
|
|
372
|
+
throw (0, types_1.userError)('server.package-protected', { name: String(name) }, `Cannot uninstall protected package "${name}"`);
|
|
334
373
|
}
|
|
335
374
|
await this.installer.uninstall(name);
|
|
336
375
|
this.logger.info('Uninstalled', { meta: { name } });
|
|
@@ -357,7 +396,7 @@ export class AddonPackageService {
|
|
|
357
396
|
});
|
|
358
397
|
}
|
|
359
398
|
catch (err) {
|
|
360
|
-
const msg = errMsg(err);
|
|
399
|
+
const msg = (0, types_2.errMsg)(err);
|
|
361
400
|
this.logger.error('npm install failed', { meta: { packageName, error: msg } });
|
|
362
401
|
this.toastService.broadcast({
|
|
363
402
|
title: 'Install Failed',
|
|
@@ -370,7 +409,7 @@ export class AddonPackageService {
|
|
|
370
409
|
await this.reloadPackages();
|
|
371
410
|
}
|
|
372
411
|
catch (err) {
|
|
373
|
-
const msg = errMsg(err);
|
|
412
|
+
const msg = (0, types_2.errMsg)(err);
|
|
374
413
|
this.logger.error('reloadPackages failed', { meta: { error: msg } });
|
|
375
414
|
}
|
|
376
415
|
let loaded = [];
|
|
@@ -381,7 +420,7 @@ export class AddonPackageService {
|
|
|
381
420
|
failed = result.failed;
|
|
382
421
|
}
|
|
383
422
|
catch (err) {
|
|
384
|
-
const msg = errMsg(err);
|
|
423
|
+
const msg = (0, types_2.errMsg)(err);
|
|
385
424
|
this.logger.error('loadNewAddons failed', { meta: { error: msg } });
|
|
386
425
|
failed.push(packageName);
|
|
387
426
|
}
|
|
@@ -408,7 +447,7 @@ export class AddonPackageService {
|
|
|
408
447
|
});
|
|
409
448
|
}
|
|
410
449
|
catch (err) {
|
|
411
|
-
const msg = errMsg(err);
|
|
450
|
+
const msg = (0, types_2.errMsg)(err);
|
|
412
451
|
this.logger.error('Workspace install failed', { meta: { error: msg } });
|
|
413
452
|
this.toastService.broadcast({ title: 'Install Failed', message: msg, severity: 'warning' });
|
|
414
453
|
throw new Error(`Workspace install failed: ${msg}`, { cause: err });
|
|
@@ -418,7 +457,7 @@ export class AddonPackageService {
|
|
|
418
457
|
}
|
|
419
458
|
catch (err) {
|
|
420
459
|
this.logger.warn('Non-fatal: failed to reload packages after workspace install', {
|
|
421
|
-
meta: { error: errMsg(err) },
|
|
460
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
422
461
|
});
|
|
423
462
|
}
|
|
424
463
|
let loaded = [];
|
|
@@ -429,7 +468,7 @@ export class AddonPackageService {
|
|
|
429
468
|
failed = result.failed;
|
|
430
469
|
}
|
|
431
470
|
catch (err) {
|
|
432
|
-
this.logger.warn('Failed to load new addons after install', { meta: { error: errMsg(err) } });
|
|
471
|
+
this.logger.warn('Failed to load new addons after install', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
433
472
|
failed.push(packageName);
|
|
434
473
|
}
|
|
435
474
|
this.toastService.broadcast({
|
|
@@ -449,7 +488,7 @@ export class AddonPackageService {
|
|
|
449
488
|
*/
|
|
450
489
|
async uninstallAndReload(packageName) {
|
|
451
490
|
if (this.isProtected(packageName)) {
|
|
452
|
-
throw userError('server.package-required', { packageName: String(packageName) }, `Package ${packageName} is required and cannot be uninstalled`);
|
|
491
|
+
throw (0, types_1.userError)('server.package-required', { packageName: String(packageName) }, `Package ${packageName} is required and cannot be uninstalled`);
|
|
453
492
|
}
|
|
454
493
|
try {
|
|
455
494
|
this.addonRegistry.emitUninstallEvent(packageName);
|
|
@@ -458,19 +497,19 @@ export class AddonPackageService {
|
|
|
458
497
|
this.logger.info('Uninstall complete', { meta: { packageName } });
|
|
459
498
|
}
|
|
460
499
|
catch (err) {
|
|
461
|
-
const msg = errMsg(err);
|
|
500
|
+
const msg = (0, types_2.errMsg)(err);
|
|
462
501
|
this.logger.error('Uninstall failed', { meta: { packageName, error: msg } });
|
|
463
502
|
this.toastService.broadcast({ title: 'Uninstall Failed', message: msg, severity: 'warning' });
|
|
464
503
|
throw new Error(`Uninstall failed: ${msg}`, { cause: err });
|
|
465
504
|
}
|
|
466
505
|
await this.reloadPackages().catch((err) => {
|
|
467
506
|
this.logger.warn('Non-fatal: failed to reload packages after uninstall', {
|
|
468
|
-
meta: { error: errMsg(err) },
|
|
507
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
469
508
|
});
|
|
470
509
|
});
|
|
471
510
|
await this.addonRegistry.loadNewAddons().catch((err) => {
|
|
472
511
|
this.logger.warn('Non-fatal: failed to load new addons after uninstall', {
|
|
473
|
-
meta: { error: errMsg(err) },
|
|
512
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
474
513
|
});
|
|
475
514
|
});
|
|
476
515
|
this.toastService.broadcast({
|
|
@@ -520,7 +559,7 @@ export class AddonPackageService {
|
|
|
520
559
|
}
|
|
521
560
|
}
|
|
522
561
|
catch (err) {
|
|
523
|
-
this.logger.warn('Failed to read workspace directory', { meta: { error: errMsg(err) } });
|
|
562
|
+
this.logger.warn('Failed to read workspace directory', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
524
563
|
}
|
|
525
564
|
return results;
|
|
526
565
|
}
|
|
@@ -551,7 +590,7 @@ export class AddonPackageService {
|
|
|
551
590
|
const fromRegistry = this.addonRegistry?.isPackageProtected?.(name);
|
|
552
591
|
if (typeof fromRegistry === 'boolean')
|
|
553
592
|
return fromRegistry;
|
|
554
|
-
return AddonInstaller.REQUIRED_PACKAGES.includes(name);
|
|
593
|
+
return system_1.AddonInstaller.REQUIRED_PACKAGES.includes(name);
|
|
555
594
|
}
|
|
556
595
|
/**
|
|
557
596
|
* Set of package names with a pending pre-update backup on disk —
|
|
@@ -640,7 +679,7 @@ export class AddonPackageService {
|
|
|
640
679
|
// Never OFFER a framework package as an addon update: clicking it would
|
|
641
680
|
// route to `updatePackage`, which now refuses it anyway. Filtering here
|
|
642
681
|
// keeps the UI honest (no dead "Update" button for @camstack/server).
|
|
643
|
-
if (AUTO_UPDATE_EXCLUDED_PACKAGES.has(name))
|
|
682
|
+
if (exports.AUTO_UPDATE_EXCLUDED_PACKAGES.has(name))
|
|
644
683
|
return;
|
|
645
684
|
const lookup = await this.lookupLatestVersion(name);
|
|
646
685
|
if (!lookup.ok) {
|
|
@@ -907,7 +946,7 @@ export class AddonPackageService {
|
|
|
907
946
|
return result;
|
|
908
947
|
}
|
|
909
948
|
catch (error) {
|
|
910
|
-
const msg = errMsg(error);
|
|
949
|
+
const msg = (0, types_2.errMsg)(error);
|
|
911
950
|
this.logger.warn('Failed to fetch versions', { meta: { name, error: msg } });
|
|
912
951
|
return cached?.versions ?? [];
|
|
913
952
|
}
|
|
@@ -946,7 +985,7 @@ export class AddonPackageService {
|
|
|
946
985
|
}
|
|
947
986
|
catch (err) {
|
|
948
987
|
this.logger.warn('Post-update confirmation failed — backup retained for rollback', {
|
|
949
|
-
meta: { name, backupDir, error: errMsg(err) },
|
|
988
|
+
meta: { name, backupDir, error: (0, types_2.errMsg)(err) },
|
|
950
989
|
});
|
|
951
990
|
}
|
|
952
991
|
}
|
|
@@ -1023,7 +1062,7 @@ export class AddonPackageService {
|
|
|
1023
1062
|
// hub/node_modules/@camstack/ — addons resolve everything from
|
|
1024
1063
|
// their own inlined deps.
|
|
1025
1064
|
const addonsDir = this.resolveAddonsDir();
|
|
1026
|
-
const { installPackageFromNpm } = await
|
|
1065
|
+
const { installPackageFromNpm } = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
1027
1066
|
const dirName = name.replace(/^@camstack\//, '');
|
|
1028
1067
|
const targetDir = path.join(addonsDir, dirName);
|
|
1029
1068
|
const packageSpec = version ? `${name}@${version}` : name;
|
|
@@ -1041,7 +1080,7 @@ export class AddonPackageService {
|
|
|
1041
1080
|
return { success: true, version: updatedVersion, requiresRestart: true };
|
|
1042
1081
|
}
|
|
1043
1082
|
catch (error) {
|
|
1044
|
-
const msg = errMsg(error);
|
|
1083
|
+
const msg = (0, types_2.errMsg)(error);
|
|
1045
1084
|
this.logger.error('Failed to update package', { meta: { name, error: msg } });
|
|
1046
1085
|
return { success: false, version: '', requiresRestart: false, error: msg };
|
|
1047
1086
|
}
|
|
@@ -1099,7 +1138,7 @@ export class AddonPackageService {
|
|
|
1099
1138
|
return { success: true, version: updatedVersion, requiresRestart: false };
|
|
1100
1139
|
}
|
|
1101
1140
|
catch (error) {
|
|
1102
|
-
const msg = errMsg(error);
|
|
1141
|
+
const msg = (0, types_2.errMsg)(error);
|
|
1103
1142
|
this.logger.error('Failed to apply staged addon update', { meta: { name, error: msg } });
|
|
1104
1143
|
return { success: false, version: '', requiresRestart: false, error: msg };
|
|
1105
1144
|
}
|
|
@@ -1172,25 +1211,25 @@ export class AddonPackageService {
|
|
|
1172
1211
|
restartServer(requestedBy, update) {
|
|
1173
1212
|
this.logger.info('Server restart requested -- initiating graceful shutdown');
|
|
1174
1213
|
// Both versions, one builder, shared with the agent — see `restart-marker.ts`.
|
|
1175
|
-
const payload = buildRestartMarker({
|
|
1214
|
+
const payload = (0, restart_marker_js_1.buildRestartMarker)({
|
|
1176
1215
|
requestedAt: Date.now(),
|
|
1177
1216
|
...(requestedBy !== undefined ? { requestedBy } : {}),
|
|
1178
1217
|
...(update !== undefined ? { update } : {}),
|
|
1179
1218
|
});
|
|
1180
1219
|
try {
|
|
1181
|
-
writePendingRestart(this.resolveDataDir(), payload);
|
|
1220
|
+
(0, system_1.writePendingRestart)(this.resolveDataDir(), payload);
|
|
1182
1221
|
}
|
|
1183
1222
|
catch (err) {
|
|
1184
1223
|
// Marker write failure shouldn't block the restart — log + continue.
|
|
1185
1224
|
this.logger.warn('Failed to write restart marker; restart will proceed without completion toast', {
|
|
1186
|
-
meta: { error: errMsg(err) },
|
|
1225
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
1187
1226
|
});
|
|
1188
1227
|
}
|
|
1189
1228
|
this.eventBusService.emit({
|
|
1190
|
-
id: randomUUID(),
|
|
1229
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
1191
1230
|
timestamp: new Date(),
|
|
1192
1231
|
source: { type: 'core', id: 'addon-package-service' },
|
|
1193
|
-
category: EventCategory.SystemRestarting,
|
|
1232
|
+
category: types_2.EventCategory.SystemRestarting,
|
|
1194
1233
|
// The node, as `system.restart-completed` names it after the boot
|
|
1195
1234
|
// (`post-boot.service.ts`): the announcement and the landing of one
|
|
1196
1235
|
// restart must name the same node, or a stale `node-updating` could not
|
|
@@ -1198,7 +1237,7 @@ export class AddonPackageService {
|
|
|
1198
1237
|
data: { ...payload, nodeId: process.env['CAMSTACK_NODE_ID'] ?? 'hub' },
|
|
1199
1238
|
});
|
|
1200
1239
|
// 10s grace gives in-flight requests time to drain.
|
|
1201
|
-
scheduleSelfRestart({ delayMs: 10_000 });
|
|
1240
|
+
(0, system_1.scheduleSelfRestart)({ delayMs: 10_000 });
|
|
1202
1241
|
}
|
|
1203
1242
|
// =========================================================================
|
|
1204
1243
|
// Framework live-update
|
|
@@ -1217,7 +1256,7 @@ export class AddonPackageService {
|
|
|
1217
1256
|
*/
|
|
1218
1257
|
async listFrameworkPackages() {
|
|
1219
1258
|
const registry = process.env['CAMSTACK_NPM_REGISTRY'];
|
|
1220
|
-
const rows = await Promise.all([SYSTEM_PACKAGE].map(async (packageName) => {
|
|
1259
|
+
const rows = await Promise.all([exports.SYSTEM_PACKAGE].map(async (packageName) => {
|
|
1221
1260
|
const manifest = readResolvedPackageManifest(packageName);
|
|
1222
1261
|
const currentVersion = manifest !== null && typeof manifest['version'] === 'string'
|
|
1223
1262
|
? manifest['version']
|
|
@@ -1228,8 +1267,8 @@ export class AddonPackageService {
|
|
|
1228
1267
|
// Content build-id of the code the hub ACTUALLY loaded — resolved from
|
|
1229
1268
|
// the same closure the running process uses. Surfaces "same semver,
|
|
1230
1269
|
// new code" (framework packages ship changes without always bumping).
|
|
1231
|
-
const hubPkgDir = resolveHubClosurePackageDir(packageName);
|
|
1232
|
-
const buildId = hubPkgDir !== null ? computeDistBuildId(path.join(hubPkgDir, 'dist')) : null;
|
|
1270
|
+
const hubPkgDir = (0, package_dir_utils_js_1.resolveHubClosurePackageDir)(packageName);
|
|
1271
|
+
const buildId = hubPkgDir !== null ? (0, package_dir_utils_js_1.computeDistBuildId)(path.join(hubPkgDir, 'dist')) : null;
|
|
1233
1272
|
let latestVersion = null;
|
|
1234
1273
|
let lookupFailed = false;
|
|
1235
1274
|
try {
|
|
@@ -1246,7 +1285,7 @@ export class AddonPackageService {
|
|
|
1246
1285
|
catch (err) {
|
|
1247
1286
|
lookupFailed = true;
|
|
1248
1287
|
this.logger.debug('listFrameworkPackages: npm view failed', {
|
|
1249
|
-
meta: { packageName, error: errMsg(err) },
|
|
1288
|
+
meta: { packageName, error: (0, types_2.errMsg)(err) },
|
|
1250
1289
|
});
|
|
1251
1290
|
}
|
|
1252
1291
|
// STRICTLY newer, never merely different. The hub runs
|
|
@@ -1318,14 +1357,14 @@ export class AddonPackageService {
|
|
|
1318
1357
|
/** Re-discover addons from the addons directory (call after install/uninstall) */
|
|
1319
1358
|
async reloadPackages() {
|
|
1320
1359
|
try {
|
|
1321
|
-
const kernel = await
|
|
1360
|
+
const kernel = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
1322
1361
|
this.loader = new kernel.AddonLoader(this.logger.child('AddonLoader'));
|
|
1323
1362
|
const addonsDir = this.resolveAddonsDir();
|
|
1324
1363
|
await this.loader.loadFromDirectory(addonsDir);
|
|
1325
1364
|
this.logger.info('Reloaded', { meta: { count: this.loader.listAddons().length } });
|
|
1326
1365
|
}
|
|
1327
1366
|
catch (error) {
|
|
1328
|
-
const msg = errMsg(error);
|
|
1367
|
+
const msg = (0, types_2.errMsg)(error);
|
|
1329
1368
|
this.logger.warn('reloadPackages failed', { meta: { error: msg } });
|
|
1330
1369
|
}
|
|
1331
1370
|
}
|
|
@@ -1359,7 +1398,7 @@ export class AddonPackageService {
|
|
|
1359
1398
|
const previousCheckInterval = this.autoUpdateConfig.global.updateCheckIntervalSeconds;
|
|
1360
1399
|
const nextCheckInterval = updateCheckIntervalSeconds === undefined
|
|
1361
1400
|
? previousCheckInterval
|
|
1362
|
-
: clampUpdateCheckInterval(updateCheckIntervalSeconds);
|
|
1401
|
+
: (0, update_check_scheduler_js_1.clampUpdateCheckInterval)(updateCheckIntervalSeconds);
|
|
1363
1402
|
this.autoUpdateConfig = {
|
|
1364
1403
|
...this.autoUpdateConfig,
|
|
1365
1404
|
global: {
|
|
@@ -1413,7 +1452,7 @@ export class AddonPackageService {
|
|
|
1413
1452
|
});
|
|
1414
1453
|
this.autoUpdateTimer = setInterval(() => {
|
|
1415
1454
|
this.runAutoUpdate().catch((err) => {
|
|
1416
|
-
this.logger.error('Auto-update check failed', { meta: { error: errMsg(err) } });
|
|
1455
|
+
this.logger.error('Auto-update check failed', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
1417
1456
|
});
|
|
1418
1457
|
}, intervalMs);
|
|
1419
1458
|
}
|
|
@@ -1443,7 +1482,7 @@ export class AddonPackageService {
|
|
|
1443
1482
|
// skipped a swept framework target; excluding it here also kills the
|
|
1444
1483
|
// useless candidate churn that participated in the 2026-07-22 hub
|
|
1445
1484
|
// wedge (mass staged swap right after a publish train).
|
|
1446
|
-
if (AUTO_UPDATE_EXCLUDED_PACKAGES.has(pkg.name))
|
|
1485
|
+
if (exports.AUTO_UPDATE_EXCLUDED_PACKAGES.has(pkg.name))
|
|
1447
1486
|
continue;
|
|
1448
1487
|
// Determine effective channel for this addon
|
|
1449
1488
|
const addonId = pkg.name.replace('@camstack/addon-', '').replace('@camstack/', '');
|
|
@@ -1491,7 +1530,7 @@ export class AddonPackageService {
|
|
|
1491
1530
|
}
|
|
1492
1531
|
catch (err) {
|
|
1493
1532
|
this.logger.warn('Auto-update check failed', {
|
|
1494
|
-
meta: { name: pkg.name, error: errMsg(err) },
|
|
1533
|
+
meta: { name: pkg.name, error: (0, types_2.errMsg)(err) },
|
|
1495
1534
|
});
|
|
1496
1535
|
}
|
|
1497
1536
|
}
|
|
@@ -1508,7 +1547,7 @@ export class AddonPackageService {
|
|
|
1508
1547
|
// ship via applyServerUpdate). Wrap so a failure is logged, not thrown out
|
|
1509
1548
|
// of the timer callback.
|
|
1510
1549
|
try {
|
|
1511
|
-
const { getLifecycleRunner } = await
|
|
1550
|
+
const { getLifecycleRunner } = await Promise.resolve().then(() => __importStar(require('../lifecycle/lifecycle-runner.singleton.js')));
|
|
1512
1551
|
const runner = getLifecycleRunner();
|
|
1513
1552
|
const { jobId } = await runner.startJob({ kind: 'update', targets, createdBy: 'system' });
|
|
1514
1553
|
this.logger.info('Auto-update job started', {
|
|
@@ -1516,7 +1555,7 @@ export class AddonPackageService {
|
|
|
1516
1555
|
});
|
|
1517
1556
|
}
|
|
1518
1557
|
catch (err) {
|
|
1519
|
-
this.logger.error('Auto-update job failed to start', { meta: { error: errMsg(err) } });
|
|
1558
|
+
this.logger.error('Auto-update job failed to start', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
1520
1559
|
}
|
|
1521
1560
|
}
|
|
1522
1561
|
// =========================================================================
|
|
@@ -1538,8 +1577,8 @@ export class AddonPackageService {
|
|
|
1538
1577
|
channel: validChannel,
|
|
1539
1578
|
intervalSeconds: typeof global['intervalSeconds'] === 'number' ? global['intervalSeconds'] : 3600,
|
|
1540
1579
|
updateCheckIntervalSeconds: typeof rawCheckInterval === 'number'
|
|
1541
|
-
? clampUpdateCheckInterval(rawCheckInterval)
|
|
1542
|
-
: DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
1580
|
+
? (0, update_check_scheduler_js_1.clampUpdateCheckInterval)(rawCheckInterval)
|
|
1581
|
+
: update_check_scheduler_js_1.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
1543
1582
|
},
|
|
1544
1583
|
overrides: Object.fromEntries(Object.entries(asRecord(raw['overrides'])).map(([k, v]) => {
|
|
1545
1584
|
const s = asString(v);
|
|
@@ -1552,14 +1591,14 @@ export class AddonPackageService {
|
|
|
1552
1591
|
}
|
|
1553
1592
|
catch (err) {
|
|
1554
1593
|
this.logger.debug('Corrupt auto-update config, falling back to defaults', {
|
|
1555
|
-
meta: { error: errMsg(err) },
|
|
1594
|
+
meta: { error: (0, types_2.errMsg)(err) },
|
|
1556
1595
|
});
|
|
1557
1596
|
}
|
|
1558
1597
|
return {
|
|
1559
1598
|
global: {
|
|
1560
1599
|
channel: 'off',
|
|
1561
1600
|
intervalSeconds: 21600,
|
|
1562
|
-
updateCheckIntervalSeconds: DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
1601
|
+
updateCheckIntervalSeconds: update_check_scheduler_js_1.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS,
|
|
1563
1602
|
},
|
|
1564
1603
|
overrides: {},
|
|
1565
1604
|
};
|
|
@@ -1575,7 +1614,7 @@ export class AddonPackageService {
|
|
|
1575
1614
|
fs.writeFileSync(configPath, JSON.stringify(this.autoUpdateConfig, null, 2));
|
|
1576
1615
|
}
|
|
1577
1616
|
catch (err) {
|
|
1578
|
-
this.logger.warn('Failed to save auto-update config', { meta: { error: errMsg(err) } });
|
|
1617
|
+
this.logger.warn('Failed to save auto-update config', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
1579
1618
|
}
|
|
1580
1619
|
}
|
|
1581
1620
|
/** Resolve the top-level data directory */
|
|
@@ -1670,7 +1709,7 @@ export class AddonPackageService {
|
|
|
1670
1709
|
// The package could not be evaluated at all (unreadable manifest, …).
|
|
1671
1710
|
// Counted as a failure for the same reason a registry miss is.
|
|
1672
1711
|
failures += 1;
|
|
1673
|
-
const msg = errMsg(error);
|
|
1712
|
+
const msg = (0, types_2.errMsg)(error);
|
|
1674
1713
|
this.logger.warn('Failed to check updates for addon', {
|
|
1675
1714
|
meta: { pkgJsonPath, error: msg },
|
|
1676
1715
|
});
|
|
@@ -1723,7 +1762,7 @@ export class AddonPackageService {
|
|
|
1723
1762
|
return { ok: true, latestVersion: version || null };
|
|
1724
1763
|
}
|
|
1725
1764
|
catch (error) {
|
|
1726
|
-
return { ok: false, error: errMsg(error) };
|
|
1765
|
+
return { ok: false, error: (0, types_2.errMsg)(error) };
|
|
1727
1766
|
}
|
|
1728
1767
|
}
|
|
1729
1768
|
/**
|
|
@@ -1796,7 +1835,7 @@ export class AddonPackageService {
|
|
|
1796
1835
|
return results;
|
|
1797
1836
|
}
|
|
1798
1837
|
catch (err) {
|
|
1799
|
-
this.logger.warn('npm search failed', { meta: { error: errMsg(err) } });
|
|
1838
|
+
this.logger.warn('npm search failed', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
1800
1839
|
// Stale cache is better than nothing on transient network failure
|
|
1801
1840
|
return this.searchCache?.results ?? [];
|
|
1802
1841
|
}
|
|
@@ -1832,7 +1871,7 @@ export class AddonPackageService {
|
|
|
1832
1871
|
}
|
|
1833
1872
|
catch (err) {
|
|
1834
1873
|
this.logger.debug('Installed-version lookup failed', {
|
|
1835
|
-
meta: { packageName, error: errMsg(err) },
|
|
1874
|
+
meta: { packageName, error: (0, types_2.errMsg)(err) },
|
|
1836
1875
|
});
|
|
1837
1876
|
}
|
|
1838
1877
|
this.logger.debug('No readable installed copy — previous version is unknown', {
|
|
@@ -1855,7 +1894,7 @@ export class AddonPackageService {
|
|
|
1855
1894
|
* host mid-`applyServerUpdate` publish. A refusal, not a silent no-op.
|
|
1856
1895
|
*/
|
|
1857
1896
|
refuseExcludedFramework(name) {
|
|
1858
|
-
if (!AUTO_UPDATE_EXCLUDED_PACKAGES.has(name))
|
|
1897
|
+
if (!exports.AUTO_UPDATE_EXCLUDED_PACKAGES.has(name))
|
|
1859
1898
|
return null;
|
|
1860
1899
|
return {
|
|
1861
1900
|
success: false,
|
|
@@ -1915,7 +1954,7 @@ export class AddonPackageService {
|
|
|
1915
1954
|
timestamp: Date.now(),
|
|
1916
1955
|
})
|
|
1917
1956
|
.catch((err) => {
|
|
1918
|
-
const msg = errMsg(err);
|
|
1957
|
+
const msg = (0, types_2.errMsg)(err);
|
|
1919
1958
|
this.logger.debug('Update notification failed', { meta: { error: msg } });
|
|
1920
1959
|
});
|
|
1921
1960
|
this.toastService.broadcast({
|
|
@@ -1926,6 +1965,7 @@ export class AddonPackageService {
|
|
|
1926
1965
|
});
|
|
1927
1966
|
}
|
|
1928
1967
|
}
|
|
1968
|
+
exports.AddonPackageService = AddonPackageService;
|
|
1929
1969
|
// ---------------------------------------------------------------------------
|
|
1930
1970
|
// Tarball extraction helper (exported for regression tests)
|
|
1931
1971
|
// ---------------------------------------------------------------------------
|
|
@@ -1942,9 +1982,9 @@ export class AddonPackageService {
|
|
|
1942
1982
|
* `src/core/addon/__tests__/extract-tarball-strip.spec.ts` can test the real
|
|
1943
1983
|
* implementation without instantiating `AddonPackageService`.
|
|
1944
1984
|
*/
|
|
1945
|
-
|
|
1985
|
+
async function extractTgzStripped(tgz, destDir) {
|
|
1946
1986
|
fs.mkdirSync(destDir, { recursive: true });
|
|
1947
|
-
const tmpFile = path.join(os.tmpdir(), `camstack-tgz-${randomUUID()}.tgz`);
|
|
1987
|
+
const tmpFile = path.join(os.tmpdir(), `camstack-tgz-${(0, node_crypto_1.randomUUID)()}.tgz`);
|
|
1948
1988
|
try {
|
|
1949
1989
|
fs.writeFileSync(tmpFile, tgz);
|
|
1950
1990
|
await execFileAsync('tar', ['--strip-components=1', '-xzf', tmpFile, '-C', destDir], {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEVER_LOADED_PROCESS = void 0;
|
|
4
|
+
exports.describeAddonProcess = describeAddonProcess;
|
|
5
|
+
function describeAddonProcess(input) {
|
|
2
6
|
if (!input.forked) {
|
|
3
7
|
// Hosted by hub-main itself: its state is hub-main's, which is running if this code is.
|
|
4
8
|
return input.initialized
|
|
@@ -21,4 +25,4 @@ export function describeAddonProcess(input) {
|
|
|
21
25
|
* A package on disk that never loaded: there is no process, and the card must
|
|
22
26
|
* show the diagnostic state distinctly (`scanFailedToLoadPackages`).
|
|
23
27
|
*/
|
|
24
|
-
|
|
28
|
+
exports.NEVER_LOADED_PROCESS = { mode: 'in-process', state: 'failed' };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.planAddonRealignment = planAddonRealignment;
|
|
1
4
|
/** `a` strictly newer than `b`, by numeric segments, missing segments as 0. */
|
|
2
5
|
function isStrictlyNewer(a, b) {
|
|
3
6
|
const pa = a.split('.').map((p) => Number.parseInt(p, 10));
|
|
@@ -13,7 +16,7 @@ function isStrictlyNewer(a, b) {
|
|
|
13
16
|
}
|
|
14
17
|
return false;
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
function planAddonRealignment(candidates) {
|
|
17
20
|
return candidates.map((c) => {
|
|
18
21
|
if (c.closureVersion === null) {
|
|
19
22
|
return { pkg: c.pkg, action: 'keep', reason: 'not carried by this closure' };
|