@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,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overlayDeclaration = overlayDeclaration;
|
|
1
4
|
/**
|
|
2
5
|
* Overlay the fresh on-disk `declaration` onto a live addon instance's
|
|
3
6
|
* `manifest` when building the rows returned by `listAddons()`.
|
|
@@ -21,6 +24,6 @@
|
|
|
21
24
|
* values), so the spread overlays only the keys the declaration actually
|
|
22
25
|
* defines; the instance manifest fills any gaps.
|
|
23
26
|
*/
|
|
24
|
-
|
|
27
|
+
function overlayDeclaration(instanceManifest, declaration) {
|
|
25
28
|
return { ...instanceManifest, ...declaration };
|
|
26
29
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddonSearchService = void 0;
|
|
4
|
+
const types_1 = require("@camstack/types");
|
|
5
|
+
class AddonSearchService {
|
|
3
6
|
loggingService;
|
|
4
7
|
cache = null;
|
|
5
8
|
CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
@@ -50,9 +53,10 @@ export class AddonSearchService {
|
|
|
50
53
|
}
|
|
51
54
|
catch (err) {
|
|
52
55
|
const logger = this.loggingService.createLogger('addon-search');
|
|
53
|
-
logger.warn('npm search failed', { meta: { error: errMsg(err) } });
|
|
56
|
+
logger.warn('npm search failed', { meta: { error: (0, types_1.errMsg)(err) } });
|
|
54
57
|
// Stale cache is better than nothing on transient network failure
|
|
55
58
|
return this.cache?.results ?? [];
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
}
|
|
62
|
+
exports.AddonSearchService = AddonSearchService;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAddonSettingsProvider = createAddonSettingsProvider;
|
|
1
4
|
function reshapeForOutput(schema) {
|
|
2
5
|
return {
|
|
3
6
|
tabs: schema.tabs
|
|
@@ -117,4 +120,3 @@ function createAddonSettingsProvider(deps) {
|
|
|
117
120
|
},
|
|
118
121
|
};
|
|
119
122
|
}
|
|
120
|
-
export { createAddonSettingsProvider };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageProtectedError = void 0;
|
|
4
|
+
exports.isHubNodeId = isHubNodeId;
|
|
5
|
+
exports.uninstallPackage = uninstallPackage;
|
|
6
|
+
exports.listInstallations = listInstallations;
|
|
1
7
|
/** The hub refuses before touching any node. Mapped to FORBIDDEN by the router. */
|
|
2
|
-
|
|
8
|
+
class PackageProtectedError extends Error {
|
|
3
9
|
constructor(packageName) {
|
|
4
10
|
super(`Package ${packageName} is required and cannot be uninstalled`);
|
|
5
11
|
this.name = 'PackageProtectedError';
|
|
6
12
|
}
|
|
7
13
|
}
|
|
14
|
+
exports.PackageProtectedError = PackageProtectedError;
|
|
8
15
|
/** A node id that refers to the hub itself (top-level or a hub group runner). */
|
|
9
|
-
|
|
16
|
+
function isHubNodeId(nodeId) {
|
|
10
17
|
return nodeId === 'hub' || nodeId.startsWith('hub/');
|
|
11
18
|
}
|
|
12
19
|
const OK_OUTCOMES = new Set([
|
|
@@ -157,7 +164,7 @@ async function agentsHolding(seam, packageName) {
|
|
|
157
164
|
}));
|
|
158
165
|
return holding.filter((n) => n !== null);
|
|
159
166
|
}
|
|
160
|
-
|
|
167
|
+
async function uninstallPackage(seam, request) {
|
|
161
168
|
const { packageName } = request;
|
|
162
169
|
if (seam.isProtected(packageName))
|
|
163
170
|
throw new PackageProtectedError(packageName);
|
|
@@ -189,7 +196,7 @@ export async function uninstallPackage(seam, request) {
|
|
|
189
196
|
}
|
|
190
197
|
return summarize(packageName, [await uninstallFromAgent(seam, node, packageName)]);
|
|
191
198
|
}
|
|
192
|
-
|
|
199
|
+
async function listInstallations(seam, packageName) {
|
|
193
200
|
const wanted = (name) => packageName === undefined || name === packageName;
|
|
194
201
|
const hubPackages = seam.listHubPackages();
|
|
195
202
|
const onHub = new Set(hubPackages.map((p) => p.name));
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUILTIN_ADDONS = exports.ADDON_REGISTRY = void 0;
|
|
4
|
+
exports.ADDON_REGISTRY = Symbol('ADDON_REGISTRY');
|
|
5
|
+
exports.BUILTIN_ADDONS = Symbol('BUILTIN_ADDONS');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* The hub-process mirror of every device's persisted `parentDeviceId`, `type`
|
|
3
4
|
* and `location` — and the rule that decides how much of the fleet a device
|
|
@@ -58,15 +59,18 @@
|
|
|
58
59
|
* contract `DeviceRowStore.getMany` states for a fleet it does not know. A
|
|
59
60
|
* read that THROWS is not that: it changes nothing at all (D49).
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
+
exports.DeviceMetaMirror = exports.MIRROR_IRRELEVANT_META_FIELDS = void 0;
|
|
64
|
+
exports.classifyDeviceEvent = classifyDeviceEvent;
|
|
65
|
+
const types_1 = require("@camstack/types");
|
|
66
|
+
const single_flight_refresh_js_1 = require("./single-flight-refresh.js");
|
|
63
67
|
/**
|
|
64
68
|
* Meta fields a `DeviceMetaChanged` can name that this mirror provably does
|
|
65
69
|
* not hold. Enumerated from every `field:` literal `device-meta-actions.ts`
|
|
66
70
|
* emits; `location` and `type` are deliberately ABSENT because those two are
|
|
67
71
|
* the mirror.
|
|
68
72
|
*/
|
|
69
|
-
|
|
73
|
+
exports.MIRROR_IRRELEVANT_META_FIELDS = new Set([
|
|
70
74
|
'name',
|
|
71
75
|
'disabled',
|
|
72
76
|
'metadata',
|
|
@@ -86,11 +90,11 @@ export const MIRROR_IRRELEVANT_META_FIELDS = new Set([
|
|
|
86
90
|
* never silently skip a refresh, because the failure mode is an authorisation
|
|
87
91
|
* mirror that quietly stops converging.
|
|
88
92
|
*/
|
|
89
|
-
|
|
93
|
+
function classifyDeviceEvent(data) {
|
|
90
94
|
if (data === null || typeof data !== 'object')
|
|
91
95
|
return { kind: 'fleet' };
|
|
92
96
|
const field = Reflect.get(data, 'field');
|
|
93
|
-
if (typeof field === 'string' && MIRROR_IRRELEVANT_META_FIELDS.has(field)) {
|
|
97
|
+
if (typeof field === 'string' && exports.MIRROR_IRRELEVANT_META_FIELDS.has(field)) {
|
|
94
98
|
return { kind: 'none' };
|
|
95
99
|
}
|
|
96
100
|
const deviceId = Reflect.get(data, 'deviceId');
|
|
@@ -100,7 +104,7 @@ export function classifyDeviceEvent(data) {
|
|
|
100
104
|
}
|
|
101
105
|
/** Max ancestor hops — defence-in-depth against a corrupt parent cycle. */
|
|
102
106
|
const MAX_ANCESTOR_HOPS = 8;
|
|
103
|
-
|
|
107
|
+
class DeviceMetaMirror {
|
|
104
108
|
read;
|
|
105
109
|
live;
|
|
106
110
|
logger;
|
|
@@ -111,7 +115,7 @@ export class DeviceMetaMirror {
|
|
|
111
115
|
this.read = read;
|
|
112
116
|
this.live = live;
|
|
113
117
|
this.logger = logger;
|
|
114
|
-
this.gate = createSingleFlightRefresh((scope) => this.refresh(scope));
|
|
118
|
+
this.gate = (0, single_flight_refresh_js_1.createSingleFlightRefresh)((scope) => this.refresh(scope));
|
|
115
119
|
}
|
|
116
120
|
/** Ask for a refresh covering exactly what the event changed. */
|
|
117
121
|
onDeviceEvent(data) {
|
|
@@ -227,8 +231,9 @@ export class DeviceMetaMirror {
|
|
|
227
231
|
}
|
|
228
232
|
catch (err) {
|
|
229
233
|
this.logger.debug('device-meta mirror refresh failed — keeping previous', {
|
|
230
|
-
meta: { error: errMsg(err), scope: scope === null ? 'fleet' : scope.size },
|
|
234
|
+
meta: { error: (0, types_1.errMsg)(err), scope: scope === null ? 'fleet' : scope.size },
|
|
231
235
|
});
|
|
232
236
|
}
|
|
233
237
|
}
|
|
234
238
|
}
|
|
239
|
+
exports.DeviceMetaMirror = DeviceMetaMirror;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toForkedCustomActionsSpec = toForkedCustomActionsSpec;
|
|
4
|
+
exports.childCatalogsFingerprint = childCatalogsFingerprint;
|
|
5
|
+
exports.summarizeChildCatalogs = summarizeChildCatalogs;
|
|
6
|
+
const zod_1 = require("zod");
|
|
2
7
|
/**
|
|
3
8
|
* Build the hub-side catalog for a forked addon.
|
|
4
9
|
*
|
|
@@ -8,12 +13,12 @@ import { z } from 'zod';
|
|
|
8
13
|
* schemas and refuses what they refuse. `kind`, `auth`, `scope` and `caller`
|
|
9
14
|
* are the fields the hub actually gates on, and they arrive intact.
|
|
10
15
|
*/
|
|
11
|
-
|
|
16
|
+
function toForkedCustomActionsSpec(descriptor) {
|
|
12
17
|
const spec = {};
|
|
13
18
|
for (const [name, action] of Object.entries(descriptor)) {
|
|
14
19
|
spec[name] = {
|
|
15
|
-
input: z.unknown(),
|
|
16
|
-
output: z.unknown(),
|
|
20
|
+
input: zod_1.z.unknown(),
|
|
21
|
+
output: zod_1.z.unknown(),
|
|
17
22
|
kind: action.kind,
|
|
18
23
|
auth: action.auth,
|
|
19
24
|
scope: action.scope,
|
|
@@ -30,7 +35,7 @@ export function toForkedCustomActionsSpec(descriptor) {
|
|
|
30
35
|
* one catalog must never fingerprint differently because a runner enumerated
|
|
31
36
|
* its map in another order.
|
|
32
37
|
*/
|
|
33
|
-
|
|
38
|
+
function childCatalogsFingerprint(catalogs) {
|
|
34
39
|
return JSON.stringify(sortKeysDeep(catalogs));
|
|
35
40
|
}
|
|
36
41
|
function sortKeysDeep(value) {
|
|
@@ -44,7 +49,7 @@ function sortKeysDeep(value) {
|
|
|
44
49
|
}
|
|
45
50
|
return out;
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
function summarizeChildCatalogs(catalogs) {
|
|
48
53
|
const withActions = [];
|
|
49
54
|
const withoutActions = [];
|
|
50
55
|
for (const addonId of Object.keys(catalogs).sort()) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Who may see, and who may mint, an integration.
|
|
3
4
|
*
|
|
@@ -10,7 +11,9 @@
|
|
|
10
11
|
* here verbatim from `AddonRegistryService.createFilteredRegistry` so the rule
|
|
11
12
|
* is testable on its own.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createFilteredIntegrationRegistry = createFilteredIntegrationRegistry;
|
|
16
|
+
const types_1 = require("@camstack/types");
|
|
14
17
|
/**
|
|
15
18
|
* Wrap `raw` in the installed-addon view.
|
|
16
19
|
*
|
|
@@ -33,12 +36,12 @@ import { bareAddonId } from '@camstack/types';
|
|
|
33
36
|
* it. Both branches returned a bare `null`, and that indistinguishability is
|
|
34
37
|
* precisely what kept rule 1's breach invisible for as long as it lasted.
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
function createFilteredIntegrationRegistry(deps) {
|
|
37
40
|
const { raw, logger } = deps;
|
|
38
41
|
// A co-located builtin's `ctx.id` is `addon:<manifest id>`; every registry
|
|
39
42
|
// key is bare (D72). Normalise on the way in, or the create guard rejects
|
|
40
43
|
// exactly the builtins that legitimately declare an integration.
|
|
41
|
-
const isInstalled = (addonId) => deps.isAddonInstalled(bareAddonId(addonId));
|
|
44
|
+
const isInstalled = (addonId) => deps.isAddonInstalled((0, types_1.bareAddonId)(addonId));
|
|
42
45
|
/** The suppression log line. Only ever called when the row EXISTS. */
|
|
43
46
|
const logHidden = (integration, phase) => {
|
|
44
47
|
logger.warn('integration hidden — its addon is not installed, so this read answers null even though the row exists', {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.materializeRoutePath = materializeRoutePath;
|
|
1
4
|
/**
|
|
2
5
|
* Rebuild the concrete request path from a route pattern and the params the
|
|
3
6
|
* hub already matched (`/:providerId/start` + `{providerId:'authentik'}` →
|
|
@@ -10,7 +13,7 @@
|
|
|
10
13
|
* overwrote the real value — every parameterized route of a forked addon saw
|
|
11
14
|
* literal `:name` params.
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
function materializeRoutePath(pattern, params) {
|
|
14
17
|
return pattern
|
|
15
18
|
.split('/')
|
|
16
19
|
.map((part) => {
|
|
@@ -1,3 +1,40 @@
|
|
|
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.resolveHubClosurePackageDir = resolveHubClosurePackageDir;
|
|
37
|
+
exports.computeDistBuildId = computeDistBuildId;
|
|
1
38
|
/**
|
|
2
39
|
* Package-dir introspection helpers for the hub's OWN framework closure.
|
|
3
40
|
*
|
|
@@ -7,14 +44,14 @@
|
|
|
7
44
|
* these two read-only helpers remain in use by `AddonPackageService`'s
|
|
8
45
|
* framework-package status surface.
|
|
9
46
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
47
|
+
const fs = __importStar(require("node:fs"));
|
|
48
|
+
const path = __importStar(require("node:path"));
|
|
49
|
+
const node_crypto_1 = require("node:crypto");
|
|
50
|
+
const node_module_1 = require("node:module");
|
|
14
51
|
// Resolve framework packages the same way the running hub does — from THIS
|
|
15
52
|
// module's location, whose walk-up lands on the hub's own `node_modules`
|
|
16
53
|
// closure (identical to the hub main's `@camstack/system` resolution).
|
|
17
|
-
const requireFromHere = createRequire(__filename);
|
|
54
|
+
const requireFromHere = (0, node_module_1.createRequire)(__filename);
|
|
18
55
|
function readJsonObjectSafe(filePath) {
|
|
19
56
|
try {
|
|
20
57
|
const parsed = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
@@ -39,7 +76,7 @@ function packageNameOf(pkgJsonPath) {
|
|
|
39
76
|
* resolving the main entry and walking up to the matching `package.json`.
|
|
40
77
|
* Returns null when the package is not resolvable.
|
|
41
78
|
*/
|
|
42
|
-
|
|
79
|
+
function resolveHubClosurePackageDir(packageName) {
|
|
43
80
|
try {
|
|
44
81
|
return path.dirname(requireFromHere.resolve(`${packageName}/package.json`));
|
|
45
82
|
}
|
|
@@ -85,7 +122,7 @@ function collectJsFiles(root, dir, out) {
|
|
|
85
122
|
* image's `seed-version` fingerprint. Returns null when the dir is missing or
|
|
86
123
|
* empty. Used to surface "same semver, new code" instead of trusting `version`.
|
|
87
124
|
*/
|
|
88
|
-
|
|
125
|
+
function computeDistBuildId(distDir) {
|
|
89
126
|
if (!fs.existsSync(distDir))
|
|
90
127
|
return null;
|
|
91
128
|
const files = [];
|
|
@@ -93,7 +130,7 @@ export function computeDistBuildId(distDir) {
|
|
|
93
130
|
if (files.length === 0)
|
|
94
131
|
return null;
|
|
95
132
|
files.sort();
|
|
96
|
-
const hash = createHash('md5');
|
|
133
|
+
const hash = (0, node_crypto_1.createHash)('md5');
|
|
97
134
|
for (const rel of files) {
|
|
98
135
|
hash.update(rel);
|
|
99
136
|
hash.update('\0');
|
|
@@ -1,3 +1,41 @@
|
|
|
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.decidePrune = decidePrune;
|
|
37
|
+
exports.isPrunableDir = isPrunableDir;
|
|
38
|
+
exports.prunePlacementLeftovers = prunePlacementLeftovers;
|
|
1
39
|
/**
|
|
2
40
|
* prune-misplaced-addons — remove an installed addon that can never run here.
|
|
3
41
|
*
|
|
@@ -27,8 +65,8 @@
|
|
|
27
65
|
* deleting DATA would be. Anything outside `<dataDir>/addons/@camstack/` is
|
|
28
66
|
* refused outright.
|
|
29
67
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
68
|
+
const fs = __importStar(require("node:fs"));
|
|
69
|
+
const path = __importStar(require("node:path"));
|
|
32
70
|
/**
|
|
33
71
|
* Decide what to prune for a node in `role`. Pure — the decision is the part
|
|
34
72
|
* worth testing, and it must never depend on a filesystem to be checked.
|
|
@@ -39,7 +77,7 @@ import * as path from 'node:path';
|
|
|
39
77
|
* is expected to be inert, so pruning it would fight the seeding rather than
|
|
40
78
|
* fix anything.
|
|
41
79
|
*/
|
|
42
|
-
|
|
80
|
+
function decidePrune(installed, role) {
|
|
43
81
|
if (role !== 'hub')
|
|
44
82
|
return [];
|
|
45
83
|
return installed
|
|
@@ -51,7 +89,7 @@ export function decidePrune(installed, role) {
|
|
|
51
89
|
}));
|
|
52
90
|
}
|
|
53
91
|
/** Guard: only ever remove something under `<dataDir>/addons/@camstack/`. */
|
|
54
|
-
|
|
92
|
+
function isPrunableDir(dir, addonsRoot) {
|
|
55
93
|
const rel = path.relative(addonsRoot, dir);
|
|
56
94
|
if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel))
|
|
57
95
|
return false;
|
|
@@ -66,7 +104,7 @@ export function isPrunableDir(dir, addonsRoot) {
|
|
|
66
104
|
* failed — which is exactly what we are trying to improve, not a reason to
|
|
67
105
|
* refuse to start.
|
|
68
106
|
*/
|
|
69
|
-
|
|
107
|
+
function prunePlacementLeftovers(decisions, addonsRoot, logger, rm = (dir) => fs.rmSync(dir, { recursive: true, force: true })) {
|
|
70
108
|
const removed = [];
|
|
71
109
|
for (const d of decisions) {
|
|
72
110
|
if (!isPrunableDir(d.dir, addonsRoot)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Group-runner convergence planner (pure).
|
|
3
4
|
*
|
|
@@ -21,6 +22,8 @@
|
|
|
21
22
|
* solo forever. To adopt a NEW roster the stale runner(s) must be STOPPED and
|
|
22
23
|
* the group spawned fresh — the convergence this planner encodes.
|
|
23
24
|
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.planRunnerConvergence = planRunnerConvergence;
|
|
24
27
|
function sameRoster(addonIds, rosterSet) {
|
|
25
28
|
return addonIds.length === rosterSet.size && addonIds.every((a) => rosterSet.has(a));
|
|
26
29
|
}
|
|
@@ -35,7 +38,7 @@ function sameRoster(addonIds, rosterSet) {
|
|
|
35
38
|
* @param opts.restart true when the caller wants an in-place respawn even if
|
|
36
39
|
* the roster already matches (deploy hot-reload path).
|
|
37
40
|
*/
|
|
38
|
-
|
|
41
|
+
function planRunnerConvergence(runnerId, rosterAddonIds, running, opts) {
|
|
39
42
|
const rosterSet = new Set(rosterAddonIds);
|
|
40
43
|
const target = running.find((p) => p.name === runnerId);
|
|
41
44
|
const targetIsCorrect = target !== undefined && sameRoster(target.addonIds, rosterSet);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRunnerSerializer = createRunnerSerializer;
|
|
4
|
+
function createRunnerSerializer() {
|
|
2
5
|
const tails = new Map();
|
|
3
6
|
return (runnerId, converge) => {
|
|
4
7
|
const previous = tails.get(runnerId) ?? Promise.resolve();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* What makes the boot runner plan safe to OVERLAP.
|
|
3
4
|
*
|
|
@@ -18,6 +19,10 @@
|
|
|
18
19
|
* Two primitives, because overlapping the loop exposes exactly one shared
|
|
19
20
|
* resource: Node's `require.cache`.
|
|
20
21
|
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.RUNNER_SPAWN_CONCURRENCY = void 0;
|
|
24
|
+
exports.spawnPlanConcurrently = spawnPlanConcurrently;
|
|
25
|
+
exports.createKeyedSerializer = createKeyedSerializer;
|
|
21
26
|
/**
|
|
22
27
|
* Concurrent runner spawns during boot.
|
|
23
28
|
*
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
* fork syscalls overlapped while never leaving more than eight bundles being
|
|
29
34
|
* parsed at once.
|
|
30
35
|
*/
|
|
31
|
-
|
|
36
|
+
exports.RUNNER_SPAWN_CONCURRENCY = 8;
|
|
32
37
|
/**
|
|
33
38
|
* Run `spawnOne` over every plan entry with at most `concurrency` in flight.
|
|
34
39
|
*
|
|
@@ -37,7 +42,7 @@ export const RUNNER_SPAWN_CONCURRENCY = 8;
|
|
|
37
42
|
* the next index until the queue is drained. `spawnOne` owns its own failure
|
|
38
43
|
* handling; a unit that settles (however it settles) frees its lane.
|
|
39
44
|
*/
|
|
40
|
-
|
|
45
|
+
async function spawnPlanConcurrently(plan, spawnOne, concurrency = exports.RUNNER_SPAWN_CONCURRENCY) {
|
|
41
46
|
const queue = [...plan.entries()];
|
|
42
47
|
if (queue.length === 0)
|
|
43
48
|
return;
|
|
@@ -71,7 +76,7 @@ export async function spawnPlanConcurrently(plan, spawnOne, concurrency = RUNNER
|
|
|
71
76
|
* Keyed by the purge scope, so the bound above still applies across packages
|
|
72
77
|
* and only true siblings queue behind each other.
|
|
73
78
|
*/
|
|
74
|
-
|
|
79
|
+
function createKeyedSerializer() {
|
|
75
80
|
const chains = new Map();
|
|
76
81
|
return {
|
|
77
82
|
run(key, work) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wireSettingsDoor = wireSettingsDoor;
|
|
1
4
|
/**
|
|
2
5
|
* Wiring the async `settings-store` door into `ConfigService` — and replaying
|
|
3
6
|
* the operator's persisted capability preferences once its boot read settles
|
|
@@ -10,13 +13,13 @@
|
|
|
10
13
|
* it. No timer, no retry (D3). A failed read is logged at error and leaves
|
|
11
14
|
* every preference UNKNOWN until the next boot.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const system_1 = require("@camstack/system");
|
|
17
|
+
const types_1 = require("@camstack/types");
|
|
15
18
|
/**
|
|
16
19
|
* Wire `door` and schedule the one preference replay. Returns the replay's
|
|
17
20
|
* promise (it never rejects) so a caller — or a spec — can await it.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
function wireSettingsDoor(deps, door) {
|
|
20
23
|
deps.configService.setSettingsDoor(door);
|
|
21
24
|
const preload = deps.configService.whenSystemSettingsPreloaded();
|
|
22
25
|
if (preload === null)
|
|
@@ -27,7 +30,7 @@ export function wireSettingsDoor(deps, door) {
|
|
|
27
30
|
deps.logger.error('capability preferences could not be read at boot — every persisted preference is UNKNOWN until the next boot, and the defaults apply', { meta: { error: result.error } });
|
|
28
31
|
return;
|
|
29
32
|
}
|
|
30
|
-
const replay = deps.registry.applyPersistedPreferences((capability) => isInfraCapability(capability));
|
|
33
|
+
const replay = deps.registry.applyPersistedPreferences((capability) => (0, system_1.isInfraCapability)(capability));
|
|
31
34
|
deps.logger.info('capability preferences loaded from the settings store', {
|
|
32
35
|
meta: {
|
|
33
36
|
keyCount: result.keyCount,
|
|
@@ -37,6 +40,6 @@ export function wireSettingsDoor(deps, door) {
|
|
|
37
40
|
});
|
|
38
41
|
})
|
|
39
42
|
.catch((err) => {
|
|
40
|
-
deps.logger.error('capability preference replay failed', { meta: { error: errMsg(err) } });
|
|
43
|
+
deps.logger.error('capability preference replay failed', { meta: { error: (0, types_1.errMsg)(err) } });
|
|
41
44
|
});
|
|
42
45
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSingleFlightRefresh = createSingleFlightRefresh;
|
|
1
4
|
/** Union of two scopes. `null` (everything) absorbs. */
|
|
2
5
|
function widenScope(a, b) {
|
|
3
6
|
if (a === null || b === null)
|
|
@@ -11,7 +14,7 @@ function widenScope(a, b) {
|
|
|
11
14
|
* @param run the rebuild, given the scope it must cover. Never called
|
|
12
15
|
* concurrently with itself, and never called with an empty set.
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
function createSingleFlightRefresh(run) {
|
|
15
18
|
let inFlight = null;
|
|
16
19
|
// The union of everything requested while a run is active — `undefined` when
|
|
17
20
|
// nothing is pending. One accumulator, not a queue: N requests during one run
|
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.AddonBridgeService = void 0;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const types_1 = require("@camstack/types");
|
|
3
39
|
/**
|
|
4
40
|
* AddonBridgeService — slim package-management surface.
|
|
5
41
|
*
|
|
@@ -20,7 +56,7 @@ import { errMsg } from '@camstack/types';
|
|
|
20
56
|
* set read like the uninstall guard and was not; uninstall is the `addons`
|
|
21
57
|
* cap's (`core/addon/addon-uninstall.ts`).
|
|
22
58
|
*/
|
|
23
|
-
|
|
59
|
+
class AddonBridgeService {
|
|
24
60
|
loggingService;
|
|
25
61
|
logger;
|
|
26
62
|
loader;
|
|
@@ -44,14 +80,14 @@ export class AddonBridgeService {
|
|
|
44
80
|
kernel.ensureDir(addonsDir);
|
|
45
81
|
}
|
|
46
82
|
catch (error) {
|
|
47
|
-
const msg = errMsg(error);
|
|
83
|
+
const msg = (0, types_1.errMsg)(error);
|
|
48
84
|
this.logger.warn('Installer init failed', { meta: { error: msg } });
|
|
49
85
|
}
|
|
50
86
|
}
|
|
51
87
|
async onModuleInit() {
|
|
52
88
|
this.logger.info('Initializing addon bridge (package management only)...');
|
|
53
89
|
try {
|
|
54
|
-
const kernel = await
|
|
90
|
+
const kernel = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
55
91
|
this.loader = new kernel.AddonLoader(this.logger.child('AddonLoader'));
|
|
56
92
|
const dataDir = process.env.CAMSTACK_DATA ?? 'camstack-data';
|
|
57
93
|
const addonsDir = process.env.CAMSTACK_ADDONS_DIR ?? path.resolve(dataDir, 'addons');
|
|
@@ -62,7 +98,7 @@ export class AddonBridgeService {
|
|
|
62
98
|
});
|
|
63
99
|
}
|
|
64
100
|
catch (error) {
|
|
65
|
-
const msg = errMsg(error);
|
|
101
|
+
const msg = (0, types_1.errMsg)(error);
|
|
66
102
|
this.logger.warn('Addon bridge loader failed — install/uninstall still available', {
|
|
67
103
|
meta: { error: msg },
|
|
68
104
|
});
|
|
@@ -98,7 +134,7 @@ export class AddonBridgeService {
|
|
|
98
134
|
this.logger.warn('reloadPackages called but bridge is unavailable — skipping');
|
|
99
135
|
return;
|
|
100
136
|
}
|
|
101
|
-
const kernel = await
|
|
137
|
+
const kernel = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
102
138
|
this.loader = new kernel.AddonLoader(this.logger.child('AddonLoader'));
|
|
103
139
|
const dataDir = process.env.CAMSTACK_DATA ?? 'camstack-data';
|
|
104
140
|
const addonsDir = process.env.CAMSTACK_ADDONS_DIR ?? path.resolve(dataDir, 'addons');
|
|
@@ -106,3 +142,4 @@ export class AddonBridgeService {
|
|
|
106
142
|
this.logger.info('Reloaded', { meta: { count: this.loader.listAddons().length } });
|
|
107
143
|
}
|
|
108
144
|
}
|
|
145
|
+
exports.AddonBridgeService = AddonBridgeService;
|