@camstack/addon-mqtt-broker 1.2.125 → 1.2.127
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/mqtt-broker.addon.js +1975 -81
- package/dist/mqtt-broker.addon.mjs +1975 -81
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ let node_fs = require("node:fs");
|
|
|
46
46
|
node_fs = __toESM(node_fs);
|
|
47
47
|
let node_path = require("node:path");
|
|
48
48
|
node_path = __toESM(node_path);
|
|
49
|
-
//#region ../types/dist/event-category-
|
|
49
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
50
50
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
51
51
|
EventCategory["SystemBoot"] = "system.boot";
|
|
52
52
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -110,6 +110,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
110
110
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
111
111
|
*/
|
|
112
112
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
113
|
+
/**
|
|
114
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
115
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
116
|
+
* action. One event per refusal.
|
|
117
|
+
*/
|
|
118
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
119
|
+
/**
|
|
120
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
121
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
122
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
123
|
+
*/
|
|
124
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
125
|
+
/**
|
|
126
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
127
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
128
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
129
|
+
*/
|
|
130
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
113
131
|
EventCategory["AddonError"] = "addon.error";
|
|
114
132
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
115
133
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -4152,6 +4170,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4152
4170
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4153
4171
|
json.type = "boolean";
|
|
4154
4172
|
};
|
|
4173
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4174
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4175
|
+
};
|
|
4176
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4177
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4178
|
+
};
|
|
4155
4179
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4156
4180
|
if (ctx.target === "openapi-3.0") {
|
|
4157
4181
|
json.type = "string";
|
|
@@ -4159,12 +4183,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4159
4183
|
json.enum = [null];
|
|
4160
4184
|
} else json.type = "null";
|
|
4161
4185
|
};
|
|
4186
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4187
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4188
|
+
};
|
|
4162
4189
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4163
4190
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4164
4191
|
};
|
|
4165
4192
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4166
4193
|
json.not = {};
|
|
4167
4194
|
};
|
|
4195
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4196
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4168
4197
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4169
4198
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4170
4199
|
};
|
|
@@ -4196,12 +4225,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4196
4225
|
json.enum = vals;
|
|
4197
4226
|
}
|
|
4198
4227
|
};
|
|
4228
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4229
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4230
|
+
};
|
|
4231
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4232
|
+
const _json = json;
|
|
4233
|
+
const pattern = schema._zod.pattern;
|
|
4234
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4235
|
+
_json.type = "string";
|
|
4236
|
+
_json.pattern = pattern.source;
|
|
4237
|
+
};
|
|
4238
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4239
|
+
const _json = json;
|
|
4240
|
+
const file = {
|
|
4241
|
+
type: "string",
|
|
4242
|
+
format: "binary",
|
|
4243
|
+
contentEncoding: "binary"
|
|
4244
|
+
};
|
|
4245
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4246
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4247
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4248
|
+
if (mime) if (mime.length === 1) {
|
|
4249
|
+
file.contentMediaType = mime[0];
|
|
4250
|
+
Object.assign(_json, file);
|
|
4251
|
+
} else {
|
|
4252
|
+
Object.assign(_json, file);
|
|
4253
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4254
|
+
}
|
|
4255
|
+
else Object.assign(_json, file);
|
|
4256
|
+
};
|
|
4257
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4258
|
+
json.type = "boolean";
|
|
4259
|
+
};
|
|
4199
4260
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4200
4261
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4201
4262
|
};
|
|
4263
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4264
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4265
|
+
};
|
|
4202
4266
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4203
4267
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4204
4268
|
};
|
|
4269
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4270
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4271
|
+
};
|
|
4272
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4273
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4274
|
+
};
|
|
4205
4275
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4206
4276
|
const json = _json;
|
|
4207
4277
|
const def = schema._zod.def;
|
|
@@ -4406,6 +4476,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4406
4476
|
seen.ref = def.innerType;
|
|
4407
4477
|
json.readOnly = true;
|
|
4408
4478
|
};
|
|
4479
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4480
|
+
const def = schema._zod.def;
|
|
4481
|
+
process$1(def.innerType, ctx, params);
|
|
4482
|
+
const seen = ctx.seen.get(schema);
|
|
4483
|
+
seen.ref = def.innerType;
|
|
4484
|
+
};
|
|
4409
4485
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4410
4486
|
const def = schema._zod.def;
|
|
4411
4487
|
process$1(def.innerType, ctx, params);
|
|
@@ -4418,6 +4494,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4418
4494
|
const seen = ctx.seen.get(schema);
|
|
4419
4495
|
seen.ref = innerType;
|
|
4420
4496
|
};
|
|
4497
|
+
var allProcessors = {
|
|
4498
|
+
string: stringProcessor,
|
|
4499
|
+
number: numberProcessor,
|
|
4500
|
+
boolean: booleanProcessor,
|
|
4501
|
+
bigint: bigintProcessor,
|
|
4502
|
+
symbol: symbolProcessor,
|
|
4503
|
+
null: nullProcessor,
|
|
4504
|
+
undefined: undefinedProcessor,
|
|
4505
|
+
void: voidProcessor,
|
|
4506
|
+
never: neverProcessor,
|
|
4507
|
+
any: anyProcessor,
|
|
4508
|
+
unknown: unknownProcessor,
|
|
4509
|
+
date: dateProcessor,
|
|
4510
|
+
enum: enumProcessor,
|
|
4511
|
+
literal: literalProcessor,
|
|
4512
|
+
nan: nanProcessor,
|
|
4513
|
+
template_literal: templateLiteralProcessor,
|
|
4514
|
+
file: fileProcessor,
|
|
4515
|
+
success: successProcessor,
|
|
4516
|
+
custom: customProcessor,
|
|
4517
|
+
function: functionProcessor,
|
|
4518
|
+
transform: transformProcessor,
|
|
4519
|
+
map: mapProcessor,
|
|
4520
|
+
set: setProcessor,
|
|
4521
|
+
array: arrayProcessor,
|
|
4522
|
+
object: objectProcessor,
|
|
4523
|
+
union: unionProcessor,
|
|
4524
|
+
intersection: intersectionProcessor,
|
|
4525
|
+
tuple: tupleProcessor,
|
|
4526
|
+
record: recordProcessor,
|
|
4527
|
+
nullable: nullableProcessor,
|
|
4528
|
+
nonoptional: nonoptionalProcessor,
|
|
4529
|
+
default: defaultProcessor,
|
|
4530
|
+
prefault: prefaultProcessor,
|
|
4531
|
+
catch: catchProcessor,
|
|
4532
|
+
pipe: pipeProcessor,
|
|
4533
|
+
readonly: readonlyProcessor,
|
|
4534
|
+
promise: promiseProcessor,
|
|
4535
|
+
optional: optionalProcessor,
|
|
4536
|
+
lazy: lazyProcessor
|
|
4537
|
+
};
|
|
4538
|
+
function toJSONSchema(input, params) {
|
|
4539
|
+
if ("_idmap" in input) {
|
|
4540
|
+
const registry = input;
|
|
4541
|
+
const ctx = initializeContext({
|
|
4542
|
+
...params,
|
|
4543
|
+
processors: allProcessors
|
|
4544
|
+
});
|
|
4545
|
+
const defs = {};
|
|
4546
|
+
for (const entry of registry._idmap.entries()) {
|
|
4547
|
+
const [_, schema] = entry;
|
|
4548
|
+
process$1(schema, ctx);
|
|
4549
|
+
}
|
|
4550
|
+
const schemas = {};
|
|
4551
|
+
ctx.external = {
|
|
4552
|
+
registry,
|
|
4553
|
+
uri: params?.uri,
|
|
4554
|
+
defs
|
|
4555
|
+
};
|
|
4556
|
+
for (const entry of registry._idmap.entries()) {
|
|
4557
|
+
const [key, schema] = entry;
|
|
4558
|
+
extractDefs(ctx, schema);
|
|
4559
|
+
schemas[key] = finalize(ctx, schema);
|
|
4560
|
+
}
|
|
4561
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
4562
|
+
return { schemas };
|
|
4563
|
+
}
|
|
4564
|
+
const ctx = initializeContext({
|
|
4565
|
+
...params,
|
|
4566
|
+
processors: allProcessors
|
|
4567
|
+
});
|
|
4568
|
+
process$1(input, ctx);
|
|
4569
|
+
extractDefs(ctx, input);
|
|
4570
|
+
return finalize(ctx, input);
|
|
4571
|
+
}
|
|
4421
4572
|
//#endregion
|
|
4422
4573
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4423
4574
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5434,7 +5585,7 @@ var ZodIssueCode = {
|
|
|
5434
5585
|
var ZodFirstPartyTypeKind;
|
|
5435
5586
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5436
5587
|
//#endregion
|
|
5437
|
-
//#region ../types/dist/sleep-
|
|
5588
|
+
//#region ../types/dist/sleep-BegKjwUu.mjs
|
|
5438
5589
|
/**
|
|
5439
5590
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5440
5591
|
* window to float samples (D455).
|
|
@@ -5551,7 +5702,7 @@ function isKeychainStoredField(field) {
|
|
|
5551
5702
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5552
5703
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5553
5704
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5554
|
-
function isRecord$
|
|
5705
|
+
function isRecord$5(value) {
|
|
5555
5706
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5556
5707
|
}
|
|
5557
5708
|
function makeSecretMarker(ref) {
|
|
@@ -5562,12 +5713,12 @@ function makeSecretMarker(ref) {
|
|
|
5562
5713
|
}
|
|
5563
5714
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5564
5715
|
function isSecretMarker(value) {
|
|
5565
|
-
if (!isRecord$
|
|
5716
|
+
if (!isRecord$5(value)) return false;
|
|
5566
5717
|
const ref = value["$secret"];
|
|
5567
5718
|
return typeof ref === "string" && ref.length > 0;
|
|
5568
5719
|
}
|
|
5569
5720
|
function isSecretClear(value) {
|
|
5570
|
-
return isRecord$
|
|
5721
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5571
5722
|
}
|
|
5572
5723
|
/**
|
|
5573
5724
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6177,7 +6328,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6177
6328
|
}
|
|
6178
6329
|
};
|
|
6179
6330
|
var KEEP = { kind: "keep" };
|
|
6180
|
-
function isRecord$
|
|
6331
|
+
function isRecord$4(value) {
|
|
6181
6332
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6182
6333
|
}
|
|
6183
6334
|
function defaultMintId() {
|
|
@@ -6190,7 +6341,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6190
6341
|
return out;
|
|
6191
6342
|
}
|
|
6192
6343
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6193
|
-
else if (isRecord$
|
|
6344
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6194
6345
|
return out;
|
|
6195
6346
|
}
|
|
6196
6347
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6245,7 +6396,7 @@ function rowId(row, idKey) {
|
|
|
6245
6396
|
return null;
|
|
6246
6397
|
}
|
|
6247
6398
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6248
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6399
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6249
6400
|
if (!Array.isArray(incoming)) {
|
|
6250
6401
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6251
6402
|
return {
|
|
@@ -6261,7 +6412,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6261
6412
|
const kept = /* @__PURE__ */ new Set();
|
|
6262
6413
|
const rows = [];
|
|
6263
6414
|
for (const row of incoming) {
|
|
6264
|
-
if (!isRecord$
|
|
6415
|
+
if (!isRecord$4(row)) {
|
|
6265
6416
|
rows.push(row);
|
|
6266
6417
|
continue;
|
|
6267
6418
|
}
|
|
@@ -6286,7 +6437,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6286
6437
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6287
6438
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6288
6439
|
case "object": {
|
|
6289
|
-
if (!isRecord$
|
|
6440
|
+
if (!isRecord$4(incoming)) {
|
|
6290
6441
|
if (incoming === void 0) return KEEP;
|
|
6291
6442
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6292
6443
|
return {
|
|
@@ -6294,7 +6445,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6294
6445
|
value: incoming
|
|
6295
6446
|
};
|
|
6296
6447
|
}
|
|
6297
|
-
const storedObj = isRecord$
|
|
6448
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6298
6449
|
return {
|
|
6299
6450
|
kind: "value",
|
|
6300
6451
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6417,7 +6568,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6417
6568
|
value: items
|
|
6418
6569
|
};
|
|
6419
6570
|
}
|
|
6420
|
-
if (isRecord$
|
|
6571
|
+
if (isRecord$4(v)) {
|
|
6421
6572
|
const out = {};
|
|
6422
6573
|
for (const [k, child] of Object.entries(v)) {
|
|
6423
6574
|
const s = substitute(child);
|
|
@@ -6449,7 +6600,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
6449
6600
|
this.name = "SecretOverwriteRefusedError";
|
|
6450
6601
|
}
|
|
6451
6602
|
};
|
|
6452
|
-
function isRecord(value) {
|
|
6603
|
+
function isRecord$3(value) {
|
|
6453
6604
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6454
6605
|
}
|
|
6455
6606
|
function resolvedValue(pass, marker) {
|
|
@@ -6478,7 +6629,7 @@ function inArray(pass, incoming, stored) {
|
|
|
6478
6629
|
return incoming.map((item, index) => {
|
|
6479
6630
|
const twin = stored[index];
|
|
6480
6631
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6481
|
-
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6632
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6482
6633
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6483
6634
|
return item;
|
|
6484
6635
|
});
|
|
@@ -6489,7 +6640,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
6489
6640
|
const twin = stored[key];
|
|
6490
6641
|
if (isSecretMarker(twin)) {
|
|
6491
6642
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6492
|
-
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6643
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6493
6644
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6494
6645
|
}
|
|
6495
6646
|
return out;
|
|
@@ -6497,7 +6648,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
6497
6648
|
async function walk(pass, incoming, stored) {
|
|
6498
6649
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6499
6650
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6500
|
-
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6651
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6501
6652
|
const out = { ...incoming };
|
|
6502
6653
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6503
6654
|
return out;
|
|
@@ -6528,7 +6679,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
6528
6679
|
function isJsonEqual(a, b) {
|
|
6529
6680
|
if (Object.is(a, b)) return true;
|
|
6530
6681
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6531
|
-
if (isRecord(a) && isRecord(b)) {
|
|
6682
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6532
6683
|
const keys = Object.keys(a);
|
|
6533
6684
|
if (keys.length !== Object.keys(b).length) return false;
|
|
6534
6685
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -6552,7 +6703,7 @@ function markerKeysOf(blob, owner) {
|
|
|
6552
6703
|
}
|
|
6553
6704
|
function nodeFromStored(value, owner) {
|
|
6554
6705
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6555
|
-
if (!isRecord(value)) return null;
|
|
6706
|
+
if (!isRecord$3(value)) return null;
|
|
6556
6707
|
const children = /* @__PURE__ */ new Map();
|
|
6557
6708
|
for (const [key, child] of Object.entries(value)) {
|
|
6558
6709
|
const node = nodeFromStored(child, owner);
|
|
@@ -6685,7 +6836,6 @@ function createHandle(raw, opts) {
|
|
|
6685
6836
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6686
6837
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6687
6838
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6688
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6689
6839
|
const overrides = {
|
|
6690
6840
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6691
6841
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6709,12 +6859,12 @@ function createHandle(raw, opts) {
|
|
|
6709
6859
|
};
|
|
6710
6860
|
} } : {},
|
|
6711
6861
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6712
|
-
|
|
6713
|
-
const rows = await readDeviceStoreBatch
|
|
6862
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6863
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6714
6864
|
const out = /* @__PURE__ */ new Map();
|
|
6715
6865
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6716
6866
|
return out;
|
|
6717
|
-
}
|
|
6867
|
+
},
|
|
6718
6868
|
writeAddonStore: async (patch) => {
|
|
6719
6869
|
await writeAddon(patch);
|
|
6720
6870
|
},
|
|
@@ -7341,7 +7491,7 @@ var BaseAddon = class {
|
|
|
7341
7491
|
if (!ctx) return;
|
|
7342
7492
|
const addonId = ctx.id;
|
|
7343
7493
|
setImmediate(() => {
|
|
7344
|
-
ctx.api.addons
|
|
7494
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7345
7495
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7346
7496
|
}).catch((err) => {
|
|
7347
7497
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7541,7 +7691,7 @@ var BaseAddon = class {
|
|
|
7541
7691
|
return this._addonSecretTree;
|
|
7542
7692
|
}
|
|
7543
7693
|
deviceSecretTree() {
|
|
7544
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7694
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7545
7695
|
return this._deviceSecretTree;
|
|
7546
7696
|
}
|
|
7547
7697
|
/**
|
|
@@ -7617,42 +7767,135 @@ var BaseAddon = class {
|
|
|
7617
7767
|
this[timerOf] = timer;
|
|
7618
7768
|
}
|
|
7619
7769
|
/**
|
|
7620
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7621
|
-
*
|
|
7622
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7623
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7770
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7771
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7624
7772
|
* addon permanently broken.
|
|
7625
7773
|
*
|
|
7626
|
-
*
|
|
7627
|
-
*
|
|
7628
|
-
* `
|
|
7774
|
+
* Two kinds of outage, two budgets:
|
|
7775
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7776
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7777
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7778
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7779
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7780
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7781
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7782
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7783
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7784
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7629
7785
|
*/
|
|
7630
7786
|
async readAddonStoreWithRetry() {
|
|
7631
7787
|
const settings = this.rawSettings();
|
|
7632
7788
|
if (!settings) return {};
|
|
7633
|
-
const delaysMs = [
|
|
7634
|
-
150,
|
|
7635
|
-
350,
|
|
7636
|
-
600,
|
|
7637
|
-
900
|
|
7638
|
-
];
|
|
7639
7789
|
let lastErr;
|
|
7640
|
-
for (let attempt = 0
|
|
7790
|
+
for (let attempt = 0;; attempt++) try {
|
|
7641
7791
|
const stored = await settings.readAddonStore() ?? {};
|
|
7642
7792
|
this.settingsStoreReady = true;
|
|
7643
7793
|
return stored;
|
|
7644
7794
|
} catch (err) {
|
|
7645
7795
|
lastErr = err;
|
|
7646
|
-
const
|
|
7647
|
-
if (
|
|
7648
|
-
|
|
7649
|
-
|
|
7796
|
+
const kind = classifyStoreError(err);
|
|
7797
|
+
if (kind === "permanent") throw err;
|
|
7798
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7799
|
+
if (delay === void 0) {
|
|
7800
|
+
if (kind === "transport") throw err;
|
|
7801
|
+
break;
|
|
7802
|
+
}
|
|
7803
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7650
7804
|
}
|
|
7651
7805
|
this.settingsStoreReady = false;
|
|
7652
7806
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7653
7807
|
return {};
|
|
7654
7808
|
}
|
|
7655
7809
|
};
|
|
7810
|
+
/** The settings store's own restart fingerprints. */
|
|
7811
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7812
|
+
150,
|
|
7813
|
+
350,
|
|
7814
|
+
600,
|
|
7815
|
+
900
|
|
7816
|
+
];
|
|
7817
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7818
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7819
|
+
150,
|
|
7820
|
+
350,
|
|
7821
|
+
600,
|
|
7822
|
+
900,
|
|
7823
|
+
2e3,
|
|
7824
|
+
5e3,
|
|
7825
|
+
1e4,
|
|
7826
|
+
2e4,
|
|
7827
|
+
3e4,
|
|
7828
|
+
3e4
|
|
7829
|
+
];
|
|
7830
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7831
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7832
|
+
var TRANSPORT_CODES = new Set([
|
|
7833
|
+
"ECONNREFUSED",
|
|
7834
|
+
"ECONNRESET",
|
|
7835
|
+
"ETIMEDOUT",
|
|
7836
|
+
"EPIPE",
|
|
7837
|
+
"EHOSTUNREACH",
|
|
7838
|
+
"ENETUNREACH"
|
|
7839
|
+
]);
|
|
7840
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7841
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7842
|
+
"TIMEOUT",
|
|
7843
|
+
"SERVICE_UNAVAILABLE",
|
|
7844
|
+
"BAD_GATEWAY",
|
|
7845
|
+
"GATEWAY_TIMEOUT"
|
|
7846
|
+
]);
|
|
7847
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7848
|
+
var TRANSPORT_PHRASES = [
|
|
7849
|
+
"discovery deadline exceeded",
|
|
7850
|
+
"parent could not route child unowned cap call",
|
|
7851
|
+
"UDS request timed out after",
|
|
7852
|
+
"channel closed"
|
|
7853
|
+
];
|
|
7854
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7855
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7856
|
+
"REQUEST_TIMEOUT",
|
|
7857
|
+
"SERVICE_NOT_FOUND",
|
|
7858
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7859
|
+
"REQUEST_REJECTED",
|
|
7860
|
+
"BROKER_DISCONNECTED"
|
|
7861
|
+
]);
|
|
7862
|
+
function stringProp(value, key) {
|
|
7863
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7864
|
+
const found = Reflect.get(value, key);
|
|
7865
|
+
return typeof found === "string" ? found : void 0;
|
|
7866
|
+
}
|
|
7867
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7868
|
+
function errorCode(err) {
|
|
7869
|
+
const out = {};
|
|
7870
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7871
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7872
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7873
|
+
if (node !== void 0) out.node = node;
|
|
7874
|
+
const trpc = stringProp(data, "code");
|
|
7875
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7876
|
+
return out;
|
|
7877
|
+
}
|
|
7878
|
+
/**
|
|
7879
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7880
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7881
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7882
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7883
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7884
|
+
*/
|
|
7885
|
+
function classifyStoreError(err) {
|
|
7886
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7887
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7888
|
+
const code = errorCode(err);
|
|
7889
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7890
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7891
|
+
if (typeof err === "object" && err !== null) {
|
|
7892
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7893
|
+
const type = stringProp(err, "type");
|
|
7894
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7895
|
+
}
|
|
7896
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7897
|
+
return "permanent";
|
|
7898
|
+
}
|
|
7656
7899
|
/**
|
|
7657
7900
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7658
7901
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7742,6 +7985,365 @@ var PeerBytesTicketSchema = object({
|
|
|
7742
7985
|
*/
|
|
7743
7986
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7744
7987
|
});
|
|
7988
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7989
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7990
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7991
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7992
|
+
var RECORD_CLASSES = [
|
|
7993
|
+
"config",
|
|
7994
|
+
"ledger",
|
|
7995
|
+
"audit",
|
|
7996
|
+
"mirror",
|
|
7997
|
+
"ephemeral"
|
|
7998
|
+
];
|
|
7999
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8000
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8001
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
8002
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
8003
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8004
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8005
|
+
var PREFIX = "records/";
|
|
8006
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8007
|
+
var RecordsError = class extends Error {
|
|
8008
|
+
code;
|
|
8009
|
+
detail;
|
|
8010
|
+
constructor(code, detail) {
|
|
8011
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
8012
|
+
this.name = "RecordsError";
|
|
8013
|
+
this.code = code;
|
|
8014
|
+
this.detail = detail;
|
|
8015
|
+
}
|
|
8016
|
+
};
|
|
8017
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
8018
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
8019
|
+
constructor(detail) {
|
|
8020
|
+
super("secret-unavailable", detail);
|
|
8021
|
+
this.name = "RecordSecretUnavailableError";
|
|
8022
|
+
}
|
|
8023
|
+
};
|
|
8024
|
+
var InvalidRecordError = class extends RecordsError {
|
|
8025
|
+
constructor(detail) {
|
|
8026
|
+
super("invalid-record", detail);
|
|
8027
|
+
this.name = "InvalidRecordError";
|
|
8028
|
+
}
|
|
8029
|
+
};
|
|
8030
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8031
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
8032
|
+
constructor(detail) {
|
|
8033
|
+
super("declaration-refused", detail);
|
|
8034
|
+
this.name = "DeclarationRefusedError";
|
|
8035
|
+
}
|
|
8036
|
+
};
|
|
8037
|
+
function defOf(schema) {
|
|
8038
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
8039
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
8040
|
+
const def = Reflect.get(zodBag, "def");
|
|
8041
|
+
if (typeof def !== "object" || def === null) return {};
|
|
8042
|
+
return def;
|
|
8043
|
+
}
|
|
8044
|
+
function declaredHere(schema) {
|
|
8045
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8046
|
+
}
|
|
8047
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8048
|
+
var WRAPPERS = new Set([
|
|
8049
|
+
"optional",
|
|
8050
|
+
"nullable",
|
|
8051
|
+
"default",
|
|
8052
|
+
"prefault",
|
|
8053
|
+
"catch",
|
|
8054
|
+
"readonly",
|
|
8055
|
+
"nonoptional"
|
|
8056
|
+
]);
|
|
8057
|
+
/**
|
|
8058
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8059
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8060
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8061
|
+
* `.transform` on `in`).
|
|
8062
|
+
*/
|
|
8063
|
+
function layersOf(schema) {
|
|
8064
|
+
const out = [];
|
|
8065
|
+
const queue = [schema];
|
|
8066
|
+
while (queue.length > 0) {
|
|
8067
|
+
const s = queue.shift();
|
|
8068
|
+
if (!s || out.includes(s)) continue;
|
|
8069
|
+
out.push(s);
|
|
8070
|
+
const def = defOf(s);
|
|
8071
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8072
|
+
if (def.type === "pipe") {
|
|
8073
|
+
if (def.in) queue.push(def.in);
|
|
8074
|
+
if (def.out) queue.push(def.out);
|
|
8075
|
+
}
|
|
8076
|
+
}
|
|
8077
|
+
return out;
|
|
8078
|
+
}
|
|
8079
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8080
|
+
function isZodSecret(schema) {
|
|
8081
|
+
return layersOf(schema).some(declaredHere);
|
|
8082
|
+
}
|
|
8083
|
+
/**
|
|
8084
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8085
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8086
|
+
* object or array is reported as one path and not descended into — everything
|
|
8087
|
+
* under it is secret.
|
|
8088
|
+
*/
|
|
8089
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8090
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8091
|
+
const paths = [];
|
|
8092
|
+
for (const layer of layersOf(schema)) {
|
|
8093
|
+
const def = defOf(layer);
|
|
8094
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8095
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8096
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8097
|
+
else if (def.type === "intersection") {
|
|
8098
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8099
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8100
|
+
}
|
|
8101
|
+
}
|
|
8102
|
+
return [...new Set(paths)];
|
|
8103
|
+
}
|
|
8104
|
+
/**
|
|
8105
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8106
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8107
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8108
|
+
*
|
|
8109
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8110
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8111
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8112
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8113
|
+
*
|
|
8114
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8115
|
+
*/
|
|
8116
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8117
|
+
function parseSecretPath(path) {
|
|
8118
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8119
|
+
return path.split(".").map((raw) => {
|
|
8120
|
+
const each = raw.endsWith("[]");
|
|
8121
|
+
const key = each ? raw.slice(0, -2) : raw;
|
|
8122
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8123
|
+
return {
|
|
8124
|
+
key,
|
|
8125
|
+
each
|
|
8126
|
+
};
|
|
8127
|
+
});
|
|
8128
|
+
}
|
|
8129
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8130
|
+
function secretArrayPrefixes(path) {
|
|
8131
|
+
const segments = parseSecretPath(path);
|
|
8132
|
+
const prefixes = [];
|
|
8133
|
+
const walked = [];
|
|
8134
|
+
for (const segment of segments) {
|
|
8135
|
+
walked.push(segment.key);
|
|
8136
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8137
|
+
}
|
|
8138
|
+
return prefixes;
|
|
8139
|
+
}
|
|
8140
|
+
/**
|
|
8141
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8142
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
8143
|
+
* JSON the engine stores.
|
|
8144
|
+
*
|
|
8145
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
8146
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
8147
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
8148
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
8149
|
+
* never a field name (D879).
|
|
8150
|
+
*/
|
|
8151
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
8152
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
8153
|
+
var RecordIndexSchema = object({
|
|
8154
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
8155
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
8156
|
+
unique: boolean().optional()
|
|
8157
|
+
}).strict();
|
|
8158
|
+
var RecordRetentionSchema = union([
|
|
8159
|
+
object({
|
|
8160
|
+
ttlMs: number().int().positive(),
|
|
8161
|
+
from: _enum(["at", "write"])
|
|
8162
|
+
}).strict(),
|
|
8163
|
+
object({
|
|
8164
|
+
maxRows: number().int().positive().optional(),
|
|
8165
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
8166
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
8167
|
+
object({
|
|
8168
|
+
owner: string().min(1),
|
|
8169
|
+
reason: string().min(1)
|
|
8170
|
+
}).strict(),
|
|
8171
|
+
object({ none: string().min(1) }).strict()
|
|
8172
|
+
]);
|
|
8173
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
8174
|
+
var EntryDescriptorSchema = object({
|
|
8175
|
+
title: string().min(1),
|
|
8176
|
+
/** The record body field shown as the entry's name. */
|
|
8177
|
+
nameField: string().min(1),
|
|
8178
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
8179
|
+
fields: record(string(), unknown())
|
|
8180
|
+
}).strict();
|
|
8181
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
8182
|
+
var RecordKindDeclarationSchema = object({
|
|
8183
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
8184
|
+
class: _enum(RECORD_CLASSES),
|
|
8185
|
+
writeTrigger: string().min(1),
|
|
8186
|
+
device: _enum([
|
|
8187
|
+
"required",
|
|
8188
|
+
"optional",
|
|
8189
|
+
"none"
|
|
8190
|
+
]).default("none"),
|
|
8191
|
+
at: _enum(["required", "none"]).default("none"),
|
|
8192
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
8193
|
+
retention: RecordRetentionSchema,
|
|
8194
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
8195
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
8196
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
8197
|
+
secretPaths: array(string().min(1)).default([]),
|
|
8198
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
8199
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
8200
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
8201
|
+
adoptsFrom: string().min(1).optional(),
|
|
8202
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
8203
|
+
transactFamily: string().min(1).optional(),
|
|
8204
|
+
entry: EntryDescriptorSchema.optional()
|
|
8205
|
+
}).strict();
|
|
8206
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8207
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
8208
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
8209
|
+
function assertValidDeclaration(name, decl) {
|
|
8210
|
+
const refuse = (why) => {
|
|
8211
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
8212
|
+
};
|
|
8213
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
8214
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8215
|
+
for (const index of decl.indexes) {
|
|
8216
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
8217
|
+
seen.add(index.name);
|
|
8218
|
+
}
|
|
8219
|
+
const { retention } = decl;
|
|
8220
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
8221
|
+
if ("ttlMs" in retention) {
|
|
8222
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
8223
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
8224
|
+
}
|
|
8225
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
8226
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
8227
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
8228
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
8229
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
8230
|
+
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
8231
|
+
}
|
|
8232
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
8233
|
+
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
8234
|
+
}
|
|
8235
|
+
function bodyFieldsOf(schema) {
|
|
8236
|
+
return { ...toJSONSchema(schema, {
|
|
8237
|
+
unrepresentable: "any",
|
|
8238
|
+
io: "input"
|
|
8239
|
+
}) };
|
|
8240
|
+
}
|
|
8241
|
+
function isRecordLike(value) {
|
|
8242
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8243
|
+
}
|
|
8244
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
8245
|
+
function hasNameField(json, field) {
|
|
8246
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
8247
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
8248
|
+
const properties = json["properties"];
|
|
8249
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
8250
|
+
}
|
|
8251
|
+
/**
|
|
8252
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
8253
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
8254
|
+
* types its handle from.
|
|
8255
|
+
*/
|
|
8256
|
+
function defineRecordKinds(specs) {
|
|
8257
|
+
const out = {};
|
|
8258
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
8259
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
8260
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
8261
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
8262
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
8263
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
8264
|
+
database: spec.database,
|
|
8265
|
+
class: spec.class,
|
|
8266
|
+
writeTrigger: spec.writeTrigger,
|
|
8267
|
+
device: spec.device,
|
|
8268
|
+
at: spec.at,
|
|
8269
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
8270
|
+
retention: spec.retention,
|
|
8271
|
+
deviceRemoval: spec.deviceRemoval,
|
|
8272
|
+
maxDataBytes: spec.maxDataBytes,
|
|
8273
|
+
secretPaths: [...secretPaths],
|
|
8274
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
8275
|
+
adoptsFrom: spec.adoptsFrom,
|
|
8276
|
+
transactFamily: spec.transactFamily,
|
|
8277
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
8278
|
+
title: spec.entry.title,
|
|
8279
|
+
nameField,
|
|
8280
|
+
fields
|
|
8281
|
+
}
|
|
8282
|
+
});
|
|
8283
|
+
assertValidDeclaration(name, parsed);
|
|
8284
|
+
out[name] = {
|
|
8285
|
+
name,
|
|
8286
|
+
schema: spec.schema,
|
|
8287
|
+
declaration: parsed
|
|
8288
|
+
};
|
|
8289
|
+
}
|
|
8290
|
+
return out;
|
|
8291
|
+
}
|
|
8292
|
+
/**
|
|
8293
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
8294
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
8295
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
8296
|
+
* through the `record-entries` capability with password fields derived from
|
|
8297
|
+
* the schema (`.meta({ secret: true })`).
|
|
8298
|
+
*/
|
|
8299
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
8300
|
+
function entryBody(shape) {
|
|
8301
|
+
return object({
|
|
8302
|
+
name: string().min(1),
|
|
8303
|
+
...shape
|
|
8304
|
+
});
|
|
8305
|
+
}
|
|
8306
|
+
/**
|
|
8307
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
8308
|
+
* engine, never aged, belonging to no device.
|
|
8309
|
+
*/
|
|
8310
|
+
function defineEntryKind(name, spec) {
|
|
8311
|
+
const defined = defineRecordKinds({ [name]: {
|
|
8312
|
+
schema: spec.schema,
|
|
8313
|
+
class: "config",
|
|
8314
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
8315
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
8316
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
8317
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
8318
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
8319
|
+
...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
|
|
8320
|
+
entry: {
|
|
8321
|
+
title: spec.title,
|
|
8322
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
8323
|
+
}
|
|
8324
|
+
} })[name];
|
|
8325
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
8326
|
+
return defined;
|
|
8327
|
+
}
|
|
8328
|
+
/**
|
|
8329
|
+
* Legacy source for broker entry adoption (B2): brokers live in addon-settings
|
|
8330
|
+
* as one row `<addonId>.brokers` whose value is an array until records-adopt
|
|
8331
|
+
* copies them into the entry kind.
|
|
8332
|
+
*/
|
|
8333
|
+
var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
|
|
8334
|
+
/** The `adoptsFrom` value for an addon's broker entry kind. */
|
|
8335
|
+
function settingsBrokersAdoptsFrom(addonId) {
|
|
8336
|
+
return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
|
|
8337
|
+
}
|
|
8338
|
+
/**
|
|
8339
|
+
* Legacy source for entry adoption (B3): a list stored under addon-settings
|
|
8340
|
+
* `<addonId>.<key>` until records-adopt copies rows into the entry kind.
|
|
8341
|
+
*/
|
|
8342
|
+
var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
|
|
8343
|
+
/** The `adoptsFrom` value for an addon-settings array field. */
|
|
8344
|
+
function settingsArrayAdoptsFrom(addonId, settingsKey) {
|
|
8345
|
+
return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
|
|
8346
|
+
}
|
|
7745
8347
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7746
8348
|
var CamProfileSchema = _enum([
|
|
7747
8349
|
"high",
|
|
@@ -8207,7 +8809,7 @@ object({
|
|
|
8207
8809
|
params: record(string(), union([string(), number()])).optional()
|
|
8208
8810
|
});
|
|
8209
8811
|
//#endregion
|
|
8210
|
-
//#region ../types/dist/err-msg-
|
|
8812
|
+
//#region ../types/dist/err-msg-BXKzRBwg.mjs
|
|
8211
8813
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8212
8814
|
DeviceType["Camera"] = "camera";
|
|
8213
8815
|
DeviceType["Hub"] = "hub";
|
|
@@ -8299,6 +8901,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
8299
8901
|
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
8300
8902
|
* integrations sharing the same food/desiccant/hopper surface. */
|
|
8301
8903
|
DeviceType["PetFeeder"] = "pet-feeder";
|
|
8904
|
+
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
8905
|
+
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
8906
|
+
* Sources: native Bosch Home Connect, reusable by similar integrations. */
|
|
8907
|
+
DeviceType["Dishwasher"] = "dishwasher";
|
|
8302
8908
|
return DeviceType;
|
|
8303
8909
|
}({});
|
|
8304
8910
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -8476,6 +9082,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8476
9082
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8477
9083
|
* real Switch device for UI rendering / export adapters. */
|
|
8478
9084
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
9085
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
9086
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
9087
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8479
9088
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8480
9089
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8481
9090
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8543,7 +9152,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8543
9152
|
return DeviceRole;
|
|
8544
9153
|
}({});
|
|
8545
9154
|
//#endregion
|
|
8546
|
-
//#region ../types/dist/composition-
|
|
9155
|
+
//#region ../types/dist/composition-CB6PMT9p.mjs
|
|
8547
9156
|
/**
|
|
8548
9157
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8549
9158
|
*
|
|
@@ -11747,11 +12356,10 @@ var ClipModelMetaSchema = object({
|
|
|
11747
12356
|
/**
|
|
11748
12357
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11749
12358
|
* per index: two models share an index only when their vectors are ranked
|
|
11750
|
-
* against each other, which for CLIP means never across families.
|
|
11751
|
-
*
|
|
11752
|
-
* `modelId`); any other model gets its own.
|
|
12359
|
+
* against each other, which for CLIP means never across families. Every
|
|
12360
|
+
* model gets its own.
|
|
11753
12361
|
*/
|
|
11754
|
-
vectorIndex: string().regex(/^object-clip
|
|
12362
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11755
12363
|
/**
|
|
11756
12364
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11757
12365
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -12930,8 +13538,13 @@ var AlertSeveritySchema = _enum([
|
|
|
12930
13538
|
"info",
|
|
12931
13539
|
"success",
|
|
12932
13540
|
"warning",
|
|
12933
|
-
"error"
|
|
13541
|
+
"error",
|
|
13542
|
+
"critical"
|
|
12934
13543
|
]);
|
|
13544
|
+
var AlertActionSchema = object({
|
|
13545
|
+
label: string(),
|
|
13546
|
+
href: string().optional()
|
|
13547
|
+
});
|
|
12935
13548
|
var AlertStatusSchema = _enum([
|
|
12936
13549
|
"active",
|
|
12937
13550
|
"in-progress",
|
|
@@ -12949,6 +13562,7 @@ var AlertSchema = object({
|
|
|
12949
13562
|
severity: AlertSeveritySchema,
|
|
12950
13563
|
title: string(),
|
|
12951
13564
|
message: string(),
|
|
13565
|
+
action: AlertActionSchema.optional(),
|
|
12952
13566
|
status: AlertStatusSchema,
|
|
12953
13567
|
progress: number().optional(),
|
|
12954
13568
|
read: boolean(),
|
|
@@ -15427,6 +16041,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15427
16041
|
keyField: string()
|
|
15428
16042
|
}).optional()
|
|
15429
16043
|
})) });
|
|
16044
|
+
/**
|
|
16045
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
16046
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
16047
|
+
*
|
|
16048
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
16049
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
16050
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
16051
|
+
*/
|
|
16052
|
+
var RawSecretMigrationInputSchema = object({
|
|
16053
|
+
/** `false` (the default of the script) = report only. */
|
|
16054
|
+
apply: boolean() });
|
|
16055
|
+
var RawSecretMigrationReportSchema = object({
|
|
16056
|
+
apply: boolean(),
|
|
16057
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
16058
|
+
rows: number().int(),
|
|
16059
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
16060
|
+
raw: number().int(),
|
|
16061
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
16062
|
+
markers: number().int(),
|
|
16063
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
16064
|
+
migrated: number().int(),
|
|
16065
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
16066
|
+
failed: number().int(),
|
|
16067
|
+
/** After the run: rows still holding plaintext. */
|
|
16068
|
+
remainingRaw: number().int(),
|
|
16069
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
16070
|
+
unresolvedMarkers: number().int(),
|
|
16071
|
+
/**
|
|
16072
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
16073
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
16074
|
+
*/
|
|
16075
|
+
redundantCopies: number().int().optional(),
|
|
16076
|
+
/** True when nothing is raw and every marker resolves. */
|
|
16077
|
+
verified: boolean()
|
|
16078
|
+
});
|
|
15430
16079
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15431
16080
|
* agent is the reason placement is not fixed to the hub. */
|
|
15432
16081
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -15653,6 +16302,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15653
16302
|
}), SettingsUpdateResultSchema, {
|
|
15654
16303
|
kind: "mutation",
|
|
15655
16304
|
auth: "admin"
|
|
16305
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16306
|
+
kind: "mutation",
|
|
16307
|
+
auth: "admin"
|
|
15656
16308
|
}), method(object({}), object({ libs: array(object({
|
|
15657
16309
|
filePath: string(),
|
|
15658
16310
|
content: string()
|
|
@@ -15916,6 +16568,347 @@ id: union([string(), number()]) }), {
|
|
|
15916
16568
|
auth: "admin"
|
|
15917
16569
|
});
|
|
15918
16570
|
/**
|
|
16571
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16572
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16573
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16574
|
+
*
|
|
16575
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16576
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16577
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16578
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16579
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16580
|
+
* addons go through the owner's capability.
|
|
16581
|
+
*
|
|
16582
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16583
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16584
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16585
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16586
|
+
* row's own ref.
|
|
16587
|
+
*
|
|
16588
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16589
|
+
*/
|
|
16590
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16591
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16592
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16593
|
+
var RecordInputSchema = object({
|
|
16594
|
+
id: RecordIdSchema,
|
|
16595
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16596
|
+
deviceId: number().int().optional(),
|
|
16597
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16598
|
+
at: number().int().optional(),
|
|
16599
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16600
|
+
expiresAt: number().int().optional(),
|
|
16601
|
+
data: RecordBodySchema
|
|
16602
|
+
});
|
|
16603
|
+
var RecordViewSchema = object({
|
|
16604
|
+
id: string(),
|
|
16605
|
+
deviceId: number().int().nullable(),
|
|
16606
|
+
at: number().nullable(),
|
|
16607
|
+
expiresAt: number().nullable(),
|
|
16608
|
+
rev: number().int(),
|
|
16609
|
+
updatedAt: number(),
|
|
16610
|
+
data: RecordBodySchema
|
|
16611
|
+
});
|
|
16612
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16613
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16614
|
+
string(),
|
|
16615
|
+
number(),
|
|
16616
|
+
boolean(),
|
|
16617
|
+
object({ in: array(union([
|
|
16618
|
+
string(),
|
|
16619
|
+
number(),
|
|
16620
|
+
boolean()
|
|
16621
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16622
|
+
object({
|
|
16623
|
+
gt: union([string(), number()]).optional(),
|
|
16624
|
+
gte: union([string(), number()]).optional(),
|
|
16625
|
+
lt: union([string(), number()]).optional(),
|
|
16626
|
+
lte: union([string(), number()]).optional()
|
|
16627
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16628
|
+
]));
|
|
16629
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16630
|
+
var TimeWindowShape = {
|
|
16631
|
+
deviceId: number().int().optional(),
|
|
16632
|
+
atFrom: number().optional(),
|
|
16633
|
+
atTo: number().optional()
|
|
16634
|
+
};
|
|
16635
|
+
var RecordQueryInputSchema = object({
|
|
16636
|
+
...KindShape,
|
|
16637
|
+
...TimeWindowShape,
|
|
16638
|
+
where: RecordWhereSchema.optional(),
|
|
16639
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16640
|
+
order: _enum(["at", "id"]).optional(),
|
|
16641
|
+
desc: boolean().optional(),
|
|
16642
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16643
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16644
|
+
cursor: string().min(1).optional()
|
|
16645
|
+
});
|
|
16646
|
+
var RecordQueryResultSchema = object({
|
|
16647
|
+
records: array(RecordViewSchema),
|
|
16648
|
+
nextCursor: string().nullable()
|
|
16649
|
+
});
|
|
16650
|
+
var RecordKindStateSchema = _enum([
|
|
16651
|
+
"created",
|
|
16652
|
+
"unchanged",
|
|
16653
|
+
"updated"
|
|
16654
|
+
]);
|
|
16655
|
+
var DeclareKindResultSchema = object({
|
|
16656
|
+
kindId: number().int(),
|
|
16657
|
+
state: RecordKindStateSchema,
|
|
16658
|
+
createdIndexes: array(string()),
|
|
16659
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16660
|
+
adoptionPending: object({
|
|
16661
|
+
legacyTable: string(),
|
|
16662
|
+
legacyRows: number().int()
|
|
16663
|
+
}).nullable()
|
|
16664
|
+
});
|
|
16665
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16666
|
+
var SecretRefsList = array(string());
|
|
16667
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16668
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16669
|
+
kind: "mutation",
|
|
16670
|
+
auth: "admin"
|
|
16671
|
+
}), method(object({
|
|
16672
|
+
...KindShape,
|
|
16673
|
+
id: RecordIdSchema
|
|
16674
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16675
|
+
...KindShape,
|
|
16676
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16677
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16678
|
+
...KindShape,
|
|
16679
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16680
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16681
|
+
...KindShape,
|
|
16682
|
+
record: RecordInputSchema,
|
|
16683
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16684
|
+
ifRev: number().int().min(0).optional()
|
|
16685
|
+
}), object({
|
|
16686
|
+
rev: number().int(),
|
|
16687
|
+
releasedRefs: SecretRefsList
|
|
16688
|
+
}), {
|
|
16689
|
+
kind: "mutation",
|
|
16690
|
+
auth: "admin"
|
|
16691
|
+
}), method(object({
|
|
16692
|
+
...KindShape,
|
|
16693
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16694
|
+
}), object({
|
|
16695
|
+
count: number().int(),
|
|
16696
|
+
releasedRefs: SecretRefsList
|
|
16697
|
+
}), {
|
|
16698
|
+
kind: "mutation",
|
|
16699
|
+
auth: "admin"
|
|
16700
|
+
}), method(object({
|
|
16701
|
+
...KindShape,
|
|
16702
|
+
id: RecordIdSchema,
|
|
16703
|
+
data: RecordBodySchema,
|
|
16704
|
+
at: number().int().nullable().optional(),
|
|
16705
|
+
expiresAt: number().int().nullable().optional(),
|
|
16706
|
+
ifRev: number().int().min(1).optional()
|
|
16707
|
+
}), object({
|
|
16708
|
+
rev: number().int(),
|
|
16709
|
+
releasedRefs: SecretRefsList
|
|
16710
|
+
}), {
|
|
16711
|
+
kind: "mutation",
|
|
16712
|
+
auth: "admin"
|
|
16713
|
+
}), method(object({
|
|
16714
|
+
...KindShape,
|
|
16715
|
+
id: RecordIdSchema
|
|
16716
|
+
}), object({
|
|
16717
|
+
deleted: boolean(),
|
|
16718
|
+
secretRefs: SecretRefsList
|
|
16719
|
+
}), {
|
|
16720
|
+
kind: "mutation",
|
|
16721
|
+
auth: "admin"
|
|
16722
|
+
}), method(object({
|
|
16723
|
+
...KindShape,
|
|
16724
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16725
|
+
}), object({
|
|
16726
|
+
deleted: number().int(),
|
|
16727
|
+
secretRefs: SecretRefsList
|
|
16728
|
+
}), {
|
|
16729
|
+
kind: "mutation",
|
|
16730
|
+
auth: "admin"
|
|
16731
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16732
|
+
...KindShape,
|
|
16733
|
+
...TimeWindowShape,
|
|
16734
|
+
where: RecordWhereSchema.optional()
|
|
16735
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16736
|
+
...KindShape,
|
|
16737
|
+
deviceId: number().int().optional(),
|
|
16738
|
+
from: number(),
|
|
16739
|
+
to: number(),
|
|
16740
|
+
bucketMs: number().int().positive()
|
|
16741
|
+
}), object({ buckets: array(object({
|
|
16742
|
+
bucketStart: number(),
|
|
16743
|
+
count: number().int()
|
|
16744
|
+
})) }), { auth: "admin" }), method(object({
|
|
16745
|
+
...KindShape,
|
|
16746
|
+
op: _enum([
|
|
16747
|
+
"sum",
|
|
16748
|
+
"min",
|
|
16749
|
+
"max",
|
|
16750
|
+
"count"
|
|
16751
|
+
]),
|
|
16752
|
+
field: RecordFieldPathSchema.optional(),
|
|
16753
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16754
|
+
where: RecordWhereSchema.optional()
|
|
16755
|
+
}), object({ rows: array(object({
|
|
16756
|
+
group: union([
|
|
16757
|
+
string(),
|
|
16758
|
+
number(),
|
|
16759
|
+
_null()
|
|
16760
|
+
]),
|
|
16761
|
+
value: number().nullable()
|
|
16762
|
+
})) }), { auth: "admin" }), method(object({
|
|
16763
|
+
...KindShape,
|
|
16764
|
+
deviceId: number().int().optional(),
|
|
16765
|
+
atBefore: number().optional(),
|
|
16766
|
+
where: RecordWhereSchema.optional()
|
|
16767
|
+
}), object({
|
|
16768
|
+
deleted: number().int(),
|
|
16769
|
+
secretRefs: SecretRefsList
|
|
16770
|
+
}), {
|
|
16771
|
+
kind: "mutation",
|
|
16772
|
+
auth: "admin"
|
|
16773
|
+
}), method(object({
|
|
16774
|
+
deviceId: number().int(),
|
|
16775
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16776
|
+
}), object({
|
|
16777
|
+
deleted: record(string(), number().int()),
|
|
16778
|
+
secretRefs: SecretRefsList
|
|
16779
|
+
}), {
|
|
16780
|
+
kind: "mutation",
|
|
16781
|
+
auth: "admin"
|
|
16782
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16783
|
+
kind: "mutation",
|
|
16784
|
+
auth: "admin"
|
|
16785
|
+
});
|
|
16786
|
+
/** One table of the settings database. */
|
|
16787
|
+
var StorageTableSchema = object({
|
|
16788
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16789
|
+
name: string(),
|
|
16790
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16791
|
+
owner: string().nullable(),
|
|
16792
|
+
rows: number().int().nonnegative(),
|
|
16793
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16794
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16795
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16796
|
+
declaredThisBoot: boolean()
|
|
16797
|
+
});
|
|
16798
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16799
|
+
var StorageKindSchema = object({
|
|
16800
|
+
owner: string(),
|
|
16801
|
+
kind: string(),
|
|
16802
|
+
database: _enum(["settings", "events"]),
|
|
16803
|
+
class: string(),
|
|
16804
|
+
state: _enum([
|
|
16805
|
+
"declared",
|
|
16806
|
+
"orphaned",
|
|
16807
|
+
"dropped"
|
|
16808
|
+
]),
|
|
16809
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16810
|
+
rows: number().int().nonnegative().nullable(),
|
|
16811
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16812
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16813
|
+
writeTrigger: string(),
|
|
16814
|
+
retention: RecordRetentionSchema,
|
|
16815
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16816
|
+
entry: boolean(),
|
|
16817
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16818
|
+
declaration: RecordKindDeclarationSchema
|
|
16819
|
+
});
|
|
16820
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16821
|
+
collection: string().min(1),
|
|
16822
|
+
expectRows: number().int().nonnegative()
|
|
16823
|
+
}), object({
|
|
16824
|
+
dropped: literal(true),
|
|
16825
|
+
rows: number().int().nonnegative()
|
|
16826
|
+
}), {
|
|
16827
|
+
kind: "mutation",
|
|
16828
|
+
auth: "admin"
|
|
16829
|
+
}), method(object({
|
|
16830
|
+
owner: string().min(1).optional(),
|
|
16831
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16832
|
+
counts: boolean().optional()
|
|
16833
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16834
|
+
owner: string().min(1),
|
|
16835
|
+
kind: RecordKindNameSchema
|
|
16836
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16837
|
+
owner: string().min(1),
|
|
16838
|
+
kind: RecordKindNameSchema,
|
|
16839
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16840
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16841
|
+
complete: boolean().optional()
|
|
16842
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16843
|
+
kind: "mutation",
|
|
16844
|
+
auth: "admin"
|
|
16845
|
+
}), method(object({
|
|
16846
|
+
collection: string().min(1),
|
|
16847
|
+
cursor: string().optional(),
|
|
16848
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16849
|
+
}), object({
|
|
16850
|
+
rows: array(object({
|
|
16851
|
+
id: string(),
|
|
16852
|
+
data: record(string(), unknown())
|
|
16853
|
+
})),
|
|
16854
|
+
nextCursor: string().nullable()
|
|
16855
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16856
|
+
/**
|
|
16857
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16858
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16859
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16860
|
+
*
|
|
16861
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16862
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16863
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16864
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16865
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16866
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16867
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16868
|
+
*
|
|
16869
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16870
|
+
*/
|
|
16871
|
+
var EntryKindInfoSchema = object({
|
|
16872
|
+
owner: string(),
|
|
16873
|
+
kind: RecordKindNameSchema,
|
|
16874
|
+
title: string(),
|
|
16875
|
+
nameField: string(),
|
|
16876
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16877
|
+
fields: record(string(), unknown()),
|
|
16878
|
+
secretPaths: array(string()),
|
|
16879
|
+
rows: number().int().nonnegative()
|
|
16880
|
+
});
|
|
16881
|
+
var EntryViewSchema = object({
|
|
16882
|
+
id: RecordIdSchema,
|
|
16883
|
+
name: string(),
|
|
16884
|
+
rev: number().int(),
|
|
16885
|
+
updatedAt: number(),
|
|
16886
|
+
/** Secret fields hold the redaction token. */
|
|
16887
|
+
data: RecordBodySchema
|
|
16888
|
+
});
|
|
16889
|
+
var EntryAddress = {
|
|
16890
|
+
owner: string().min(1),
|
|
16891
|
+
kind: RecordKindNameSchema
|
|
16892
|
+
};
|
|
16893
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16894
|
+
...EntryAddress,
|
|
16895
|
+
id: RecordIdSchema.optional(),
|
|
16896
|
+
data: RecordBodySchema,
|
|
16897
|
+
ifRev: number().int().min(1).optional()
|
|
16898
|
+
}), object({
|
|
16899
|
+
id: string(),
|
|
16900
|
+
rev: number().int()
|
|
16901
|
+
}), {
|
|
16902
|
+
kind: "mutation",
|
|
16903
|
+
auth: "admin"
|
|
16904
|
+
}), method(object({
|
|
16905
|
+
...EntryAddress,
|
|
16906
|
+
id: RecordIdSchema
|
|
16907
|
+
}), object({ deleted: boolean() }), {
|
|
16908
|
+
kind: "mutation",
|
|
16909
|
+
auth: "admin"
|
|
16910
|
+
});
|
|
16911
|
+
/**
|
|
15919
16912
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15920
16913
|
*
|
|
15921
16914
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16456,6 +17449,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16456
17449
|
kind: "mutation",
|
|
16457
17450
|
auth: "admin",
|
|
16458
17451
|
caller: "required"
|
|
17452
|
+
}), method(object({
|
|
17453
|
+
ref: string().min(1),
|
|
17454
|
+
value: string().min(1)
|
|
17455
|
+
}), object({
|
|
17456
|
+
ref: string(),
|
|
17457
|
+
version: number().int()
|
|
17458
|
+
}), {
|
|
17459
|
+
kind: "mutation",
|
|
17460
|
+
auth: "admin",
|
|
17461
|
+
caller: "required"
|
|
16459
17462
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16460
17463
|
deleted: array(string()).readonly(),
|
|
16461
17464
|
kept: array(object({
|
|
@@ -16753,7 +17756,11 @@ DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number().int
|
|
|
16753
17756
|
});
|
|
16754
17757
|
/**
|
|
16755
17758
|
* `device-adoption` — generic discovery + adoption surface,
|
|
16756
|
-
* system-scoped
|
|
17759
|
+
* system-scoped collection (one provider per integration addon), routed
|
|
17760
|
+
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
17761
|
+
* pin model as `connection-test`. The admin UI keeps using
|
|
17762
|
+
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
17763
|
+
* successor to `ha-discovery`:
|
|
16757
17764
|
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
16758
17765
|
* internally) rather than a connection-specific `brokerId`, and it
|
|
16759
17766
|
* REUSES the shared `DiscoveredChildDevice` candidate type from
|
|
@@ -38925,6 +39932,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
38925
39932
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
38926
39933
|
kind: "mutation",
|
|
38927
39934
|
auth: "admin"
|
|
39935
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
39936
|
+
kind: "mutation",
|
|
39937
|
+
auth: "admin"
|
|
38928
39938
|
}), method(ProfileRefInputSchema, _void(), {
|
|
38929
39939
|
kind: "mutation",
|
|
38930
39940
|
auth: "admin"
|
|
@@ -49367,6 +50377,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49367
50377
|
atMs: number(),
|
|
49368
50378
|
reason: string()
|
|
49369
50379
|
});
|
|
50380
|
+
/**
|
|
50381
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50382
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50383
|
+
* service holds, because only the hub plans) against the states the process
|
|
50384
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50385
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50386
|
+
*
|
|
50387
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50388
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50389
|
+
* planned runner the process service has no entry for.
|
|
50390
|
+
*/
|
|
50391
|
+
var RunnerRefusalSchema = object({
|
|
50392
|
+
runnerId: string(),
|
|
50393
|
+
addonIds: array(string()),
|
|
50394
|
+
reason: string()
|
|
50395
|
+
});
|
|
50396
|
+
var RunnerBootCheckSchema = object({
|
|
50397
|
+
checkedAtMs: number(),
|
|
50398
|
+
/** Runners planned for this node. */
|
|
50399
|
+
expected: number(),
|
|
50400
|
+
/** Planned runners whose process is `running`. */
|
|
50401
|
+
running: number(),
|
|
50402
|
+
failed: array(string()),
|
|
50403
|
+
refused: array(RunnerRefusalSchema),
|
|
50404
|
+
missing: array(string()),
|
|
50405
|
+
/**
|
|
50406
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50407
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50408
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50409
|
+
* Optional for version skew (absent = settled).
|
|
50410
|
+
*/
|
|
50411
|
+
pending: array(string()).optional(),
|
|
50412
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50413
|
+
planKnown: boolean()
|
|
50414
|
+
});
|
|
49370
50415
|
var ServerPackageStatusSchema = object({
|
|
49371
50416
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49372
50417
|
packageName: string(),
|
|
@@ -49429,7 +50474,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49429
50474
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49430
50475
|
* absent wrapper is unknown — never `native`.
|
|
49431
50476
|
*/
|
|
49432
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50477
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50478
|
+
/**
|
|
50479
|
+
* What this node PLANNED to run against what its process service reports
|
|
50480
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50481
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50482
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50483
|
+
*/
|
|
50484
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49433
50485
|
});
|
|
49434
50486
|
var ServerUpdateCheckResultSchema = object({
|
|
49435
50487
|
packageName: string(),
|
|
@@ -49480,6 +50532,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49480
50532
|
"refused",
|
|
49481
50533
|
"failed"
|
|
49482
50534
|
]);
|
|
50535
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50536
|
+
var UpdateBlockerSchema = object({
|
|
50537
|
+
addonId: string(),
|
|
50538
|
+
reason: string(),
|
|
50539
|
+
/** What the operator does about it. */
|
|
50540
|
+
remedy: string()
|
|
50541
|
+
});
|
|
49483
50542
|
var ServerUpdateActionResultSchema = object({
|
|
49484
50543
|
accepted: boolean(),
|
|
49485
50544
|
targetVersion: string().nullable(),
|
|
@@ -49497,14 +50556,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
49497
50556
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
49498
50557
|
* staging install). Non-null only for `failed`.
|
|
49499
50558
|
*/
|
|
49500
|
-
error: string().nullable().optional()
|
|
50559
|
+
error: string().nullable().optional(),
|
|
50560
|
+
/**
|
|
50561
|
+
* The addons the target version would refuse to start on this node's live
|
|
50562
|
+
* store (D877), present when the pre-flight refused the update
|
|
50563
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50564
|
+
*/
|
|
50565
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
49501
50566
|
});
|
|
49502
50567
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
49503
50568
|
kind: "mutation",
|
|
49504
50569
|
auth: "admin"
|
|
49505
|
-
}), method(object({
|
|
49506
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
49507
|
-
version: string().optional()
|
|
50570
|
+
}), method(object({
|
|
50571
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50572
|
+
version: string().optional(),
|
|
50573
|
+
/**
|
|
50574
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50575
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50576
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50577
|
+
*/
|
|
50578
|
+
acknowledgeRefusals: boolean().optional()
|
|
50579
|
+
}), ServerUpdateActionResultSchema, {
|
|
49508
50580
|
kind: "mutation",
|
|
49509
50581
|
auth: "admin",
|
|
49510
50582
|
timeoutMs: 16 * 6e4
|
|
@@ -51917,7 +52989,9 @@ var ManifestShapeSchema = object({
|
|
|
51917
52989
|
var AddonProcessSchema = object({
|
|
51918
52990
|
pid: number().optional(),
|
|
51919
52991
|
mode: string(),
|
|
51920
|
-
state: string()
|
|
52992
|
+
state: string(),
|
|
52993
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
52994
|
+
reason: string().optional()
|
|
51921
52995
|
});
|
|
51922
52996
|
/**
|
|
51923
52997
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -52495,7 +53569,7 @@ var BatteryStatusSchema = object({
|
|
|
52495
53569
|
*/
|
|
52496
53570
|
binary: boolean().optional()
|
|
52497
53571
|
});
|
|
52498
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
|
|
53572
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
|
|
52499
53573
|
deviceId: number(),
|
|
52500
53574
|
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
52501
53575
|
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
@@ -52920,6 +53994,12 @@ object({
|
|
|
52920
53994
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
52921
53995
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
52922
53996
|
swingHorizontal: boolean().nullable(),
|
|
53997
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
53998
|
+
minTemp: number().nullable().optional(),
|
|
53999
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54000
|
+
maxTemp: number().nullable().optional(),
|
|
54001
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
54002
|
+
tempStep: number().positive().nullable().optional(),
|
|
52923
54003
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
52924
54004
|
lastFetchedAt: number()
|
|
52925
54005
|
});
|
|
@@ -53365,6 +54445,130 @@ object({
|
|
|
53365
54445
|
deviceId: number(),
|
|
53366
54446
|
status: DeviceStatusSchema
|
|
53367
54447
|
});
|
|
54448
|
+
/**
|
|
54449
|
+
* Smart-dishwasher cap — program lifecycle, door / remote-start gates,
|
|
54450
|
+
* consumable levels (salt, rinse aid) and common program options.
|
|
54451
|
+
*
|
|
54452
|
+
* Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
|
|
54453
|
+
* by any integration that exposes the same program / option surface.
|
|
54454
|
+
*
|
|
54455
|
+
* `kind: 'poll'` — cloud REST APIs typically have no push channel; the
|
|
54456
|
+
* provider refreshes the slice on an interval and eagerly after commands.
|
|
54457
|
+
*/
|
|
54458
|
+
var DishwasherStateSchema = _enum([
|
|
54459
|
+
"idle",
|
|
54460
|
+
"running",
|
|
54461
|
+
"paused",
|
|
54462
|
+
"finished",
|
|
54463
|
+
"error",
|
|
54464
|
+
"unavailable"
|
|
54465
|
+
]);
|
|
54466
|
+
var DishwasherConsumableLevelSchema = _enum([
|
|
54467
|
+
"ok",
|
|
54468
|
+
"low",
|
|
54469
|
+
"empty"
|
|
54470
|
+
]);
|
|
54471
|
+
object({
|
|
54472
|
+
state: DishwasherStateSchema,
|
|
54473
|
+
/** Active program id/name, or null when none selected / unknown. */
|
|
54474
|
+
program: string().nullable(),
|
|
54475
|
+
/** Program tokens the hardware accepts — drives the UI selector. */
|
|
54476
|
+
availablePrograms: array(string()),
|
|
54477
|
+
/** Minutes remaining on the active cycle, or null when not running. */
|
|
54478
|
+
remainingMinutes: number().int().nonnegative().nullable(),
|
|
54479
|
+
/** Cycle completion 0..100, or null when not applicable. */
|
|
54480
|
+
progressPercent: number().min(0).max(100).nullable(),
|
|
54481
|
+
/** True when the door is reported open. */
|
|
54482
|
+
doorOpen: boolean(),
|
|
54483
|
+
/** True when remote start is allowed (door closed, power on, etc.). */
|
|
54484
|
+
remoteStartAllowed: boolean(),
|
|
54485
|
+
/** Main power / switched-on state. */
|
|
54486
|
+
powerOn: boolean(),
|
|
54487
|
+
saltLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
54488
|
+
rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
54489
|
+
halfLoad: boolean(),
|
|
54490
|
+
hygienePlus: boolean(),
|
|
54491
|
+
/** Extra dry option when the appliance exposes it. */
|
|
54492
|
+
extraDry: boolean(),
|
|
54493
|
+
/** Intensive zone (lower basket) when the appliance exposes it. */
|
|
54494
|
+
intensiveZone: boolean(),
|
|
54495
|
+
/** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
|
|
54496
|
+
varioSpeedPlus: boolean(),
|
|
54497
|
+
/** Child lock (controls disabled on the appliance). */
|
|
54498
|
+
childLock: boolean(),
|
|
54499
|
+
errorCode: number().nullable(),
|
|
54500
|
+
errorLabel: string().nullable(),
|
|
54501
|
+
lastFetchedAt: number()
|
|
54502
|
+
});
|
|
54503
|
+
DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
54504
|
+
kind: "mutation",
|
|
54505
|
+
auth: "protected"
|
|
54506
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
54507
|
+
kind: "mutation",
|
|
54508
|
+
auth: "protected"
|
|
54509
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
54510
|
+
kind: "mutation",
|
|
54511
|
+
auth: "protected"
|
|
54512
|
+
}), method(object({
|
|
54513
|
+
deviceId: number().int().nonnegative(),
|
|
54514
|
+
program: string().min(1)
|
|
54515
|
+
}), _void(), {
|
|
54516
|
+
kind: "mutation",
|
|
54517
|
+
auth: "protected"
|
|
54518
|
+
}), method(object({
|
|
54519
|
+
deviceId: number().int().nonnegative(),
|
|
54520
|
+
on: boolean()
|
|
54521
|
+
}), _void(), {
|
|
54522
|
+
kind: "mutation",
|
|
54523
|
+
auth: "protected"
|
|
54524
|
+
}), method(object({
|
|
54525
|
+
deviceId: number().int().nonnegative(),
|
|
54526
|
+
on: boolean()
|
|
54527
|
+
}), _void(), {
|
|
54528
|
+
kind: "mutation",
|
|
54529
|
+
auth: "protected"
|
|
54530
|
+
}), method(object({
|
|
54531
|
+
deviceId: number().int().nonnegative(),
|
|
54532
|
+
on: boolean()
|
|
54533
|
+
}), _void(), {
|
|
54534
|
+
kind: "mutation",
|
|
54535
|
+
auth: "protected"
|
|
54536
|
+
}), method(object({
|
|
54537
|
+
deviceId: number().int().nonnegative(),
|
|
54538
|
+
on: boolean()
|
|
54539
|
+
}), _void(), {
|
|
54540
|
+
kind: "mutation",
|
|
54541
|
+
auth: "protected"
|
|
54542
|
+
}), method(object({
|
|
54543
|
+
deviceId: number().int().nonnegative(),
|
|
54544
|
+
on: boolean()
|
|
54545
|
+
}), _void(), {
|
|
54546
|
+
kind: "mutation",
|
|
54547
|
+
auth: "protected"
|
|
54548
|
+
}), method(object({
|
|
54549
|
+
deviceId: number().int().nonnegative(),
|
|
54550
|
+
on: boolean()
|
|
54551
|
+
}), _void(), {
|
|
54552
|
+
kind: "mutation",
|
|
54553
|
+
auth: "protected"
|
|
54554
|
+
}), method(object({
|
|
54555
|
+
deviceId: number().int().nonnegative(),
|
|
54556
|
+
on: boolean()
|
|
54557
|
+
}), _void(), {
|
|
54558
|
+
kind: "mutation",
|
|
54559
|
+
auth: "protected"
|
|
54560
|
+
}), method(object({
|
|
54561
|
+
deviceId: number().int().nonnegative(),
|
|
54562
|
+
key: string().min(1),
|
|
54563
|
+
value: union([
|
|
54564
|
+
boolean(),
|
|
54565
|
+
string(),
|
|
54566
|
+
number()
|
|
54567
|
+
])
|
|
54568
|
+
}), _void(), {
|
|
54569
|
+
kind: "mutation",
|
|
54570
|
+
auth: "protected"
|
|
54571
|
+
});
|
|
53368
54572
|
object({
|
|
53369
54573
|
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
53370
54574
|
lastPressedAt: number().nullable(),
|
|
@@ -53930,6 +55134,13 @@ object({
|
|
|
53930
55134
|
lastChangedAt: number()
|
|
53931
55135
|
});
|
|
53932
55136
|
DeviceType.Sensor;
|
|
55137
|
+
object({
|
|
55138
|
+
/** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
|
|
55139
|
+
position: number().min(0).max(100).nullable(),
|
|
55140
|
+
/** Ms epoch when the slice was last updated (push or poll). */
|
|
55141
|
+
lastFetchedAt: number()
|
|
55142
|
+
});
|
|
55143
|
+
DeviceType.Thermostat;
|
|
53933
55144
|
object({
|
|
53934
55145
|
/** Whether the humidifier is currently on. */
|
|
53935
55146
|
on: boolean(),
|
|
@@ -54740,7 +55951,19 @@ var TlsStatusSchema = object({
|
|
|
54740
55951
|
sans: array(string()),
|
|
54741
55952
|
caCertPem: string().nullable(),
|
|
54742
55953
|
reissueError: string().nullable(),
|
|
54743
|
-
restartRequired: boolean()
|
|
55954
|
+
restartRequired: boolean(),
|
|
55955
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
55956
|
+
caMissing: boolean(),
|
|
55957
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
55958
|
+
localCaConstrained: boolean().nullable(),
|
|
55959
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
55960
|
+
caReplacedAt: string().nullable(),
|
|
55961
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
55962
|
+
storedUpload: object({
|
|
55963
|
+
leafFingerprintSha256: string(),
|
|
55964
|
+
validTo: string(),
|
|
55965
|
+
hasCa: boolean()
|
|
55966
|
+
}).nullable()
|
|
54744
55967
|
});
|
|
54745
55968
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
54746
55969
|
/**
|
|
@@ -54796,6 +56019,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
54796
56019
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
54797
56020
|
kind: "mutation",
|
|
54798
56021
|
auth: "admin"
|
|
56022
|
+
}), method(_void(), TlsStatusSchema, {
|
|
56023
|
+
kind: "mutation",
|
|
56024
|
+
auth: "admin"
|
|
54799
56025
|
});
|
|
54800
56026
|
object({
|
|
54801
56027
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -59925,7 +61151,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
59925
61151
|
kind: "mutation",
|
|
59926
61152
|
auth: "admin",
|
|
59927
61153
|
access: "delete"
|
|
59928
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
61154
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
61155
|
+
kind: "mutation",
|
|
61156
|
+
auth: "admin",
|
|
61157
|
+
access: "create"
|
|
61158
|
+
}), method(object({
|
|
59929
61159
|
userId: string(),
|
|
59930
61160
|
code: string()
|
|
59931
61161
|
}), object({ valid: boolean() }), {
|
|
@@ -60977,7 +62207,7 @@ var AccessoryKind = {
|
|
|
60977
62207
|
PrivacyMask: DeviceRole.PrivacyMask
|
|
60978
62208
|
};
|
|
60979
62209
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
60980
|
-
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
|
|
62210
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
|
|
60981
62211
|
new Set(Object.values(DeviceType));
|
|
60982
62212
|
Object.freeze({
|
|
60983
62213
|
"accessories.getStatus": {
|
|
@@ -62126,6 +63356,12 @@ Object.freeze({
|
|
|
62126
63356
|
addonId: null,
|
|
62127
63357
|
access: "view"
|
|
62128
63358
|
},
|
|
63359
|
+
"coreBlocks.migrateRawSecrets": {
|
|
63360
|
+
capName: "core-blocks",
|
|
63361
|
+
capScope: "system",
|
|
63362
|
+
addonId: null,
|
|
63363
|
+
access: "create"
|
|
63364
|
+
},
|
|
62129
63365
|
"coreBlocks.restart": {
|
|
62130
63366
|
capName: "core-blocks",
|
|
62131
63367
|
capScope: "system",
|
|
@@ -63392,6 +64628,84 @@ Object.freeze({
|
|
|
63392
64628
|
addonId: null,
|
|
63393
64629
|
access: "view"
|
|
63394
64630
|
},
|
|
64631
|
+
"dishwasher.getStatus": {
|
|
64632
|
+
capName: "dishwasher",
|
|
64633
|
+
capScope: "device",
|
|
64634
|
+
addonId: null,
|
|
64635
|
+
access: "view"
|
|
64636
|
+
},
|
|
64637
|
+
"dishwasher.pause": {
|
|
64638
|
+
capName: "dishwasher",
|
|
64639
|
+
capScope: "device",
|
|
64640
|
+
addonId: null,
|
|
64641
|
+
access: "create"
|
|
64642
|
+
},
|
|
64643
|
+
"dishwasher.setChildLock": {
|
|
64644
|
+
capName: "dishwasher",
|
|
64645
|
+
capScope: "device",
|
|
64646
|
+
addonId: null,
|
|
64647
|
+
access: "create"
|
|
64648
|
+
},
|
|
64649
|
+
"dishwasher.setExtraDry": {
|
|
64650
|
+
capName: "dishwasher",
|
|
64651
|
+
capScope: "device",
|
|
64652
|
+
addonId: null,
|
|
64653
|
+
access: "create"
|
|
64654
|
+
},
|
|
64655
|
+
"dishwasher.setHalfLoad": {
|
|
64656
|
+
capName: "dishwasher",
|
|
64657
|
+
capScope: "device",
|
|
64658
|
+
addonId: null,
|
|
64659
|
+
access: "create"
|
|
64660
|
+
},
|
|
64661
|
+
"dishwasher.setHygienePlus": {
|
|
64662
|
+
capName: "dishwasher",
|
|
64663
|
+
capScope: "device",
|
|
64664
|
+
addonId: null,
|
|
64665
|
+
access: "create"
|
|
64666
|
+
},
|
|
64667
|
+
"dishwasher.setIntensiveZone": {
|
|
64668
|
+
capName: "dishwasher",
|
|
64669
|
+
capScope: "device",
|
|
64670
|
+
addonId: null,
|
|
64671
|
+
access: "create"
|
|
64672
|
+
},
|
|
64673
|
+
"dishwasher.setOption": {
|
|
64674
|
+
capName: "dishwasher",
|
|
64675
|
+
capScope: "device",
|
|
64676
|
+
addonId: null,
|
|
64677
|
+
access: "create"
|
|
64678
|
+
},
|
|
64679
|
+
"dishwasher.setPower": {
|
|
64680
|
+
capName: "dishwasher",
|
|
64681
|
+
capScope: "device",
|
|
64682
|
+
addonId: null,
|
|
64683
|
+
access: "create"
|
|
64684
|
+
},
|
|
64685
|
+
"dishwasher.setProgram": {
|
|
64686
|
+
capName: "dishwasher",
|
|
64687
|
+
capScope: "device",
|
|
64688
|
+
addonId: null,
|
|
64689
|
+
access: "create"
|
|
64690
|
+
},
|
|
64691
|
+
"dishwasher.setVarioSpeedPlus": {
|
|
64692
|
+
capName: "dishwasher",
|
|
64693
|
+
capScope: "device",
|
|
64694
|
+
addonId: null,
|
|
64695
|
+
access: "create"
|
|
64696
|
+
},
|
|
64697
|
+
"dishwasher.start": {
|
|
64698
|
+
capName: "dishwasher",
|
|
64699
|
+
capScope: "device",
|
|
64700
|
+
addonId: null,
|
|
64701
|
+
access: "create"
|
|
64702
|
+
},
|
|
64703
|
+
"dishwasher.stop": {
|
|
64704
|
+
capName: "dishwasher",
|
|
64705
|
+
capScope: "device",
|
|
64706
|
+
addonId: null,
|
|
64707
|
+
access: "create"
|
|
64708
|
+
},
|
|
63395
64709
|
"doorbell.getStatus": {
|
|
63396
64710
|
capName: "doorbell",
|
|
63397
64711
|
capScope: "device",
|
|
@@ -63602,6 +64916,12 @@ Object.freeze({
|
|
|
63602
64916
|
addonId: null,
|
|
63603
64917
|
access: "view"
|
|
63604
64918
|
},
|
|
64919
|
+
"heatingValve.getStatus": {
|
|
64920
|
+
capName: "heating-valve",
|
|
64921
|
+
capScope: "device",
|
|
64922
|
+
addonId: null,
|
|
64923
|
+
access: "view"
|
|
64924
|
+
},
|
|
63605
64925
|
"humidifier.getStatus": {
|
|
63606
64926
|
capName: "humidifier",
|
|
63607
64927
|
capScope: "device",
|
|
@@ -63812,6 +65132,12 @@ Object.freeze({
|
|
|
63812
65132
|
addonId: null,
|
|
63813
65133
|
access: "create"
|
|
63814
65134
|
},
|
|
65135
|
+
"keychainAdmin.importSecret": {
|
|
65136
|
+
capName: "keychain-admin",
|
|
65137
|
+
capScope: "system",
|
|
65138
|
+
addonId: null,
|
|
65139
|
+
access: "create"
|
|
65140
|
+
},
|
|
63815
65141
|
"keychainAdmin.listAudit": {
|
|
63816
65142
|
capName: "keychain-admin",
|
|
63817
65143
|
capScope: "system",
|
|
@@ -63980,6 +65306,12 @@ Object.freeze({
|
|
|
63980
65306
|
addonId: null,
|
|
63981
65307
|
access: "view"
|
|
63982
65308
|
},
|
|
65309
|
+
"llm.migrateRawSecrets": {
|
|
65310
|
+
capName: "llm",
|
|
65311
|
+
capScope: "system",
|
|
65312
|
+
addonId: null,
|
|
65313
|
+
access: "create"
|
|
65314
|
+
},
|
|
63983
65315
|
"llm.resolveModelRef": {
|
|
63984
65316
|
capName: "llm",
|
|
63985
65317
|
capScope: "system",
|
|
@@ -64208,6 +65540,12 @@ Object.freeze({
|
|
|
64208
65540
|
addonId: null,
|
|
64209
65541
|
access: "create"
|
|
64210
65542
|
},
|
|
65543
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
65544
|
+
capName: "local-network",
|
|
65545
|
+
capScope: "system",
|
|
65546
|
+
addonId: null,
|
|
65547
|
+
access: "create"
|
|
65548
|
+
},
|
|
64211
65549
|
"lockControl.getStatus": {
|
|
64212
65550
|
capName: "lock-control",
|
|
64213
65551
|
capScope: "device",
|
|
@@ -66860,6 +68198,30 @@ Object.freeze({
|
|
|
66860
68198
|
addonId: null,
|
|
66861
68199
|
access: "create"
|
|
66862
68200
|
},
|
|
68201
|
+
"recordEntries.deleteEntry": {
|
|
68202
|
+
capName: "record-entries",
|
|
68203
|
+
capScope: "system",
|
|
68204
|
+
addonId: null,
|
|
68205
|
+
access: "delete"
|
|
68206
|
+
},
|
|
68207
|
+
"recordEntries.listEntries": {
|
|
68208
|
+
capName: "record-entries",
|
|
68209
|
+
capScope: "system",
|
|
68210
|
+
addonId: null,
|
|
68211
|
+
access: "view"
|
|
68212
|
+
},
|
|
68213
|
+
"recordEntries.listEntryKinds": {
|
|
68214
|
+
capName: "record-entries",
|
|
68215
|
+
capScope: "system",
|
|
68216
|
+
addonId: null,
|
|
68217
|
+
access: "view"
|
|
68218
|
+
},
|
|
68219
|
+
"recordEntries.putEntry": {
|
|
68220
|
+
capName: "record-entries",
|
|
68221
|
+
capScope: "system",
|
|
68222
|
+
addonId: null,
|
|
68223
|
+
access: "create"
|
|
68224
|
+
},
|
|
66863
68225
|
"recording.getAvailability": {
|
|
66864
68226
|
capName: "recording",
|
|
66865
68227
|
capScope: "device",
|
|
@@ -67160,6 +68522,102 @@ Object.freeze({
|
|
|
67160
68522
|
addonId: null,
|
|
67161
68523
|
access: "view"
|
|
67162
68524
|
},
|
|
68525
|
+
"records.aggregate": {
|
|
68526
|
+
capName: "records",
|
|
68527
|
+
capScope: "system",
|
|
68528
|
+
addonId: null,
|
|
68529
|
+
access: "view"
|
|
68530
|
+
},
|
|
68531
|
+
"records.allocateId": {
|
|
68532
|
+
capName: "records",
|
|
68533
|
+
capScope: "system",
|
|
68534
|
+
addonId: null,
|
|
68535
|
+
access: "create"
|
|
68536
|
+
},
|
|
68537
|
+
"records.count": {
|
|
68538
|
+
capName: "records",
|
|
68539
|
+
capScope: "system",
|
|
68540
|
+
addonId: null,
|
|
68541
|
+
access: "view"
|
|
68542
|
+
},
|
|
68543
|
+
"records.declareKinds": {
|
|
68544
|
+
capName: "records",
|
|
68545
|
+
capScope: "system",
|
|
68546
|
+
addonId: null,
|
|
68547
|
+
access: "create"
|
|
68548
|
+
},
|
|
68549
|
+
"records.delete": {
|
|
68550
|
+
capName: "records",
|
|
68551
|
+
capScope: "system",
|
|
68552
|
+
addonId: null,
|
|
68553
|
+
access: "delete"
|
|
68554
|
+
},
|
|
68555
|
+
"records.deleteDevice": {
|
|
68556
|
+
capName: "records",
|
|
68557
|
+
capScope: "system",
|
|
68558
|
+
addonId: null,
|
|
68559
|
+
access: "delete"
|
|
68560
|
+
},
|
|
68561
|
+
"records.deleteMany": {
|
|
68562
|
+
capName: "records",
|
|
68563
|
+
capScope: "system",
|
|
68564
|
+
addonId: null,
|
|
68565
|
+
access: "delete"
|
|
68566
|
+
},
|
|
68567
|
+
"records.deleteWhere": {
|
|
68568
|
+
capName: "records",
|
|
68569
|
+
capScope: "system",
|
|
68570
|
+
addonId: null,
|
|
68571
|
+
access: "delete"
|
|
68572
|
+
},
|
|
68573
|
+
"records.get": {
|
|
68574
|
+
capName: "records",
|
|
68575
|
+
capScope: "system",
|
|
68576
|
+
addonId: null,
|
|
68577
|
+
access: "view"
|
|
68578
|
+
},
|
|
68579
|
+
"records.getMany": {
|
|
68580
|
+
capName: "records",
|
|
68581
|
+
capScope: "system",
|
|
68582
|
+
addonId: null,
|
|
68583
|
+
access: "view"
|
|
68584
|
+
},
|
|
68585
|
+
"records.histogram": {
|
|
68586
|
+
capName: "records",
|
|
68587
|
+
capScope: "system",
|
|
68588
|
+
addonId: null,
|
|
68589
|
+
access: "view"
|
|
68590
|
+
},
|
|
68591
|
+
"records.patch": {
|
|
68592
|
+
capName: "records",
|
|
68593
|
+
capScope: "system",
|
|
68594
|
+
addonId: null,
|
|
68595
|
+
access: "create"
|
|
68596
|
+
},
|
|
68597
|
+
"records.put": {
|
|
68598
|
+
capName: "records",
|
|
68599
|
+
capScope: "system",
|
|
68600
|
+
addonId: null,
|
|
68601
|
+
access: "create"
|
|
68602
|
+
},
|
|
68603
|
+
"records.putMany": {
|
|
68604
|
+
capName: "records",
|
|
68605
|
+
capScope: "system",
|
|
68606
|
+
addonId: null,
|
|
68607
|
+
access: "create"
|
|
68608
|
+
},
|
|
68609
|
+
"records.query": {
|
|
68610
|
+
capName: "records",
|
|
68611
|
+
capScope: "system",
|
|
68612
|
+
addonId: null,
|
|
68613
|
+
access: "view"
|
|
68614
|
+
},
|
|
68615
|
+
"records.secretRefs": {
|
|
68616
|
+
capName: "records",
|
|
68617
|
+
capScope: "system",
|
|
68618
|
+
addonId: null,
|
|
68619
|
+
access: "view"
|
|
68620
|
+
},
|
|
67163
68621
|
"sceneMonitor.captureReference": {
|
|
67164
68622
|
capName: "scene-monitor",
|
|
67165
68623
|
capScope: "device",
|
|
@@ -67592,6 +69050,48 @@ Object.freeze({
|
|
|
67592
69050
|
addonId: null,
|
|
67593
69051
|
access: "create"
|
|
67594
69052
|
},
|
|
69053
|
+
"storageAdmin.adoptRecords": {
|
|
69054
|
+
capName: "storage-admin",
|
|
69055
|
+
capScope: "system",
|
|
69056
|
+
addonId: null,
|
|
69057
|
+
access: "create"
|
|
69058
|
+
},
|
|
69059
|
+
"storageAdmin.dropCollection": {
|
|
69060
|
+
capName: "storage-admin",
|
|
69061
|
+
capScope: "system",
|
|
69062
|
+
addonId: null,
|
|
69063
|
+
access: "delete"
|
|
69064
|
+
},
|
|
69065
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
69066
|
+
capName: "storage-admin",
|
|
69067
|
+
capScope: "system",
|
|
69068
|
+
addonId: null,
|
|
69069
|
+
access: "view"
|
|
69070
|
+
},
|
|
69071
|
+
"storageAdmin.listKinds": {
|
|
69072
|
+
capName: "storage-admin",
|
|
69073
|
+
capScope: "system",
|
|
69074
|
+
addonId: null,
|
|
69075
|
+
access: "view"
|
|
69076
|
+
},
|
|
69077
|
+
"storageAdmin.listTables": {
|
|
69078
|
+
capName: "storage-admin",
|
|
69079
|
+
capScope: "system",
|
|
69080
|
+
addonId: null,
|
|
69081
|
+
access: "view"
|
|
69082
|
+
},
|
|
69083
|
+
"storageAdmin.readLegacyCollection": {
|
|
69084
|
+
capName: "storage-admin",
|
|
69085
|
+
capScope: "system",
|
|
69086
|
+
addonId: null,
|
|
69087
|
+
access: "view"
|
|
69088
|
+
},
|
|
69089
|
+
"storageAdmin.readRecords": {
|
|
69090
|
+
capName: "storage-admin",
|
|
69091
|
+
capScope: "system",
|
|
69092
|
+
addonId: null,
|
|
69093
|
+
access: "view"
|
|
69094
|
+
},
|
|
67595
69095
|
"storageEvictable.evict": {
|
|
67596
69096
|
capName: "storage-evictable",
|
|
67597
69097
|
capScope: "system",
|
|
@@ -68504,6 +70004,12 @@ Object.freeze({
|
|
|
68504
70004
|
addonId: null,
|
|
68505
70005
|
access: "view"
|
|
68506
70006
|
},
|
|
70007
|
+
"userManagement.migrateRawSecrets": {
|
|
70008
|
+
capName: "user-management",
|
|
70009
|
+
capScope: "system",
|
|
70010
|
+
addonId: null,
|
|
70011
|
+
access: "create"
|
|
70012
|
+
},
|
|
68507
70013
|
"userManagement.oauthExchangeCode": {
|
|
68508
70014
|
capName: "user-management",
|
|
68509
70015
|
capScope: "system",
|
|
@@ -69003,7 +70509,7 @@ Object.freeze({
|
|
|
69003
70509
|
access: "create"
|
|
69004
70510
|
}
|
|
69005
70511
|
});
|
|
69006
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
|
|
70512
|
+
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
|
|
69007
70513
|
DeviceFeature.BatteryOperated;
|
|
69008
70514
|
Object.freeze({
|
|
69009
70515
|
"accessories.getStatus": [{
|
|
@@ -69827,6 +71333,71 @@ Object.freeze({
|
|
|
69827
71333
|
form: "single",
|
|
69828
71334
|
optional: false
|
|
69829
71335
|
}],
|
|
71336
|
+
"dishwasher.getStatus": [{
|
|
71337
|
+
name: "deviceId",
|
|
71338
|
+
form: "single",
|
|
71339
|
+
optional: false
|
|
71340
|
+
}],
|
|
71341
|
+
"dishwasher.pause": [{
|
|
71342
|
+
name: "deviceId",
|
|
71343
|
+
form: "single",
|
|
71344
|
+
optional: false
|
|
71345
|
+
}],
|
|
71346
|
+
"dishwasher.setChildLock": [{
|
|
71347
|
+
name: "deviceId",
|
|
71348
|
+
form: "single",
|
|
71349
|
+
optional: false
|
|
71350
|
+
}],
|
|
71351
|
+
"dishwasher.setExtraDry": [{
|
|
71352
|
+
name: "deviceId",
|
|
71353
|
+
form: "single",
|
|
71354
|
+
optional: false
|
|
71355
|
+
}],
|
|
71356
|
+
"dishwasher.setHalfLoad": [{
|
|
71357
|
+
name: "deviceId",
|
|
71358
|
+
form: "single",
|
|
71359
|
+
optional: false
|
|
71360
|
+
}],
|
|
71361
|
+
"dishwasher.setHygienePlus": [{
|
|
71362
|
+
name: "deviceId",
|
|
71363
|
+
form: "single",
|
|
71364
|
+
optional: false
|
|
71365
|
+
}],
|
|
71366
|
+
"dishwasher.setIntensiveZone": [{
|
|
71367
|
+
name: "deviceId",
|
|
71368
|
+
form: "single",
|
|
71369
|
+
optional: false
|
|
71370
|
+
}],
|
|
71371
|
+
"dishwasher.setOption": [{
|
|
71372
|
+
name: "deviceId",
|
|
71373
|
+
form: "single",
|
|
71374
|
+
optional: false
|
|
71375
|
+
}],
|
|
71376
|
+
"dishwasher.setPower": [{
|
|
71377
|
+
name: "deviceId",
|
|
71378
|
+
form: "single",
|
|
71379
|
+
optional: false
|
|
71380
|
+
}],
|
|
71381
|
+
"dishwasher.setProgram": [{
|
|
71382
|
+
name: "deviceId",
|
|
71383
|
+
form: "single",
|
|
71384
|
+
optional: false
|
|
71385
|
+
}],
|
|
71386
|
+
"dishwasher.setVarioSpeedPlus": [{
|
|
71387
|
+
name: "deviceId",
|
|
71388
|
+
form: "single",
|
|
71389
|
+
optional: false
|
|
71390
|
+
}],
|
|
71391
|
+
"dishwasher.start": [{
|
|
71392
|
+
name: "deviceId",
|
|
71393
|
+
form: "single",
|
|
71394
|
+
optional: false
|
|
71395
|
+
}],
|
|
71396
|
+
"dishwasher.stop": [{
|
|
71397
|
+
name: "deviceId",
|
|
71398
|
+
form: "single",
|
|
71399
|
+
optional: false
|
|
71400
|
+
}],
|
|
69830
71401
|
"doorbell.getStatus": [{
|
|
69831
71402
|
name: "deviceId",
|
|
69832
71403
|
form: "single",
|
|
@@ -69896,6 +71467,11 @@ Object.freeze({
|
|
|
69896
71467
|
form: "single",
|
|
69897
71468
|
optional: false
|
|
69898
71469
|
}],
|
|
71470
|
+
"heatingValve.getStatus": [{
|
|
71471
|
+
name: "deviceId",
|
|
71472
|
+
form: "single",
|
|
71473
|
+
optional: false
|
|
71474
|
+
}],
|
|
69899
71475
|
"humidifier.getStatus": [{
|
|
69900
71476
|
name: "deviceId",
|
|
69901
71477
|
form: "single",
|
|
@@ -71180,6 +72756,37 @@ Object.freeze({
|
|
|
71180
72756
|
form: "single",
|
|
71181
72757
|
optional: false
|
|
71182
72758
|
}],
|
|
72759
|
+
"records.count": [{
|
|
72760
|
+
name: "deviceId",
|
|
72761
|
+
form: "single",
|
|
72762
|
+
optional: true
|
|
72763
|
+
}],
|
|
72764
|
+
"records.deleteDevice": [{
|
|
72765
|
+
name: "deviceId",
|
|
72766
|
+
form: "single",
|
|
72767
|
+
optional: false
|
|
72768
|
+
}],
|
|
72769
|
+
"records.deleteWhere": [{
|
|
72770
|
+
name: "deviceId",
|
|
72771
|
+
form: "single",
|
|
72772
|
+
optional: true
|
|
72773
|
+
}],
|
|
72774
|
+
"records.histogram": [{
|
|
72775
|
+
name: "deviceId",
|
|
72776
|
+
form: "single",
|
|
72777
|
+
optional: true
|
|
72778
|
+
}],
|
|
72779
|
+
"records.putMany": [{
|
|
72780
|
+
name: "records",
|
|
72781
|
+
form: "object-array",
|
|
72782
|
+
optional: false,
|
|
72783
|
+
itemField: "deviceId"
|
|
72784
|
+
}],
|
|
72785
|
+
"records.query": [{
|
|
72786
|
+
name: "deviceId",
|
|
72787
|
+
form: "single",
|
|
72788
|
+
optional: true
|
|
72789
|
+
}],
|
|
71183
72790
|
"sceneMonitor.captureReference": [{
|
|
71184
72791
|
name: "deviceId",
|
|
71185
72792
|
form: "single",
|
|
@@ -71296,6 +72903,17 @@ Object.freeze({
|
|
|
71296
72903
|
form: "single",
|
|
71297
72904
|
optional: false
|
|
71298
72905
|
}],
|
|
72906
|
+
"storageAdmin.adoptRecords": [{
|
|
72907
|
+
name: "records",
|
|
72908
|
+
form: "object-array",
|
|
72909
|
+
optional: false,
|
|
72910
|
+
itemField: "deviceId"
|
|
72911
|
+
}],
|
|
72912
|
+
"storageAdmin.readRecords": [{
|
|
72913
|
+
name: "deviceId",
|
|
72914
|
+
form: "single",
|
|
72915
|
+
optional: true
|
|
72916
|
+
}],
|
|
71299
72917
|
"streamBroker.acquireEgressTranscode": [{
|
|
71300
72918
|
name: "deviceId",
|
|
71301
72919
|
form: "single",
|
|
@@ -104879,6 +106497,205 @@ function retiredCiphertextPaths(config) {
|
|
|
104879
106497
|
return out;
|
|
104880
106498
|
}
|
|
104881
106499
|
//#endregion
|
|
106500
|
+
//#region src/mqtt-external-broker-entry.ts
|
|
106501
|
+
var mqttOnboardDescriptorSchema = object({
|
|
106502
|
+
port: number().int().min(1).max(65535),
|
|
106503
|
+
allowAnonymous: boolean()
|
|
106504
|
+
});
|
|
106505
|
+
var MqttExternalBrokerEntrySchema = object({
|
|
106506
|
+
id: string().min(1),
|
|
106507
|
+
name: string().min(1),
|
|
106508
|
+
url: string().min(1),
|
|
106509
|
+
username: string().optional(),
|
|
106510
|
+
password: string().optional().meta({ secret: true }),
|
|
106511
|
+
clientIdPrefix: string().optional(),
|
|
106512
|
+
onboard: mqttOnboardDescriptorSchema.optional()
|
|
106513
|
+
});
|
|
106514
|
+
var mqttBrokersEntryKind = defineEntryKind("brokers", {
|
|
106515
|
+
title: "MQTT external brokers",
|
|
106516
|
+
schema: entryBody({
|
|
106517
|
+
url: string().min(1),
|
|
106518
|
+
username: string().optional(),
|
|
106519
|
+
password: string().optional().meta({ secret: true }),
|
|
106520
|
+
clientIdPrefix: string().optional(),
|
|
106521
|
+
onboard: mqttOnboardDescriptorSchema.optional()
|
|
106522
|
+
}),
|
|
106523
|
+
writeTrigger: "an operator adds or removes an external MQTT broker entry",
|
|
106524
|
+
adoptsFrom: settingsBrokersAdoptsFrom("mqtt-broker")
|
|
106525
|
+
});
|
|
106526
|
+
//#endregion
|
|
106527
|
+
//#region src/mqtt-entry-record-kinds.ts
|
|
106528
|
+
var aclAccessSchema = _enum([
|
|
106529
|
+
"sub",
|
|
106530
|
+
"pub",
|
|
106531
|
+
"both"
|
|
106532
|
+
]);
|
|
106533
|
+
var MqttClientBodySchema = entryBody({ passwordHash: string() });
|
|
106534
|
+
var mqttClientEntryKind = defineEntryKind("mqtt-client", {
|
|
106535
|
+
title: "MQTT embedded clients",
|
|
106536
|
+
schema: MqttClientBodySchema,
|
|
106537
|
+
writeTrigger: "an operator adds or removes an embedded MQTT client credential",
|
|
106538
|
+
adoptsFrom: settingsArrayAdoptsFrom("mqtt-broker", "embeddedClients")
|
|
106539
|
+
});
|
|
106540
|
+
var MqttAclBodySchema = entryBody({
|
|
106541
|
+
username: string().min(1),
|
|
106542
|
+
topicPattern: string().min(1),
|
|
106543
|
+
access: aclAccessSchema
|
|
106544
|
+
});
|
|
106545
|
+
var mqttAclEntryKind = defineEntryKind("mqtt-acl-rule", {
|
|
106546
|
+
title: "MQTT ACL rules",
|
|
106547
|
+
schema: MqttAclBodySchema,
|
|
106548
|
+
writeTrigger: "an operator edits embedded broker ACL rules",
|
|
106549
|
+
adoptsFrom: settingsArrayAdoptsFrom("mqtt-broker", "embeddedAcl")
|
|
106550
|
+
});
|
|
106551
|
+
//#endregion
|
|
106552
|
+
//#region src/mqtt-broker-store.ts
|
|
106553
|
+
function rowToEntry(id, data) {
|
|
106554
|
+
const parsed = MqttExternalBrokerEntrySchema.safeParse({
|
|
106555
|
+
id,
|
|
106556
|
+
name: data.name,
|
|
106557
|
+
url: data.url,
|
|
106558
|
+
username: data.username,
|
|
106559
|
+
password: data.password,
|
|
106560
|
+
clientIdPrefix: data.clientIdPrefix,
|
|
106561
|
+
onboard: data.onboard
|
|
106562
|
+
});
|
|
106563
|
+
return parsed.success ? parsed.data : null;
|
|
106564
|
+
}
|
|
106565
|
+
var MqttBrokerStore = class MqttBrokerStore {
|
|
106566
|
+
kind;
|
|
106567
|
+
constructor(kind) {
|
|
106568
|
+
this.kind = kind;
|
|
106569
|
+
}
|
|
106570
|
+
static of(records) {
|
|
106571
|
+
return new MqttBrokerStore(records.kind(mqttBrokersEntryKind));
|
|
106572
|
+
}
|
|
106573
|
+
async listResolved() {
|
|
106574
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106575
|
+
const out = [];
|
|
106576
|
+
for (const record of page.records) {
|
|
106577
|
+
let data = record.data;
|
|
106578
|
+
try {
|
|
106579
|
+
const resolved = await this.kind.getResolved(record.id);
|
|
106580
|
+
if (resolved !== null) data = resolved.data;
|
|
106581
|
+
} catch (err) {
|
|
106582
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
106583
|
+
}
|
|
106584
|
+
const entry = rowToEntry(record.id, data);
|
|
106585
|
+
if (entry !== null) out.push(entry);
|
|
106586
|
+
}
|
|
106587
|
+
return out;
|
|
106588
|
+
}
|
|
106589
|
+
async replaceAll(entries) {
|
|
106590
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106591
|
+
const nextIds = new Set(entries.map((e) => e.id));
|
|
106592
|
+
for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
|
|
106593
|
+
for (const entry of entries) {
|
|
106594
|
+
const { id, name, url, username, password, clientIdPrefix, onboard } = entry;
|
|
106595
|
+
const body = {
|
|
106596
|
+
name,
|
|
106597
|
+
url,
|
|
106598
|
+
...username === void 0 ? {} : { username },
|
|
106599
|
+
...password === void 0 ? {} : { password },
|
|
106600
|
+
...clientIdPrefix === void 0 ? {} : { clientIdPrefix },
|
|
106601
|
+
...onboard === void 0 ? {} : { onboard }
|
|
106602
|
+
};
|
|
106603
|
+
const parsed = mqttBrokersEntryKind.schema.safeParse(body);
|
|
106604
|
+
if (!parsed.success) throw new Error(`invalid MQTT broker '${id}': ${parsed.error.message}`);
|
|
106605
|
+
await this.kind.put({
|
|
106606
|
+
id,
|
|
106607
|
+
data: parsed.data
|
|
106608
|
+
});
|
|
106609
|
+
}
|
|
106610
|
+
}
|
|
106611
|
+
};
|
|
106612
|
+
//#endregion
|
|
106613
|
+
//#region src/mqtt-entry-store.ts
|
|
106614
|
+
function mqttAclRecordId(rule) {
|
|
106615
|
+
return `${rule.username}\u0000${rule.topicPattern}`;
|
|
106616
|
+
}
|
|
106617
|
+
var MqttClientStore = class MqttClientStore {
|
|
106618
|
+
kind;
|
|
106619
|
+
constructor(kind) {
|
|
106620
|
+
this.kind = kind;
|
|
106621
|
+
}
|
|
106622
|
+
static of(records) {
|
|
106623
|
+
return new MqttClientStore(records.kind(mqttClientEntryKind));
|
|
106624
|
+
}
|
|
106625
|
+
async listResolved() {
|
|
106626
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106627
|
+
const out = [];
|
|
106628
|
+
for (const record of page.records) {
|
|
106629
|
+
const parsed = MqttClientBodySchema.safeParse(record.data);
|
|
106630
|
+
if (!parsed.success) continue;
|
|
106631
|
+
out.push({
|
|
106632
|
+
username: record.id,
|
|
106633
|
+
passwordHash: parsed.data.passwordHash
|
|
106634
|
+
});
|
|
106635
|
+
}
|
|
106636
|
+
return out;
|
|
106637
|
+
}
|
|
106638
|
+
async replaceAll(entries) {
|
|
106639
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106640
|
+
const nextIds = new Set(entries.map((e) => e.username));
|
|
106641
|
+
for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
|
|
106642
|
+
for (const entry of entries) {
|
|
106643
|
+
const body = {
|
|
106644
|
+
name: entry.username,
|
|
106645
|
+
passwordHash: entry.passwordHash
|
|
106646
|
+
};
|
|
106647
|
+
const parsed = mqttClientEntryKind.schema.safeParse(body);
|
|
106648
|
+
if (!parsed.success) throw new Error(`invalid MQTT client '${entry.username}': ${parsed.error.message}`);
|
|
106649
|
+
await this.kind.put({
|
|
106650
|
+
id: entry.username,
|
|
106651
|
+
data: parsed.data
|
|
106652
|
+
});
|
|
106653
|
+
}
|
|
106654
|
+
}
|
|
106655
|
+
};
|
|
106656
|
+
var MqttAclStore = class MqttAclStore {
|
|
106657
|
+
kind;
|
|
106658
|
+
constructor(kind) {
|
|
106659
|
+
this.kind = kind;
|
|
106660
|
+
}
|
|
106661
|
+
static of(records) {
|
|
106662
|
+
return new MqttAclStore(records.kind(mqttAclEntryKind));
|
|
106663
|
+
}
|
|
106664
|
+
async listResolved() {
|
|
106665
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106666
|
+
const out = [];
|
|
106667
|
+
for (const record of page.records) {
|
|
106668
|
+
const parsed = MqttAclBodySchema.safeParse(record.data);
|
|
106669
|
+
if (!parsed.success) continue;
|
|
106670
|
+
out.push({
|
|
106671
|
+
username: parsed.data.username,
|
|
106672
|
+
topicPattern: parsed.data.topicPattern,
|
|
106673
|
+
access: parsed.data.access
|
|
106674
|
+
});
|
|
106675
|
+
}
|
|
106676
|
+
return out;
|
|
106677
|
+
}
|
|
106678
|
+
async replaceAll(entries) {
|
|
106679
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
106680
|
+
const nextIds = new Set(entries.map((e) => mqttAclRecordId(e)));
|
|
106681
|
+
for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
|
|
106682
|
+
for (const entry of entries) {
|
|
106683
|
+
const body = {
|
|
106684
|
+
name: `${entry.username} · ${entry.topicPattern}`,
|
|
106685
|
+
username: entry.username,
|
|
106686
|
+
topicPattern: entry.topicPattern,
|
|
106687
|
+
access: entry.access
|
|
106688
|
+
};
|
|
106689
|
+
const parsed = mqttAclEntryKind.schema.safeParse(body);
|
|
106690
|
+
if (!parsed.success) throw new Error(`invalid MQTT ACL '${entry.username}/${entry.topicPattern}': ${parsed.error.message}`);
|
|
106691
|
+
await this.kind.put({
|
|
106692
|
+
id: mqttAclRecordId(entry),
|
|
106693
|
+
data: parsed.data
|
|
106694
|
+
});
|
|
106695
|
+
}
|
|
106696
|
+
}
|
|
106697
|
+
};
|
|
106698
|
+
//#endregion
|
|
104882
106699
|
//#region src/mqtt-broker.addon.ts
|
|
104883
106700
|
/**
|
|
104884
106701
|
* MQTT Broker addon — broker REGISTRY (not a pub/sub proxy).
|
|
@@ -104912,7 +106729,7 @@ function retiredCiphertextPaths(config) {
|
|
|
104912
106729
|
* integration-type addon.
|
|
104913
106730
|
*
|
|
104914
106731
|
* Lifecycle:
|
|
104915
|
-
* - External broker entries are persisted in `this.
|
|
106732
|
+
* - External broker entries are persisted in `this.activeExternalBrokers`.
|
|
104916
106733
|
* - The embedded broker is persisted as flat `embedded*` config keys
|
|
104917
106734
|
* (`embeddedEnabled`, `embeddedPort`, …) so the standard settings
|
|
104918
106735
|
* form can drive it; {@link MqttBrokerAddon.deriveEmbeddedEntry}
|
|
@@ -105031,11 +106848,86 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105031
106848
|
/** Per-entry onboard `aedes` runtimes, keyed by `ExternalBrokerEntry.id`. */
|
|
105032
106849
|
onboardRuntimes = /* @__PURE__ */ new Map();
|
|
105033
106850
|
probeCache = null;
|
|
106851
|
+
brokerStore = null;
|
|
106852
|
+
clientStore = null;
|
|
106853
|
+
aclStore = null;
|
|
106854
|
+
/** External broker rows (records when B2 is live, else settings mirror). */
|
|
106855
|
+
activeExternalBrokers = [];
|
|
106856
|
+
activeEmbeddedClients = [];
|
|
106857
|
+
activeEmbeddedAcl = [];
|
|
105034
106858
|
constructor() {
|
|
105035
106859
|
super({ ...DEFAULT_CONFIG });
|
|
105036
106860
|
}
|
|
106861
|
+
async loadPersistedExternalBrokers() {
|
|
106862
|
+
const store = this.brokerStore;
|
|
106863
|
+
if (store !== null) {
|
|
106864
|
+
const fromRecords = await store.listResolved();
|
|
106865
|
+
if (fromRecords.length > 0) return fromRecords;
|
|
106866
|
+
}
|
|
106867
|
+
return this.config.brokers;
|
|
106868
|
+
}
|
|
106869
|
+
async persistExternalBrokers(entries) {
|
|
106870
|
+
this.activeExternalBrokers = [...entries];
|
|
106871
|
+
const store = this.brokerStore;
|
|
106872
|
+
if (store !== null) {
|
|
106873
|
+
await store.replaceAll(entries);
|
|
106874
|
+
return;
|
|
106875
|
+
}
|
|
106876
|
+
await this.updateGlobalSettings({ brokers: entries });
|
|
106877
|
+
}
|
|
106878
|
+
async loadEmbeddedClients() {
|
|
106879
|
+
const store = this.clientStore;
|
|
106880
|
+
if (store !== null) {
|
|
106881
|
+
const fromRecords = await store.listResolved();
|
|
106882
|
+
if (fromRecords.length > 0) return fromRecords;
|
|
106883
|
+
}
|
|
106884
|
+
return this.config.embeddedClients;
|
|
106885
|
+
}
|
|
106886
|
+
async loadEmbeddedAcl() {
|
|
106887
|
+
const store = this.aclStore;
|
|
106888
|
+
if (store !== null) {
|
|
106889
|
+
const fromRecords = await store.listResolved();
|
|
106890
|
+
if (fromRecords.length > 0) return fromRecords;
|
|
106891
|
+
}
|
|
106892
|
+
return this.config.embeddedAcl;
|
|
106893
|
+
}
|
|
106894
|
+
async syncEmbeddedEntriesFromConfig() {
|
|
106895
|
+
const clients = [...this.config.embeddedClients];
|
|
106896
|
+
const acl = [...this.config.embeddedAcl];
|
|
106897
|
+
this.activeEmbeddedClients = clients;
|
|
106898
|
+
this.activeEmbeddedAcl = acl;
|
|
106899
|
+
const clientStore = this.clientStore;
|
|
106900
|
+
const aclStore = this.aclStore;
|
|
106901
|
+
if (clientStore !== null) await clientStore.replaceAll(clients);
|
|
106902
|
+
if (aclStore !== null) await aclStore.replaceAll(acl);
|
|
106903
|
+
}
|
|
105037
106904
|
async onInitialize() {
|
|
105038
106905
|
this.reportRetiredCiphertext();
|
|
106906
|
+
const records = this.ctx.records;
|
|
106907
|
+
if (records === void 0) throw new Error("mqtt-broker: ctx.records is required (hub-only addon)");
|
|
106908
|
+
await records.declare({
|
|
106909
|
+
brokers: mqttBrokersEntryKind,
|
|
106910
|
+
"mqtt-client": mqttClientEntryKind,
|
|
106911
|
+
"mqtt-acl-rule": mqttAclEntryKind
|
|
106912
|
+
});
|
|
106913
|
+
this.brokerStore = MqttBrokerStore.of(records);
|
|
106914
|
+
this.clientStore = MqttClientStore.of(records);
|
|
106915
|
+
this.aclStore = MqttAclStore.of(records);
|
|
106916
|
+
this.activeExternalBrokers = await this.loadPersistedExternalBrokers();
|
|
106917
|
+
if ((await this.brokerStore.listResolved()).length === 0 && this.config.brokers.length > 0) {
|
|
106918
|
+
await this.brokerStore.replaceAll(this.config.brokers);
|
|
106919
|
+
this.activeExternalBrokers = await this.loadPersistedExternalBrokers();
|
|
106920
|
+
}
|
|
106921
|
+
this.activeEmbeddedClients = await this.loadEmbeddedClients();
|
|
106922
|
+
this.activeEmbeddedAcl = await this.loadEmbeddedAcl();
|
|
106923
|
+
if ((await this.clientStore.listResolved()).length === 0 && this.config.embeddedClients.length > 0) {
|
|
106924
|
+
await this.clientStore.replaceAll(this.config.embeddedClients);
|
|
106925
|
+
this.activeEmbeddedClients = await this.loadEmbeddedClients();
|
|
106926
|
+
}
|
|
106927
|
+
if ((await this.aclStore.listResolved()).length === 0 && this.config.embeddedAcl.length > 0) {
|
|
106928
|
+
await this.aclStore.replaceAll(this.config.embeddedAcl);
|
|
106929
|
+
this.activeEmbeddedAcl = await this.loadEmbeddedAcl();
|
|
106930
|
+
}
|
|
105039
106931
|
this.probeCache = new BrokerProbeCache({
|
|
105040
106932
|
intervalMs: PROBE_INTERVAL_MS,
|
|
105041
106933
|
onError: (id, err) => {
|
|
@@ -105081,7 +106973,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105081
106973
|
startEmbeddedBroker: async (input) => this.startEmbeddedBroker(input),
|
|
105082
106974
|
stopEmbeddedBroker: async ({ id }) => this.stopEmbeddedBroker(id),
|
|
105083
106975
|
getStatus: async () => ({
|
|
105084
|
-
brokerCount: this.
|
|
106976
|
+
brokerCount: this.activeExternalBrokers.length + (this.config.embeddedEnabled ? 1 : 0),
|
|
105085
106977
|
embeddedRunning: this.embeddedRuntime !== null
|
|
105086
106978
|
})
|
|
105087
106979
|
};
|
|
@@ -105114,7 +107006,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105114
107006
|
error: info.error ?? null
|
|
105115
107007
|
});
|
|
105116
107008
|
const owns = (id) => {
|
|
105117
|
-
if (this.
|
|
107009
|
+
if (this.activeExternalBrokers.some((b) => b.id === id)) return true;
|
|
105118
107010
|
const embedded = this.deriveEmbeddedEntry();
|
|
105119
107011
|
return embedded !== null && embedded.id === id;
|
|
105120
107012
|
};
|
|
@@ -105208,7 +107100,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105208
107100
|
getStatus: async () => {
|
|
105209
107101
|
const all = await this.listBrokers();
|
|
105210
107102
|
return {
|
|
105211
|
-
brokerCount: this.
|
|
107103
|
+
brokerCount: this.activeExternalBrokers.length + (this.config.embeddedEnabled ? 1 : 0),
|
|
105212
107104
|
connectedCount: all.filter((b) => b.status === "connected").length
|
|
105213
107105
|
};
|
|
105214
107106
|
}
|
|
@@ -105220,6 +107112,8 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105220
107112
|
await this.shutdownAllOnboard();
|
|
105221
107113
|
}
|
|
105222
107114
|
async onConfigChanged() {
|
|
107115
|
+
this.activeExternalBrokers = await this.loadPersistedExternalBrokers();
|
|
107116
|
+
await this.syncEmbeddedEntriesFromConfig();
|
|
105223
107117
|
await this.reconcileOnboardRuntimes();
|
|
105224
107118
|
const desired = this.deriveEmbeddedEntry();
|
|
105225
107119
|
const running = this.embeddedRuntime?.entry ?? null;
|
|
@@ -105246,7 +107140,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105246
107140
|
}
|
|
105247
107141
|
async listBrokers() {
|
|
105248
107142
|
const out = [];
|
|
105249
|
-
for (const entry of this.
|
|
107143
|
+
for (const entry of this.activeExternalBrokers) {
|
|
105250
107144
|
if (entry.onboard) {
|
|
105251
107145
|
const running = this.onboardRuntimes.get(entry.id) ?? null;
|
|
105252
107146
|
const status = running !== null ? "connected" : "disconnected";
|
|
@@ -105295,7 +107189,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105295
107189
|
return out;
|
|
105296
107190
|
}
|
|
105297
107191
|
getBrokerConfig(id) {
|
|
105298
|
-
const external = this.
|
|
107192
|
+
const external = this.activeExternalBrokers.find((b) => b.id === id);
|
|
105299
107193
|
if (external) {
|
|
105300
107194
|
const password = this.storedPassword(external.password);
|
|
105301
107195
|
return {
|
|
@@ -105326,8 +107220,8 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105326
107220
|
...input.password !== void 0 ? { password: input.password } : {},
|
|
105327
107221
|
...input.clientIdPrefix !== void 0 ? { clientIdPrefix: input.clientIdPrefix } : {}
|
|
105328
107222
|
};
|
|
105329
|
-
const next = [...this.
|
|
105330
|
-
await this.
|
|
107223
|
+
const next = [...this.activeExternalBrokers, entry];
|
|
107224
|
+
await this.persistExternalBrokers(next);
|
|
105331
107225
|
this.ctx.logger.info("mqtt broker added", { meta: {
|
|
105332
107226
|
id,
|
|
105333
107227
|
url: entry.url
|
|
@@ -105356,8 +107250,8 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105356
107250
|
...built.password !== void 0 ? { password: built.password } : {},
|
|
105357
107251
|
onboard: built.onboard
|
|
105358
107252
|
};
|
|
105359
|
-
const next = [...this.
|
|
105360
|
-
await this.
|
|
107253
|
+
const next = [...this.activeExternalBrokers, entry];
|
|
107254
|
+
await this.persistExternalBrokers(next);
|
|
105361
107255
|
const spawn = this.onboardSpawnEntry(entry);
|
|
105362
107256
|
if (spawn) await this.spawnOnboard(spawn);
|
|
105363
107257
|
this.ctx.logger.info("onboard mqtt broker added", {
|
|
@@ -105373,10 +107267,10 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105373
107267
|
return { id };
|
|
105374
107268
|
}
|
|
105375
107269
|
async removeBroker(id) {
|
|
105376
|
-
const removed = this.
|
|
107270
|
+
const removed = this.activeExternalBrokers.find((b) => b.id === id);
|
|
105377
107271
|
if (removed) {
|
|
105378
|
-
const next = this.
|
|
105379
|
-
await this.
|
|
107272
|
+
const next = this.activeExternalBrokers.filter((b) => b.id !== id);
|
|
107273
|
+
await this.persistExternalBrokers(next);
|
|
105380
107274
|
this.probeCache?.evict(id);
|
|
105381
107275
|
if (removed.onboard) await this.shutdownOnboard(id);
|
|
105382
107276
|
this.ctx.logger.info("mqtt broker removed", { meta: { id } });
|
|
@@ -105597,7 +107491,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105597
107491
|
* entry disappeared, and respawn runtimes whose port changed.
|
|
105598
107492
|
*/
|
|
105599
107493
|
async reconcileOnboardRuntimes() {
|
|
105600
|
-
const desiredEntries = this.
|
|
107494
|
+
const desiredEntries = this.activeExternalBrokers.filter(hasOnboard);
|
|
105601
107495
|
const desired = desiredEntries.map((b) => ({
|
|
105602
107496
|
id: b.id,
|
|
105603
107497
|
port: b.onboard.port
|
|
@@ -105638,7 +107532,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105638
107532
|
done(null, allowAnonymous);
|
|
105639
107533
|
return;
|
|
105640
107534
|
}
|
|
105641
|
-
const match = this.
|
|
107535
|
+
const match = this.activeEmbeddedClients.find((c) => c.username === username);
|
|
105642
107536
|
if (match) {
|
|
105643
107537
|
done(null, bcryptCompareSafe(passwordStr, match.passwordHash));
|
|
105644
107538
|
return;
|
|
@@ -105678,7 +107572,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105678
107572
|
* requested topic and access mode.
|
|
105679
107573
|
*/
|
|
105680
107574
|
isAclAllowed(client, topic, access) {
|
|
105681
|
-
const acl = this.
|
|
107575
|
+
const acl = this.activeEmbeddedAcl;
|
|
105682
107576
|
if (acl.length === 0) return true;
|
|
105683
107577
|
const username = readClientUsername(client);
|
|
105684
107578
|
if (!username) return true;
|
|
@@ -105705,7 +107599,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105705
107599
|
runtime.aedes.authorizeSubscribe = this.makeSubscribeAuthorizer();
|
|
105706
107600
|
runtime.credentialsSnapshot = nextSnapshot;
|
|
105707
107601
|
if (affectedUsers.length === 0) {
|
|
105708
|
-
this.ctx.logger.debug("mqtt embedded hot-reload — no password changes", { meta: { aclRules: this.
|
|
107602
|
+
this.ctx.logger.debug("mqtt embedded hot-reload — no password changes", { meta: { aclRules: this.activeEmbeddedAcl.length } });
|
|
105709
107603
|
return;
|
|
105710
107604
|
}
|
|
105711
107605
|
const clients = readClientMap(runtime.aedes);
|
|
@@ -105731,7 +107625,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105731
107625
|
}
|
|
105732
107626
|
buildCredentialsSnapshot() {
|
|
105733
107627
|
const m = /* @__PURE__ */ new Map();
|
|
105734
|
-
for (const c of this.
|
|
107628
|
+
for (const c of this.activeEmbeddedClients) m.set(c.username, c.passwordHash);
|
|
105735
107629
|
return m;
|
|
105736
107630
|
}
|
|
105737
107631
|
/**
|
|
@@ -105756,7 +107650,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105756
107650
|
}
|
|
105757
107651
|
collectExternalProbeInputs() {
|
|
105758
107652
|
const out = [];
|
|
105759
|
-
for (const b of this.
|
|
107653
|
+
for (const b of this.activeExternalBrokers) {
|
|
105760
107654
|
if (b.onboard !== void 0) continue;
|
|
105761
107655
|
let password;
|
|
105762
107656
|
try {
|
|
@@ -105793,7 +107687,7 @@ var MqttBrokerAddon = class extends BaseAddon {
|
|
|
105793
107687
|
const paths = retiredCiphertextPaths(this.config);
|
|
105794
107688
|
if (paths.length === 0) return;
|
|
105795
107689
|
const unreadable = [];
|
|
105796
|
-
const values = [...this.
|
|
107690
|
+
const values = [...this.activeExternalBrokers.map((b) => ({
|
|
105797
107691
|
id: `brokers[${b.id}].password`,
|
|
105798
107692
|
v: b.password
|
|
105799
107693
|
})), {
|