@camstack/server 1.2.885 → 1.2.887
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/trpc/generated-cap-routers.js +18 -0
- package/package.json +10 -8
- package/system/dist/addon-utils.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 +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
- 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 +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- 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 +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +170 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +170 -2
- package/system/dist/builtins/device-history/retention/range-delete.d.ts +52 -0
- package/system/dist/builtins/device-history/rollup/rollup-engine.d.ts +11 -0
- package/system/dist/builtins/device-history/runtime/history-runtime.d.ts +5 -1
- package/system/dist/builtins/device-history/store/history-store.d.ts +5 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- 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 +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- 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 +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- 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/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- 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/{capture-engine-D14TTaaO.js → capture-engine-CFpIaN4h.js} +1 -1
- package/system/dist/{capture-engine-D1VxFidj.mjs → capture-engine-OY78v21k.mjs} +1 -1
- package/system/dist/{composition-sources-DW9aO1g9.js → composition-sources-887l8zZU.js} +1 -1
- package/system/dist/{composition-sources-D83ybKCS.mjs → composition-sources-BnjzY6h1.mjs} +1 -1
- package/system/dist/{constants-2GrhzN-T.js → constants-BrsZY2kk.js} +1 -1
- package/system/dist/{constants-BdZYM4pz.mjs → constants-hKRykChp.mjs} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/{device-ca-DsmVXeGp.js → device-ca-DH3kSBQU.js} +1 -1
- package/system/dist/{device-ca-GCSaBq5b.mjs → device-ca-Daa8UqCp.mjs} +1 -1
- package/system/dist/{dist-g8h5trmJ.js → dist-DNZdEzw0.js} +155 -1
- package/system/dist/{dist-BDoMdUU3.mjs → dist-jhKGWoOo.mjs} +155 -1
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-mscSQisH.js → hub-identity-1S01Uoxg.js} +1 -1
- package/system/dist/{hub-identity-DWpZuOni.mjs → hub-identity-Cqefb2qH.mjs} +10 -10
- package/system/dist/{hub-mdns-ciao-x1wE7M7D.js → hub-mdns-ciao-DVPKAuTm.js} +2 -2
- package/system/dist/{hub-mdns-ciao-DwnPlf4P.mjs → hub-mdns-ciao-Qfdqv_j1.mjs} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +217 -217
- package/system/dist/{legacy-integration-rows-door-COwJBP8g.js → legacy-integration-rows-door-CRmUwtJ-.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-DOAAvsCM.mjs → legacy-integration-rows-door-nxoPlTyI.mjs} +1 -1
- package/system/dist/{rename-composition-block-4TI-pwzS.js → rename-composition-block-1tEV5PeJ.js} +1 -1
- package/system/dist/{rename-composition-block-AX9Lc9Bu.mjs → rename-composition-block-lIOVbvzB.mjs} +1 -1
- package/system/dist/{restore-archive-Bpqb4LSG.js → restore-archive-CPKCo4EZ.js} +1 -1
- package/system/dist/{restore-archive-B4f1EeXn.mjs → restore-archive-CpvNbRTS.mjs} +94 -94
- package/system/dist/{wal-maintenance-BU17H1Z1.js → wal-maintenance-BTqfYbnU.js} +0 -0
- package/system/dist/{wal-maintenance-Cp6aLpv5.mjs → wal-maintenance-Ck_hJBJr.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_capture_engine = require("../../capture-engine-
|
|
6
|
+
const require_dist = require("../../dist-DNZdEzw0.js");
|
|
7
|
+
const require_capture_engine = require("../../capture-engine-CFpIaN4h.js");
|
|
8
8
|
const require_retention = require("../../retention-BcOSL6b9.js");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
@@ -917,6 +917,120 @@ var OrphanSeries = class {
|
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
919
|
//#endregion
|
|
920
|
+
//#region src/builtins/device-history/retention/range-delete.ts
|
|
921
|
+
/** The widest range one call takes: 31 days. A longer one is deleted in several calls. */
|
|
922
|
+
var RANGE_DELETE_MAX_MS = 744 * require_retention.HOUR_MS;
|
|
923
|
+
var RangeDelete = class {
|
|
924
|
+
deps;
|
|
925
|
+
constructor(deps) {
|
|
926
|
+
this.deps = deps;
|
|
927
|
+
}
|
|
928
|
+
async run(input) {
|
|
929
|
+
const { registry } = this.deps;
|
|
930
|
+
if (!(input.fromMs < input.toMs)) return {
|
|
931
|
+
ok: false,
|
|
932
|
+
reason: "invalid-range"
|
|
933
|
+
};
|
|
934
|
+
if (input.toMs - input.fromMs > RANGE_DELETE_MAX_MS) return {
|
|
935
|
+
ok: false,
|
|
936
|
+
reason: "range-too-large"
|
|
937
|
+
};
|
|
938
|
+
const series = registry.find(input.key, `d:${input.deviceId}`, input.scope);
|
|
939
|
+
if (series === void 0) return {
|
|
940
|
+
ok: false,
|
|
941
|
+
reason: "series-not-found"
|
|
942
|
+
};
|
|
943
|
+
if (registry.metric(series.key)?.ingest !== "points") return {
|
|
944
|
+
ok: false,
|
|
945
|
+
reason: "not-a-point-series"
|
|
946
|
+
};
|
|
947
|
+
return this.deps.rollup.exclusive(() => this.apply(series, input));
|
|
948
|
+
}
|
|
949
|
+
async apply(series, input) {
|
|
950
|
+
const { store, logger } = this.deps;
|
|
951
|
+
await this.deps.flush();
|
|
952
|
+
const span = await this.coveredSpan(series, input);
|
|
953
|
+
if (input.dryRun) {
|
|
954
|
+
const rows = await this.countRows(series.id, input, span);
|
|
955
|
+
logger.debug("device-history: dry run of a range delete", {
|
|
956
|
+
tags: { deviceId: input.deviceId },
|
|
957
|
+
meta: {
|
|
958
|
+
key: series.key,
|
|
959
|
+
fromMs: input.fromMs,
|
|
960
|
+
toMs: input.toMs,
|
|
961
|
+
rows
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
return {
|
|
965
|
+
ok: true,
|
|
966
|
+
dryRun: true,
|
|
967
|
+
seriesId: series.id,
|
|
968
|
+
rows,
|
|
969
|
+
rewritten: null
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
const rows = {
|
|
973
|
+
raw: await store.deleteRange("raw", series.id, input.fromMs, input.toMs),
|
|
974
|
+
"5m": await store.deleteRange("5m", series.id, span.m5[0], span.m5[1]),
|
|
975
|
+
"1h": await store.deleteRange("1h", series.id, span.h1[0], span.h1[1]),
|
|
976
|
+
"1d": await store.deleteRange("1d", series.id, span.d1[0], span.d1[1])
|
|
977
|
+
};
|
|
978
|
+
const rewritten = await this.rebuild(series.id, span);
|
|
979
|
+
logger.info("device-history: deleted a range of points", {
|
|
980
|
+
tags: { deviceId: input.deviceId },
|
|
981
|
+
meta: {
|
|
982
|
+
key: series.key,
|
|
983
|
+
scope: series.scope,
|
|
984
|
+
fromMs: input.fromMs,
|
|
985
|
+
toMs: input.toMs,
|
|
986
|
+
rows,
|
|
987
|
+
rewritten
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
return {
|
|
991
|
+
ok: true,
|
|
992
|
+
dryRun: false,
|
|
993
|
+
seriesId: series.id,
|
|
994
|
+
rows,
|
|
995
|
+
rewritten
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
async coveredSpan(series, input) {
|
|
999
|
+
const [next] = await this.deps.store.readRaw(series.id, input.toMs + 1, Number.MAX_SAFE_INTEGER, 1);
|
|
1000
|
+
const lastBucket = require_retention.floorTo(next?.ts ?? input.toMs, require_retention.FIVE_MINUTES_MS);
|
|
1001
|
+
const m5 = [require_retention.floorTo(input.fromMs, require_retention.FIVE_MINUTES_MS), lastBucket];
|
|
1002
|
+
const h1 = [require_retention.floorTo(m5[0], require_retention.HOUR_MS), require_retention.floorTo(m5[1], require_retention.HOUR_MS)];
|
|
1003
|
+
return {
|
|
1004
|
+
m5,
|
|
1005
|
+
h1,
|
|
1006
|
+
d1: [require_retention.bucketStartOf("1d", h1[0]), require_retention.bucketStartOf("1d", h1[1])]
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
async countRows(seriesId, input, span) {
|
|
1010
|
+
const { store } = this.deps;
|
|
1011
|
+
return {
|
|
1012
|
+
raw: await store.countRange("raw", seriesId, input.fromMs, input.toMs),
|
|
1013
|
+
"5m": await store.countRange("5m", seriesId, span.m5[0], span.m5[1]),
|
|
1014
|
+
"1h": await store.countRange("1h", seriesId, span.h1[0], span.h1[1]),
|
|
1015
|
+
"1d": await store.countRange("1d", seriesId, span.d1[0], span.d1[1])
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
/** Rebuild the removed rows from what remains, tier by tier; returns the rows written. */
|
|
1019
|
+
async rebuild(seriesId, span) {
|
|
1020
|
+
const { rollup, store, clock } = this.deps;
|
|
1021
|
+
const now = clock();
|
|
1022
|
+
const m5 = await rollup.recomputeFiveMinute(seriesId, span.m5[0], span.m5[1] + require_retention.FIVE_MINUTES_MS, now);
|
|
1023
|
+
for (let hour = span.h1[0]; hour <= span.h1[1]; hour += require_retention.HOUR_MS) await rollup.recomputeBucket("1h", seriesId, hour, now);
|
|
1024
|
+
const h1 = await store.countRange("1h", seriesId, span.h1[0], span.h1[1]);
|
|
1025
|
+
for (let day = span.d1[0]; day <= span.d1[1]; day = require_retention.bucketEndOf("1d", day)) await rollup.recomputeBucket("1d", seriesId, day, now);
|
|
1026
|
+
return {
|
|
1027
|
+
"5m": m5,
|
|
1028
|
+
"1h": h1,
|
|
1029
|
+
"1d": await store.countRange("1d", seriesId, span.d1[0], span.d1[1])
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
//#endregion
|
|
920
1034
|
//#region src/builtins/device-history/store/series-scale.ts
|
|
921
1035
|
/**
|
|
922
1036
|
* One-shot rescales of series whose every stored point shared one factor
|
|
@@ -1608,6 +1722,20 @@ var HistoryStore = class {
|
|
|
1608
1722
|
filter: { where: { series_id: seriesId } }
|
|
1609
1723
|
});
|
|
1610
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* One series' rows of a tier with the order column in `[lo, hiInclusive]`: a
|
|
1727
|
+
* range of the primary key (D447, asserted in `history-query-plans.spec.ts`).
|
|
1728
|
+
*/
|
|
1729
|
+
async countRange(tier, seriesId, lo, hiInclusive) {
|
|
1730
|
+
return this.door.count.query({
|
|
1731
|
+
namespace: HISTORY_NAMESPACE,
|
|
1732
|
+
collection: collectionOf(tier),
|
|
1733
|
+
filter: {
|
|
1734
|
+
where: { series_id: seriesId },
|
|
1735
|
+
whereBetween: { [orderColumnOf(tier)]: [lo, hiInclusive] }
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1611
1739
|
async countRows(tier) {
|
|
1612
1740
|
return this.door.count.query({
|
|
1613
1741
|
namespace: HISTORY_NAMESPACE,
|
|
@@ -1977,6 +2105,24 @@ var RollupEngine = class {
|
|
|
1977
2105
|
this.ticking = run;
|
|
1978
2106
|
return run;
|
|
1979
2107
|
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Run `work` while no tick runs and none starts: a tick that read rows before
|
|
2110
|
+
* a range delete must not upsert them back after it. A tick requested
|
|
2111
|
+
* meanwhile joins `work` (the dirty sets keep its job for the next one).
|
|
2112
|
+
*/
|
|
2113
|
+
async exclusive(work) {
|
|
2114
|
+
while (this.ticking !== null) await this.ticking;
|
|
2115
|
+
const run = work();
|
|
2116
|
+
const guard = run.then(() => void 0, () => void 0).finally(() => {
|
|
2117
|
+
this.ticking = null;
|
|
2118
|
+
});
|
|
2119
|
+
this.ticking = guard;
|
|
2120
|
+
try {
|
|
2121
|
+
return await run;
|
|
2122
|
+
} finally {
|
|
2123
|
+
await guard;
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
1980
2126
|
async doTick() {
|
|
1981
2127
|
const now = this.deps.clock();
|
|
1982
2128
|
await this.guarded("5m", () => this.tickFiveMinute(now));
|
|
@@ -2099,6 +2245,14 @@ var RollupEngine = class {
|
|
|
2099
2245
|
if (parent === "1h") mark(this.dirty1d, seriesId, require_retention.bucketStartOf("1d", windowStart));
|
|
2100
2246
|
}
|
|
2101
2247
|
/**
|
|
2248
|
+
* Rebuild one 1h or 1d row NOW, from the tier below (a range delete does not
|
|
2249
|
+
* wait for the bucket to close). Writes nothing when the tier below has no row.
|
|
2250
|
+
*/
|
|
2251
|
+
async recomputeBucket(tier, seriesId, windowStart, now) {
|
|
2252
|
+
if (tier === "1h") await this.recomputeHour(seriesId, windowStart, now);
|
|
2253
|
+
else await this.recomputeDay(seriesId, windowStart, now);
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2102
2256
|
* After a restart the dirty sets are gone. Rebuild the recent window from raw
|
|
2103
2257
|
* (the still-open bucket included, time-weighted up to `now`), then mark the
|
|
2104
2258
|
* 1h / 1d buckets of that window dirty so the next ticks recompute them.
|
|
@@ -2260,6 +2414,7 @@ var HistoryRuntime = class {
|
|
|
2260
2414
|
retentionJob;
|
|
2261
2415
|
departures;
|
|
2262
2416
|
orphans;
|
|
2417
|
+
rangeDelete;
|
|
2263
2418
|
optedOutDevices = /* @__PURE__ */ new Set();
|
|
2264
2419
|
tierCounts = /* @__PURE__ */ new Map();
|
|
2265
2420
|
startedAt;
|
|
@@ -2344,6 +2499,14 @@ var HistoryRuntime = class {
|
|
|
2344
2499
|
counters: this.counters,
|
|
2345
2500
|
logger
|
|
2346
2501
|
});
|
|
2502
|
+
this.rangeDelete = new RangeDelete({
|
|
2503
|
+
store: this.store,
|
|
2504
|
+
registry: this.registry,
|
|
2505
|
+
rollup: this.rollup,
|
|
2506
|
+
logger,
|
|
2507
|
+
clock,
|
|
2508
|
+
flush: () => this.flushNow()
|
|
2509
|
+
});
|
|
2347
2510
|
this.orphans = new OrphanSeries({
|
|
2348
2511
|
store: this.store,
|
|
2349
2512
|
registry: this.registry,
|
|
@@ -2527,6 +2690,10 @@ var HistoryRuntime = class {
|
|
|
2527
2690
|
deleteOrphans(seriesIds) {
|
|
2528
2691
|
return this.orphans.delete(seriesIds);
|
|
2529
2692
|
}
|
|
2693
|
+
/** Delete (or count, on a dry run) one series' points in a time range; rollups rebuilt. */
|
|
2694
|
+
deleteSeriesRange(input) {
|
|
2695
|
+
return this.rangeDelete.run(input);
|
|
2696
|
+
}
|
|
2530
2697
|
/** Series held per device, for the admin clean-up listing. */
|
|
2531
2698
|
seriesByDevice() {
|
|
2532
2699
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -3722,6 +3889,7 @@ var DeviceHistoryAddon = class extends require_dist.BaseAddon {
|
|
|
3722
3889
|
setDeviceEnabled: async (input) => ({ enabled: await this.requireRuntime().setEnabled(input.deviceId, input.enabled) }),
|
|
3723
3890
|
getStatus: async () => this.requireRuntime().status(),
|
|
3724
3891
|
listOrphanSeries: async () => this.requireRuntime().listOrphans(),
|
|
3892
|
+
deleteSeriesRange: async (input) => this.requireRuntime().deleteSeriesRange(input),
|
|
3725
3893
|
deleteOrphanSeries: async (input) => ({ results: await this.requireRuntime().deleteOrphans(input.seriesIds) })
|
|
3726
3894
|
};
|
|
3727
3895
|
const runsFacade = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $s as DeviceTransitionSchema, Br as deviceTransitionsCapability, Gl as DeviceType, Gs as wattMillisecondsToKwh, Ir as deviceRemovalHookCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Lr as deviceRunsCapability, Nn as armRemovalReconcile, Nr as deviceHistoryCapability, U as DEVICE_HISTORY_ENERGY_KEY, Xc as emitReadiness, bt as HISTORY_CATALOG, nl as historyUnitFor, nt as DeviceRunSchema, rc as InvalidRecordError, ul as isReadingQuantity, xt as HISTORY_ITEM_CATALOG, yc as RecordTooLargeError } from "../../dist-
|
|
2
|
-
import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-
|
|
1
|
+
import { $s as DeviceTransitionSchema, Br as deviceTransitionsCapability, Gl as DeviceType, Gs as wattMillisecondsToKwh, Ir as deviceRemovalHookCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Lr as deviceRunsCapability, Nn as armRemovalReconcile, Nr as deviceHistoryCapability, U as DEVICE_HISTORY_ENERGY_KEY, Xc as emitReadiness, bt as HISTORY_CATALOG, nl as historyUnitFor, nt as DeviceRunSchema, rc as InvalidRecordError, ul as isReadingQuantity, xt as HISTORY_ITEM_CATALOG, yc as RecordTooLargeError } from "../../dist-jhKGWoOo.mjs";
|
|
2
|
+
import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-OY78v21k.mjs";
|
|
3
3
|
import { a as FIVE_MINUTES_MS, c as bucketEndOf, i as DAY_MS, l as bucketStartOf, n as RetentionJob, o as HOUR_MS, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo } from "../../retention-CUOVI1p7.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
@@ -912,6 +912,120 @@ var OrphanSeries = class {
|
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
914
|
//#endregion
|
|
915
|
+
//#region src/builtins/device-history/retention/range-delete.ts
|
|
916
|
+
/** The widest range one call takes: 31 days. A longer one is deleted in several calls. */
|
|
917
|
+
var RANGE_DELETE_MAX_MS = 744 * HOUR_MS;
|
|
918
|
+
var RangeDelete = class {
|
|
919
|
+
deps;
|
|
920
|
+
constructor(deps) {
|
|
921
|
+
this.deps = deps;
|
|
922
|
+
}
|
|
923
|
+
async run(input) {
|
|
924
|
+
const { registry } = this.deps;
|
|
925
|
+
if (!(input.fromMs < input.toMs)) return {
|
|
926
|
+
ok: false,
|
|
927
|
+
reason: "invalid-range"
|
|
928
|
+
};
|
|
929
|
+
if (input.toMs - input.fromMs > RANGE_DELETE_MAX_MS) return {
|
|
930
|
+
ok: false,
|
|
931
|
+
reason: "range-too-large"
|
|
932
|
+
};
|
|
933
|
+
const series = registry.find(input.key, `d:${input.deviceId}`, input.scope);
|
|
934
|
+
if (series === void 0) return {
|
|
935
|
+
ok: false,
|
|
936
|
+
reason: "series-not-found"
|
|
937
|
+
};
|
|
938
|
+
if (registry.metric(series.key)?.ingest !== "points") return {
|
|
939
|
+
ok: false,
|
|
940
|
+
reason: "not-a-point-series"
|
|
941
|
+
};
|
|
942
|
+
return this.deps.rollup.exclusive(() => this.apply(series, input));
|
|
943
|
+
}
|
|
944
|
+
async apply(series, input) {
|
|
945
|
+
const { store, logger } = this.deps;
|
|
946
|
+
await this.deps.flush();
|
|
947
|
+
const span = await this.coveredSpan(series, input);
|
|
948
|
+
if (input.dryRun) {
|
|
949
|
+
const rows = await this.countRows(series.id, input, span);
|
|
950
|
+
logger.debug("device-history: dry run of a range delete", {
|
|
951
|
+
tags: { deviceId: input.deviceId },
|
|
952
|
+
meta: {
|
|
953
|
+
key: series.key,
|
|
954
|
+
fromMs: input.fromMs,
|
|
955
|
+
toMs: input.toMs,
|
|
956
|
+
rows
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
return {
|
|
960
|
+
ok: true,
|
|
961
|
+
dryRun: true,
|
|
962
|
+
seriesId: series.id,
|
|
963
|
+
rows,
|
|
964
|
+
rewritten: null
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
const rows = {
|
|
968
|
+
raw: await store.deleteRange("raw", series.id, input.fromMs, input.toMs),
|
|
969
|
+
"5m": await store.deleteRange("5m", series.id, span.m5[0], span.m5[1]),
|
|
970
|
+
"1h": await store.deleteRange("1h", series.id, span.h1[0], span.h1[1]),
|
|
971
|
+
"1d": await store.deleteRange("1d", series.id, span.d1[0], span.d1[1])
|
|
972
|
+
};
|
|
973
|
+
const rewritten = await this.rebuild(series.id, span);
|
|
974
|
+
logger.info("device-history: deleted a range of points", {
|
|
975
|
+
tags: { deviceId: input.deviceId },
|
|
976
|
+
meta: {
|
|
977
|
+
key: series.key,
|
|
978
|
+
scope: series.scope,
|
|
979
|
+
fromMs: input.fromMs,
|
|
980
|
+
toMs: input.toMs,
|
|
981
|
+
rows,
|
|
982
|
+
rewritten
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
return {
|
|
986
|
+
ok: true,
|
|
987
|
+
dryRun: false,
|
|
988
|
+
seriesId: series.id,
|
|
989
|
+
rows,
|
|
990
|
+
rewritten
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
async coveredSpan(series, input) {
|
|
994
|
+
const [next] = await this.deps.store.readRaw(series.id, input.toMs + 1, Number.MAX_SAFE_INTEGER, 1);
|
|
995
|
+
const lastBucket = floorTo(next?.ts ?? input.toMs, FIVE_MINUTES_MS);
|
|
996
|
+
const m5 = [floorTo(input.fromMs, FIVE_MINUTES_MS), lastBucket];
|
|
997
|
+
const h1 = [floorTo(m5[0], HOUR_MS), floorTo(m5[1], HOUR_MS)];
|
|
998
|
+
return {
|
|
999
|
+
m5,
|
|
1000
|
+
h1,
|
|
1001
|
+
d1: [bucketStartOf("1d", h1[0]), bucketStartOf("1d", h1[1])]
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
async countRows(seriesId, input, span) {
|
|
1005
|
+
const { store } = this.deps;
|
|
1006
|
+
return {
|
|
1007
|
+
raw: await store.countRange("raw", seriesId, input.fromMs, input.toMs),
|
|
1008
|
+
"5m": await store.countRange("5m", seriesId, span.m5[0], span.m5[1]),
|
|
1009
|
+
"1h": await store.countRange("1h", seriesId, span.h1[0], span.h1[1]),
|
|
1010
|
+
"1d": await store.countRange("1d", seriesId, span.d1[0], span.d1[1])
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
/** Rebuild the removed rows from what remains, tier by tier; returns the rows written. */
|
|
1014
|
+
async rebuild(seriesId, span) {
|
|
1015
|
+
const { rollup, store, clock } = this.deps;
|
|
1016
|
+
const now = clock();
|
|
1017
|
+
const m5 = await rollup.recomputeFiveMinute(seriesId, span.m5[0], span.m5[1] + FIVE_MINUTES_MS, now);
|
|
1018
|
+
for (let hour = span.h1[0]; hour <= span.h1[1]; hour += HOUR_MS) await rollup.recomputeBucket("1h", seriesId, hour, now);
|
|
1019
|
+
const h1 = await store.countRange("1h", seriesId, span.h1[0], span.h1[1]);
|
|
1020
|
+
for (let day = span.d1[0]; day <= span.d1[1]; day = bucketEndOf("1d", day)) await rollup.recomputeBucket("1d", seriesId, day, now);
|
|
1021
|
+
return {
|
|
1022
|
+
"5m": m5,
|
|
1023
|
+
"1h": h1,
|
|
1024
|
+
"1d": await store.countRange("1d", seriesId, span.d1[0], span.d1[1])
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
//#endregion
|
|
915
1029
|
//#region src/builtins/device-history/store/series-scale.ts
|
|
916
1030
|
/**
|
|
917
1031
|
* One-shot rescales of series whose every stored point shared one factor
|
|
@@ -1603,6 +1717,20 @@ var HistoryStore = class {
|
|
|
1603
1717
|
filter: { where: { series_id: seriesId } }
|
|
1604
1718
|
});
|
|
1605
1719
|
}
|
|
1720
|
+
/**
|
|
1721
|
+
* One series' rows of a tier with the order column in `[lo, hiInclusive]`: a
|
|
1722
|
+
* range of the primary key (D447, asserted in `history-query-plans.spec.ts`).
|
|
1723
|
+
*/
|
|
1724
|
+
async countRange(tier, seriesId, lo, hiInclusive) {
|
|
1725
|
+
return this.door.count.query({
|
|
1726
|
+
namespace: HISTORY_NAMESPACE,
|
|
1727
|
+
collection: collectionOf(tier),
|
|
1728
|
+
filter: {
|
|
1729
|
+
where: { series_id: seriesId },
|
|
1730
|
+
whereBetween: { [orderColumnOf(tier)]: [lo, hiInclusive] }
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1606
1734
|
async countRows(tier) {
|
|
1607
1735
|
return this.door.count.query({
|
|
1608
1736
|
namespace: HISTORY_NAMESPACE,
|
|
@@ -1972,6 +2100,24 @@ var RollupEngine = class {
|
|
|
1972
2100
|
this.ticking = run;
|
|
1973
2101
|
return run;
|
|
1974
2102
|
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Run `work` while no tick runs and none starts: a tick that read rows before
|
|
2105
|
+
* a range delete must not upsert them back after it. A tick requested
|
|
2106
|
+
* meanwhile joins `work` (the dirty sets keep its job for the next one).
|
|
2107
|
+
*/
|
|
2108
|
+
async exclusive(work) {
|
|
2109
|
+
while (this.ticking !== null) await this.ticking;
|
|
2110
|
+
const run = work();
|
|
2111
|
+
const guard = run.then(() => void 0, () => void 0).finally(() => {
|
|
2112
|
+
this.ticking = null;
|
|
2113
|
+
});
|
|
2114
|
+
this.ticking = guard;
|
|
2115
|
+
try {
|
|
2116
|
+
return await run;
|
|
2117
|
+
} finally {
|
|
2118
|
+
await guard;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
1975
2121
|
async doTick() {
|
|
1976
2122
|
const now = this.deps.clock();
|
|
1977
2123
|
await this.guarded("5m", () => this.tickFiveMinute(now));
|
|
@@ -2094,6 +2240,14 @@ var RollupEngine = class {
|
|
|
2094
2240
|
if (parent === "1h") mark(this.dirty1d, seriesId, bucketStartOf("1d", windowStart));
|
|
2095
2241
|
}
|
|
2096
2242
|
/**
|
|
2243
|
+
* Rebuild one 1h or 1d row NOW, from the tier below (a range delete does not
|
|
2244
|
+
* wait for the bucket to close). Writes nothing when the tier below has no row.
|
|
2245
|
+
*/
|
|
2246
|
+
async recomputeBucket(tier, seriesId, windowStart, now) {
|
|
2247
|
+
if (tier === "1h") await this.recomputeHour(seriesId, windowStart, now);
|
|
2248
|
+
else await this.recomputeDay(seriesId, windowStart, now);
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2097
2251
|
* After a restart the dirty sets are gone. Rebuild the recent window from raw
|
|
2098
2252
|
* (the still-open bucket included, time-weighted up to `now`), then mark the
|
|
2099
2253
|
* 1h / 1d buckets of that window dirty so the next ticks recompute them.
|
|
@@ -2255,6 +2409,7 @@ var HistoryRuntime = class {
|
|
|
2255
2409
|
retentionJob;
|
|
2256
2410
|
departures;
|
|
2257
2411
|
orphans;
|
|
2412
|
+
rangeDelete;
|
|
2258
2413
|
optedOutDevices = /* @__PURE__ */ new Set();
|
|
2259
2414
|
tierCounts = /* @__PURE__ */ new Map();
|
|
2260
2415
|
startedAt;
|
|
@@ -2339,6 +2494,14 @@ var HistoryRuntime = class {
|
|
|
2339
2494
|
counters: this.counters,
|
|
2340
2495
|
logger
|
|
2341
2496
|
});
|
|
2497
|
+
this.rangeDelete = new RangeDelete({
|
|
2498
|
+
store: this.store,
|
|
2499
|
+
registry: this.registry,
|
|
2500
|
+
rollup: this.rollup,
|
|
2501
|
+
logger,
|
|
2502
|
+
clock,
|
|
2503
|
+
flush: () => this.flushNow()
|
|
2504
|
+
});
|
|
2342
2505
|
this.orphans = new OrphanSeries({
|
|
2343
2506
|
store: this.store,
|
|
2344
2507
|
registry: this.registry,
|
|
@@ -2522,6 +2685,10 @@ var HistoryRuntime = class {
|
|
|
2522
2685
|
deleteOrphans(seriesIds) {
|
|
2523
2686
|
return this.orphans.delete(seriesIds);
|
|
2524
2687
|
}
|
|
2688
|
+
/** Delete (or count, on a dry run) one series' points in a time range; rollups rebuilt. */
|
|
2689
|
+
deleteSeriesRange(input) {
|
|
2690
|
+
return this.rangeDelete.run(input);
|
|
2691
|
+
}
|
|
2525
2692
|
/** Series held per device, for the admin clean-up listing. */
|
|
2526
2693
|
seriesByDevice() {
|
|
2527
2694
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -3717,6 +3884,7 @@ var DeviceHistoryAddon = class extends BaseAddon {
|
|
|
3717
3884
|
setDeviceEnabled: async (input) => ({ enabled: await this.requireRuntime().setEnabled(input.deviceId, input.enabled) }),
|
|
3718
3885
|
getStatus: async () => this.requireRuntime().status(),
|
|
3719
3886
|
listOrphanSeries: async () => this.requireRuntime().listOrphans(),
|
|
3887
|
+
deleteSeriesRange: async (input) => this.requireRuntime().deleteSeriesRange(input),
|
|
3720
3888
|
deleteOrphanSeries: async (input) => ({ results: await this.requireRuntime().deleteOrphans(input.seriesIds) })
|
|
3721
3889
|
};
|
|
3722
3890
|
const runsFacade = {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a time range of one series' points (admin, operator-judged): the raw
|
|
3
|
+
* points in `[from, to]` go, and every rollup row that covered them is removed
|
|
4
|
+
* and REBUILT from what remains — the same recompute the rollup engine runs
|
|
5
|
+
* for a late write, so a gap never leaves a stale max, sum or held value.
|
|
6
|
+
*
|
|
7
|
+
* What a rollup row depends on beyond its own bucket is the value HELD into it:
|
|
8
|
+
* the first bucket with points after the range carried the deleted value in,
|
|
9
|
+
* so the covered 5-minute span runs up to and including that bucket. The 1h
|
|
10
|
+
* and 1d spans follow from it. A dry run counts exactly those ranges with
|
|
11
|
+
* primary-key range counts (D447) and changes nothing.
|
|
12
|
+
*
|
|
13
|
+
* The whole delete-and-rebuild runs EXCLUSIVELY with the rollup tick (a tick
|
|
14
|
+
* that read rows before the delete would otherwise write them back). It is not
|
|
15
|
+
* one transaction: a crash between tiers leaves rollups stale, and running the
|
|
16
|
+
* SAME call again repairs it (every step is a range delete or a recompute from
|
|
17
|
+
* what remains, so a repeat is idempotent). A point captured inside the range
|
|
18
|
+
* AFTER the initial flush survives: only what was stored then is judged.
|
|
19
|
+
*/
|
|
20
|
+
import type { DeviceHistoryRangeDeleteResult, IScopedLogger } from "@camstack/types";
|
|
21
|
+
import type { RollupEngine } from "../rollup/rollup-engine.js";
|
|
22
|
+
import type { HistoryStore } from "../store/history-store.js";
|
|
23
|
+
import type { SeriesRegistry } from "../store/series-registry.js";
|
|
24
|
+
/** The widest range one call takes: 31 days. A longer one is deleted in several calls. */
|
|
25
|
+
export declare const RANGE_DELETE_MAX_MS: number;
|
|
26
|
+
export interface RangeDeleteInput {
|
|
27
|
+
readonly deviceId: number;
|
|
28
|
+
readonly key: string;
|
|
29
|
+
readonly scope: string;
|
|
30
|
+
readonly fromMs: number;
|
|
31
|
+
readonly toMs: number;
|
|
32
|
+
readonly dryRun: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface RangeDeleteDeps {
|
|
35
|
+
readonly store: HistoryStore;
|
|
36
|
+
readonly registry: SeriesRegistry;
|
|
37
|
+
readonly rollup: RollupEngine;
|
|
38
|
+
readonly logger: IScopedLogger;
|
|
39
|
+
readonly clock: () => number;
|
|
40
|
+
/** Write what the capture buffer still holds, so a pending point is not written after the delete. */
|
|
41
|
+
readonly flush: () => Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export declare class RangeDelete {
|
|
44
|
+
private readonly deps;
|
|
45
|
+
constructor(deps: RangeDeleteDeps);
|
|
46
|
+
run(input: RangeDeleteInput): Promise<DeviceHistoryRangeDeleteResult>;
|
|
47
|
+
private apply;
|
|
48
|
+
private coveredSpan;
|
|
49
|
+
private countRows;
|
|
50
|
+
/** Rebuild the removed rows from what remains, tier by tier; returns the rows written. */
|
|
51
|
+
private rebuild;
|
|
52
|
+
}
|
|
@@ -50,6 +50,12 @@ export declare class RollupEngine {
|
|
|
50
50
|
markFiveMinuteRow(seriesId: number, bucketStart: number): void;
|
|
51
51
|
/** One pass over the three tiers. Single-flight; errors are counted and the work stays dirty. */
|
|
52
52
|
tick(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Run `work` while no tick runs and none starts: a tick that read rows before
|
|
55
|
+
* a range delete must not upsert them back after it. A tick requested
|
|
56
|
+
* meanwhile joins `work` (the dirty sets keep its job for the next one).
|
|
57
|
+
*/
|
|
58
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
53
59
|
private doTick;
|
|
54
60
|
private guarded;
|
|
55
61
|
private closedBuckets;
|
|
@@ -66,6 +72,11 @@ export declare class RollupEngine {
|
|
|
66
72
|
private recomputeDay;
|
|
67
73
|
private recomputeFrom;
|
|
68
74
|
/**
|
|
75
|
+
* Rebuild one 1h or 1d row NOW, from the tier below (a range delete does not
|
|
76
|
+
* wait for the bucket to close). Writes nothing when the tier below has no row.
|
|
77
|
+
*/
|
|
78
|
+
recomputeBucket(tier: "1h" | "1d", seriesId: number, windowStart: number, now: number): Promise<void>;
|
|
79
|
+
/**
|
|
69
80
|
* After a restart the dirty sets are gone. Rebuild the recent window from raw
|
|
70
81
|
* (the still-open bucket included, time-weighted up to `now`), then mark the
|
|
71
82
|
* 1h / 1d buckets of that window dirty so the next ticks recompute them.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Then {@link HistoryRuntime.startTimers} arms flush (10 s), rollups (60 s),
|
|
12
12
|
* reconcile (5 min), retention (10 min) and the row counts (30 min).
|
|
13
13
|
*/
|
|
14
|
-
import type { DeviceHistoryOrphanDeleteEntry, DeviceHistoryOrphanList, DeviceHistoryStatus, IScopedLogger, ReadingQuantity } from "@camstack/types";
|
|
14
|
+
import type { DeviceHistoryOrphanDeleteEntry, DeviceHistoryOrphanList, DeviceHistoryRangeDeleteResult, DeviceHistoryStatus, IScopedLogger, ReadingQuantity } from "@camstack/types";
|
|
15
15
|
import { CaptureEngine, type HistoryCatalog, type HistoryItemCatalog, type SnapshotMap } from "../capture/capture-engine.js";
|
|
16
16
|
import { DeviceDirectory, type DeviceTypeSource } from "../capture/device-directory.js";
|
|
17
17
|
import { PointWriter } from "../capture/point-writer.js";
|
|
@@ -19,6 +19,7 @@ import { ProducerIngest } from "../ingest/producer-ingest.js";
|
|
|
19
19
|
import { HistoryQuery } from "../query/history-query.js";
|
|
20
20
|
import { DepartureTracker } from "../retention/departure-tracker.js";
|
|
21
21
|
import { OrphanSeries } from "../retention/orphans.js";
|
|
22
|
+
import { type RangeDeleteInput } from "../retention/range-delete.js";
|
|
22
23
|
import { RetentionJob, type RetentionPolicy } from "../retention/retention.js";
|
|
23
24
|
import { RollupEngine } from "../rollup/rollup-engine.js";
|
|
24
25
|
import { HistoryCounters } from "../status/counters.js";
|
|
@@ -68,6 +69,7 @@ export declare class HistoryRuntime {
|
|
|
68
69
|
readonly retentionJob: RetentionJob;
|
|
69
70
|
readonly departures: DepartureTracker;
|
|
70
71
|
readonly orphans: OrphanSeries;
|
|
72
|
+
private readonly rangeDelete;
|
|
71
73
|
private optedOutDevices;
|
|
72
74
|
private readonly tierCounts;
|
|
73
75
|
private readonly startedAt;
|
|
@@ -112,6 +114,8 @@ export declare class HistoryRuntime {
|
|
|
112
114
|
listOrphans(): Promise<DeviceHistoryOrphanList>;
|
|
113
115
|
/** Delete orphan series by id; a series that is not orphan NOW is refused. */
|
|
114
116
|
deleteOrphans(seriesIds: readonly number[]): Promise<readonly DeviceHistoryOrphanDeleteEntry[]>;
|
|
117
|
+
/** Delete (or count, on a dry run) one series' points in a time range; rollups rebuilt. */
|
|
118
|
+
deleteSeriesRange(input: RangeDeleteInput): Promise<DeviceHistoryRangeDeleteResult>;
|
|
115
119
|
/** Series held per device, for the admin clean-up listing. */
|
|
116
120
|
seriesByDevice(): ReadonlyMap<number, number>;
|
|
117
121
|
status(): DeviceHistoryStatus;
|
|
@@ -88,6 +88,11 @@ export declare class HistoryStore {
|
|
|
88
88
|
* never a scan of the tier (D447, asserted in `history-query-plans.spec.ts`).
|
|
89
89
|
*/
|
|
90
90
|
countSeriesRows(tier: StoredTier, seriesId: number): Promise<number>;
|
|
91
|
+
/**
|
|
92
|
+
* One series' rows of a tier with the order column in `[lo, hiInclusive]`: a
|
|
93
|
+
* range of the primary key (D447, asserted in `history-query-plans.spec.ts`).
|
|
94
|
+
*/
|
|
95
|
+
countRange(tier: StoredTier, seriesId: number, lo: number, hiInclusive: number): Promise<number>;
|
|
91
96
|
countRows(tier: StoredTier): Promise<number>;
|
|
92
97
|
loadOptOuts(): Promise<ReadonlySet<number>>;
|
|
93
98
|
setOptOut(deviceId: number, at: number): Promise<void>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DNZdEzw0.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
|
|
9
|
-
const require_rename_composition_block = require("../../rename-composition-block-
|
|
9
|
+
const require_rename_composition_block = require("../../rename-composition-block-1tEV5PeJ.js");
|
|
10
10
|
const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
|
|
11
11
|
const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
|
|
12
12
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $n as checkDeviceAlias, Bc as collectZodSecretPaths$1, Dr as defineExtensionSlotProvider, Eo as siteZoneKey, Fc as auditedFields, Fr as deviceOffersActions, Gl as DeviceType$1, Gn as buildStreamParamsConfigSchema, Hi as locationIconKey, Hr as enumerateItemArrayFields, Ia as reconcileReportedFeatures, Il as toSecretFieldView, J as DEVICE_TEMPLATE_FILTERS, Jc as defineRecordKinds, Jl as EventCategory$1, Jr as expandContainer, Kl as errMsg$1, Ks as BaseAddon, Li as legacyAutoLinkIds, Ll as transformSecretWrite, Mr as deviceExtensionCapability, Nt as MINUTES_PER_DAY, Oc as WELL_KNOWN_TAB_MAP, Ol as resolveSecretMarkers, Pl as sleep$2, Pr as deviceManagerCapability, Ps as implementedMethodsOf$1, Q as DEVICE_TEMPLATE_VALUES_CAP, Qc as expandCapMethods$1, Rl as userError, Rr as deviceStateCapability, S as CAP_NAMES_WITH_STATUS, Sc as SECRET_CLEAR, Ul as DeviceFeature, Ur as enumerateSchemaFields, Vc as commandEffect, Wl as DeviceRole, X as DEVICE_TEMPLATE_MAX_OUTPUT, Y as DEVICE_TEMPLATE_MAX_LENGTH, Yn as canonicalIconKey, Zr as extractSourceInfoFromMetadata, _a as parseStreamParamsFormPatch, _o as searchRank, _t as FieldClaimModeSchema, at as DiscoveryProposalBodySchema, b as CAMERA_SWITCH_ORDER, bo as settleDeviceFeatures, bs as capAppliesToDeviceKind, co as resolveTemplateRef, dl as isSecretClear, do as runtimeFieldUnit, fo as runtimeStatePolicyFor, il as isCommand$1, in as STREAM_PROFILE_META, it as DeviceTombstoneSchema, j as ConditionMirror, jl as secretTreeFromPaths, ki as isKernelDerivedFeature, la as normalizeTags, ll as isKeychainStoredField, lt as ExportNameRefusedError, ml as isSecretMarkerLike, ol as isDeviceConfigCap, pl as isSecretMarker, rt as DeviceStatusSchema, s as ALL_CAPABILITY_DEFINITIONS, si as formatMinutes, ua as normalizeUnit, ui as generateDeviceAlias, vt as FieldClaimSchema, yr as createDeviceExtensionProvider, ys as canonicalStoredDeviceType, z as DAY_NAMES, zl as vocabActionIdFor, zr as deviceStatusCapability } from "../../dist-
|
|
1
|
+
import { $n as checkDeviceAlias, Bc as collectZodSecretPaths$1, Dr as defineExtensionSlotProvider, Eo as siteZoneKey, Fc as auditedFields, Fr as deviceOffersActions, Gl as DeviceType$1, Gn as buildStreamParamsConfigSchema, Hi as locationIconKey, Hr as enumerateItemArrayFields, Ia as reconcileReportedFeatures, Il as toSecretFieldView, J as DEVICE_TEMPLATE_FILTERS, Jc as defineRecordKinds, Jl as EventCategory$1, Jr as expandContainer, Kl as errMsg$1, Ks as BaseAddon, Li as legacyAutoLinkIds, Ll as transformSecretWrite, Mr as deviceExtensionCapability, Nt as MINUTES_PER_DAY, Oc as WELL_KNOWN_TAB_MAP, Ol as resolveSecretMarkers, Pl as sleep$2, Pr as deviceManagerCapability, Ps as implementedMethodsOf$1, Q as DEVICE_TEMPLATE_VALUES_CAP, Qc as expandCapMethods$1, Rl as userError, Rr as deviceStateCapability, S as CAP_NAMES_WITH_STATUS, Sc as SECRET_CLEAR, Ul as DeviceFeature, Ur as enumerateSchemaFields, Vc as commandEffect, Wl as DeviceRole, X as DEVICE_TEMPLATE_MAX_OUTPUT, Y as DEVICE_TEMPLATE_MAX_LENGTH, Yn as canonicalIconKey, Zr as extractSourceInfoFromMetadata, _a as parseStreamParamsFormPatch, _o as searchRank, _t as FieldClaimModeSchema, at as DiscoveryProposalBodySchema, b as CAMERA_SWITCH_ORDER, bo as settleDeviceFeatures, bs as capAppliesToDeviceKind, co as resolveTemplateRef, dl as isSecretClear, do as runtimeFieldUnit, fo as runtimeStatePolicyFor, il as isCommand$1, in as STREAM_PROFILE_META, it as DeviceTombstoneSchema, j as ConditionMirror, jl as secretTreeFromPaths, ki as isKernelDerivedFeature, la as normalizeTags, ll as isKeychainStoredField, lt as ExportNameRefusedError, ml as isSecretMarkerLike, ol as isDeviceConfigCap, pl as isSecretMarker, rt as DeviceStatusSchema, s as ALL_CAPABILITY_DEFINITIONS, si as formatMinutes, ua as normalizeUnit, ui as generateDeviceAlias, vt as FieldClaimSchema, yr as createDeviceExtensionProvider, ys as canonicalStoredDeviceType, z as DAY_NAMES, zl as vocabActionIdFor, zr as deviceStatusCapability } from "../../dist-jhKGWoOo.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { a as redactLogText, i as redactLogMeta, n as isSecretArgumentKey } from "../../log-redactor-XLDrPzOi.mjs";
|
|
4
|
-
import { n as renameCompositionBlock, t as composedBlockIdOf } from "../../rename-composition-block-
|
|
4
|
+
import { n as renameCompositionBlock, t as composedBlockIdOf } from "../../rename-composition-block-lIOVbvzB.mjs";
|
|
5
5
|
import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
|
|
6
6
|
import { t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
|
|
7
7
|
import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
@@ -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-DNZdEzw0.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gi as logDestinationCapability, Ks as BaseAddon } from "../../dist-
|
|
1
|
+
import { Gi as logDestinationCapability, Ks as BaseAddon } from "../../dist-jhKGWoOo.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_device_ca = require("../../device-ca-
|
|
6
|
+
const require_dist = require("../../dist-DNZdEzw0.js");
|
|
7
|
+
const require_device_ca = require("../../device-ca-DH3kSBQU.js");
|
|
8
8
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
9
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
10
|
-
const require_constants = require("../../constants-
|
|
9
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-CRmUwtJ-.js");
|
|
10
|
+
const require_constants = require("../../constants-BrsZY2kk.js");
|
|
11
11
|
const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
|
|
12
12
|
let node_crypto = require("node:crypto");
|
|
13
13
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $c as formatSecretScope, Dt as KEYCHAIN_RESET_TRIGGER_ACTOR, Fi as keychainAdminCapability, Ii as keychainCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Ot as KeychainAuditEntrySchema, kt as KeychainResetRecordSchema, wl as parseSecretRef, xl as normalizeSecretOwner } from "../../dist-
|
|
2
|
-
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-
|
|
1
|
+
import { $c as formatSecretScope, Dt as KEYCHAIN_RESET_TRIGGER_ACTOR, Fi as keychainAdminCapability, Ii as keychainCapability, Jc as defineRecordKinds, Jl as EventCategory, Ks as BaseAddon, Ot as KeychainAuditEntrySchema, kt as KeychainResetRecordSchema, wl as parseSecretRef, xl as normalizeSecretOwner } from "../../dist-jhKGWoOo.mjs";
|
|
2
|
+
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-Daa8UqCp.mjs";
|
|
3
3
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
4
|
-
import { t as LEGACY_INTEGRATION_ROWS_TABLE } from "../../legacy-integration-rows-door-
|
|
5
|
-
import { a as MESH_CA_KEY_REF } from "../../constants-
|
|
4
|
+
import { t as LEGACY_INTEGRATION_ROWS_TABLE } from "../../legacy-integration-rows-door-nxoPlTyI.mjs";
|
|
5
|
+
import { a as MESH_CA_KEY_REF } from "../../constants-hKRykChp.mjs";
|
|
6
6
|
import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
|
|
7
7
|
import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
8
8
|
import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
|