@camstack/system 1.2.439 → 1.2.440
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-runner.js +743 -79
- package/dist/addon-runner.mjs +743 -79
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/block-settings-store.d.ts +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +77 -11
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +77 -12
- package/dist/builtins/core-blocks/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +181 -59
- package/dist/builtins/device-manager/device-manager.addon.mjs +180 -60
- package/dist/builtins/device-manager/device-removal-hooks.d.ts +0 -11
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +29 -11
- package/dist/builtins/keychain/index.mjs +29 -11
- package/dist/builtins/keychain/keychain-service.d.ts +8 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +38 -7
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +69 -3
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +69 -3
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +31 -0
- package/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +3 -3
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +4 -4
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +4 -4
- package/dist/builtins/system-config/system-config.addon.js +2 -2
- package/dist/builtins/system-config/system-config.addon.mjs +283 -283
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-BGOSCGWa.mjs → composition-sources-CS0D7imL.mjs} +1 -1
- package/dist/{composition-sources-B4jC2FC7.js → composition-sources-cBG8fBTu.js} +1 -1
- package/dist/{constants-B92BjObl.mjs → constants-CIzPjw7L.mjs} +1 -1
- package/dist/{constants-BRsjQwi-.js → constants-CRI3QzT4.js} +1 -1
- package/dist/{device-ca-46BUsWD1.mjs → device-ca-DLKXYseS.mjs} +1 -1
- package/dist/{device-ca-DHG9OW2m.js → device-ca-DNHjts4_.js} +1 -1
- package/dist/{dist-yI6kF6r6.mjs → dist-9fcsrFU3.mjs} +237 -25
- package/dist/{dist-BOWdLjoK.js → dist-BKhlcYz6.js} +254 -24
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-D7S5AJRU.js → hub-mdns-ciao-3Zc9G9MS.js} +1 -1
- package/dist/{hub-mdns-ciao-DGwVc2uh.mjs → hub-mdns-ciao-Dy2YjRqC.mjs} +1 -1
- package/dist/index.js +336 -336
- package/dist/index.mjs +337 -337
- package/dist/kernel/addon-settings-store.d.ts +43 -0
- package/dist/kernel/config-manager.d.ts +0 -19
- package/dist/kernel/device-settings-store.d.ts +74 -0
- package/dist/kernel/legacy-blob-guard.d.ts +58 -0
- package/dist/kernel/moleculer/runner-addon-settings.d.ts +34 -0
- package/dist/kernel/moleculer/runner-device-settings.d.ts +39 -0
- package/dist/kernel/prefix-walk.d.ts +39 -0
- package/dist/kernel/sections-store.d.ts +20 -0
- package/dist/kernel/settings-door-view.d.ts +2 -2
- package/dist/kernel/settings-view-types.d.ts +5 -30
- package/dist/kernel/store-settings-view.d.ts +0 -3
- package/dist/prefix-range-D_KueXbQ.js +27 -0
- package/dist/prefix-range-Dl0znowN.mjs +22 -0
- package/dist/prefix-walk-DAOBSyH1.mjs +88 -0
- package/dist/prefix-walk-Dv6MLZlM.js +99 -0
- package/dist/{restore-archive-DiGiI6Jp.js → restore-archive-49aZwkp8.js} +1 -1
- package/dist/{restore-archive-CpdUO-uS.mjs → restore-archive-DgvDecXM.mjs} +82 -82
- package/dist/{retired-settings-keys-UsVtLOT0.mjs → retired-settings-keys-Bhwe4ymb.mjs} +2 -2
- package/dist/{retired-settings-keys-CyQ7uvta.js → retired-settings-keys-D_VwZiDt.js} +10 -4
- package/dist/{wal-maintenance-xsvdT5Go.mjs → wal-maintenance-BZGmF-3U.mjs} +0 -0
- package/dist/{wal-maintenance-DEL_jeG0.js → wal-maintenance-C041zn6V.js} +0 -0
- package/package.json +5 -2
- package/dist/{custom-action-registry-Bf_YnagS.js → custom-action-registry-BKmoaqG0.js} +1 -1
- package/dist/{custom-action-registry-BQnbN0DP.mjs → custom-action-registry-CyUuhATc.mjs} +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const require_prefix_range = require("./prefix-range-D_KueXbQ.js");
|
|
2
|
+
//#region src/kernel/prefix-walk.ts
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function unwrapStoredValue(parsed) {
|
|
7
|
+
if (!isRecord(parsed) || !("value" in parsed)) return parsed;
|
|
8
|
+
return parsed.value;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Rows one page of a prefix read asks for.
|
|
12
|
+
*
|
|
13
|
+
* Below `SETTINGS_QUERY_DEFAULT_ROW_CAP` (2 000, `query-bounds.ts`) on purpose:
|
|
14
|
+
* this read now names its own bound, so the engine's defensive cap is never the
|
|
15
|
+
* thing that decides how much of the answer the caller gets.
|
|
16
|
+
*/
|
|
17
|
+
var PREFIX_PAGE_ROWS = 1e3;
|
|
18
|
+
/**
|
|
19
|
+
* Pages one prefix read may take before it refuses.
|
|
20
|
+
*
|
|
21
|
+
* 512 pages is 512 000 rows — three orders of magnitude past the largest live
|
|
22
|
+
* scope (`addon-device-settings` for one addon over a ~1 019-device fleet) and
|
|
23
|
+
* still a bound, because a walk with no bound is the defect this file was
|
|
24
|
+
* fixing, not one to reintroduce.
|
|
25
|
+
*/
|
|
26
|
+
var PREFIX_PAGE_BUDGET = 512;
|
|
27
|
+
/**
|
|
28
|
+
* Every row under `prefix`, or a throw — never the first 2 000 of them.
|
|
29
|
+
*
|
|
30
|
+
* **The defect.** This issued ONE `query` with no `limit`, and
|
|
31
|
+
* `queryDeclared` resolves an absent limit to `SETTINGS_QUERY_DEFAULT_ROW_CAP`
|
|
32
|
+
* and cuts the result there. On the live hub that fired 138 times in two hours
|
|
33
|
+
* (`settings-store query truncated by a defensive row cap`, collection
|
|
34
|
+
* `addon-device-settings`, `rowCap: 2000`, `requestedLimit: null`): a
|
|
35
|
+
* ~1 019-device fleet with more than two stored keys per device puts one
|
|
36
|
+
* addon's `<addonId>:` range past the cap. The engine warned; the door did not
|
|
37
|
+
* notice, and handed its caller a short map that is **shape-identical to a
|
|
38
|
+
* complete one**. Every device whose rows sort past the cap reads as "has no
|
|
39
|
+
* stored settings", which is exactly what a device with none looks like.
|
|
40
|
+
*
|
|
41
|
+
* **The fix is a keyset walk, not a bigger limit.** The cursor is the last id
|
|
42
|
+
* of the previous page, INCLUSIVE — so the page boundary re-reads exactly one
|
|
43
|
+
* row (ids are unique, so a full page always advances) and no row can fall
|
|
44
|
+
* between two pages the way an `OFFSET` walk drops rows under a concurrent
|
|
45
|
+
* write (D295 rule 1). Re-reading is free here: the accumulator is keyed by
|
|
46
|
+
* suffix, so the duplicate overwrites itself with its own value.
|
|
47
|
+
*
|
|
48
|
+
* `ORDER BY id` is not decoration — the cursor is only meaningful if the
|
|
49
|
+
* engine returns the range in the order the cursor advances through. It is the
|
|
50
|
+
* primary key, so the ordering is the range scan's own.
|
|
51
|
+
*
|
|
52
|
+
* @throws when the prefix cannot be expressed as a range and the collection is
|
|
53
|
+
* larger than one page, or when the walk exceeds {@link PREFIX_PAGE_BUDGET}.
|
|
54
|
+
* A throw is the point: a caller that cannot be answered completely must not
|
|
55
|
+
* be handed something that looks like a complete answer.
|
|
56
|
+
*/
|
|
57
|
+
async function loadPrefixed(door, collection, prefix, decode = unwrapStoredValue) {
|
|
58
|
+
const range = require_prefix_range.prefixRange(prefix);
|
|
59
|
+
const result = {};
|
|
60
|
+
let cursor = range?.lo ?? null;
|
|
61
|
+
for (let page = 0;; page++) {
|
|
62
|
+
if (page >= PREFIX_PAGE_BUDGET) throw new Error(`settings door: reading "${prefix}" from "${collection}" exceeded ${PREFIX_PAGE_BUDGET} pages of ${PREFIX_PAGE_ROWS} rows. Refusing to return the part that was read — a partial scope read is indistinguishable from an empty one.`);
|
|
63
|
+
const rows = await door.query({
|
|
64
|
+
collection,
|
|
65
|
+
filter: {
|
|
66
|
+
...range !== null && cursor !== null ? { whereBetween: { id: [cursor, range.hi] } } : {},
|
|
67
|
+
orderBy: {
|
|
68
|
+
field: "id",
|
|
69
|
+
direction: "asc"
|
|
70
|
+
},
|
|
71
|
+
limit: PREFIX_PAGE_ROWS
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
for (const row of rows) {
|
|
75
|
+
if (range !== null && (row.id < range.lo || row.id >= range.hi)) continue;
|
|
76
|
+
if (!row.id.startsWith(prefix)) continue;
|
|
77
|
+
result[row.id.slice(prefix.length)] = decode(row.data);
|
|
78
|
+
}
|
|
79
|
+
if (rows.length < PREFIX_PAGE_ROWS) return result;
|
|
80
|
+
const last = rows[rows.length - 1];
|
|
81
|
+
if (last === void 0) return result;
|
|
82
|
+
if (range === null) throw new Error(`settings door: prefix "${prefix}" on "${collection}" cannot be expressed as an id range, and the unfiltered read filled a page — the answer would be partial. Use an ASCII, non-empty prefix.`);
|
|
83
|
+
if (last.id === cursor) throw new Error(`settings door: reading "${prefix}" from "${collection}" made no progress at id "${last.id}" — ids under a prefix must be unique.`);
|
|
84
|
+
cursor = last.id;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
Object.defineProperty(exports, "loadPrefixed", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function() {
|
|
91
|
+
return loadPrefixed;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "unwrapStoredValue", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function() {
|
|
97
|
+
return unwrapStoredValue;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-BKhlcYz6.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let buffer = require("buffer");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|