@camstack/server 1.2.740 → 1.2.742
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/CHANGELOG.md +13 -0
- package/dist/api/core/cap-providers.js +167 -43
- package/dist/api/core/integration-role.js +20 -0
- package/dist/api/trpc/generated-cap-mounts.js +18 -1
- package/dist/api/trpc/generated-cap-routers.js +2434 -2379
- package/package.json +16 -16
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-DXWlu1kP.js → agent-https-CsDhLoui.js} +1 -1
- package/system/dist/{agent-https-DcYKH3q_.mjs → agent-https-lgka7y2l.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +4 -4
- package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +4 -4
- package/system/dist/builtins/camera-grid/index.mjs +4 -4
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +193 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +193 -3
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -0
- package/system/dist/builtins/core-blocks/migrations/pump-cycle-split.d.ts +43 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +146 -48
- package/system/dist/builtins/loki-logging/index.mjs +146 -48
- package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +15 -0
- package/system/dist/builtins/loki-logging/loki-record-kinds.d.ts +2 -0
- package/system/dist/builtins/loki-logging/migrations/index.d.ts +11 -1
- package/system/dist/builtins/loki-logging/migrations/registry-toggle-to-record.d.ts +26 -0
- package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +8 -23
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-BNa_vU07.mjs → composition-sources-BE6yrVCB.mjs} +1 -1
- package/system/dist/{composition-sources-BfWnLt2j.js → composition-sources-ny5MCbhd.js} +1 -1
- package/system/dist/{constants-DugYIgQF.js → constants-BbgVaoOX.js} +1 -1
- package/system/dist/{constants-DCYUT12P.mjs → constants-DiDTdj26.mjs} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
- package/system/dist/{device-ca-CFs0PY9S.js → device-ca-BdgE_3J6.js} +1 -1
- package/system/dist/{device-ca-BnBFt1ex.mjs → device-ca-CVcZIfhA.mjs} +1 -1
- package/system/dist/{dist-BF9MiiHX.mjs → dist-BqlGZK-1.mjs} +397 -132
- package/system/dist/{dist-DwI4ifnv.js → dist-DdlfeOQx.js} +402 -131
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CnSqBHO9.mjs → hub-mdns-ciao-BZsVTXQ7.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-Dsk7HF0G.js → hub-mdns-ciao-D3ZQMWjg.js} +2 -2
- package/system/dist/index.js +14 -9
- package/system/dist/index.mjs +225 -220
- package/system/dist/migrations/hub/2026-11-02-integration-addon-id-bare.d.ts +3 -0
- package/system/dist/{restore-archive-CDgSTubW.mjs → restore-archive-BFem7ZuS.mjs} +94 -94
- package/system/dist/{restore-archive-CnG6nyar.js → restore-archive-Ch76C3VQ.js} +1 -1
- package/system/dist/{retention-csYEu0l3.mjs → retention-D5Vk8FXc.mjs} +1 -1
- package/system/dist/{retention-voCdtR4h.js → retention-DWsfcaKe.js} +1 -1
- package/system/dist/{wal-maintenance-CTsOr0e7.mjs → wal-maintenance-CS-Wtg9w.mjs} +0 -0
- package/system/dist/{wal-maintenance-DrLnLCGO.js → wal-maintenance-DcVdVWDD.js} +0 -0
- package/system/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $n as deviceCredentialsCapability, A as CredentialTokenClaimsSchema, At as PreferenceValueSchema, Dt as PREFERENCES_MAX_VALUE_BYTES,
|
|
2
|
+
import { $n as deviceCredentialsCapability, A as CredentialTokenClaimsSchema, At as PreferenceValueSchema, Dt as PREFERENCES_MAX_VALUE_BYTES, Ea as userManagementCapability, Es as isSecretMarker, Fr as isCredentialTokenPayload, Gt as SsoBridgeClaimsSchema, Ot as PreferenceDeviceIdSchema, Qt as TokenScopeSchema, R as DEVICE_ENROLLMENT_TTL_MS, Sr as formatDeviceRevoker, Ut as ScopedTokenSchema, V as DEVICE_NONCE_TTL_MS, Xs as userError, bn as buildDeviceEnrollmentLink, en as UserRecordSchema, ho as BaseAddon, ks as makeSecretMarker, kt as PreferenceNamespaceSchema, pn as authProviderCapability, us as defineRecordKinds, w as CREDENTIAL_TOKEN_AUDIENCE, xn as buildDeviceSignatureMessage } from "../../dist-BqlGZK-1.mjs";
|
|
3
3
|
import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
|
|
4
4
|
import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
|
|
5
|
-
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-
|
|
5
|
+
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-CVcZIfhA.mjs";
|
|
6
6
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as crypto$1 from "node:crypto";
|
|
9
9
|
import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
10
10
|
import nodeCrypto from "crypto";
|
|
11
11
|
import * as path$1 from "node:path";
|
|
12
|
-
import * as fs from "node:fs";
|
|
12
|
+
import * as fs$1 from "node:fs";
|
|
13
13
|
//#region ../../node_modules/bcryptjs/index.js
|
|
14
14
|
/**
|
|
15
15
|
* The random implementation to use as a fallback.
|
|
@@ -11912,8 +11912,8 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
11912
11912
|
users: this.userManager,
|
|
11913
11913
|
dataDir: this.ctx.nodeDataDir,
|
|
11914
11914
|
fs: {
|
|
11915
|
-
exists: (filePath) => fs.existsSync(filePath),
|
|
11916
|
-
remove: (filePath) => fs.rmSync(filePath, { force: true })
|
|
11915
|
+
exists: (filePath) => fs$1.existsSync(filePath),
|
|
11916
|
+
remove: (filePath) => fs$1.rmSync(filePath, { force: true })
|
|
11917
11917
|
},
|
|
11918
11918
|
logger: this.ctx.logger
|
|
11919
11919
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-DdlfeOQx.js");
|
|
4
4
|
const require_dns_wire = require("../../dns-wire-B1BvF9Ao.js");
|
|
5
|
-
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-
|
|
5
|
+
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-D3ZQMWjg.js");
|
|
6
6
|
let zod = require("zod");
|
|
7
7
|
let node_net = require("node:net");
|
|
8
8
|
let node_os = require("node:os");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bi as resolveAppConnections, Et as NetworkTunnelStartedDataSchema, Ir as isDefaultAppConnectionEndpoint, Ji as resolveNotificationTapAddress, Mr as isAppLinkBase, Oa as validateCustomAddress, On as checkRoleAddress, Wi as resolveHubAddressRoles, Yr as localNetworkCapability, _ as CAMSTACK_APP_LINK_ORIGIN, ca as shortHostname, dt as HUB_MDNS_TXT_KEYS, ho as BaseAddon, nc as EventCategory, tc as errMsg, ut as HUB_MDNS_SERVICE_TYPE, wi as pickAppLinkHub } from "../../dist-BqlGZK-1.mjs";
|
|
2
2
|
import { a as emptyMdnsRecords, c as parseMdnsMessage, i as buildRecordQuery, l as parseMdnsRecords, n as MDNS_PORT, o as mergeMdnsRecords, r as buildPtrQuery, s as normalizeServiceType, t as MDNS_GROUP } from "../../dns-wire-Dm3H_7ST.mjs";
|
|
3
|
-
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-
|
|
3
|
+
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-BZsVTXQ7.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { isIP } from "node:net";
|
|
6
6
|
import * as os$1 from "node:os";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DdlfeOQx.js");
|
|
7
7
|
const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
@@ -649,7 +649,8 @@ var LokiDestinationBodySchema = zod.z.object({
|
|
|
649
649
|
password: zod.z.string().optional().meta({ secret: true }),
|
|
650
650
|
batchIntervalMs: zod.z.number().int().min(LOKI_BOUNDS.batchIntervalMs.min).max(LOKI_BOUNDS.batchIntervalMs.max),
|
|
651
651
|
batchSize: zod.z.number().int().min(LOKI_BOUNDS.batchSize.min).max(LOKI_BOUNDS.batchSize.max),
|
|
652
|
-
timeoutMs: zod.z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max)
|
|
652
|
+
timeoutMs: zod.z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max),
|
|
653
|
+
enabled: zod.z.boolean().optional()
|
|
653
654
|
});
|
|
654
655
|
var lokiDestinationsKind = require_dist.defineEntryKind("destinations", {
|
|
655
656
|
title: "Loki destinations",
|
|
@@ -801,40 +802,91 @@ async function confirmRecordHoldsLegacy(ports, stored) {
|
|
|
801
802
|
if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
|
|
802
803
|
}
|
|
803
804
|
//#endregion
|
|
805
|
+
//#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
|
|
806
|
+
async function moveRegistryToggleToRecord(ports) {
|
|
807
|
+
const state = await ports.readRegistryState();
|
|
808
|
+
if (state === "active") return {
|
|
809
|
+
outcome: "already-done",
|
|
810
|
+
summary: { carried: false }
|
|
811
|
+
};
|
|
812
|
+
if (state === "unregistered") throw new Error("the log-destination provider is not registered yet");
|
|
813
|
+
const record = await ports.findToggleRecord();
|
|
814
|
+
if (record === null) return {
|
|
815
|
+
outcome: "already-done",
|
|
816
|
+
summary: { carried: false }
|
|
817
|
+
};
|
|
818
|
+
if (record.enabled) await ports.disableRecord(record.id);
|
|
819
|
+
await ports.enableRegistry();
|
|
820
|
+
return {
|
|
821
|
+
outcome: "done",
|
|
822
|
+
summary: {
|
|
823
|
+
carried: true,
|
|
824
|
+
integrationId: record.id
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
804
829
|
//#region src/builtins/loki-logging/migrations/index.ts
|
|
805
830
|
var CONNECTION_TO_RECORDS_ID = "loki-logging/2026-11-02-connection-to-records";
|
|
831
|
+
var REGISTRY_TOGGLE_TO_RECORD_ID = "loki-logging/2026-11-02-registry-toggle-to-record";
|
|
806
832
|
/** The `loki-logging` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
|
|
807
|
-
var ADDON_MIGRATIONS = [
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
833
|
+
var ADDON_MIGRATIONS = [
|
|
834
|
+
{
|
|
835
|
+
meta: {
|
|
836
|
+
id: CONNECTION_TO_RECORDS_ID,
|
|
837
|
+
owner: "loki-logging",
|
|
838
|
+
level: "addon-state",
|
|
839
|
+
seq: 1,
|
|
840
|
+
dependsOn: [],
|
|
841
|
+
store: "settings",
|
|
842
|
+
scope: "cluster",
|
|
843
|
+
onFailure: "block-owner",
|
|
844
|
+
bodyKind: "procedure",
|
|
845
|
+
description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
|
|
846
|
+
fixtureMark: "the D777 retirement marker the migration does not know"
|
|
847
|
+
},
|
|
848
|
+
procedure: moveConnectionToRecord
|
|
820
849
|
},
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
850
|
+
{
|
|
851
|
+
meta: {
|
|
852
|
+
id: "loki-logging/2026-11-02-drop-moved-settings",
|
|
853
|
+
owner: "loki-logging",
|
|
854
|
+
level: "addon-state",
|
|
855
|
+
seq: 2,
|
|
856
|
+
dependsOn: [CONNECTION_TO_RECORDS_ID],
|
|
857
|
+
store: "settings",
|
|
858
|
+
scope: "cluster",
|
|
859
|
+
onFailure: "block-owner",
|
|
860
|
+
bodyKind: "plan",
|
|
861
|
+
description: "Delete the connection keys that moved into the destinations record",
|
|
862
|
+
fixtureMark: "the D777 retirement marker the migration does not know"
|
|
863
|
+
},
|
|
864
|
+
plan: planDropMovedSettings
|
|
835
865
|
},
|
|
836
|
-
|
|
837
|
-
|
|
866
|
+
{
|
|
867
|
+
meta: {
|
|
868
|
+
id: REGISTRY_TOGGLE_TO_RECORD_ID,
|
|
869
|
+
owner: "loki-logging",
|
|
870
|
+
level: "addon-state",
|
|
871
|
+
seq: 3,
|
|
872
|
+
dependsOn: [CONNECTION_TO_RECORDS_ID],
|
|
873
|
+
store: "settings",
|
|
874
|
+
scope: "cluster",
|
|
875
|
+
onFailure: "tolerate",
|
|
876
|
+
bodyKind: "procedure",
|
|
877
|
+
description: "Carry a Loki provider switched off at the log-destination registry toggle to a destinations record that is off, and turn the registry toggle back on",
|
|
878
|
+
fixtureMark: "a destinations record field the migration does not know (the job)"
|
|
879
|
+
},
|
|
880
|
+
procedure: moveRegistryToggleToRecord
|
|
881
|
+
}
|
|
882
|
+
];
|
|
883
|
+
/**
|
|
884
|
+
* What can be decided while the addon initialises. The registry-toggle migration reads the hub's
|
|
885
|
+
* registry, which holds this provider only AFTER registration, so it is run from `postBrokerStart`
|
|
886
|
+
* (the full {@link ADDON_MIGRATIONS}) and never offered here: a pass that cannot decide is a
|
|
887
|
+
* guaranteed failure and a critical alert for nothing.
|
|
888
|
+
*/
|
|
889
|
+
var INITIALIZE_MIGRATIONS = ADDON_MIGRATIONS.filter((m) => m.meta.id !== REGISTRY_TOGGLE_TO_RECORD_ID);
|
|
838
890
|
//#endregion
|
|
839
891
|
//#region src/builtins/loki-logging/retire-enabled-flag.ts
|
|
840
892
|
/** The retired settings key. */
|
|
@@ -856,17 +908,12 @@ async function retireEnabledFlag(deps) {
|
|
|
856
908
|
if (isMarked(marker)) return { kind: "already-retired" };
|
|
857
909
|
const flag = await deps.readStoredKey(RETIRED_ENABLED_KEY);
|
|
858
910
|
if (flag.kind === "unreadable") return deferred("settings store unreadable (enabled)");
|
|
859
|
-
const
|
|
860
|
-
if (wasOff) try {
|
|
861
|
-
await deps.disableAtCapability();
|
|
862
|
-
} catch (err) {
|
|
863
|
-
return deferred(`capability toggle refused: ${err instanceof Error ? err.message : String(err)}`);
|
|
864
|
-
}
|
|
911
|
+
const strippedValue = flag.kind === "present" && typeof flag.value === "boolean" ? flag.value : null;
|
|
865
912
|
await deps.commit();
|
|
866
913
|
if (!isMarked(await deps.readStoredKey("migratedEnabled"))) return deferred("retirement write did not land");
|
|
867
914
|
return {
|
|
868
915
|
kind: "retired",
|
|
869
|
-
|
|
916
|
+
strippedValue
|
|
870
917
|
};
|
|
871
918
|
}
|
|
872
919
|
//#endregion
|
|
@@ -946,7 +993,7 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
946
993
|
test: (input) => this.probe(input.id, input.values)
|
|
947
994
|
});
|
|
948
995
|
if (hub) {
|
|
949
|
-
await this.runMigrations(require_dist.defineAddonMigrations(
|
|
996
|
+
await this.runMigrations(require_dist.defineAddonMigrations(await this.initializeCatalogue(), this.migrationPorts()));
|
|
950
997
|
registrations.push({
|
|
951
998
|
capability: require_dist.integrationInstancesCapability,
|
|
952
999
|
provider: this.instances.toProvider()
|
|
@@ -998,6 +1045,20 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
998
1045
|
this.current = first?.body ?? null;
|
|
999
1046
|
await this.destination?.reconfigure(this.destinationConfig());
|
|
1000
1047
|
}
|
|
1048
|
+
/**
|
|
1049
|
+
* The catalogue to offer while initialising. Seq 3 cannot decide before registration, so it is
|
|
1050
|
+
* left out (`INITIALIZE_MIGRATIONS`) — unless the ledger already holds it APPLIED: then the full
|
|
1051
|
+
* catalogue is offered and the engine skips it, whereas a subset would make it log the id as a
|
|
1052
|
+
* database newer than this code on every boot. A ledger that cannot be read offers the subset.
|
|
1053
|
+
*/
|
|
1054
|
+
async initializeCatalogue() {
|
|
1055
|
+
try {
|
|
1056
|
+
const { entries } = await this.ctx.api.migrations.listLedger.query({});
|
|
1057
|
+
return entries.some((e) => e.id === "loki-logging/2026-11-02-registry-toggle-to-record" && e.status === "applied") ? ADDON_MIGRATIONS : INITIALIZE_MIGRATIONS;
|
|
1058
|
+
} catch {
|
|
1059
|
+
return INITIALIZE_MIGRATIONS;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1001
1062
|
/** The ports of the connection migrations: the old settings in, the record out. */
|
|
1002
1063
|
migrationPorts() {
|
|
1003
1064
|
const records = this.ctx.records;
|
|
@@ -1048,6 +1109,28 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1048
1109
|
}
|
|
1049
1110
|
return "created";
|
|
1050
1111
|
},
|
|
1112
|
+
readRegistryState: async () => {
|
|
1113
|
+
const own = (await this.ctx.api.addons.listCapabilityProviders.query({ capName: require_dist.logDestinationCapability.name })).find((p) => require_dist.isSameAddonId(p.addonId, this.ctx.id));
|
|
1114
|
+
if (own === void 0) return "unregistered";
|
|
1115
|
+
return own.isActive ? "active" : "inactive";
|
|
1116
|
+
},
|
|
1117
|
+
findToggleRecord: async () => {
|
|
1118
|
+
const [first] = await instances.listResolved();
|
|
1119
|
+
return first === void 0 ? null : {
|
|
1120
|
+
id: first.id,
|
|
1121
|
+
enabled: first.enabled
|
|
1122
|
+
};
|
|
1123
|
+
},
|
|
1124
|
+
disableRecord: async (id) => {
|
|
1125
|
+
await handle.patch(id, { enabled: false });
|
|
1126
|
+
},
|
|
1127
|
+
enableRegistry: async () => {
|
|
1128
|
+
await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
|
|
1129
|
+
capName: require_dist.logDestinationCapability.name,
|
|
1130
|
+
addonId: require_dist.bareAddonId(this.ctx.id),
|
|
1131
|
+
enabled: true
|
|
1132
|
+
});
|
|
1133
|
+
},
|
|
1051
1134
|
clearOldPassword: async () => {
|
|
1052
1135
|
await this.clearSecrets(["password"]);
|
|
1053
1136
|
}
|
|
@@ -1103,13 +1186,6 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1103
1186
|
try {
|
|
1104
1187
|
outcome = await retireEnabledFlag({
|
|
1105
1188
|
readStoredKey: (key) => this.readStoredGlobalKey(key),
|
|
1106
|
-
disableAtCapability: async () => {
|
|
1107
|
-
await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
|
|
1108
|
-
capName: require_dist.logDestinationCapability.name,
|
|
1109
|
-
addonId: this.ctx.id,
|
|
1110
|
-
enabled: false
|
|
1111
|
-
});
|
|
1112
|
-
},
|
|
1113
1189
|
commit: async () => {
|
|
1114
1190
|
const patch = {
|
|
1115
1191
|
[RETIRED_ENABLED_KEY]: void 0,
|
|
@@ -1124,7 +1200,7 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1124
1200
|
reason: err instanceof Error ? err.message : String(err)
|
|
1125
1201
|
};
|
|
1126
1202
|
}
|
|
1127
|
-
if (outcome.kind === "retired" && outcome.
|
|
1203
|
+
if (outcome.kind === "retired" && outcome.strippedValue !== null) this.ctx.logger.info(`Loki logging: the retired \`enabled: ${String(outcome.strippedValue)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
1128
1204
|
if (outcome.kind !== "deferred") return;
|
|
1129
1205
|
const delay = RETIREMENT_RETRY_DELAYS_MS[attempt];
|
|
1130
1206
|
if (delay === void 0) {
|
|
@@ -1142,6 +1218,28 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1142
1218
|
}, delay);
|
|
1143
1219
|
this.retirementTimer.unref?.();
|
|
1144
1220
|
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Registration is done: the hub calls this after the providers are registered, so
|
|
1223
|
+
* `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
|
|
1224
|
+
* that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
|
|
1225
|
+
* failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
|
|
1226
|
+
*/
|
|
1227
|
+
postBrokerStart() {
|
|
1228
|
+
super.postBrokerStart();
|
|
1229
|
+
if (!this.isHub() || this.instances === null || this.shuttingDown) return;
|
|
1230
|
+
this.runRegistryToggleMigration();
|
|
1231
|
+
}
|
|
1232
|
+
async runRegistryToggleMigration() {
|
|
1233
|
+
try {
|
|
1234
|
+
if ((await this.runMigrations(require_dist.defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()))).failed.includes("loki-logging/2026-11-02-registry-toggle-to-record")) {
|
|
1235
|
+
this.ctx.logger.warn("Loki logging: the registry-toggle migration is kept for next boot");
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
await this.refreshFromRecord();
|
|
1239
|
+
} catch (err) {
|
|
1240
|
+
this.ctx.logger.warn("Loki logging: the registry-toggle migration could not run", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1145
1243
|
async onShutdown() {
|
|
1146
1244
|
this.shuttingDown = true;
|
|
1147
1245
|
if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
|
|
@@ -1178,7 +1276,7 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1178
1276
|
name: ""
|
|
1179
1277
|
};
|
|
1180
1278
|
return {
|
|
1181
|
-
enabled:
|
|
1279
|
+
enabled: body.enabled !== false,
|
|
1182
1280
|
url: body.url,
|
|
1183
1281
|
job: body.job,
|
|
1184
1282
|
node: this.ctx.kernel.localNodeId ?? "hub",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dr as integrationInstancesCapability,
|
|
1
|
+
import { $r as logDestinationCapability, Br as isSameAddonId, Dr as integrationInstancesCapability, Es as isSecretMarker, Ho as RevConflictError, Pt as RecordIntegrationInstances, Ts as isSecretFieldView, hn as bareAddonId, ho as BaseAddon, ki as preconditionOf, ls as defineEntryKind, ss as defineAddonMigrations } from "../../dist-BqlGZK-1.mjs";
|
|
2
2
|
import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
@@ -646,7 +646,8 @@ var lokiDestinationsKind = defineEntryKind("destinations", {
|
|
|
646
646
|
password: z.string().optional().meta({ secret: true }),
|
|
647
647
|
batchIntervalMs: z.number().int().min(LOKI_BOUNDS.batchIntervalMs.min).max(LOKI_BOUNDS.batchIntervalMs.max),
|
|
648
648
|
batchSize: z.number().int().min(LOKI_BOUNDS.batchSize.min).max(LOKI_BOUNDS.batchSize.max),
|
|
649
|
-
timeoutMs: z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max)
|
|
649
|
+
timeoutMs: z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max),
|
|
650
|
+
enabled: z.boolean().optional()
|
|
650
651
|
})
|
|
651
652
|
});
|
|
652
653
|
var LOKI_DEFAULT_BODY = {
|
|
@@ -794,40 +795,91 @@ async function confirmRecordHoldsLegacy(ports, stored) {
|
|
|
794
795
|
if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
|
|
795
796
|
}
|
|
796
797
|
//#endregion
|
|
798
|
+
//#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
|
|
799
|
+
async function moveRegistryToggleToRecord(ports) {
|
|
800
|
+
const state = await ports.readRegistryState();
|
|
801
|
+
if (state === "active") return {
|
|
802
|
+
outcome: "already-done",
|
|
803
|
+
summary: { carried: false }
|
|
804
|
+
};
|
|
805
|
+
if (state === "unregistered") throw new Error("the log-destination provider is not registered yet");
|
|
806
|
+
const record = await ports.findToggleRecord();
|
|
807
|
+
if (record === null) return {
|
|
808
|
+
outcome: "already-done",
|
|
809
|
+
summary: { carried: false }
|
|
810
|
+
};
|
|
811
|
+
if (record.enabled) await ports.disableRecord(record.id);
|
|
812
|
+
await ports.enableRegistry();
|
|
813
|
+
return {
|
|
814
|
+
outcome: "done",
|
|
815
|
+
summary: {
|
|
816
|
+
carried: true,
|
|
817
|
+
integrationId: record.id
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
//#endregion
|
|
797
822
|
//#region src/builtins/loki-logging/migrations/index.ts
|
|
798
823
|
var CONNECTION_TO_RECORDS_ID = "loki-logging/2026-11-02-connection-to-records";
|
|
824
|
+
var REGISTRY_TOGGLE_TO_RECORD_ID = "loki-logging/2026-11-02-registry-toggle-to-record";
|
|
799
825
|
/** The `loki-logging` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
|
|
800
|
-
var ADDON_MIGRATIONS = [
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
826
|
+
var ADDON_MIGRATIONS = [
|
|
827
|
+
{
|
|
828
|
+
meta: {
|
|
829
|
+
id: CONNECTION_TO_RECORDS_ID,
|
|
830
|
+
owner: "loki-logging",
|
|
831
|
+
level: "addon-state",
|
|
832
|
+
seq: 1,
|
|
833
|
+
dependsOn: [],
|
|
834
|
+
store: "settings",
|
|
835
|
+
scope: "cluster",
|
|
836
|
+
onFailure: "block-owner",
|
|
837
|
+
bodyKind: "procedure",
|
|
838
|
+
description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
|
|
839
|
+
fixtureMark: "the D777 retirement marker the migration does not know"
|
|
840
|
+
},
|
|
841
|
+
procedure: moveConnectionToRecord
|
|
813
842
|
},
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
843
|
+
{
|
|
844
|
+
meta: {
|
|
845
|
+
id: "loki-logging/2026-11-02-drop-moved-settings",
|
|
846
|
+
owner: "loki-logging",
|
|
847
|
+
level: "addon-state",
|
|
848
|
+
seq: 2,
|
|
849
|
+
dependsOn: [CONNECTION_TO_RECORDS_ID],
|
|
850
|
+
store: "settings",
|
|
851
|
+
scope: "cluster",
|
|
852
|
+
onFailure: "block-owner",
|
|
853
|
+
bodyKind: "plan",
|
|
854
|
+
description: "Delete the connection keys that moved into the destinations record",
|
|
855
|
+
fixtureMark: "the D777 retirement marker the migration does not know"
|
|
856
|
+
},
|
|
857
|
+
plan: planDropMovedSettings
|
|
828
858
|
},
|
|
829
|
-
|
|
830
|
-
|
|
859
|
+
{
|
|
860
|
+
meta: {
|
|
861
|
+
id: REGISTRY_TOGGLE_TO_RECORD_ID,
|
|
862
|
+
owner: "loki-logging",
|
|
863
|
+
level: "addon-state",
|
|
864
|
+
seq: 3,
|
|
865
|
+
dependsOn: [CONNECTION_TO_RECORDS_ID],
|
|
866
|
+
store: "settings",
|
|
867
|
+
scope: "cluster",
|
|
868
|
+
onFailure: "tolerate",
|
|
869
|
+
bodyKind: "procedure",
|
|
870
|
+
description: "Carry a Loki provider switched off at the log-destination registry toggle to a destinations record that is off, and turn the registry toggle back on",
|
|
871
|
+
fixtureMark: "a destinations record field the migration does not know (the job)"
|
|
872
|
+
},
|
|
873
|
+
procedure: moveRegistryToggleToRecord
|
|
874
|
+
}
|
|
875
|
+
];
|
|
876
|
+
/**
|
|
877
|
+
* What can be decided while the addon initialises. The registry-toggle migration reads the hub's
|
|
878
|
+
* registry, which holds this provider only AFTER registration, so it is run from `postBrokerStart`
|
|
879
|
+
* (the full {@link ADDON_MIGRATIONS}) and never offered here: a pass that cannot decide is a
|
|
880
|
+
* guaranteed failure and a critical alert for nothing.
|
|
881
|
+
*/
|
|
882
|
+
var INITIALIZE_MIGRATIONS = ADDON_MIGRATIONS.filter((m) => m.meta.id !== REGISTRY_TOGGLE_TO_RECORD_ID);
|
|
831
883
|
//#endregion
|
|
832
884
|
//#region src/builtins/loki-logging/retire-enabled-flag.ts
|
|
833
885
|
/** The retired settings key. */
|
|
@@ -849,17 +901,12 @@ async function retireEnabledFlag(deps) {
|
|
|
849
901
|
if (isMarked(marker)) return { kind: "already-retired" };
|
|
850
902
|
const flag = await deps.readStoredKey(RETIRED_ENABLED_KEY);
|
|
851
903
|
if (flag.kind === "unreadable") return deferred("settings store unreadable (enabled)");
|
|
852
|
-
const
|
|
853
|
-
if (wasOff) try {
|
|
854
|
-
await deps.disableAtCapability();
|
|
855
|
-
} catch (err) {
|
|
856
|
-
return deferred(`capability toggle refused: ${err instanceof Error ? err.message : String(err)}`);
|
|
857
|
-
}
|
|
904
|
+
const strippedValue = flag.kind === "present" && typeof flag.value === "boolean" ? flag.value : null;
|
|
858
905
|
await deps.commit();
|
|
859
906
|
if (!isMarked(await deps.readStoredKey("migratedEnabled"))) return deferred("retirement write did not land");
|
|
860
907
|
return {
|
|
861
908
|
kind: "retired",
|
|
862
|
-
|
|
909
|
+
strippedValue
|
|
863
910
|
};
|
|
864
911
|
}
|
|
865
912
|
//#endregion
|
|
@@ -939,7 +986,7 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
939
986
|
test: (input) => this.probe(input.id, input.values)
|
|
940
987
|
});
|
|
941
988
|
if (hub) {
|
|
942
|
-
await this.runMigrations(defineAddonMigrations(
|
|
989
|
+
await this.runMigrations(defineAddonMigrations(await this.initializeCatalogue(), this.migrationPorts()));
|
|
943
990
|
registrations.push({
|
|
944
991
|
capability: integrationInstancesCapability,
|
|
945
992
|
provider: this.instances.toProvider()
|
|
@@ -991,6 +1038,20 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
991
1038
|
this.current = first?.body ?? null;
|
|
992
1039
|
await this.destination?.reconfigure(this.destinationConfig());
|
|
993
1040
|
}
|
|
1041
|
+
/**
|
|
1042
|
+
* The catalogue to offer while initialising. Seq 3 cannot decide before registration, so it is
|
|
1043
|
+
* left out (`INITIALIZE_MIGRATIONS`) — unless the ledger already holds it APPLIED: then the full
|
|
1044
|
+
* catalogue is offered and the engine skips it, whereas a subset would make it log the id as a
|
|
1045
|
+
* database newer than this code on every boot. A ledger that cannot be read offers the subset.
|
|
1046
|
+
*/
|
|
1047
|
+
async initializeCatalogue() {
|
|
1048
|
+
try {
|
|
1049
|
+
const { entries } = await this.ctx.api.migrations.listLedger.query({});
|
|
1050
|
+
return entries.some((e) => e.id === "loki-logging/2026-11-02-registry-toggle-to-record" && e.status === "applied") ? ADDON_MIGRATIONS : INITIALIZE_MIGRATIONS;
|
|
1051
|
+
} catch {
|
|
1052
|
+
return INITIALIZE_MIGRATIONS;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
994
1055
|
/** The ports of the connection migrations: the old settings in, the record out. */
|
|
995
1056
|
migrationPorts() {
|
|
996
1057
|
const records = this.ctx.records;
|
|
@@ -1041,6 +1102,28 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1041
1102
|
}
|
|
1042
1103
|
return "created";
|
|
1043
1104
|
},
|
|
1105
|
+
readRegistryState: async () => {
|
|
1106
|
+
const own = (await this.ctx.api.addons.listCapabilityProviders.query({ capName: logDestinationCapability.name })).find((p) => isSameAddonId(p.addonId, this.ctx.id));
|
|
1107
|
+
if (own === void 0) return "unregistered";
|
|
1108
|
+
return own.isActive ? "active" : "inactive";
|
|
1109
|
+
},
|
|
1110
|
+
findToggleRecord: async () => {
|
|
1111
|
+
const [first] = await instances.listResolved();
|
|
1112
|
+
return first === void 0 ? null : {
|
|
1113
|
+
id: first.id,
|
|
1114
|
+
enabled: first.enabled
|
|
1115
|
+
};
|
|
1116
|
+
},
|
|
1117
|
+
disableRecord: async (id) => {
|
|
1118
|
+
await handle.patch(id, { enabled: false });
|
|
1119
|
+
},
|
|
1120
|
+
enableRegistry: async () => {
|
|
1121
|
+
await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
|
|
1122
|
+
capName: logDestinationCapability.name,
|
|
1123
|
+
addonId: bareAddonId(this.ctx.id),
|
|
1124
|
+
enabled: true
|
|
1125
|
+
});
|
|
1126
|
+
},
|
|
1044
1127
|
clearOldPassword: async () => {
|
|
1045
1128
|
await this.clearSecrets(["password"]);
|
|
1046
1129
|
}
|
|
@@ -1096,13 +1179,6 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1096
1179
|
try {
|
|
1097
1180
|
outcome = await retireEnabledFlag({
|
|
1098
1181
|
readStoredKey: (key) => this.readStoredGlobalKey(key),
|
|
1099
|
-
disableAtCapability: async () => {
|
|
1100
|
-
await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
|
|
1101
|
-
capName: logDestinationCapability.name,
|
|
1102
|
-
addonId: this.ctx.id,
|
|
1103
|
-
enabled: false
|
|
1104
|
-
});
|
|
1105
|
-
},
|
|
1106
1182
|
commit: async () => {
|
|
1107
1183
|
const patch = {
|
|
1108
1184
|
[RETIRED_ENABLED_KEY]: void 0,
|
|
@@ -1117,7 +1193,7 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1117
1193
|
reason: err instanceof Error ? err.message : String(err)
|
|
1118
1194
|
};
|
|
1119
1195
|
}
|
|
1120
|
-
if (outcome.kind === "retired" && outcome.
|
|
1196
|
+
if (outcome.kind === "retired" && outcome.strippedValue !== null) this.ctx.logger.info(`Loki logging: the retired \`enabled: ${String(outcome.strippedValue)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
1121
1197
|
if (outcome.kind !== "deferred") return;
|
|
1122
1198
|
const delay = RETIREMENT_RETRY_DELAYS_MS[attempt];
|
|
1123
1199
|
if (delay === void 0) {
|
|
@@ -1135,6 +1211,28 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1135
1211
|
}, delay);
|
|
1136
1212
|
this.retirementTimer.unref?.();
|
|
1137
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Registration is done: the hub calls this after the providers are registered, so
|
|
1216
|
+
* `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
|
|
1217
|
+
* that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
|
|
1218
|
+
* failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
|
|
1219
|
+
*/
|
|
1220
|
+
postBrokerStart() {
|
|
1221
|
+
super.postBrokerStart();
|
|
1222
|
+
if (!this.isHub() || this.instances === null || this.shuttingDown) return;
|
|
1223
|
+
this.runRegistryToggleMigration();
|
|
1224
|
+
}
|
|
1225
|
+
async runRegistryToggleMigration() {
|
|
1226
|
+
try {
|
|
1227
|
+
if ((await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()))).failed.includes("loki-logging/2026-11-02-registry-toggle-to-record")) {
|
|
1228
|
+
this.ctx.logger.warn("Loki logging: the registry-toggle migration is kept for next boot");
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
await this.refreshFromRecord();
|
|
1232
|
+
} catch (err) {
|
|
1233
|
+
this.ctx.logger.warn("Loki logging: the registry-toggle migration could not run", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1138
1236
|
async onShutdown() {
|
|
1139
1237
|
this.shuttingDown = true;
|
|
1140
1238
|
if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
|
|
@@ -1171,7 +1269,7 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1171
1269
|
name: ""
|
|
1172
1270
|
};
|
|
1173
1271
|
return {
|
|
1174
|
-
enabled:
|
|
1272
|
+
enabled: body.enabled !== false,
|
|
1175
1273
|
url: body.url,
|
|
1176
1274
|
job: body.job,
|
|
1177
1275
|
node: this.ctx.kernel.localNodeId ?? "hub",
|
|
@@ -42,12 +42,27 @@ export declare class LokiLoggingAddon extends BaseAddon<LokiAddonConfig> {
|
|
|
42
42
|
private ensureDeclaredQuietly;
|
|
43
43
|
/** Re-read the connection record and apply it to the live destination. */
|
|
44
44
|
private refreshFromRecord;
|
|
45
|
+
/**
|
|
46
|
+
* The catalogue to offer while initialising. Seq 3 cannot decide before registration, so it is
|
|
47
|
+
* left out (`INITIALIZE_MIGRATIONS`) — unless the ledger already holds it APPLIED: then the full
|
|
48
|
+
* catalogue is offered and the engine skips it, whereas a subset would make it log the id as a
|
|
49
|
+
* database newer than this code on every boot. A ledger that cannot be read offers the subset.
|
|
50
|
+
*/
|
|
51
|
+
private initializeCatalogue;
|
|
45
52
|
/** The ports of the connection migrations: the old settings in, the record out. */
|
|
46
53
|
private migrationPorts;
|
|
47
54
|
/** Probe a Loki instance (`/ready`) with the form's values, falling back to the stored ones. */
|
|
48
55
|
private probe;
|
|
49
56
|
/** One attempt of the D777 carry-over; reschedules itself while deferred. */
|
|
50
57
|
private attemptEnabledFlagRetirement;
|
|
58
|
+
/**
|
|
59
|
+
* Registration is done: the hub calls this after the providers are registered, so
|
|
60
|
+
* `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
|
|
61
|
+
* that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
|
|
62
|
+
* failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
|
|
63
|
+
*/
|
|
64
|
+
override postBrokerStart(): void;
|
|
65
|
+
private runRegistryToggleMigration;
|
|
51
66
|
protected onShutdown(): Promise<void>;
|
|
52
67
|
/**
|
|
53
68
|
* React to a settings change (URL, level, batching) without a
|
|
@@ -25,6 +25,8 @@ export type LokiDestinationBody = {
|
|
|
25
25
|
readonly batchIntervalMs: number;
|
|
26
26
|
readonly batchSize: number;
|
|
27
27
|
readonly timeoutMs: number;
|
|
28
|
+
/** The instance's own switch (D996). Absent means on, so no data migration was needed. */
|
|
29
|
+
readonly enabled?: boolean | undefined;
|
|
28
30
|
};
|
|
29
31
|
/** The schema is checked against the interface by its annotation: a drifted field fails the typecheck. */
|
|
30
32
|
export declare const LokiDestinationBodySchema: z.ZodType<LokiDestinationBody>;
|