@camstack/addon-google-services 0.2.8 → 0.2.9
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/google-services.addon.js +1464 -59
- package/dist/google-services.addon.mjs +1464 -59
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
|
-
//#region ../types/dist/event-category-
|
|
6
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
7
7
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
8
8
|
EventCategory["SystemBoot"] = "system.boot";
|
|
9
9
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -67,6 +67,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
67
67
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
68
68
|
*/
|
|
69
69
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
70
|
+
/**
|
|
71
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
72
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
73
|
+
* action. One event per refusal.
|
|
74
|
+
*/
|
|
75
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
76
|
+
/**
|
|
77
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
78
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
79
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
80
|
+
*/
|
|
81
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
82
|
+
/**
|
|
83
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
84
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
85
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
86
|
+
*/
|
|
87
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
70
88
|
EventCategory["AddonError"] = "addon.error";
|
|
71
89
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
72
90
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -4109,6 +4127,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4109
4127
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4110
4128
|
json.type = "boolean";
|
|
4111
4129
|
};
|
|
4130
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4131
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4132
|
+
};
|
|
4133
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4134
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4135
|
+
};
|
|
4112
4136
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4113
4137
|
if (ctx.target === "openapi-3.0") {
|
|
4114
4138
|
json.type = "string";
|
|
@@ -4116,12 +4140,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4116
4140
|
json.enum = [null];
|
|
4117
4141
|
} else json.type = "null";
|
|
4118
4142
|
};
|
|
4143
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4144
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4145
|
+
};
|
|
4119
4146
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4120
4147
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4121
4148
|
};
|
|
4122
4149
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4123
4150
|
json.not = {};
|
|
4124
4151
|
};
|
|
4152
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4153
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4125
4154
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4126
4155
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4127
4156
|
};
|
|
@@ -4153,12 +4182,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4153
4182
|
json.enum = vals;
|
|
4154
4183
|
}
|
|
4155
4184
|
};
|
|
4185
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4186
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4187
|
+
};
|
|
4188
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4189
|
+
const _json = json;
|
|
4190
|
+
const pattern = schema._zod.pattern;
|
|
4191
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4192
|
+
_json.type = "string";
|
|
4193
|
+
_json.pattern = pattern.source;
|
|
4194
|
+
};
|
|
4195
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4196
|
+
const _json = json;
|
|
4197
|
+
const file = {
|
|
4198
|
+
type: "string",
|
|
4199
|
+
format: "binary",
|
|
4200
|
+
contentEncoding: "binary"
|
|
4201
|
+
};
|
|
4202
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4203
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4204
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4205
|
+
if (mime) if (mime.length === 1) {
|
|
4206
|
+
file.contentMediaType = mime[0];
|
|
4207
|
+
Object.assign(_json, file);
|
|
4208
|
+
} else {
|
|
4209
|
+
Object.assign(_json, file);
|
|
4210
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4211
|
+
}
|
|
4212
|
+
else Object.assign(_json, file);
|
|
4213
|
+
};
|
|
4214
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4215
|
+
json.type = "boolean";
|
|
4216
|
+
};
|
|
4156
4217
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4157
4218
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4158
4219
|
};
|
|
4220
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4221
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4222
|
+
};
|
|
4159
4223
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4160
4224
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4161
4225
|
};
|
|
4226
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4227
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4228
|
+
};
|
|
4229
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4230
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4231
|
+
};
|
|
4162
4232
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4163
4233
|
const json = _json;
|
|
4164
4234
|
const def = schema._zod.def;
|
|
@@ -4363,6 +4433,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4363
4433
|
seen.ref = def.innerType;
|
|
4364
4434
|
json.readOnly = true;
|
|
4365
4435
|
};
|
|
4436
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4437
|
+
const def = schema._zod.def;
|
|
4438
|
+
process(def.innerType, ctx, params);
|
|
4439
|
+
const seen = ctx.seen.get(schema);
|
|
4440
|
+
seen.ref = def.innerType;
|
|
4441
|
+
};
|
|
4366
4442
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4367
4443
|
const def = schema._zod.def;
|
|
4368
4444
|
process(def.innerType, ctx, params);
|
|
@@ -4375,6 +4451,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4375
4451
|
const seen = ctx.seen.get(schema);
|
|
4376
4452
|
seen.ref = innerType;
|
|
4377
4453
|
};
|
|
4454
|
+
var allProcessors = {
|
|
4455
|
+
string: stringProcessor,
|
|
4456
|
+
number: numberProcessor,
|
|
4457
|
+
boolean: booleanProcessor,
|
|
4458
|
+
bigint: bigintProcessor,
|
|
4459
|
+
symbol: symbolProcessor,
|
|
4460
|
+
null: nullProcessor,
|
|
4461
|
+
undefined: undefinedProcessor,
|
|
4462
|
+
void: voidProcessor,
|
|
4463
|
+
never: neverProcessor,
|
|
4464
|
+
any: anyProcessor,
|
|
4465
|
+
unknown: unknownProcessor,
|
|
4466
|
+
date: dateProcessor,
|
|
4467
|
+
enum: enumProcessor,
|
|
4468
|
+
literal: literalProcessor,
|
|
4469
|
+
nan: nanProcessor,
|
|
4470
|
+
template_literal: templateLiteralProcessor,
|
|
4471
|
+
file: fileProcessor,
|
|
4472
|
+
success: successProcessor,
|
|
4473
|
+
custom: customProcessor,
|
|
4474
|
+
function: functionProcessor,
|
|
4475
|
+
transform: transformProcessor,
|
|
4476
|
+
map: mapProcessor,
|
|
4477
|
+
set: setProcessor,
|
|
4478
|
+
array: arrayProcessor,
|
|
4479
|
+
object: objectProcessor,
|
|
4480
|
+
union: unionProcessor,
|
|
4481
|
+
intersection: intersectionProcessor,
|
|
4482
|
+
tuple: tupleProcessor,
|
|
4483
|
+
record: recordProcessor,
|
|
4484
|
+
nullable: nullableProcessor,
|
|
4485
|
+
nonoptional: nonoptionalProcessor,
|
|
4486
|
+
default: defaultProcessor,
|
|
4487
|
+
prefault: prefaultProcessor,
|
|
4488
|
+
catch: catchProcessor,
|
|
4489
|
+
pipe: pipeProcessor,
|
|
4490
|
+
readonly: readonlyProcessor,
|
|
4491
|
+
promise: promiseProcessor,
|
|
4492
|
+
optional: optionalProcessor,
|
|
4493
|
+
lazy: lazyProcessor
|
|
4494
|
+
};
|
|
4495
|
+
function toJSONSchema(input, params) {
|
|
4496
|
+
if ("_idmap" in input) {
|
|
4497
|
+
const registry = input;
|
|
4498
|
+
const ctx = initializeContext({
|
|
4499
|
+
...params,
|
|
4500
|
+
processors: allProcessors
|
|
4501
|
+
});
|
|
4502
|
+
const defs = {};
|
|
4503
|
+
for (const entry of registry._idmap.entries()) {
|
|
4504
|
+
const [_, schema] = entry;
|
|
4505
|
+
process(schema, ctx);
|
|
4506
|
+
}
|
|
4507
|
+
const schemas = {};
|
|
4508
|
+
ctx.external = {
|
|
4509
|
+
registry,
|
|
4510
|
+
uri: params?.uri,
|
|
4511
|
+
defs
|
|
4512
|
+
};
|
|
4513
|
+
for (const entry of registry._idmap.entries()) {
|
|
4514
|
+
const [key, schema] = entry;
|
|
4515
|
+
extractDefs(ctx, schema);
|
|
4516
|
+
schemas[key] = finalize(ctx, schema);
|
|
4517
|
+
}
|
|
4518
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
4519
|
+
return { schemas };
|
|
4520
|
+
}
|
|
4521
|
+
const ctx = initializeContext({
|
|
4522
|
+
...params,
|
|
4523
|
+
processors: allProcessors
|
|
4524
|
+
});
|
|
4525
|
+
process(input, ctx);
|
|
4526
|
+
extractDefs(ctx, input);
|
|
4527
|
+
return finalize(ctx, input);
|
|
4528
|
+
}
|
|
4378
4529
|
//#endregion
|
|
4379
4530
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4380
4531
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5391,7 +5542,7 @@ var ZodIssueCode = {
|
|
|
5391
5542
|
var ZodFirstPartyTypeKind;
|
|
5392
5543
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5393
5544
|
//#endregion
|
|
5394
|
-
//#region ../types/dist/sleep-
|
|
5545
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
5395
5546
|
/**
|
|
5396
5547
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5397
5548
|
* window to float samples (D455).
|
|
@@ -5508,7 +5659,7 @@ function isKeychainStoredField(field) {
|
|
|
5508
5659
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5509
5660
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5510
5661
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5511
|
-
function isRecord$
|
|
5662
|
+
function isRecord$5(value) {
|
|
5512
5663
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5513
5664
|
}
|
|
5514
5665
|
function makeSecretMarker(ref) {
|
|
@@ -5519,12 +5670,12 @@ function makeSecretMarker(ref) {
|
|
|
5519
5670
|
}
|
|
5520
5671
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5521
5672
|
function isSecretMarker(value) {
|
|
5522
|
-
if (!isRecord$
|
|
5673
|
+
if (!isRecord$5(value)) return false;
|
|
5523
5674
|
const ref = value["$secret"];
|
|
5524
5675
|
return typeof ref === "string" && ref.length > 0;
|
|
5525
5676
|
}
|
|
5526
5677
|
function isSecretClear(value) {
|
|
5527
|
-
return isRecord$
|
|
5678
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5528
5679
|
}
|
|
5529
5680
|
/**
|
|
5530
5681
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6134,7 +6285,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6134
6285
|
}
|
|
6135
6286
|
};
|
|
6136
6287
|
var KEEP = { kind: "keep" };
|
|
6137
|
-
function isRecord$
|
|
6288
|
+
function isRecord$4(value) {
|
|
6138
6289
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6139
6290
|
}
|
|
6140
6291
|
function defaultMintId() {
|
|
@@ -6147,7 +6298,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6147
6298
|
return out;
|
|
6148
6299
|
}
|
|
6149
6300
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6150
|
-
else if (isRecord$
|
|
6301
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6151
6302
|
return out;
|
|
6152
6303
|
}
|
|
6153
6304
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6202,7 +6353,7 @@ function rowId(row, idKey) {
|
|
|
6202
6353
|
return null;
|
|
6203
6354
|
}
|
|
6204
6355
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6205
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6356
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6206
6357
|
if (!Array.isArray(incoming)) {
|
|
6207
6358
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6208
6359
|
return {
|
|
@@ -6218,7 +6369,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6218
6369
|
const kept = /* @__PURE__ */ new Set();
|
|
6219
6370
|
const rows = [];
|
|
6220
6371
|
for (const row of incoming) {
|
|
6221
|
-
if (!isRecord$
|
|
6372
|
+
if (!isRecord$4(row)) {
|
|
6222
6373
|
rows.push(row);
|
|
6223
6374
|
continue;
|
|
6224
6375
|
}
|
|
@@ -6243,7 +6394,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6243
6394
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6244
6395
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6245
6396
|
case "object": {
|
|
6246
|
-
if (!isRecord$
|
|
6397
|
+
if (!isRecord$4(incoming)) {
|
|
6247
6398
|
if (incoming === void 0) return KEEP;
|
|
6248
6399
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6249
6400
|
return {
|
|
@@ -6251,7 +6402,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6251
6402
|
value: incoming
|
|
6252
6403
|
};
|
|
6253
6404
|
}
|
|
6254
|
-
const storedObj = isRecord$
|
|
6405
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6255
6406
|
return {
|
|
6256
6407
|
kind: "value",
|
|
6257
6408
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6374,7 +6525,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6374
6525
|
value: items
|
|
6375
6526
|
};
|
|
6376
6527
|
}
|
|
6377
|
-
if (isRecord$
|
|
6528
|
+
if (isRecord$4(v)) {
|
|
6378
6529
|
const out = {};
|
|
6379
6530
|
for (const [k, child] of Object.entries(v)) {
|
|
6380
6531
|
const s = substitute(child);
|
|
@@ -6406,7 +6557,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
6406
6557
|
this.name = "SecretOverwriteRefusedError";
|
|
6407
6558
|
}
|
|
6408
6559
|
};
|
|
6409
|
-
function isRecord(value) {
|
|
6560
|
+
function isRecord$3(value) {
|
|
6410
6561
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6411
6562
|
}
|
|
6412
6563
|
function resolvedValue(pass, marker) {
|
|
@@ -6435,7 +6586,7 @@ function inArray(pass, incoming, stored) {
|
|
|
6435
6586
|
return incoming.map((item, index) => {
|
|
6436
6587
|
const twin = stored[index];
|
|
6437
6588
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6438
|
-
if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
|
|
6589
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6439
6590
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6440
6591
|
return item;
|
|
6441
6592
|
});
|
|
@@ -6446,7 +6597,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
6446
6597
|
const twin = stored[key];
|
|
6447
6598
|
if (isSecretMarker(twin)) {
|
|
6448
6599
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6449
|
-
} else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6600
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6450
6601
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6451
6602
|
}
|
|
6452
6603
|
return out;
|
|
@@ -6454,7 +6605,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
6454
6605
|
async function walk(pass, incoming, stored) {
|
|
6455
6606
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6456
6607
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6457
|
-
if (!isRecord(incoming) || !isRecord(stored)) return incoming;
|
|
6608
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6458
6609
|
const out = { ...incoming };
|
|
6459
6610
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6460
6611
|
return out;
|
|
@@ -6485,7 +6636,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
6485
6636
|
function isJsonEqual(a, b) {
|
|
6486
6637
|
if (Object.is(a, b)) return true;
|
|
6487
6638
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6488
|
-
if (isRecord(a) && isRecord(b)) {
|
|
6639
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6489
6640
|
const keys = Object.keys(a);
|
|
6490
6641
|
if (keys.length !== Object.keys(b).length) return false;
|
|
6491
6642
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -6509,7 +6660,7 @@ function markerKeysOf(blob, owner) {
|
|
|
6509
6660
|
}
|
|
6510
6661
|
function nodeFromStored(value, owner) {
|
|
6511
6662
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6512
|
-
if (!isRecord(value)) return null;
|
|
6663
|
+
if (!isRecord$3(value)) return null;
|
|
6513
6664
|
const children = /* @__PURE__ */ new Map();
|
|
6514
6665
|
for (const [key, child] of Object.entries(value)) {
|
|
6515
6666
|
const node = nodeFromStored(child, owner);
|
|
@@ -6642,7 +6793,6 @@ function createHandle(raw, opts) {
|
|
|
6642
6793
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6643
6794
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6644
6795
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6645
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6646
6796
|
const overrides = {
|
|
6647
6797
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6648
6798
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6666,12 +6816,12 @@ function createHandle(raw, opts) {
|
|
|
6666
6816
|
};
|
|
6667
6817
|
} } : {},
|
|
6668
6818
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6669
|
-
|
|
6670
|
-
const rows = await readDeviceStoreBatch
|
|
6819
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6820
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6671
6821
|
const out = /* @__PURE__ */ new Map();
|
|
6672
6822
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6673
6823
|
return out;
|
|
6674
|
-
}
|
|
6824
|
+
},
|
|
6675
6825
|
writeAddonStore: async (patch) => {
|
|
6676
6826
|
await writeAddon(patch);
|
|
6677
6827
|
},
|
|
@@ -7298,7 +7448,7 @@ var BaseAddon = class {
|
|
|
7298
7448
|
if (!ctx) return;
|
|
7299
7449
|
const addonId = ctx.id;
|
|
7300
7450
|
setImmediate(() => {
|
|
7301
|
-
ctx.api.addons
|
|
7451
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7302
7452
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7303
7453
|
}).catch((err) => {
|
|
7304
7454
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7498,7 +7648,7 @@ var BaseAddon = class {
|
|
|
7498
7648
|
return this._addonSecretTree;
|
|
7499
7649
|
}
|
|
7500
7650
|
deviceSecretTree() {
|
|
7501
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7651
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7502
7652
|
return this._deviceSecretTree;
|
|
7503
7653
|
}
|
|
7504
7654
|
/**
|
|
@@ -7574,42 +7724,135 @@ var BaseAddon = class {
|
|
|
7574
7724
|
this[timerOf] = timer;
|
|
7575
7725
|
}
|
|
7576
7726
|
/**
|
|
7577
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7578
|
-
*
|
|
7579
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7580
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7727
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7728
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7581
7729
|
* addon permanently broken.
|
|
7582
7730
|
*
|
|
7583
|
-
*
|
|
7584
|
-
*
|
|
7585
|
-
* `
|
|
7731
|
+
* Two kinds of outage, two budgets:
|
|
7732
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7733
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7734
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7735
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7736
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7737
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7738
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7739
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7740
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7741
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7586
7742
|
*/
|
|
7587
7743
|
async readAddonStoreWithRetry() {
|
|
7588
7744
|
const settings = this.rawSettings();
|
|
7589
7745
|
if (!settings) return {};
|
|
7590
|
-
const delaysMs = [
|
|
7591
|
-
150,
|
|
7592
|
-
350,
|
|
7593
|
-
600,
|
|
7594
|
-
900
|
|
7595
|
-
];
|
|
7596
7746
|
let lastErr;
|
|
7597
|
-
for (let attempt = 0
|
|
7747
|
+
for (let attempt = 0;; attempt++) try {
|
|
7598
7748
|
const stored = await settings.readAddonStore() ?? {};
|
|
7599
7749
|
this.settingsStoreReady = true;
|
|
7600
7750
|
return stored;
|
|
7601
7751
|
} catch (err) {
|
|
7602
7752
|
lastErr = err;
|
|
7603
|
-
const
|
|
7604
|
-
if (
|
|
7605
|
-
|
|
7606
|
-
|
|
7753
|
+
const kind = classifyStoreError(err);
|
|
7754
|
+
if (kind === "permanent") throw err;
|
|
7755
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7756
|
+
if (delay === void 0) {
|
|
7757
|
+
if (kind === "transport") throw err;
|
|
7758
|
+
break;
|
|
7759
|
+
}
|
|
7760
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7607
7761
|
}
|
|
7608
7762
|
this.settingsStoreReady = false;
|
|
7609
7763
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7610
7764
|
return {};
|
|
7611
7765
|
}
|
|
7612
7766
|
};
|
|
7767
|
+
/** The settings store's own restart fingerprints. */
|
|
7768
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7769
|
+
150,
|
|
7770
|
+
350,
|
|
7771
|
+
600,
|
|
7772
|
+
900
|
|
7773
|
+
];
|
|
7774
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7775
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7776
|
+
150,
|
|
7777
|
+
350,
|
|
7778
|
+
600,
|
|
7779
|
+
900,
|
|
7780
|
+
2e3,
|
|
7781
|
+
5e3,
|
|
7782
|
+
1e4,
|
|
7783
|
+
2e4,
|
|
7784
|
+
3e4,
|
|
7785
|
+
3e4
|
|
7786
|
+
];
|
|
7787
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7788
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7789
|
+
var TRANSPORT_CODES = new Set([
|
|
7790
|
+
"ECONNREFUSED",
|
|
7791
|
+
"ECONNRESET",
|
|
7792
|
+
"ETIMEDOUT",
|
|
7793
|
+
"EPIPE",
|
|
7794
|
+
"EHOSTUNREACH",
|
|
7795
|
+
"ENETUNREACH"
|
|
7796
|
+
]);
|
|
7797
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7798
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7799
|
+
"TIMEOUT",
|
|
7800
|
+
"SERVICE_UNAVAILABLE",
|
|
7801
|
+
"BAD_GATEWAY",
|
|
7802
|
+
"GATEWAY_TIMEOUT"
|
|
7803
|
+
]);
|
|
7804
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7805
|
+
var TRANSPORT_PHRASES = [
|
|
7806
|
+
"discovery deadline exceeded",
|
|
7807
|
+
"parent could not route child unowned cap call",
|
|
7808
|
+
"UDS request timed out after",
|
|
7809
|
+
"channel closed"
|
|
7810
|
+
];
|
|
7811
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7812
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7813
|
+
"REQUEST_TIMEOUT",
|
|
7814
|
+
"SERVICE_NOT_FOUND",
|
|
7815
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7816
|
+
"REQUEST_REJECTED",
|
|
7817
|
+
"BROKER_DISCONNECTED"
|
|
7818
|
+
]);
|
|
7819
|
+
function stringProp(value, key) {
|
|
7820
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7821
|
+
const found = Reflect.get(value, key);
|
|
7822
|
+
return typeof found === "string" ? found : void 0;
|
|
7823
|
+
}
|
|
7824
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7825
|
+
function errorCode(err) {
|
|
7826
|
+
const out = {};
|
|
7827
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7828
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7829
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7830
|
+
if (node !== void 0) out.node = node;
|
|
7831
|
+
const trpc = stringProp(data, "code");
|
|
7832
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7833
|
+
return out;
|
|
7834
|
+
}
|
|
7835
|
+
/**
|
|
7836
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7837
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7838
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7839
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7840
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7841
|
+
*/
|
|
7842
|
+
function classifyStoreError(err) {
|
|
7843
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7844
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7845
|
+
const code = errorCode(err);
|
|
7846
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7847
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7848
|
+
if (typeof err === "object" && err !== null) {
|
|
7849
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7850
|
+
const type = stringProp(err, "type");
|
|
7851
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7852
|
+
}
|
|
7853
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7854
|
+
return "permanent";
|
|
7855
|
+
}
|
|
7613
7856
|
/**
|
|
7614
7857
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7615
7858
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7699,6 +7942,356 @@ var PeerBytesTicketSchema = object({
|
|
|
7699
7942
|
*/
|
|
7700
7943
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7701
7944
|
});
|
|
7945
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7946
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7947
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7948
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7949
|
+
var RECORD_CLASSES = [
|
|
7950
|
+
"config",
|
|
7951
|
+
"ledger",
|
|
7952
|
+
"audit",
|
|
7953
|
+
"mirror",
|
|
7954
|
+
"ephemeral"
|
|
7955
|
+
];
|
|
7956
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7957
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7958
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7959
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7960
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
7961
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
7962
|
+
var PREFIX = "records/";
|
|
7963
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
7964
|
+
var RecordsError = class extends Error {
|
|
7965
|
+
code;
|
|
7966
|
+
detail;
|
|
7967
|
+
constructor(code, detail) {
|
|
7968
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
7969
|
+
this.name = "RecordsError";
|
|
7970
|
+
this.code = code;
|
|
7971
|
+
this.detail = detail;
|
|
7972
|
+
}
|
|
7973
|
+
};
|
|
7974
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
7975
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
7976
|
+
constructor(detail) {
|
|
7977
|
+
super("secret-unavailable", detail);
|
|
7978
|
+
this.name = "RecordSecretUnavailableError";
|
|
7979
|
+
}
|
|
7980
|
+
};
|
|
7981
|
+
var InvalidRecordError = class extends RecordsError {
|
|
7982
|
+
constructor(detail) {
|
|
7983
|
+
super("invalid-record", detail);
|
|
7984
|
+
this.name = "InvalidRecordError";
|
|
7985
|
+
}
|
|
7986
|
+
};
|
|
7987
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
7988
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
7989
|
+
constructor(detail) {
|
|
7990
|
+
super("declaration-refused", detail);
|
|
7991
|
+
this.name = "DeclarationRefusedError";
|
|
7992
|
+
}
|
|
7993
|
+
};
|
|
7994
|
+
function defOf(schema) {
|
|
7995
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
7996
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
7997
|
+
const def = Reflect.get(zodBag, "def");
|
|
7998
|
+
if (typeof def !== "object" || def === null) return {};
|
|
7999
|
+
return def;
|
|
8000
|
+
}
|
|
8001
|
+
function declaredHere(schema) {
|
|
8002
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8003
|
+
}
|
|
8004
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8005
|
+
var WRAPPERS = new Set([
|
|
8006
|
+
"optional",
|
|
8007
|
+
"nullable",
|
|
8008
|
+
"default",
|
|
8009
|
+
"prefault",
|
|
8010
|
+
"catch",
|
|
8011
|
+
"readonly",
|
|
8012
|
+
"nonoptional"
|
|
8013
|
+
]);
|
|
8014
|
+
/**
|
|
8015
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8016
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8017
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8018
|
+
* `.transform` on `in`).
|
|
8019
|
+
*/
|
|
8020
|
+
function layersOf(schema) {
|
|
8021
|
+
const out = [];
|
|
8022
|
+
const queue = [schema];
|
|
8023
|
+
while (queue.length > 0) {
|
|
8024
|
+
const s = queue.shift();
|
|
8025
|
+
if (!s || out.includes(s)) continue;
|
|
8026
|
+
out.push(s);
|
|
8027
|
+
const def = defOf(s);
|
|
8028
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8029
|
+
if (def.type === "pipe") {
|
|
8030
|
+
if (def.in) queue.push(def.in);
|
|
8031
|
+
if (def.out) queue.push(def.out);
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
return out;
|
|
8035
|
+
}
|
|
8036
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8037
|
+
function isZodSecret(schema) {
|
|
8038
|
+
return layersOf(schema).some(declaredHere);
|
|
8039
|
+
}
|
|
8040
|
+
/**
|
|
8041
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8042
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8043
|
+
* object or array is reported as one path and not descended into — everything
|
|
8044
|
+
* under it is secret.
|
|
8045
|
+
*/
|
|
8046
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8047
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8048
|
+
const paths = [];
|
|
8049
|
+
for (const layer of layersOf(schema)) {
|
|
8050
|
+
const def = defOf(layer);
|
|
8051
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8052
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8053
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8054
|
+
else if (def.type === "intersection") {
|
|
8055
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8056
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
return [...new Set(paths)];
|
|
8060
|
+
}
|
|
8061
|
+
/**
|
|
8062
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8063
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8064
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8065
|
+
*
|
|
8066
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8067
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8068
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8069
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8070
|
+
*
|
|
8071
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8072
|
+
*/
|
|
8073
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8074
|
+
function parseSecretPath(path) {
|
|
8075
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8076
|
+
return path.split(".").map((raw) => {
|
|
8077
|
+
const each = raw.endsWith("[]");
|
|
8078
|
+
const key = each ? raw.slice(0, -2) : raw;
|
|
8079
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8080
|
+
return {
|
|
8081
|
+
key,
|
|
8082
|
+
each
|
|
8083
|
+
};
|
|
8084
|
+
});
|
|
8085
|
+
}
|
|
8086
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8087
|
+
function secretArrayPrefixes(path) {
|
|
8088
|
+
const segments = parseSecretPath(path);
|
|
8089
|
+
const prefixes = [];
|
|
8090
|
+
const walked = [];
|
|
8091
|
+
for (const segment of segments) {
|
|
8092
|
+
walked.push(segment.key);
|
|
8093
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8094
|
+
}
|
|
8095
|
+
return prefixes;
|
|
8096
|
+
}
|
|
8097
|
+
/**
|
|
8098
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8099
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
8100
|
+
* JSON the engine stores.
|
|
8101
|
+
*
|
|
8102
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
8103
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
8104
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
8105
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
8106
|
+
* never a field name (D879).
|
|
8107
|
+
*/
|
|
8108
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
8109
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
8110
|
+
var RecordIndexSchema = object({
|
|
8111
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
8112
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
8113
|
+
unique: boolean().optional()
|
|
8114
|
+
}).strict();
|
|
8115
|
+
var RecordRetentionSchema = union([
|
|
8116
|
+
object({
|
|
8117
|
+
ttlMs: number().int().positive(),
|
|
8118
|
+
from: _enum(["at", "write"])
|
|
8119
|
+
}).strict(),
|
|
8120
|
+
object({
|
|
8121
|
+
maxRows: number().int().positive().optional(),
|
|
8122
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
8123
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
8124
|
+
object({
|
|
8125
|
+
owner: string().min(1),
|
|
8126
|
+
reason: string().min(1)
|
|
8127
|
+
}).strict(),
|
|
8128
|
+
object({ none: string().min(1) }).strict()
|
|
8129
|
+
]);
|
|
8130
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
8131
|
+
var EntryDescriptorSchema = object({
|
|
8132
|
+
title: string().min(1),
|
|
8133
|
+
/** The record body field shown as the entry's name. */
|
|
8134
|
+
nameField: string().min(1),
|
|
8135
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
8136
|
+
fields: record(string(), unknown())
|
|
8137
|
+
}).strict();
|
|
8138
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
8139
|
+
var RecordKindDeclarationSchema = object({
|
|
8140
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
8141
|
+
class: _enum(RECORD_CLASSES),
|
|
8142
|
+
writeTrigger: string().min(1),
|
|
8143
|
+
device: _enum([
|
|
8144
|
+
"required",
|
|
8145
|
+
"optional",
|
|
8146
|
+
"none"
|
|
8147
|
+
]).default("none"),
|
|
8148
|
+
at: _enum(["required", "none"]).default("none"),
|
|
8149
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
8150
|
+
retention: RecordRetentionSchema,
|
|
8151
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
8152
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
8153
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
8154
|
+
secretPaths: array(string().min(1)).default([]),
|
|
8155
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
8156
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
8157
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
8158
|
+
adoptsFrom: string().min(1).optional(),
|
|
8159
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
8160
|
+
transactFamily: string().min(1).optional(),
|
|
8161
|
+
entry: EntryDescriptorSchema.optional()
|
|
8162
|
+
}).strict();
|
|
8163
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8164
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
8165
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
8166
|
+
function assertValidDeclaration(name, decl) {
|
|
8167
|
+
const refuse = (why) => {
|
|
8168
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
8169
|
+
};
|
|
8170
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
8171
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8172
|
+
for (const index of decl.indexes) {
|
|
8173
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
8174
|
+
seen.add(index.name);
|
|
8175
|
+
}
|
|
8176
|
+
const { retention } = decl;
|
|
8177
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
8178
|
+
if ("ttlMs" in retention) {
|
|
8179
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
8180
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
8181
|
+
}
|
|
8182
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
8183
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
8184
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
8185
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
8186
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
8187
|
+
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)`);
|
|
8188
|
+
}
|
|
8189
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
8190
|
+
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`);
|
|
8191
|
+
}
|
|
8192
|
+
function bodyFieldsOf(schema) {
|
|
8193
|
+
return { ...toJSONSchema(schema, {
|
|
8194
|
+
unrepresentable: "any",
|
|
8195
|
+
io: "input"
|
|
8196
|
+
}) };
|
|
8197
|
+
}
|
|
8198
|
+
function isRecordLike(value) {
|
|
8199
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8200
|
+
}
|
|
8201
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
8202
|
+
function hasNameField(json, field) {
|
|
8203
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
8204
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
8205
|
+
const properties = json["properties"];
|
|
8206
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
8207
|
+
}
|
|
8208
|
+
/**
|
|
8209
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
8210
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
8211
|
+
* types its handle from.
|
|
8212
|
+
*/
|
|
8213
|
+
function defineRecordKinds(specs) {
|
|
8214
|
+
const out = {};
|
|
8215
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
8216
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
8217
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
8218
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
8219
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
8220
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
8221
|
+
database: spec.database,
|
|
8222
|
+
class: spec.class,
|
|
8223
|
+
writeTrigger: spec.writeTrigger,
|
|
8224
|
+
device: spec.device,
|
|
8225
|
+
at: spec.at,
|
|
8226
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
8227
|
+
retention: spec.retention,
|
|
8228
|
+
deviceRemoval: spec.deviceRemoval,
|
|
8229
|
+
maxDataBytes: spec.maxDataBytes,
|
|
8230
|
+
secretPaths: [...secretPaths],
|
|
8231
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
8232
|
+
adoptsFrom: spec.adoptsFrom,
|
|
8233
|
+
transactFamily: spec.transactFamily,
|
|
8234
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
8235
|
+
title: spec.entry.title,
|
|
8236
|
+
nameField,
|
|
8237
|
+
fields
|
|
8238
|
+
}
|
|
8239
|
+
});
|
|
8240
|
+
assertValidDeclaration(name, parsed);
|
|
8241
|
+
out[name] = {
|
|
8242
|
+
name,
|
|
8243
|
+
schema: spec.schema,
|
|
8244
|
+
declaration: parsed
|
|
8245
|
+
};
|
|
8246
|
+
}
|
|
8247
|
+
return out;
|
|
8248
|
+
}
|
|
8249
|
+
/**
|
|
8250
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
8251
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
8252
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
8253
|
+
* through the `record-entries` capability with password fields derived from
|
|
8254
|
+
* the schema (`.meta({ secret: true })`).
|
|
8255
|
+
*/
|
|
8256
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
8257
|
+
function entryBody(shape) {
|
|
8258
|
+
return object({
|
|
8259
|
+
name: string().min(1),
|
|
8260
|
+
...shape
|
|
8261
|
+
});
|
|
8262
|
+
}
|
|
8263
|
+
/**
|
|
8264
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
8265
|
+
* engine, never aged, belonging to no device.
|
|
8266
|
+
*/
|
|
8267
|
+
function defineEntryKind(name, spec) {
|
|
8268
|
+
const defined = defineRecordKinds({ [name]: {
|
|
8269
|
+
schema: spec.schema,
|
|
8270
|
+
class: "config",
|
|
8271
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
8272
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
8273
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
8274
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
8275
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
8276
|
+
...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
|
|
8277
|
+
entry: {
|
|
8278
|
+
title: spec.title,
|
|
8279
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
8280
|
+
}
|
|
8281
|
+
} })[name];
|
|
8282
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
8283
|
+
return defined;
|
|
8284
|
+
}
|
|
8285
|
+
/**
|
|
8286
|
+
* Legacy source for broker entry adoption (B2): brokers live in addon-settings
|
|
8287
|
+
* as one row `<addonId>.brokers` whose value is an array until records-adopt
|
|
8288
|
+
* copies them into the entry kind.
|
|
8289
|
+
*/
|
|
8290
|
+
var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
|
|
8291
|
+
/** The `adoptsFrom` value for an addon's broker entry kind. */
|
|
8292
|
+
function settingsBrokersAdoptsFrom(addonId) {
|
|
8293
|
+
return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
|
|
8294
|
+
}
|
|
7702
8295
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7703
8296
|
var CamProfileSchema = _enum([
|
|
7704
8297
|
"high",
|
|
@@ -8178,7 +8771,7 @@ function userError(code, params, englishFallback) {
|
|
|
8178
8771
|
return new CamstackError(code, params, englishFallback);
|
|
8179
8772
|
}
|
|
8180
8773
|
//#endregion
|
|
8181
|
-
//#region ../types/dist/err-msg
|
|
8774
|
+
//#region ../types/dist/err-msg--2RrYiLO.mjs
|
|
8182
8775
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8183
8776
|
DeviceType["Camera"] = "camera";
|
|
8184
8777
|
DeviceType["Hub"] = "hub";
|
|
@@ -8447,6 +9040,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8447
9040
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8448
9041
|
* real Switch device for UI rendering / export adapters. */
|
|
8449
9042
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
9043
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
9044
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
9045
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8450
9046
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8451
9047
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8452
9048
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8514,7 +9110,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8514
9110
|
return DeviceRole;
|
|
8515
9111
|
}({});
|
|
8516
9112
|
//#endregion
|
|
8517
|
-
//#region ../types/dist/composition-
|
|
9113
|
+
//#region ../types/dist/composition-DOwQB_Ua.mjs
|
|
8518
9114
|
/**
|
|
8519
9115
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8520
9116
|
*
|
|
@@ -11835,11 +12431,10 @@ var ClipModelMetaSchema = object({
|
|
|
11835
12431
|
/**
|
|
11836
12432
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11837
12433
|
* per index: two models share an index only when their vectors are ranked
|
|
11838
|
-
* against each other, which for CLIP means never across families.
|
|
11839
|
-
*
|
|
11840
|
-
* `modelId`); any other model gets its own.
|
|
12434
|
+
* against each other, which for CLIP means never across families. Every
|
|
12435
|
+
* model gets its own.
|
|
11841
12436
|
*/
|
|
11842
|
-
vectorIndex: string().regex(/^object-clip
|
|
12437
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11843
12438
|
/**
|
|
11844
12439
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11845
12440
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -15534,6 +16129,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15534
16129
|
keyField: string()
|
|
15535
16130
|
}).optional()
|
|
15536
16131
|
})) });
|
|
16132
|
+
/**
|
|
16133
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
16134
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
16135
|
+
*
|
|
16136
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
16137
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
16138
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
16139
|
+
*/
|
|
16140
|
+
var RawSecretMigrationInputSchema = object({
|
|
16141
|
+
/** `false` (the default of the script) = report only. */
|
|
16142
|
+
apply: boolean() });
|
|
16143
|
+
var RawSecretMigrationReportSchema = object({
|
|
16144
|
+
apply: boolean(),
|
|
16145
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
16146
|
+
rows: number().int(),
|
|
16147
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
16148
|
+
raw: number().int(),
|
|
16149
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
16150
|
+
markers: number().int(),
|
|
16151
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
16152
|
+
migrated: number().int(),
|
|
16153
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
16154
|
+
failed: number().int(),
|
|
16155
|
+
/** After the run: rows still holding plaintext. */
|
|
16156
|
+
remainingRaw: number().int(),
|
|
16157
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
16158
|
+
unresolvedMarkers: number().int(),
|
|
16159
|
+
/**
|
|
16160
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
16161
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
16162
|
+
*/
|
|
16163
|
+
redundantCopies: number().int().optional(),
|
|
16164
|
+
/** True when nothing is raw and every marker resolves. */
|
|
16165
|
+
verified: boolean()
|
|
16166
|
+
});
|
|
15537
16167
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15538
16168
|
* agent is the reason placement is not fixed to the hub. */
|
|
15539
16169
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -15760,6 +16390,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15760
16390
|
}), SettingsUpdateResultSchema, {
|
|
15761
16391
|
kind: "mutation",
|
|
15762
16392
|
auth: "admin"
|
|
16393
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16394
|
+
kind: "mutation",
|
|
16395
|
+
auth: "admin"
|
|
15763
16396
|
}), method(object({}), object({ libs: array(object({
|
|
15764
16397
|
filePath: string(),
|
|
15765
16398
|
content: string()
|
|
@@ -16023,6 +16656,347 @@ id: union([string(), number()]) }), {
|
|
|
16023
16656
|
auth: "admin"
|
|
16024
16657
|
});
|
|
16025
16658
|
/**
|
|
16659
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16660
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16661
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16662
|
+
*
|
|
16663
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16664
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16665
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16666
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16667
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16668
|
+
* addons go through the owner's capability.
|
|
16669
|
+
*
|
|
16670
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16671
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16672
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16673
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16674
|
+
* row's own ref.
|
|
16675
|
+
*
|
|
16676
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16677
|
+
*/
|
|
16678
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16679
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16680
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16681
|
+
var RecordInputSchema = object({
|
|
16682
|
+
id: RecordIdSchema,
|
|
16683
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16684
|
+
deviceId: number().int().optional(),
|
|
16685
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16686
|
+
at: number().int().optional(),
|
|
16687
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16688
|
+
expiresAt: number().int().optional(),
|
|
16689
|
+
data: RecordBodySchema
|
|
16690
|
+
});
|
|
16691
|
+
var RecordViewSchema = object({
|
|
16692
|
+
id: string(),
|
|
16693
|
+
deviceId: number().int().nullable(),
|
|
16694
|
+
at: number().nullable(),
|
|
16695
|
+
expiresAt: number().nullable(),
|
|
16696
|
+
rev: number().int(),
|
|
16697
|
+
updatedAt: number(),
|
|
16698
|
+
data: RecordBodySchema
|
|
16699
|
+
});
|
|
16700
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16701
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16702
|
+
string(),
|
|
16703
|
+
number(),
|
|
16704
|
+
boolean(),
|
|
16705
|
+
object({ in: array(union([
|
|
16706
|
+
string(),
|
|
16707
|
+
number(),
|
|
16708
|
+
boolean()
|
|
16709
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16710
|
+
object({
|
|
16711
|
+
gt: union([string(), number()]).optional(),
|
|
16712
|
+
gte: union([string(), number()]).optional(),
|
|
16713
|
+
lt: union([string(), number()]).optional(),
|
|
16714
|
+
lte: union([string(), number()]).optional()
|
|
16715
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16716
|
+
]));
|
|
16717
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16718
|
+
var TimeWindowShape = {
|
|
16719
|
+
deviceId: number().int().optional(),
|
|
16720
|
+
atFrom: number().optional(),
|
|
16721
|
+
atTo: number().optional()
|
|
16722
|
+
};
|
|
16723
|
+
var RecordQueryInputSchema = object({
|
|
16724
|
+
...KindShape,
|
|
16725
|
+
...TimeWindowShape,
|
|
16726
|
+
where: RecordWhereSchema.optional(),
|
|
16727
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16728
|
+
order: _enum(["at", "id"]).optional(),
|
|
16729
|
+
desc: boolean().optional(),
|
|
16730
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16731
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16732
|
+
cursor: string().min(1).optional()
|
|
16733
|
+
});
|
|
16734
|
+
var RecordQueryResultSchema = object({
|
|
16735
|
+
records: array(RecordViewSchema),
|
|
16736
|
+
nextCursor: string().nullable()
|
|
16737
|
+
});
|
|
16738
|
+
var RecordKindStateSchema = _enum([
|
|
16739
|
+
"created",
|
|
16740
|
+
"unchanged",
|
|
16741
|
+
"updated"
|
|
16742
|
+
]);
|
|
16743
|
+
var DeclareKindResultSchema = object({
|
|
16744
|
+
kindId: number().int(),
|
|
16745
|
+
state: RecordKindStateSchema,
|
|
16746
|
+
createdIndexes: array(string()),
|
|
16747
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16748
|
+
adoptionPending: object({
|
|
16749
|
+
legacyTable: string(),
|
|
16750
|
+
legacyRows: number().int()
|
|
16751
|
+
}).nullable()
|
|
16752
|
+
});
|
|
16753
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16754
|
+
var SecretRefsList = array(string());
|
|
16755
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16756
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16757
|
+
kind: "mutation",
|
|
16758
|
+
auth: "admin"
|
|
16759
|
+
}), method(object({
|
|
16760
|
+
...KindShape,
|
|
16761
|
+
id: RecordIdSchema
|
|
16762
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16763
|
+
...KindShape,
|
|
16764
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16765
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16766
|
+
...KindShape,
|
|
16767
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16768
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16769
|
+
...KindShape,
|
|
16770
|
+
record: RecordInputSchema,
|
|
16771
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16772
|
+
ifRev: number().int().min(0).optional()
|
|
16773
|
+
}), object({
|
|
16774
|
+
rev: number().int(),
|
|
16775
|
+
releasedRefs: SecretRefsList
|
|
16776
|
+
}), {
|
|
16777
|
+
kind: "mutation",
|
|
16778
|
+
auth: "admin"
|
|
16779
|
+
}), method(object({
|
|
16780
|
+
...KindShape,
|
|
16781
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16782
|
+
}), object({
|
|
16783
|
+
count: number().int(),
|
|
16784
|
+
releasedRefs: SecretRefsList
|
|
16785
|
+
}), {
|
|
16786
|
+
kind: "mutation",
|
|
16787
|
+
auth: "admin"
|
|
16788
|
+
}), method(object({
|
|
16789
|
+
...KindShape,
|
|
16790
|
+
id: RecordIdSchema,
|
|
16791
|
+
data: RecordBodySchema,
|
|
16792
|
+
at: number().int().nullable().optional(),
|
|
16793
|
+
expiresAt: number().int().nullable().optional(),
|
|
16794
|
+
ifRev: number().int().min(1).optional()
|
|
16795
|
+
}), object({
|
|
16796
|
+
rev: number().int(),
|
|
16797
|
+
releasedRefs: SecretRefsList
|
|
16798
|
+
}), {
|
|
16799
|
+
kind: "mutation",
|
|
16800
|
+
auth: "admin"
|
|
16801
|
+
}), method(object({
|
|
16802
|
+
...KindShape,
|
|
16803
|
+
id: RecordIdSchema
|
|
16804
|
+
}), object({
|
|
16805
|
+
deleted: boolean(),
|
|
16806
|
+
secretRefs: SecretRefsList
|
|
16807
|
+
}), {
|
|
16808
|
+
kind: "mutation",
|
|
16809
|
+
auth: "admin"
|
|
16810
|
+
}), method(object({
|
|
16811
|
+
...KindShape,
|
|
16812
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16813
|
+
}), object({
|
|
16814
|
+
deleted: number().int(),
|
|
16815
|
+
secretRefs: SecretRefsList
|
|
16816
|
+
}), {
|
|
16817
|
+
kind: "mutation",
|
|
16818
|
+
auth: "admin"
|
|
16819
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16820
|
+
...KindShape,
|
|
16821
|
+
...TimeWindowShape,
|
|
16822
|
+
where: RecordWhereSchema.optional()
|
|
16823
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16824
|
+
...KindShape,
|
|
16825
|
+
deviceId: number().int().optional(),
|
|
16826
|
+
from: number(),
|
|
16827
|
+
to: number(),
|
|
16828
|
+
bucketMs: number().int().positive()
|
|
16829
|
+
}), object({ buckets: array(object({
|
|
16830
|
+
bucketStart: number(),
|
|
16831
|
+
count: number().int()
|
|
16832
|
+
})) }), { auth: "admin" }), method(object({
|
|
16833
|
+
...KindShape,
|
|
16834
|
+
op: _enum([
|
|
16835
|
+
"sum",
|
|
16836
|
+
"min",
|
|
16837
|
+
"max",
|
|
16838
|
+
"count"
|
|
16839
|
+
]),
|
|
16840
|
+
field: RecordFieldPathSchema.optional(),
|
|
16841
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16842
|
+
where: RecordWhereSchema.optional()
|
|
16843
|
+
}), object({ rows: array(object({
|
|
16844
|
+
group: union([
|
|
16845
|
+
string(),
|
|
16846
|
+
number(),
|
|
16847
|
+
_null()
|
|
16848
|
+
]),
|
|
16849
|
+
value: number().nullable()
|
|
16850
|
+
})) }), { auth: "admin" }), method(object({
|
|
16851
|
+
...KindShape,
|
|
16852
|
+
deviceId: number().int().optional(),
|
|
16853
|
+
atBefore: number().optional(),
|
|
16854
|
+
where: RecordWhereSchema.optional()
|
|
16855
|
+
}), object({
|
|
16856
|
+
deleted: number().int(),
|
|
16857
|
+
secretRefs: SecretRefsList
|
|
16858
|
+
}), {
|
|
16859
|
+
kind: "mutation",
|
|
16860
|
+
auth: "admin"
|
|
16861
|
+
}), method(object({
|
|
16862
|
+
deviceId: number().int(),
|
|
16863
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16864
|
+
}), object({
|
|
16865
|
+
deleted: record(string(), number().int()),
|
|
16866
|
+
secretRefs: SecretRefsList
|
|
16867
|
+
}), {
|
|
16868
|
+
kind: "mutation",
|
|
16869
|
+
auth: "admin"
|
|
16870
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16871
|
+
kind: "mutation",
|
|
16872
|
+
auth: "admin"
|
|
16873
|
+
});
|
|
16874
|
+
/** One table of the settings database. */
|
|
16875
|
+
var StorageTableSchema = object({
|
|
16876
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16877
|
+
name: string(),
|
|
16878
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16879
|
+
owner: string().nullable(),
|
|
16880
|
+
rows: number().int().nonnegative(),
|
|
16881
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16882
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16883
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16884
|
+
declaredThisBoot: boolean()
|
|
16885
|
+
});
|
|
16886
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16887
|
+
var StorageKindSchema = object({
|
|
16888
|
+
owner: string(),
|
|
16889
|
+
kind: string(),
|
|
16890
|
+
database: _enum(["settings", "events"]),
|
|
16891
|
+
class: string(),
|
|
16892
|
+
state: _enum([
|
|
16893
|
+
"declared",
|
|
16894
|
+
"orphaned",
|
|
16895
|
+
"dropped"
|
|
16896
|
+
]),
|
|
16897
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16898
|
+
rows: number().int().nonnegative().nullable(),
|
|
16899
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16900
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16901
|
+
writeTrigger: string(),
|
|
16902
|
+
retention: RecordRetentionSchema,
|
|
16903
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16904
|
+
entry: boolean(),
|
|
16905
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16906
|
+
declaration: RecordKindDeclarationSchema
|
|
16907
|
+
});
|
|
16908
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16909
|
+
collection: string().min(1),
|
|
16910
|
+
expectRows: number().int().nonnegative()
|
|
16911
|
+
}), object({
|
|
16912
|
+
dropped: literal(true),
|
|
16913
|
+
rows: number().int().nonnegative()
|
|
16914
|
+
}), {
|
|
16915
|
+
kind: "mutation",
|
|
16916
|
+
auth: "admin"
|
|
16917
|
+
}), method(object({
|
|
16918
|
+
owner: string().min(1).optional(),
|
|
16919
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16920
|
+
counts: boolean().optional()
|
|
16921
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16922
|
+
owner: string().min(1),
|
|
16923
|
+
kind: RecordKindNameSchema
|
|
16924
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16925
|
+
owner: string().min(1),
|
|
16926
|
+
kind: RecordKindNameSchema,
|
|
16927
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16928
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16929
|
+
complete: boolean().optional()
|
|
16930
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16931
|
+
kind: "mutation",
|
|
16932
|
+
auth: "admin"
|
|
16933
|
+
}), method(object({
|
|
16934
|
+
collection: string().min(1),
|
|
16935
|
+
cursor: string().optional(),
|
|
16936
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16937
|
+
}), object({
|
|
16938
|
+
rows: array(object({
|
|
16939
|
+
id: string(),
|
|
16940
|
+
data: record(string(), unknown())
|
|
16941
|
+
})),
|
|
16942
|
+
nextCursor: string().nullable()
|
|
16943
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16944
|
+
/**
|
|
16945
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16946
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16947
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16948
|
+
*
|
|
16949
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16950
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16951
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16952
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16953
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16954
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16955
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16956
|
+
*
|
|
16957
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16958
|
+
*/
|
|
16959
|
+
var EntryKindInfoSchema = object({
|
|
16960
|
+
owner: string(),
|
|
16961
|
+
kind: RecordKindNameSchema,
|
|
16962
|
+
title: string(),
|
|
16963
|
+
nameField: string(),
|
|
16964
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16965
|
+
fields: record(string(), unknown()),
|
|
16966
|
+
secretPaths: array(string()),
|
|
16967
|
+
rows: number().int().nonnegative()
|
|
16968
|
+
});
|
|
16969
|
+
var EntryViewSchema = object({
|
|
16970
|
+
id: RecordIdSchema,
|
|
16971
|
+
name: string(),
|
|
16972
|
+
rev: number().int(),
|
|
16973
|
+
updatedAt: number(),
|
|
16974
|
+
/** Secret fields hold the redaction token. */
|
|
16975
|
+
data: RecordBodySchema
|
|
16976
|
+
});
|
|
16977
|
+
var EntryAddress = {
|
|
16978
|
+
owner: string().min(1),
|
|
16979
|
+
kind: RecordKindNameSchema
|
|
16980
|
+
};
|
|
16981
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16982
|
+
...EntryAddress,
|
|
16983
|
+
id: RecordIdSchema.optional(),
|
|
16984
|
+
data: RecordBodySchema,
|
|
16985
|
+
ifRev: number().int().min(1).optional()
|
|
16986
|
+
}), object({
|
|
16987
|
+
id: string(),
|
|
16988
|
+
rev: number().int()
|
|
16989
|
+
}), {
|
|
16990
|
+
kind: "mutation",
|
|
16991
|
+
auth: "admin"
|
|
16992
|
+
}), method(object({
|
|
16993
|
+
...EntryAddress,
|
|
16994
|
+
id: RecordIdSchema
|
|
16995
|
+
}), object({ deleted: boolean() }), {
|
|
16996
|
+
kind: "mutation",
|
|
16997
|
+
auth: "admin"
|
|
16998
|
+
});
|
|
16999
|
+
/**
|
|
16026
17000
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16027
17001
|
*
|
|
16028
17002
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16563,6 +17537,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16563
17537
|
kind: "mutation",
|
|
16564
17538
|
auth: "admin",
|
|
16565
17539
|
caller: "required"
|
|
17540
|
+
}), method(object({
|
|
17541
|
+
ref: string().min(1),
|
|
17542
|
+
value: string().min(1)
|
|
17543
|
+
}), object({
|
|
17544
|
+
ref: string(),
|
|
17545
|
+
version: number().int()
|
|
17546
|
+
}), {
|
|
17547
|
+
kind: "mutation",
|
|
17548
|
+
auth: "admin",
|
|
17549
|
+
caller: "required"
|
|
16566
17550
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16567
17551
|
deleted: array(string()).readonly(),
|
|
16568
17552
|
kept: array(object({
|
|
@@ -39032,6 +40016,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39032
40016
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39033
40017
|
kind: "mutation",
|
|
39034
40018
|
auth: "admin"
|
|
40019
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
40020
|
+
kind: "mutation",
|
|
40021
|
+
auth: "admin"
|
|
39035
40022
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39036
40023
|
kind: "mutation",
|
|
39037
40024
|
auth: "admin"
|
|
@@ -49455,6 +50442,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49455
50442
|
atMs: number(),
|
|
49456
50443
|
reason: string()
|
|
49457
50444
|
});
|
|
50445
|
+
/**
|
|
50446
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50447
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50448
|
+
* service holds, because only the hub plans) against the states the process
|
|
50449
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50450
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50451
|
+
*
|
|
50452
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50453
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50454
|
+
* planned runner the process service has no entry for.
|
|
50455
|
+
*/
|
|
50456
|
+
var RunnerRefusalSchema = object({
|
|
50457
|
+
runnerId: string(),
|
|
50458
|
+
addonIds: array(string()),
|
|
50459
|
+
reason: string()
|
|
50460
|
+
});
|
|
50461
|
+
var RunnerBootCheckSchema = object({
|
|
50462
|
+
checkedAtMs: number(),
|
|
50463
|
+
/** Runners planned for this node. */
|
|
50464
|
+
expected: number(),
|
|
50465
|
+
/** Planned runners whose process is `running`. */
|
|
50466
|
+
running: number(),
|
|
50467
|
+
failed: array(string()),
|
|
50468
|
+
refused: array(RunnerRefusalSchema),
|
|
50469
|
+
missing: array(string()),
|
|
50470
|
+
/**
|
|
50471
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50472
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50473
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50474
|
+
* Optional for version skew (absent = settled).
|
|
50475
|
+
*/
|
|
50476
|
+
pending: array(string()).optional(),
|
|
50477
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50478
|
+
planKnown: boolean()
|
|
50479
|
+
});
|
|
49458
50480
|
var ServerPackageStatusSchema = object({
|
|
49459
50481
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49460
50482
|
packageName: string(),
|
|
@@ -49517,7 +50539,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49517
50539
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49518
50540
|
* absent wrapper is unknown — never `native`.
|
|
49519
50541
|
*/
|
|
49520
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50542
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50543
|
+
/**
|
|
50544
|
+
* What this node PLANNED to run against what its process service reports
|
|
50545
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50546
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50547
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50548
|
+
*/
|
|
50549
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49521
50550
|
});
|
|
49522
50551
|
var ServerUpdateCheckResultSchema = object({
|
|
49523
50552
|
packageName: string(),
|
|
@@ -49568,6 +50597,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49568
50597
|
"refused",
|
|
49569
50598
|
"failed"
|
|
49570
50599
|
]);
|
|
50600
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50601
|
+
var UpdateBlockerSchema = object({
|
|
50602
|
+
addonId: string(),
|
|
50603
|
+
reason: string(),
|
|
50604
|
+
/** What the operator does about it. */
|
|
50605
|
+
remedy: string()
|
|
50606
|
+
});
|
|
49571
50607
|
var ServerUpdateActionResultSchema = object({
|
|
49572
50608
|
accepted: boolean(),
|
|
49573
50609
|
targetVersion: string().nullable(),
|
|
@@ -49585,14 +50621,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
49585
50621
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
49586
50622
|
* staging install). Non-null only for `failed`.
|
|
49587
50623
|
*/
|
|
49588
|
-
error: string().nullable().optional()
|
|
50624
|
+
error: string().nullable().optional(),
|
|
50625
|
+
/**
|
|
50626
|
+
* The addons the target version would refuse to start on this node's live
|
|
50627
|
+
* store (D877), present when the pre-flight refused the update
|
|
50628
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50629
|
+
*/
|
|
50630
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
49589
50631
|
});
|
|
49590
50632
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
49591
50633
|
kind: "mutation",
|
|
49592
50634
|
auth: "admin"
|
|
49593
|
-
}), method(object({
|
|
49594
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
49595
|
-
version: string().optional()
|
|
50635
|
+
}), method(object({
|
|
50636
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50637
|
+
version: string().optional(),
|
|
50638
|
+
/**
|
|
50639
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50640
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50641
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50642
|
+
*/
|
|
50643
|
+
acknowledgeRefusals: boolean().optional()
|
|
50644
|
+
}), ServerUpdateActionResultSchema, {
|
|
49596
50645
|
kind: "mutation",
|
|
49597
50646
|
auth: "admin",
|
|
49598
50647
|
timeoutMs: 16 * 6e4
|
|
@@ -52018,7 +53067,9 @@ var ManifestShapeSchema = object({
|
|
|
52018
53067
|
var AddonProcessSchema = object({
|
|
52019
53068
|
pid: number().optional(),
|
|
52020
53069
|
mode: string(),
|
|
52021
|
-
state: string()
|
|
53070
|
+
state: string(),
|
|
53071
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
53072
|
+
reason: string().optional()
|
|
52022
53073
|
});
|
|
52023
53074
|
/**
|
|
52024
53075
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -53031,6 +54082,12 @@ object({
|
|
|
53031
54082
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
53032
54083
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
53033
54084
|
swingHorizontal: boolean().nullable(),
|
|
54085
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54086
|
+
minTemp: number().nullable().optional(),
|
|
54087
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54088
|
+
maxTemp: number().nullable().optional(),
|
|
54089
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
54090
|
+
tempStep: number().positive().nullable().optional(),
|
|
53034
54091
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
53035
54092
|
lastFetchedAt: number()
|
|
53036
54093
|
});
|
|
@@ -54851,7 +55908,19 @@ var TlsStatusSchema = object({
|
|
|
54851
55908
|
sans: array(string()),
|
|
54852
55909
|
caCertPem: string().nullable(),
|
|
54853
55910
|
reissueError: string().nullable(),
|
|
54854
|
-
restartRequired: boolean()
|
|
55911
|
+
restartRequired: boolean(),
|
|
55912
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
55913
|
+
caMissing: boolean(),
|
|
55914
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
55915
|
+
localCaConstrained: boolean().nullable(),
|
|
55916
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
55917
|
+
caReplacedAt: string().nullable(),
|
|
55918
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
55919
|
+
storedUpload: object({
|
|
55920
|
+
leafFingerprintSha256: string(),
|
|
55921
|
+
validTo: string(),
|
|
55922
|
+
hasCa: boolean()
|
|
55923
|
+
}).nullable()
|
|
54855
55924
|
});
|
|
54856
55925
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
54857
55926
|
/**
|
|
@@ -54907,6 +55976,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
54907
55976
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
54908
55977
|
kind: "mutation",
|
|
54909
55978
|
auth: "admin"
|
|
55979
|
+
}), method(_void(), TlsStatusSchema, {
|
|
55980
|
+
kind: "mutation",
|
|
55981
|
+
auth: "admin"
|
|
54910
55982
|
});
|
|
54911
55983
|
object({
|
|
54912
55984
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -60036,7 +61108,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
60036
61108
|
kind: "mutation",
|
|
60037
61109
|
auth: "admin",
|
|
60038
61110
|
access: "delete"
|
|
60039
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
61111
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
61112
|
+
kind: "mutation",
|
|
61113
|
+
auth: "admin",
|
|
61114
|
+
access: "create"
|
|
61115
|
+
}), method(object({
|
|
60040
61116
|
userId: string(),
|
|
60041
61117
|
code: string()
|
|
60042
61118
|
}), object({ valid: boolean() }), {
|
|
@@ -62237,6 +63313,12 @@ Object.freeze({
|
|
|
62237
63313
|
addonId: null,
|
|
62238
63314
|
access: "view"
|
|
62239
63315
|
},
|
|
63316
|
+
"coreBlocks.migrateRawSecrets": {
|
|
63317
|
+
capName: "core-blocks",
|
|
63318
|
+
capScope: "system",
|
|
63319
|
+
addonId: null,
|
|
63320
|
+
access: "create"
|
|
63321
|
+
},
|
|
62240
63322
|
"coreBlocks.restart": {
|
|
62241
63323
|
capName: "core-blocks",
|
|
62242
63324
|
capScope: "system",
|
|
@@ -63923,6 +65005,12 @@ Object.freeze({
|
|
|
63923
65005
|
addonId: null,
|
|
63924
65006
|
access: "create"
|
|
63925
65007
|
},
|
|
65008
|
+
"keychainAdmin.importSecret": {
|
|
65009
|
+
capName: "keychain-admin",
|
|
65010
|
+
capScope: "system",
|
|
65011
|
+
addonId: null,
|
|
65012
|
+
access: "create"
|
|
65013
|
+
},
|
|
63926
65014
|
"keychainAdmin.listAudit": {
|
|
63927
65015
|
capName: "keychain-admin",
|
|
63928
65016
|
capScope: "system",
|
|
@@ -64091,6 +65179,12 @@ Object.freeze({
|
|
|
64091
65179
|
addonId: null,
|
|
64092
65180
|
access: "view"
|
|
64093
65181
|
},
|
|
65182
|
+
"llm.migrateRawSecrets": {
|
|
65183
|
+
capName: "llm",
|
|
65184
|
+
capScope: "system",
|
|
65185
|
+
addonId: null,
|
|
65186
|
+
access: "create"
|
|
65187
|
+
},
|
|
64094
65188
|
"llm.resolveModelRef": {
|
|
64095
65189
|
capName: "llm",
|
|
64096
65190
|
capScope: "system",
|
|
@@ -64319,6 +65413,12 @@ Object.freeze({
|
|
|
64319
65413
|
addonId: null,
|
|
64320
65414
|
access: "create"
|
|
64321
65415
|
},
|
|
65416
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
65417
|
+
capName: "local-network",
|
|
65418
|
+
capScope: "system",
|
|
65419
|
+
addonId: null,
|
|
65420
|
+
access: "create"
|
|
65421
|
+
},
|
|
64322
65422
|
"lockControl.getStatus": {
|
|
64323
65423
|
capName: "lock-control",
|
|
64324
65424
|
capScope: "device",
|
|
@@ -66971,6 +68071,30 @@ Object.freeze({
|
|
|
66971
68071
|
addonId: null,
|
|
66972
68072
|
access: "create"
|
|
66973
68073
|
},
|
|
68074
|
+
"recordEntries.deleteEntry": {
|
|
68075
|
+
capName: "record-entries",
|
|
68076
|
+
capScope: "system",
|
|
68077
|
+
addonId: null,
|
|
68078
|
+
access: "delete"
|
|
68079
|
+
},
|
|
68080
|
+
"recordEntries.listEntries": {
|
|
68081
|
+
capName: "record-entries",
|
|
68082
|
+
capScope: "system",
|
|
68083
|
+
addonId: null,
|
|
68084
|
+
access: "view"
|
|
68085
|
+
},
|
|
68086
|
+
"recordEntries.listEntryKinds": {
|
|
68087
|
+
capName: "record-entries",
|
|
68088
|
+
capScope: "system",
|
|
68089
|
+
addonId: null,
|
|
68090
|
+
access: "view"
|
|
68091
|
+
},
|
|
68092
|
+
"recordEntries.putEntry": {
|
|
68093
|
+
capName: "record-entries",
|
|
68094
|
+
capScope: "system",
|
|
68095
|
+
addonId: null,
|
|
68096
|
+
access: "create"
|
|
68097
|
+
},
|
|
66974
68098
|
"recording.getAvailability": {
|
|
66975
68099
|
capName: "recording",
|
|
66976
68100
|
capScope: "device",
|
|
@@ -67271,6 +68395,102 @@ Object.freeze({
|
|
|
67271
68395
|
addonId: null,
|
|
67272
68396
|
access: "view"
|
|
67273
68397
|
},
|
|
68398
|
+
"records.aggregate": {
|
|
68399
|
+
capName: "records",
|
|
68400
|
+
capScope: "system",
|
|
68401
|
+
addonId: null,
|
|
68402
|
+
access: "view"
|
|
68403
|
+
},
|
|
68404
|
+
"records.allocateId": {
|
|
68405
|
+
capName: "records",
|
|
68406
|
+
capScope: "system",
|
|
68407
|
+
addonId: null,
|
|
68408
|
+
access: "create"
|
|
68409
|
+
},
|
|
68410
|
+
"records.count": {
|
|
68411
|
+
capName: "records",
|
|
68412
|
+
capScope: "system",
|
|
68413
|
+
addonId: null,
|
|
68414
|
+
access: "view"
|
|
68415
|
+
},
|
|
68416
|
+
"records.declareKinds": {
|
|
68417
|
+
capName: "records",
|
|
68418
|
+
capScope: "system",
|
|
68419
|
+
addonId: null,
|
|
68420
|
+
access: "create"
|
|
68421
|
+
},
|
|
68422
|
+
"records.delete": {
|
|
68423
|
+
capName: "records",
|
|
68424
|
+
capScope: "system",
|
|
68425
|
+
addonId: null,
|
|
68426
|
+
access: "delete"
|
|
68427
|
+
},
|
|
68428
|
+
"records.deleteDevice": {
|
|
68429
|
+
capName: "records",
|
|
68430
|
+
capScope: "system",
|
|
68431
|
+
addonId: null,
|
|
68432
|
+
access: "delete"
|
|
68433
|
+
},
|
|
68434
|
+
"records.deleteMany": {
|
|
68435
|
+
capName: "records",
|
|
68436
|
+
capScope: "system",
|
|
68437
|
+
addonId: null,
|
|
68438
|
+
access: "delete"
|
|
68439
|
+
},
|
|
68440
|
+
"records.deleteWhere": {
|
|
68441
|
+
capName: "records",
|
|
68442
|
+
capScope: "system",
|
|
68443
|
+
addonId: null,
|
|
68444
|
+
access: "delete"
|
|
68445
|
+
},
|
|
68446
|
+
"records.get": {
|
|
68447
|
+
capName: "records",
|
|
68448
|
+
capScope: "system",
|
|
68449
|
+
addonId: null,
|
|
68450
|
+
access: "view"
|
|
68451
|
+
},
|
|
68452
|
+
"records.getMany": {
|
|
68453
|
+
capName: "records",
|
|
68454
|
+
capScope: "system",
|
|
68455
|
+
addonId: null,
|
|
68456
|
+
access: "view"
|
|
68457
|
+
},
|
|
68458
|
+
"records.histogram": {
|
|
68459
|
+
capName: "records",
|
|
68460
|
+
capScope: "system",
|
|
68461
|
+
addonId: null,
|
|
68462
|
+
access: "view"
|
|
68463
|
+
},
|
|
68464
|
+
"records.patch": {
|
|
68465
|
+
capName: "records",
|
|
68466
|
+
capScope: "system",
|
|
68467
|
+
addonId: null,
|
|
68468
|
+
access: "create"
|
|
68469
|
+
},
|
|
68470
|
+
"records.put": {
|
|
68471
|
+
capName: "records",
|
|
68472
|
+
capScope: "system",
|
|
68473
|
+
addonId: null,
|
|
68474
|
+
access: "create"
|
|
68475
|
+
},
|
|
68476
|
+
"records.putMany": {
|
|
68477
|
+
capName: "records",
|
|
68478
|
+
capScope: "system",
|
|
68479
|
+
addonId: null,
|
|
68480
|
+
access: "create"
|
|
68481
|
+
},
|
|
68482
|
+
"records.query": {
|
|
68483
|
+
capName: "records",
|
|
68484
|
+
capScope: "system",
|
|
68485
|
+
addonId: null,
|
|
68486
|
+
access: "view"
|
|
68487
|
+
},
|
|
68488
|
+
"records.secretRefs": {
|
|
68489
|
+
capName: "records",
|
|
68490
|
+
capScope: "system",
|
|
68491
|
+
addonId: null,
|
|
68492
|
+
access: "view"
|
|
68493
|
+
},
|
|
67274
68494
|
"sceneMonitor.captureReference": {
|
|
67275
68495
|
capName: "scene-monitor",
|
|
67276
68496
|
capScope: "device",
|
|
@@ -67703,6 +68923,48 @@ Object.freeze({
|
|
|
67703
68923
|
addonId: null,
|
|
67704
68924
|
access: "create"
|
|
67705
68925
|
},
|
|
68926
|
+
"storageAdmin.adoptRecords": {
|
|
68927
|
+
capName: "storage-admin",
|
|
68928
|
+
capScope: "system",
|
|
68929
|
+
addonId: null,
|
|
68930
|
+
access: "create"
|
|
68931
|
+
},
|
|
68932
|
+
"storageAdmin.dropCollection": {
|
|
68933
|
+
capName: "storage-admin",
|
|
68934
|
+
capScope: "system",
|
|
68935
|
+
addonId: null,
|
|
68936
|
+
access: "delete"
|
|
68937
|
+
},
|
|
68938
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
68939
|
+
capName: "storage-admin",
|
|
68940
|
+
capScope: "system",
|
|
68941
|
+
addonId: null,
|
|
68942
|
+
access: "view"
|
|
68943
|
+
},
|
|
68944
|
+
"storageAdmin.listKinds": {
|
|
68945
|
+
capName: "storage-admin",
|
|
68946
|
+
capScope: "system",
|
|
68947
|
+
addonId: null,
|
|
68948
|
+
access: "view"
|
|
68949
|
+
},
|
|
68950
|
+
"storageAdmin.listTables": {
|
|
68951
|
+
capName: "storage-admin",
|
|
68952
|
+
capScope: "system",
|
|
68953
|
+
addonId: null,
|
|
68954
|
+
access: "view"
|
|
68955
|
+
},
|
|
68956
|
+
"storageAdmin.readLegacyCollection": {
|
|
68957
|
+
capName: "storage-admin",
|
|
68958
|
+
capScope: "system",
|
|
68959
|
+
addonId: null,
|
|
68960
|
+
access: "view"
|
|
68961
|
+
},
|
|
68962
|
+
"storageAdmin.readRecords": {
|
|
68963
|
+
capName: "storage-admin",
|
|
68964
|
+
capScope: "system",
|
|
68965
|
+
addonId: null,
|
|
68966
|
+
access: "view"
|
|
68967
|
+
},
|
|
67706
68968
|
"storageEvictable.evict": {
|
|
67707
68969
|
capName: "storage-evictable",
|
|
67708
68970
|
capScope: "system",
|
|
@@ -68615,6 +69877,12 @@ Object.freeze({
|
|
|
68615
69877
|
addonId: null,
|
|
68616
69878
|
access: "view"
|
|
68617
69879
|
},
|
|
69880
|
+
"userManagement.migrateRawSecrets": {
|
|
69881
|
+
capName: "user-management",
|
|
69882
|
+
capScope: "system",
|
|
69883
|
+
addonId: null,
|
|
69884
|
+
access: "create"
|
|
69885
|
+
},
|
|
68618
69886
|
"userManagement.oauthExchangeCode": {
|
|
68619
69887
|
capName: "user-management",
|
|
68620
69888
|
capScope: "system",
|
|
@@ -71291,6 +72559,37 @@ Object.freeze({
|
|
|
71291
72559
|
form: "single",
|
|
71292
72560
|
optional: false
|
|
71293
72561
|
}],
|
|
72562
|
+
"records.count": [{
|
|
72563
|
+
name: "deviceId",
|
|
72564
|
+
form: "single",
|
|
72565
|
+
optional: true
|
|
72566
|
+
}],
|
|
72567
|
+
"records.deleteDevice": [{
|
|
72568
|
+
name: "deviceId",
|
|
72569
|
+
form: "single",
|
|
72570
|
+
optional: false
|
|
72571
|
+
}],
|
|
72572
|
+
"records.deleteWhere": [{
|
|
72573
|
+
name: "deviceId",
|
|
72574
|
+
form: "single",
|
|
72575
|
+
optional: true
|
|
72576
|
+
}],
|
|
72577
|
+
"records.histogram": [{
|
|
72578
|
+
name: "deviceId",
|
|
72579
|
+
form: "single",
|
|
72580
|
+
optional: true
|
|
72581
|
+
}],
|
|
72582
|
+
"records.putMany": [{
|
|
72583
|
+
name: "records",
|
|
72584
|
+
form: "object-array",
|
|
72585
|
+
optional: false,
|
|
72586
|
+
itemField: "deviceId"
|
|
72587
|
+
}],
|
|
72588
|
+
"records.query": [{
|
|
72589
|
+
name: "deviceId",
|
|
72590
|
+
form: "single",
|
|
72591
|
+
optional: true
|
|
72592
|
+
}],
|
|
71294
72593
|
"sceneMonitor.captureReference": [{
|
|
71295
72594
|
name: "deviceId",
|
|
71296
72595
|
form: "single",
|
|
@@ -71407,6 +72706,17 @@ Object.freeze({
|
|
|
71407
72706
|
form: "single",
|
|
71408
72707
|
optional: false
|
|
71409
72708
|
}],
|
|
72709
|
+
"storageAdmin.adoptRecords": [{
|
|
72710
|
+
name: "records",
|
|
72711
|
+
form: "object-array",
|
|
72712
|
+
optional: false,
|
|
72713
|
+
itemField: "deviceId"
|
|
72714
|
+
}],
|
|
72715
|
+
"storageAdmin.readRecords": [{
|
|
72716
|
+
name: "deviceId",
|
|
72717
|
+
form: "single",
|
|
72718
|
+
optional: true
|
|
72719
|
+
}],
|
|
71410
72720
|
"streamBroker.acquireEgressTranscode": [{
|
|
71411
72721
|
name: "deviceId",
|
|
71412
72722
|
form: "single",
|
|
@@ -73790,6 +75100,74 @@ async function probeGoogleOauthClient(cfg, http = { fetch }) {
|
|
|
73790
75100
|
function pickOauthRedirectOrigin(book) {
|
|
73791
75101
|
return book.roles.publicEndpoint.resolved ?? book.roles.internal.resolved ?? null;
|
|
73792
75102
|
}
|
|
75103
|
+
var googleBrokersEntryKind = defineEntryKind("brokers", {
|
|
75104
|
+
title: "Google Services brokers",
|
|
75105
|
+
schema: entryBody({
|
|
75106
|
+
clientId: GoogleBrokerEntrySchema.shape.clientId,
|
|
75107
|
+
clientSecret: GoogleBrokerEntrySchema.shape.clientSecret,
|
|
75108
|
+
calendarFilter: GoogleBrokerEntrySchema.shape.calendarFilter,
|
|
75109
|
+
fromAddress: GoogleBrokerEntrySchema.shape.fromAddress,
|
|
75110
|
+
fromName: GoogleBrokerEntrySchema.shape.fromName
|
|
75111
|
+
}),
|
|
75112
|
+
writeTrigger: "an operator adds or edits a Google OAuth broker",
|
|
75113
|
+
adoptsFrom: settingsBrokersAdoptsFrom("google-services")
|
|
75114
|
+
});
|
|
75115
|
+
//#endregion
|
|
75116
|
+
//#region src/google-broker-store.ts
|
|
75117
|
+
function rowToEntry(id, data) {
|
|
75118
|
+
const parsed = GoogleBrokerEntrySchema.safeParse({
|
|
75119
|
+
id,
|
|
75120
|
+
...data
|
|
75121
|
+
});
|
|
75122
|
+
return parsed.success ? parsed.data : null;
|
|
75123
|
+
}
|
|
75124
|
+
var GoogleBrokerStore = class GoogleBrokerStore {
|
|
75125
|
+
kind;
|
|
75126
|
+
constructor(kind) {
|
|
75127
|
+
this.kind = kind;
|
|
75128
|
+
}
|
|
75129
|
+
static of(records) {
|
|
75130
|
+
return new GoogleBrokerStore(records.kind(googleBrokersEntryKind));
|
|
75131
|
+
}
|
|
75132
|
+
async listResolved() {
|
|
75133
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
75134
|
+
const out = [];
|
|
75135
|
+
for (const record of page.records) {
|
|
75136
|
+
let data = record.data;
|
|
75137
|
+
try {
|
|
75138
|
+
const resolved = await this.kind.getResolved(record.id);
|
|
75139
|
+
if (resolved !== null) data = resolved.data;
|
|
75140
|
+
} catch (err) {
|
|
75141
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
75142
|
+
}
|
|
75143
|
+
const entry = rowToEntry(record.id, data);
|
|
75144
|
+
if (entry !== null) out.push(entry);
|
|
75145
|
+
}
|
|
75146
|
+
return out;
|
|
75147
|
+
}
|
|
75148
|
+
async replaceAll(entries) {
|
|
75149
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
75150
|
+
const nextIds = new Set(entries.map((e) => e.id));
|
|
75151
|
+
for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
|
|
75152
|
+
for (const entry of entries) {
|
|
75153
|
+
const { id, name, clientId, clientSecret, calendarFilter, fromAddress, fromName } = entry;
|
|
75154
|
+
const body = {
|
|
75155
|
+
name,
|
|
75156
|
+
clientId,
|
|
75157
|
+
clientSecret,
|
|
75158
|
+
calendarFilter,
|
|
75159
|
+
fromAddress,
|
|
75160
|
+
fromName
|
|
75161
|
+
};
|
|
75162
|
+
const parsed = googleBrokersEntryKind.schema.safeParse(body);
|
|
75163
|
+
if (!parsed.success) throw new Error(`invalid Google broker '${id}': ${parsed.error.message}`);
|
|
75164
|
+
await this.kind.put({
|
|
75165
|
+
id,
|
|
75166
|
+
data: parsed.data
|
|
75167
|
+
});
|
|
75168
|
+
}
|
|
75169
|
+
}
|
|
75170
|
+
};
|
|
73793
75171
|
//#endregion
|
|
73794
75172
|
//#region src/google-services.addon.ts
|
|
73795
75173
|
/**
|
|
@@ -73815,6 +75193,8 @@ var GoogleServicesAddon = class extends BaseAddon {
|
|
|
73815
75193
|
];
|
|
73816
75194
|
oauthAccountsHandle = null;
|
|
73817
75195
|
registry = new GoogleBrokerRegistry();
|
|
75196
|
+
brokerStore = null;
|
|
75197
|
+
activeBrokers = [];
|
|
73818
75198
|
/** CSRF state → { brokerId, popup, issuedAt } — popup mirrors OIDC D794. */
|
|
73819
75199
|
pendingStates = /* @__PURE__ */ new Map();
|
|
73820
75200
|
publicOrigin = null;
|
|
@@ -73856,7 +75236,16 @@ var GoogleServicesAddon = class extends BaseAddon {
|
|
|
73856
75236
|
await this.oauthAccountsHandle.set(oauthAccounts);
|
|
73857
75237
|
await legacyHandle.set({ ...DEFAULT_OAUTH_STATE });
|
|
73858
75238
|
}
|
|
73859
|
-
this.
|
|
75239
|
+
const records = this.ctx.records;
|
|
75240
|
+
if (records === void 0) throw new Error("google-services: ctx.records is required (hub-only addon)");
|
|
75241
|
+
await records.declare({ brokers: googleBrokersEntryKind });
|
|
75242
|
+
this.brokerStore = GoogleBrokerStore.of(records);
|
|
75243
|
+
this.activeBrokers = await this.loadPersistedBrokers();
|
|
75244
|
+
if ((await this.brokerStore.listResolved()).length === 0 && this.config.brokers.length > 0) {
|
|
75245
|
+
await this.brokerStore.replaceAll(this.config.brokers);
|
|
75246
|
+
this.activeBrokers = await this.loadPersistedBrokers();
|
|
75247
|
+
}
|
|
75248
|
+
this.registry.seedFrom(this.activeBrokers, oauthAccounts.accounts);
|
|
73860
75249
|
await this.refreshPublicOrigin();
|
|
73861
75250
|
const calendarProvider = createGoogleCalendarSource({
|
|
73862
75251
|
logger: this.ctx.logger,
|
|
@@ -73928,7 +75317,8 @@ var GoogleServicesAddon = class extends BaseAddon {
|
|
|
73928
75317
|
}
|
|
73929
75318
|
async onConfigChanged() {
|
|
73930
75319
|
const accounts = this.registry.listOauthAccounts();
|
|
73931
|
-
this.
|
|
75320
|
+
this.activeBrokers = await this.loadPersistedBrokers();
|
|
75321
|
+
this.registry.seedFrom(this.activeBrokers, accounts);
|
|
73932
75322
|
}
|
|
73933
75323
|
buildBrokerProvider() {
|
|
73934
75324
|
const ownerAddonId = this.ctx.id;
|
|
@@ -74281,8 +75671,23 @@ var GoogleServicesAddon = class extends BaseAddon {
|
|
|
74281
75671
|
const cutoff = Date.now() - 10 * 6e4;
|
|
74282
75672
|
for (const [k, v] of this.pendingStates) if (v.issuedAt < cutoff) this.pendingStates.delete(k);
|
|
74283
75673
|
}
|
|
75674
|
+
async loadPersistedBrokers() {
|
|
75675
|
+
const store = this.brokerStore;
|
|
75676
|
+
if (store !== null) {
|
|
75677
|
+
const fromRecords = await store.listResolved();
|
|
75678
|
+
if (fromRecords.length > 0) return fromRecords;
|
|
75679
|
+
}
|
|
75680
|
+
return this.config.brokers;
|
|
75681
|
+
}
|
|
74284
75682
|
async persistBrokers() {
|
|
74285
|
-
|
|
75683
|
+
const entries = [...this.registry.listEntries()];
|
|
75684
|
+
this.activeBrokers = entries;
|
|
75685
|
+
const store = this.brokerStore;
|
|
75686
|
+
if (store !== null) {
|
|
75687
|
+
await store.replaceAll(entries);
|
|
75688
|
+
return;
|
|
75689
|
+
}
|
|
75690
|
+
await this.updateGlobalSettings({ brokers: entries });
|
|
74286
75691
|
}
|
|
74287
75692
|
async persistOauthAccounts() {
|
|
74288
75693
|
if (!this.oauthAccountsHandle) return;
|