@camstack/addon-export-google 0.1.123 → 0.1.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/export-google.addon.js +1830 -578
- package/dist/export-google.addon.mjs +1830 -578
- package/package.json +2 -2
|
@@ -859,7 +859,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
859
859
|
return EventCategory;
|
|
860
860
|
}({});
|
|
861
861
|
//#endregion
|
|
862
|
-
//#region ../types/dist/device-type-
|
|
862
|
+
//#region ../types/dist/device-type-D1fH5kaC.mjs
|
|
863
863
|
/**
|
|
864
864
|
import { errMsg } from '@camstack/types'
|
|
865
865
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1048,6 +1048,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1048
1048
|
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
1049
1049
|
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
1050
1050
|
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
1051
|
+
/** Cover has a real stop: `stop` halts the travel in place. Gates the stop
|
|
1052
|
+
* control in exporters; a provider whose `stop` is a no-op never declares it. */
|
|
1053
|
+
DeviceFeature["CoverStoppable"] = "cover-stoppable";
|
|
1051
1054
|
/** Valve exposes intermediate position control (0..100). Gates the
|
|
1052
1055
|
* position slider / drag surface UI. */
|
|
1053
1056
|
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
@@ -1087,6 +1090,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1087
1090
|
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
1088
1091
|
/** Media player exposes stop distinct from pause. */
|
|
1089
1092
|
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
1093
|
+
/** Media player exposes volume up / down in steps (an infrared TV has no level). */
|
|
1094
|
+
DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
|
|
1095
|
+
/** Media player exposes channel up / down in steps. */
|
|
1096
|
+
DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
|
|
1097
|
+
/** Media player exposes power on / off. */
|
|
1098
|
+
DeviceFeature["MediaPlayerPower"] = "media-player-power";
|
|
1090
1099
|
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
1091
1100
|
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
1092
1101
|
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
@@ -4623,6 +4632,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4623
4632
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4624
4633
|
json.type = "boolean";
|
|
4625
4634
|
};
|
|
4635
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4636
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4637
|
+
};
|
|
4638
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4639
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4640
|
+
};
|
|
4626
4641
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4627
4642
|
if (ctx.target === "openapi-3.0") {
|
|
4628
4643
|
json.type = "string";
|
|
@@ -4630,12 +4645,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4630
4645
|
json.enum = [null];
|
|
4631
4646
|
} else json.type = "null";
|
|
4632
4647
|
};
|
|
4648
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4649
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4650
|
+
};
|
|
4633
4651
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4634
4652
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4635
4653
|
};
|
|
4636
4654
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4637
4655
|
json.not = {};
|
|
4638
4656
|
};
|
|
4657
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4658
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4639
4659
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4640
4660
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4641
4661
|
};
|
|
@@ -4667,12 +4687,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4667
4687
|
json.enum = vals;
|
|
4668
4688
|
}
|
|
4669
4689
|
};
|
|
4690
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4691
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4692
|
+
};
|
|
4693
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4694
|
+
const _json = json;
|
|
4695
|
+
const pattern = schema._zod.pattern;
|
|
4696
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4697
|
+
_json.type = "string";
|
|
4698
|
+
_json.pattern = pattern.source;
|
|
4699
|
+
};
|
|
4700
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4701
|
+
const _json = json;
|
|
4702
|
+
const file = {
|
|
4703
|
+
type: "string",
|
|
4704
|
+
format: "binary",
|
|
4705
|
+
contentEncoding: "binary"
|
|
4706
|
+
};
|
|
4707
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4708
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4709
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4710
|
+
if (mime) if (mime.length === 1) {
|
|
4711
|
+
file.contentMediaType = mime[0];
|
|
4712
|
+
Object.assign(_json, file);
|
|
4713
|
+
} else {
|
|
4714
|
+
Object.assign(_json, file);
|
|
4715
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4716
|
+
}
|
|
4717
|
+
else Object.assign(_json, file);
|
|
4718
|
+
};
|
|
4719
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4720
|
+
json.type = "boolean";
|
|
4721
|
+
};
|
|
4670
4722
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4671
4723
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4672
4724
|
};
|
|
4725
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4726
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4727
|
+
};
|
|
4673
4728
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4674
4729
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4675
4730
|
};
|
|
4731
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4732
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4733
|
+
};
|
|
4734
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4735
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4736
|
+
};
|
|
4676
4737
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4677
4738
|
const json = _json;
|
|
4678
4739
|
const def = schema._zod.def;
|
|
@@ -4877,6 +4938,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4877
4938
|
seen.ref = def.innerType;
|
|
4878
4939
|
json.readOnly = true;
|
|
4879
4940
|
};
|
|
4941
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4942
|
+
const def = schema._zod.def;
|
|
4943
|
+
process(def.innerType, ctx, params);
|
|
4944
|
+
const seen = ctx.seen.get(schema);
|
|
4945
|
+
seen.ref = def.innerType;
|
|
4946
|
+
};
|
|
4880
4947
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4881
4948
|
const def = schema._zod.def;
|
|
4882
4949
|
process(def.innerType, ctx, params);
|
|
@@ -4889,6 +4956,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4889
4956
|
const seen = ctx.seen.get(schema);
|
|
4890
4957
|
seen.ref = innerType;
|
|
4891
4958
|
};
|
|
4959
|
+
var allProcessors = {
|
|
4960
|
+
string: stringProcessor,
|
|
4961
|
+
number: numberProcessor,
|
|
4962
|
+
boolean: booleanProcessor,
|
|
4963
|
+
bigint: bigintProcessor,
|
|
4964
|
+
symbol: symbolProcessor,
|
|
4965
|
+
null: nullProcessor,
|
|
4966
|
+
undefined: undefinedProcessor,
|
|
4967
|
+
void: voidProcessor,
|
|
4968
|
+
never: neverProcessor,
|
|
4969
|
+
any: anyProcessor,
|
|
4970
|
+
unknown: unknownProcessor,
|
|
4971
|
+
date: dateProcessor,
|
|
4972
|
+
enum: enumProcessor,
|
|
4973
|
+
literal: literalProcessor,
|
|
4974
|
+
nan: nanProcessor,
|
|
4975
|
+
template_literal: templateLiteralProcessor,
|
|
4976
|
+
file: fileProcessor,
|
|
4977
|
+
success: successProcessor,
|
|
4978
|
+
custom: customProcessor,
|
|
4979
|
+
function: functionProcessor,
|
|
4980
|
+
transform: transformProcessor,
|
|
4981
|
+
map: mapProcessor,
|
|
4982
|
+
set: setProcessor,
|
|
4983
|
+
array: arrayProcessor,
|
|
4984
|
+
object: objectProcessor,
|
|
4985
|
+
union: unionProcessor,
|
|
4986
|
+
intersection: intersectionProcessor,
|
|
4987
|
+
tuple: tupleProcessor,
|
|
4988
|
+
record: recordProcessor,
|
|
4989
|
+
nullable: nullableProcessor,
|
|
4990
|
+
nonoptional: nonoptionalProcessor,
|
|
4991
|
+
default: defaultProcessor,
|
|
4992
|
+
prefault: prefaultProcessor,
|
|
4993
|
+
catch: catchProcessor,
|
|
4994
|
+
pipe: pipeProcessor,
|
|
4995
|
+
readonly: readonlyProcessor,
|
|
4996
|
+
promise: promiseProcessor,
|
|
4997
|
+
optional: optionalProcessor,
|
|
4998
|
+
lazy: lazyProcessor
|
|
4999
|
+
};
|
|
5000
|
+
function toJSONSchema(input, params) {
|
|
5001
|
+
if ("_idmap" in input) {
|
|
5002
|
+
const registry = input;
|
|
5003
|
+
const ctx = initializeContext({
|
|
5004
|
+
...params,
|
|
5005
|
+
processors: allProcessors
|
|
5006
|
+
});
|
|
5007
|
+
const defs = {};
|
|
5008
|
+
for (const entry of registry._idmap.entries()) {
|
|
5009
|
+
const [_, schema] = entry;
|
|
5010
|
+
process(schema, ctx);
|
|
5011
|
+
}
|
|
5012
|
+
const schemas = {};
|
|
5013
|
+
ctx.external = {
|
|
5014
|
+
registry,
|
|
5015
|
+
uri: params?.uri,
|
|
5016
|
+
defs
|
|
5017
|
+
};
|
|
5018
|
+
for (const entry of registry._idmap.entries()) {
|
|
5019
|
+
const [key, schema] = entry;
|
|
5020
|
+
extractDefs(ctx, schema);
|
|
5021
|
+
schemas[key] = finalize(ctx, schema);
|
|
5022
|
+
}
|
|
5023
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
5024
|
+
return { schemas };
|
|
5025
|
+
}
|
|
5026
|
+
const ctx = initializeContext({
|
|
5027
|
+
...params,
|
|
5028
|
+
processors: allProcessors
|
|
5029
|
+
});
|
|
5030
|
+
process(input, ctx);
|
|
5031
|
+
extractDefs(ctx, input);
|
|
5032
|
+
return finalize(ctx, input);
|
|
5033
|
+
}
|
|
4892
5034
|
//#endregion
|
|
4893
5035
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4894
5036
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5913,7 +6055,7 @@ var ZodIssueCode = {
|
|
|
5913
6055
|
var ZodFirstPartyTypeKind;
|
|
5914
6056
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5915
6057
|
//#endregion
|
|
5916
|
-
//#region ../types/dist/sleep-
|
|
6058
|
+
//#region ../types/dist/sleep-BaWhXZFm.mjs
|
|
5917
6059
|
/**
|
|
5918
6060
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5919
6061
|
* window to float samples (D455).
|
|
@@ -5992,6 +6134,22 @@ function buildAlawTable() {
|
|
|
5992
6134
|
}
|
|
5993
6135
|
buildUlawTable();
|
|
5994
6136
|
buildAlawTable();
|
|
6137
|
+
/**
|
|
6138
|
+
* An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
|
|
6139
|
+
* so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
|
|
6140
|
+
* co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
|
|
6141
|
+
* bundles its own copy of this module, so the class the runner sees is not the one that threw.
|
|
6142
|
+
*/
|
|
6143
|
+
var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
|
|
6144
|
+
var AddonMigrationsBlockedError = class extends Error {
|
|
6145
|
+
/** The ledger ids that did not apply and block the owner. */
|
|
6146
|
+
migrationIds;
|
|
6147
|
+
constructor(migrationIds) {
|
|
6148
|
+
super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
|
|
6149
|
+
this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
|
|
6150
|
+
this.migrationIds = migrationIds;
|
|
6151
|
+
}
|
|
6152
|
+
};
|
|
5995
6153
|
/** Is this field's stored value a credential? */
|
|
5996
6154
|
function isSecretConfigField(field) {
|
|
5997
6155
|
if (field.type === "password") return true;
|
|
@@ -6860,7 +7018,7 @@ async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
|
6860
7018
|
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6861
7019
|
return out;
|
|
6862
7020
|
}
|
|
6863
|
-
function rowId(row, idKey) {
|
|
7021
|
+
function rowId$1(row, idKey) {
|
|
6864
7022
|
const raw = row[idKey];
|
|
6865
7023
|
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6866
7024
|
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
@@ -6877,7 +7035,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6877
7035
|
}
|
|
6878
7036
|
const storedById = /* @__PURE__ */ new Map();
|
|
6879
7037
|
for (const row of storedRows) {
|
|
6880
|
-
const id = rowId(row, node.idKey);
|
|
7038
|
+
const id = rowId$1(row, node.idKey);
|
|
6881
7039
|
if (id !== null) storedById.set(id, row);
|
|
6882
7040
|
}
|
|
6883
7041
|
const kept = /* @__PURE__ */ new Set();
|
|
@@ -6887,13 +7045,13 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6887
7045
|
rows.push(row);
|
|
6888
7046
|
continue;
|
|
6889
7047
|
}
|
|
6890
|
-
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7048
|
+
const id = rowId$1(row, node.idKey) ?? ctx.mintId();
|
|
6891
7049
|
kept.add(id);
|
|
6892
7050
|
const withId = {
|
|
6893
7051
|
...row,
|
|
6894
7052
|
[node.idKey]: row[node.idKey] ?? id
|
|
6895
7053
|
};
|
|
6896
|
-
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7054
|
+
if (rowId$1(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6897
7055
|
const storedRow = storedById.get(id) ?? {};
|
|
6898
7056
|
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6899
7057
|
}
|
|
@@ -7645,7 +7803,7 @@ var BaseAddon = class {
|
|
|
7645
7803
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7646
7804
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7647
7805
|
}, migrations, this.ctx.logger);
|
|
7648
|
-
if (report.blockOwner.length > 0) throw new
|
|
7806
|
+
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7649
7807
|
return report;
|
|
7650
7808
|
}
|
|
7651
7809
|
/**
|
|
@@ -7985,6 +8143,10 @@ var BaseAddon = class {
|
|
|
7985
8143
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7986
8144
|
const patch = {};
|
|
7987
8145
|
for (const key of keys) {
|
|
8146
|
+
if (tree.get(key)?.kind === "array") {
|
|
8147
|
+
patch[key] = [];
|
|
8148
|
+
continue;
|
|
8149
|
+
}
|
|
7988
8150
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7989
8151
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7990
8152
|
}
|
|
@@ -8624,6 +8786,38 @@ function normalizeAddonInitResult(result) {
|
|
|
8624
8786
|
if (Array.isArray(result)) return { providers: result };
|
|
8625
8787
|
return result;
|
|
8626
8788
|
}
|
|
8789
|
+
var PREFIX$1 = "records/";
|
|
8790
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8791
|
+
var RecordsError = class extends Error {
|
|
8792
|
+
code;
|
|
8793
|
+
detail;
|
|
8794
|
+
constructor(code, detail) {
|
|
8795
|
+
super(`${PREFIX$1}${code}: ${detail}`);
|
|
8796
|
+
this.name = "RecordsError";
|
|
8797
|
+
this.code = code;
|
|
8798
|
+
this.detail = detail;
|
|
8799
|
+
}
|
|
8800
|
+
};
|
|
8801
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8802
|
+
var RevConflictError = class extends RecordsError {
|
|
8803
|
+
constructor(detail) {
|
|
8804
|
+
super("rev-conflict", detail);
|
|
8805
|
+
this.name = "RevConflictError";
|
|
8806
|
+
}
|
|
8807
|
+
};
|
|
8808
|
+
var InvalidRecordError = class extends RecordsError {
|
|
8809
|
+
constructor(detail) {
|
|
8810
|
+
super("invalid-record", detail);
|
|
8811
|
+
this.name = "InvalidRecordError";
|
|
8812
|
+
}
|
|
8813
|
+
};
|
|
8814
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8815
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
8816
|
+
constructor(detail) {
|
|
8817
|
+
super("declaration-refused", detail);
|
|
8818
|
+
this.name = "DeclarationRefusedError";
|
|
8819
|
+
}
|
|
8820
|
+
};
|
|
8627
8821
|
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8628
8822
|
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8629
8823
|
var RECORD_DATABASES = ["settings", "events"];
|
|
@@ -8639,6 +8833,50 @@ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
|
8639
8833
|
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8640
8834
|
var RECORD_BATCH_MAX = 1e3;
|
|
8641
8835
|
var RECORD_QUERY_MAX = 1e3;
|
|
8836
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8837
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8838
|
+
/**
|
|
8839
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8840
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8841
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8842
|
+
*
|
|
8843
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8844
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8845
|
+
* key releases exactly that key's secret.
|
|
8846
|
+
*
|
|
8847
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8848
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8849
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8850
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8851
|
+
*
|
|
8852
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8853
|
+
*/
|
|
8854
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8855
|
+
function parseSecretPath(path) {
|
|
8856
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8857
|
+
return path.split(".").map((raw) => {
|
|
8858
|
+
const each = raw.endsWith("[]");
|
|
8859
|
+
const map = raw.endsWith("{}");
|
|
8860
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8861
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8862
|
+
return {
|
|
8863
|
+
key,
|
|
8864
|
+
each,
|
|
8865
|
+
map
|
|
8866
|
+
};
|
|
8867
|
+
});
|
|
8868
|
+
}
|
|
8869
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8870
|
+
function secretArrayPrefixes(path) {
|
|
8871
|
+
const segments = parseSecretPath(path);
|
|
8872
|
+
const prefixes = [];
|
|
8873
|
+
const walked = [];
|
|
8874
|
+
for (const segment of segments) {
|
|
8875
|
+
walked.push(segment.key);
|
|
8876
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8877
|
+
}
|
|
8878
|
+
return prefixes;
|
|
8879
|
+
}
|
|
8642
8880
|
/**
|
|
8643
8881
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
8644
8882
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -8663,6 +8901,75 @@ var PeerBytesTicketSchema = object({
|
|
|
8663
8901
|
*/
|
|
8664
8902
|
declaredBytes: number().int().nonnegative().nullable()
|
|
8665
8903
|
});
|
|
8904
|
+
function defOf(schema) {
|
|
8905
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
8906
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
8907
|
+
const def = Reflect.get(zodBag, "def");
|
|
8908
|
+
if (typeof def !== "object" || def === null) return {};
|
|
8909
|
+
return def;
|
|
8910
|
+
}
|
|
8911
|
+
function declaredHere(schema) {
|
|
8912
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8913
|
+
}
|
|
8914
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8915
|
+
var WRAPPERS = new Set([
|
|
8916
|
+
"optional",
|
|
8917
|
+
"nullable",
|
|
8918
|
+
"default",
|
|
8919
|
+
"prefault",
|
|
8920
|
+
"catch",
|
|
8921
|
+
"readonly",
|
|
8922
|
+
"nonoptional"
|
|
8923
|
+
]);
|
|
8924
|
+
/**
|
|
8925
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8926
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8927
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8928
|
+
* `.transform` on `in`).
|
|
8929
|
+
*/
|
|
8930
|
+
function layersOf(schema) {
|
|
8931
|
+
const out = [];
|
|
8932
|
+
const queue = [schema];
|
|
8933
|
+
while (queue.length > 0) {
|
|
8934
|
+
const s = queue.shift();
|
|
8935
|
+
if (!s || out.includes(s)) continue;
|
|
8936
|
+
out.push(s);
|
|
8937
|
+
const def = defOf(s);
|
|
8938
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8939
|
+
if (def.type === "pipe") {
|
|
8940
|
+
if (def.in) queue.push(def.in);
|
|
8941
|
+
if (def.out) queue.push(def.out);
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
return out;
|
|
8945
|
+
}
|
|
8946
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8947
|
+
function isZodSecret(schema) {
|
|
8948
|
+
return layersOf(schema).some(declaredHere);
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8952
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
8953
|
+
* map" (`applianceSecrets{}`). A declared
|
|
8954
|
+
* object or array is reported as one path and not descended into — everything
|
|
8955
|
+
* under it is secret.
|
|
8956
|
+
*/
|
|
8957
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8958
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8959
|
+
const paths = [];
|
|
8960
|
+
for (const layer of layersOf(schema)) {
|
|
8961
|
+
const def = defOf(layer);
|
|
8962
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8963
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8964
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
8965
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8966
|
+
else if (def.type === "intersection") {
|
|
8967
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8968
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8969
|
+
}
|
|
8970
|
+
}
|
|
8971
|
+
return [...new Set(paths)];
|
|
8972
|
+
}
|
|
8666
8973
|
/**
|
|
8667
8974
|
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8668
8975
|
* Zod row schema that describes it, and the helper that turns the two into the
|
|
@@ -8729,6 +9036,111 @@ var RecordKindDeclarationSchema = object({
|
|
|
8729
9036
|
}).strict();
|
|
8730
9037
|
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8731
9038
|
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9039
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9040
|
+
function assertValidDeclaration(name, decl) {
|
|
9041
|
+
const refuse = (why) => {
|
|
9042
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9043
|
+
};
|
|
9044
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9045
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9046
|
+
for (const index of decl.indexes) {
|
|
9047
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9048
|
+
seen.add(index.name);
|
|
9049
|
+
}
|
|
9050
|
+
const { retention } = decl;
|
|
9051
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
9052
|
+
if ("ttlMs" in retention) {
|
|
9053
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9054
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9055
|
+
}
|
|
9056
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9057
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9058
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9059
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9060
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9061
|
+
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)`);
|
|
9062
|
+
}
|
|
9063
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9064
|
+
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`);
|
|
9065
|
+
}
|
|
9066
|
+
function bodyFieldsOf(schema) {
|
|
9067
|
+
return { ...toJSONSchema(schema, {
|
|
9068
|
+
unrepresentable: "any",
|
|
9069
|
+
io: "input"
|
|
9070
|
+
}) };
|
|
9071
|
+
}
|
|
9072
|
+
function isRecordLike(value) {
|
|
9073
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9074
|
+
}
|
|
9075
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9076
|
+
function hasNameField(json, field) {
|
|
9077
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9078
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9079
|
+
const properties = json["properties"];
|
|
9080
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9081
|
+
}
|
|
9082
|
+
/**
|
|
9083
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9084
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9085
|
+
* types its handle from.
|
|
9086
|
+
*/
|
|
9087
|
+
function defineRecordKinds(specs) {
|
|
9088
|
+
const out = {};
|
|
9089
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
9090
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9091
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
9092
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
9093
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9094
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
9095
|
+
database: spec.database,
|
|
9096
|
+
class: spec.class,
|
|
9097
|
+
writeTrigger: spec.writeTrigger,
|
|
9098
|
+
device: spec.device,
|
|
9099
|
+
at: spec.at,
|
|
9100
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9101
|
+
retention: spec.retention,
|
|
9102
|
+
deviceRemoval: spec.deviceRemoval,
|
|
9103
|
+
maxDataBytes: spec.maxDataBytes,
|
|
9104
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9105
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9106
|
+
transactFamily: spec.transactFamily,
|
|
9107
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
9108
|
+
title: spec.entry.title,
|
|
9109
|
+
nameField,
|
|
9110
|
+
fields
|
|
9111
|
+
}
|
|
9112
|
+
});
|
|
9113
|
+
assertValidDeclaration(name, parsed);
|
|
9114
|
+
out[name] = {
|
|
9115
|
+
name,
|
|
9116
|
+
schema: spec.schema,
|
|
9117
|
+
declaration: parsed
|
|
9118
|
+
};
|
|
9119
|
+
}
|
|
9120
|
+
return out;
|
|
9121
|
+
}
|
|
9122
|
+
/**
|
|
9123
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9124
|
+
* engine, never aged, belonging to no device.
|
|
9125
|
+
*/
|
|
9126
|
+
function defineEntryKind(name, spec) {
|
|
9127
|
+
const defined = defineRecordKinds({ [name]: {
|
|
9128
|
+
schema: spec.schema,
|
|
9129
|
+
class: "config",
|
|
9130
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9131
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9132
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9133
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9134
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9135
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9136
|
+
entry: {
|
|
9137
|
+
title: spec.title,
|
|
9138
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9139
|
+
}
|
|
9140
|
+
} })[name];
|
|
9141
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9142
|
+
return defined;
|
|
9143
|
+
}
|
|
8732
9144
|
object({
|
|
8733
9145
|
field: string().min(1),
|
|
8734
9146
|
on: literal("advance")
|
|
@@ -9381,6 +9793,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9381
9793
|
"backup",
|
|
9382
9794
|
"battery",
|
|
9383
9795
|
"binary",
|
|
9796
|
+
"board-key-source",
|
|
9384
9797
|
"brightness",
|
|
9385
9798
|
"broker",
|
|
9386
9799
|
"button",
|
|
@@ -9502,6 +9915,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9502
9915
|
"privacy-mask",
|
|
9503
9916
|
"ptz",
|
|
9504
9917
|
"ptz-autotrack",
|
|
9918
|
+
"pump-cycle",
|
|
9505
9919
|
"reboot",
|
|
9506
9920
|
"record-entries",
|
|
9507
9921
|
"recording",
|
|
@@ -10794,18 +11208,6 @@ Object.freeze({
|
|
|
10794
11208
|
"path": "pumpRunning",
|
|
10795
11209
|
"valueType": "boolean"
|
|
10796
11210
|
},
|
|
10797
|
-
{
|
|
10798
|
-
"path": "pumpIntervalEnabled",
|
|
10799
|
-
"valueType": "boolean"
|
|
10800
|
-
},
|
|
10801
|
-
{
|
|
10802
|
-
"path": "pumpOnTime",
|
|
10803
|
-
"valueType": "number"
|
|
10804
|
-
},
|
|
10805
|
-
{
|
|
10806
|
-
"path": "pumpOffTime",
|
|
10807
|
-
"valueType": "number"
|
|
10808
|
-
},
|
|
10809
11211
|
{
|
|
10810
11212
|
"path": "lastDrink",
|
|
10811
11213
|
"valueType": "number"
|
|
@@ -10929,6 +11331,20 @@ Object.freeze({
|
|
|
10929
11331
|
"valueType": "number"
|
|
10930
11332
|
}
|
|
10931
11333
|
],
|
|
11334
|
+
"pump-cycle": [
|
|
11335
|
+
{
|
|
11336
|
+
"path": "enabled",
|
|
11337
|
+
"valueType": "boolean"
|
|
11338
|
+
},
|
|
11339
|
+
{
|
|
11340
|
+
"path": "onTime",
|
|
11341
|
+
"valueType": "number"
|
|
11342
|
+
},
|
|
11343
|
+
{
|
|
11344
|
+
"path": "offTime",
|
|
11345
|
+
"valueType": "number"
|
|
11346
|
+
}
|
|
11347
|
+
],
|
|
10932
11348
|
"recording-archive": [
|
|
10933
11349
|
{
|
|
10934
11350
|
"path": "deviceId",
|
|
@@ -11378,7 +11794,7 @@ object({
|
|
|
11378
11794
|
params: record(string(), union([string(), number()])).optional()
|
|
11379
11795
|
});
|
|
11380
11796
|
//#endregion
|
|
11381
|
-
//#region ../types/dist/composition-
|
|
11797
|
+
//#region ../types/dist/composition-CRNwcFYY.mjs
|
|
11382
11798
|
/**
|
|
11383
11799
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11384
11800
|
*
|
|
@@ -12141,38 +12557,6 @@ function validateExpressionSource(src) {
|
|
|
12141
12557
|
return null;
|
|
12142
12558
|
}
|
|
12143
12559
|
/**
|
|
12144
|
-
* One power reading becomes a washer, dryer or dishwasher (D944 helper).
|
|
12145
|
-
*
|
|
12146
|
-
* Standby of the control board is under 5 W; a motor or a heater is far
|
|
12147
|
-
* above that, so 5 W is the line. A door lock or a short pump spike is not
|
|
12148
|
-
* a cycle, so running starts only after 30 s above the line.
|
|
12149
|
-
*
|
|
12150
|
-
* A wash, dry or dishwasher pause (soak, heat-wait, heater off between
|
|
12151
|
-
* bursts) lasts several minutes. Ending the cycle on the first dip would
|
|
12152
|
-
* report "finished" in the middle of the program, so the stop dwell is
|
|
12153
|
-
* 10 minutes on every type. The number is stored per type so one machine
|
|
12154
|
-
* can move later without moving the others.
|
|
12155
|
-
*/
|
|
12156
|
-
var APPLIANCE_TEMPLATE_ID = "appliance";
|
|
12157
|
-
var APPLIANCE_KINDS = [
|
|
12158
|
-
"washer",
|
|
12159
|
-
"dryer",
|
|
12160
|
-
"dishwasher"
|
|
12161
|
-
];
|
|
12162
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
|
|
12163
|
-
/**
|
|
12164
|
-
* A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
|
|
12165
|
-
*
|
|
12166
|
-
* The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
|
|
12167
|
-
* (D967), so the heater switches exactly as the plug does. Running is the
|
|
12168
|
-
* plug being on; when a power reading is also named, running is the draw
|
|
12169
|
-
* staying above the line instead (a plug left on with the stove's own
|
|
12170
|
-
* thermostat open is not heating). 50 W is far above any standby and below
|
|
12171
|
-
* the smallest radiator.
|
|
12172
|
-
*/
|
|
12173
|
-
var HEATER_TEMPLATE_ID = "heater";
|
|
12174
|
-
DeviceType.Heater;
|
|
12175
|
-
/**
|
|
12176
12560
|
* Statistics and integrals over a history read (D944).
|
|
12177
12561
|
*
|
|
12178
12562
|
* Pure: the same points always give the same answer, so a restart recomputes
|
|
@@ -12316,34 +12700,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
|
|
|
12316
12700
|
/** Actuator groups only. Readings leave this unset. */
|
|
12317
12701
|
active: ActiveCriterionSchema.optional()
|
|
12318
12702
|
}),
|
|
12319
|
-
object({
|
|
12320
|
-
kind: literal("appliance"),
|
|
12321
|
-
templateId: literal(APPLIANCE_TEMPLATE_ID),
|
|
12322
|
-
appliance: _enum(APPLIANCE_KINDS),
|
|
12323
|
-
thresholdWatts: number().positive(),
|
|
12324
|
-
startDwellMs: number().int().nonnegative(),
|
|
12325
|
-
stopDwellMs: number().int().nonnegative(),
|
|
12326
|
-
member: HelperMemberSchema,
|
|
12327
|
-
/**
|
|
12328
|
-
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
12329
|
-
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
12330
|
-
* that plug (power-source link of a NEW-target composition).
|
|
12331
|
-
*/
|
|
12332
|
-
powerSwitch: HelperMemberSchema.optional(),
|
|
12333
|
-
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
12334
|
-
offSeconds: number().optional()
|
|
12335
|
-
}),
|
|
12336
|
-
object({
|
|
12337
|
-
kind: literal("heater"),
|
|
12338
|
-
templateId: literal(HEATER_TEMPLATE_ID),
|
|
12339
|
-
/** The plug, read and commanded at `switch.on`. */
|
|
12340
|
-
plug: HelperMemberSchema,
|
|
12341
|
-
/** The plug's power reading, when it has one: running is then the draw, not the switch. */
|
|
12342
|
-
meter: HelperMemberSchema.optional(),
|
|
12343
|
-
thresholdWatts: number().positive(),
|
|
12344
|
-
startDwellMs: number().int().nonnegative(),
|
|
12345
|
-
stopDwellMs: number().int().nonnegative()
|
|
12346
|
-
}),
|
|
12347
12703
|
object({
|
|
12348
12704
|
kind: literal("statistic"),
|
|
12349
12705
|
stat: _enum(STATISTIC_STATS),
|
|
@@ -12515,7 +12871,14 @@ var CompositionForwardCommandSchema = object({
|
|
|
12515
12871
|
method: string().min(1),
|
|
12516
12872
|
args: record(string().min(1), CompositionForwardArgSchema).optional()
|
|
12517
12873
|
});
|
|
12518
|
-
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
12874
|
+
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
12875
|
+
CompositionForwardCommandSchema,
|
|
12876
|
+
CompositionCodeSourceSchema,
|
|
12877
|
+
object({
|
|
12878
|
+
kind: literal("extension"),
|
|
12879
|
+
target: literal("remote")
|
|
12880
|
+
})
|
|
12881
|
+
]);
|
|
12519
12882
|
/** An item key inside an item-array cap (`consumables.items[<key>]`). */
|
|
12520
12883
|
var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
|
|
12521
12884
|
/**
|
|
@@ -12560,7 +12923,7 @@ var CompositionSchema = object({
|
|
|
12560
12923
|
kind: literal("existing"),
|
|
12561
12924
|
device: CompositionSourceRefSchema
|
|
12562
12925
|
})]),
|
|
12563
|
-
features: array(CompositionFeatureSchema).min(
|
|
12926
|
+
features: array(CompositionFeatureSchema).min(0).max(16),
|
|
12564
12927
|
/**
|
|
12565
12928
|
* Present when the block is a helper template. Absent on a free
|
|
12566
12929
|
* composition (the room example, device 4603). The editor reads this,
|
|
@@ -12592,6 +12955,73 @@ var NodeColorIdSchema = _enum([
|
|
|
12592
12955
|
"node-g",
|
|
12593
12956
|
"node-h"
|
|
12594
12957
|
]);
|
|
12958
|
+
//#endregion
|
|
12959
|
+
//#region ../types/dist/index.mjs
|
|
12960
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
12961
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
12962
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
12963
|
+
/** The text excerpt a message carries on the bus. */
|
|
12964
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
12965
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
12966
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
12967
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
12968
|
+
object({
|
|
12969
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
12970
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
12971
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
12972
|
+
requireAuth: boolean().default(true),
|
|
12973
|
+
username: string().default(""),
|
|
12974
|
+
password: string().default("").meta({ secret: true }),
|
|
12975
|
+
starttls: boolean().default(false),
|
|
12976
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
12977
|
+
});
|
|
12978
|
+
object({
|
|
12979
|
+
host: string().min(1).nullable(),
|
|
12980
|
+
hostReason: string().nullable(),
|
|
12981
|
+
port: PortSchema,
|
|
12982
|
+
domain: string().min(1),
|
|
12983
|
+
requireAuth: boolean(),
|
|
12984
|
+
username: string(),
|
|
12985
|
+
password: string(),
|
|
12986
|
+
starttls: boolean()
|
|
12987
|
+
});
|
|
12988
|
+
object({
|
|
12989
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
12990
|
+
/**
|
|
12991
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
12992
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
12993
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
12994
|
+
* Absent, the subscriber is anonymous and unique.
|
|
12995
|
+
*/
|
|
12996
|
+
subscriberId: string().min(1).max(64).optional()
|
|
12997
|
+
});
|
|
12998
|
+
var SmtpInboundAttachmentSchema = object({
|
|
12999
|
+
filename: string(),
|
|
13000
|
+
contentType: string(),
|
|
13001
|
+
bytes: number().int().nonnegative()
|
|
13002
|
+
});
|
|
13003
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13004
|
+
var SmtpInboundMessageSchema = object({
|
|
13005
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13006
|
+
seq: number().int().positive(),
|
|
13007
|
+
messageId: string(),
|
|
13008
|
+
receivedAt: number().int().nonnegative(),
|
|
13009
|
+
from: string(),
|
|
13010
|
+
to: string(),
|
|
13011
|
+
subject: string(),
|
|
13012
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13013
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
13014
|
+
});
|
|
13015
|
+
object({
|
|
13016
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
13017
|
+
lastSeq: number().int().nonnegative(),
|
|
13018
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
13019
|
+
oldestSeq: number().int().nonnegative(),
|
|
13020
|
+
messages: array(object({
|
|
13021
|
+
key: string(),
|
|
13022
|
+
message: SmtpInboundMessageSchema
|
|
13023
|
+
}))
|
|
13024
|
+
});
|
|
12595
13025
|
new Set([
|
|
12596
13026
|
"track",
|
|
12597
13027
|
"face",
|
|
@@ -18998,24 +19428,52 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
18998
19428
|
args: { on: false }
|
|
18999
19429
|
},
|
|
19000
19430
|
{
|
|
19001
|
-
id: "petFountain.
|
|
19002
|
-
method: "
|
|
19431
|
+
id: "petFountain.resetDailyConsumption",
|
|
19432
|
+
method: "resetDailyConsumption",
|
|
19433
|
+
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19434
|
+
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19435
|
+
icon: "rotate-ccw"
|
|
19436
|
+
}
|
|
19437
|
+
],
|
|
19438
|
+
state: [{
|
|
19439
|
+
kind: "boolean",
|
|
19440
|
+
field: "empty",
|
|
19441
|
+
label: t("Tank empty", "Serbatoio vuoto"),
|
|
19442
|
+
whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
|
|
19443
|
+
whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
|
|
19444
|
+
icon: "droplet"
|
|
19445
|
+
}, {
|
|
19446
|
+
kind: "numeric",
|
|
19447
|
+
field: "waterLevel",
|
|
19448
|
+
quantity: t("the water level", "il livello dell’acqua"),
|
|
19449
|
+
label: t("Water level", "Livello dell’acqua"),
|
|
19450
|
+
unit: "%",
|
|
19451
|
+
icon: "droplets"
|
|
19452
|
+
}]
|
|
19453
|
+
},
|
|
19454
|
+
"pump-cycle": {
|
|
19455
|
+
scope: "device",
|
|
19456
|
+
noun: t("Pump cycle", "Ciclo della pompa"),
|
|
19457
|
+
actions: [
|
|
19458
|
+
{
|
|
19459
|
+
id: "pumpCycle.on",
|
|
19460
|
+
method: "setEnabled",
|
|
19003
19461
|
label: t("Pump cycle on", "Ciclo pompa attivo"),
|
|
19004
19462
|
phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
|
|
19005
19463
|
icon: "timer",
|
|
19006
19464
|
args: { on: true }
|
|
19007
19465
|
},
|
|
19008
19466
|
{
|
|
19009
|
-
id: "
|
|
19010
|
-
method: "
|
|
19467
|
+
id: "pumpCycle.off",
|
|
19468
|
+
method: "setEnabled",
|
|
19011
19469
|
label: t("Pump cycle off", "Ciclo pompa spento"),
|
|
19012
19470
|
phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
|
|
19013
19471
|
icon: "timer-off",
|
|
19014
19472
|
args: { on: false }
|
|
19015
19473
|
},
|
|
19016
19474
|
{
|
|
19017
|
-
id: "
|
|
19018
|
-
method: "
|
|
19475
|
+
id: "pumpCycle.onMinutes",
|
|
19476
|
+
method: "setOnMinutes",
|
|
19019
19477
|
label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
|
|
19020
19478
|
phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
|
|
19021
19479
|
icon: "timer",
|
|
@@ -19031,8 +19489,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19031
19489
|
}]
|
|
19032
19490
|
},
|
|
19033
19491
|
{
|
|
19034
|
-
id: "
|
|
19035
|
-
method: "
|
|
19492
|
+
id: "pumpCycle.offMinutes",
|
|
19493
|
+
method: "setOffMinutes",
|
|
19036
19494
|
label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
|
|
19037
19495
|
phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
|
|
19038
19496
|
icon: "timer-off",
|
|
@@ -19046,35 +19504,63 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19046
19504
|
unit: "min"
|
|
19047
19505
|
}
|
|
19048
19506
|
}]
|
|
19049
|
-
},
|
|
19050
|
-
{
|
|
19051
|
-
id: "petFountain.resetDailyConsumption",
|
|
19052
|
-
method: "resetDailyConsumption",
|
|
19053
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19054
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19055
|
-
icon: "rotate-ccw"
|
|
19056
19507
|
}
|
|
19057
19508
|
],
|
|
19058
19509
|
state: [{
|
|
19059
19510
|
kind: "boolean",
|
|
19060
|
-
field: "
|
|
19061
|
-
label: t("
|
|
19062
|
-
whenTrue: t("When
|
|
19063
|
-
whenFalse: t("When
|
|
19064
|
-
icon: "
|
|
19065
|
-
}, {
|
|
19066
|
-
kind: "numeric",
|
|
19067
|
-
field: "waterLevel",
|
|
19068
|
-
quantity: t("the water level", "il livello dell’acqua"),
|
|
19069
|
-
label: t("Water level", "Livello dell’acqua"),
|
|
19070
|
-
unit: "%",
|
|
19071
|
-
icon: "droplets"
|
|
19511
|
+
field: "enabled",
|
|
19512
|
+
label: t("Pump cycle", "Ciclo pompa"),
|
|
19513
|
+
whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
|
|
19514
|
+
whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
|
|
19515
|
+
icon: "timer"
|
|
19072
19516
|
}]
|
|
19073
19517
|
},
|
|
19074
19518
|
"media-player": {
|
|
19075
19519
|
scope: "device",
|
|
19076
19520
|
noun: t("Media player", "Lettore multimediale"),
|
|
19077
19521
|
actions: [
|
|
19522
|
+
{
|
|
19523
|
+
id: "media.turnOn",
|
|
19524
|
+
method: "turnOn",
|
|
19525
|
+
label: t("Turn on", "Accendi"),
|
|
19526
|
+
phrase: t("Turn on {device}", "Accendi {device}"),
|
|
19527
|
+
icon: "power"
|
|
19528
|
+
},
|
|
19529
|
+
{
|
|
19530
|
+
id: "media.turnOff",
|
|
19531
|
+
method: "turnOff",
|
|
19532
|
+
label: t("Turn off", "Spegni"),
|
|
19533
|
+
phrase: t("Turn off {device}", "Spegni {device}"),
|
|
19534
|
+
icon: "power"
|
|
19535
|
+
},
|
|
19536
|
+
{
|
|
19537
|
+
id: "media.volumeUp",
|
|
19538
|
+
method: "volumeUp",
|
|
19539
|
+
label: t("Volume up", "Alza il volume"),
|
|
19540
|
+
phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
|
|
19541
|
+
icon: "volume-2"
|
|
19542
|
+
},
|
|
19543
|
+
{
|
|
19544
|
+
id: "media.volumeDown",
|
|
19545
|
+
method: "volumeDown",
|
|
19546
|
+
label: t("Volume down", "Abbassa il volume"),
|
|
19547
|
+
phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
|
|
19548
|
+
icon: "volume-2"
|
|
19549
|
+
},
|
|
19550
|
+
{
|
|
19551
|
+
id: "media.channelUp",
|
|
19552
|
+
method: "channelUp",
|
|
19553
|
+
label: t("Channel up", "Canale successivo"),
|
|
19554
|
+
phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
|
|
19555
|
+
icon: "skip-forward"
|
|
19556
|
+
},
|
|
19557
|
+
{
|
|
19558
|
+
id: "media.channelDown",
|
|
19559
|
+
method: "channelDown",
|
|
19560
|
+
label: t("Channel down", "Canale precedente"),
|
|
19561
|
+
phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
|
|
19562
|
+
icon: "skip-back"
|
|
19563
|
+
},
|
|
19078
19564
|
{
|
|
19079
19565
|
id: "media.play",
|
|
19080
19566
|
method: "play",
|
|
@@ -20961,6 +21447,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
20961
21447
|
"audio-analyzer": system(PIPELINE),
|
|
20962
21448
|
"audio-codec": system(INTERNAL),
|
|
20963
21449
|
"auth-provider": system(IDENTITY),
|
|
21450
|
+
"board-key-source": system(INTERNAL),
|
|
20964
21451
|
backup: system("system backups — run and restored from the Backups page"),
|
|
20965
21452
|
broker: system("message-broker connections — configured, not actuated"),
|
|
20966
21453
|
"calendar-source": system(INTERNAL),
|
|
@@ -45507,6 +45994,49 @@ object({
|
|
|
45507
45994
|
});
|
|
45508
45995
|
DeviceType.Sensor;
|
|
45509
45996
|
/**
|
|
45997
|
+
* Why a board key could not be read. Typed so a caller reports the cause and
|
|
45998
|
+
* never treats "could not read" as "has no key" (D49).
|
|
45999
|
+
*/
|
|
46000
|
+
var BoardKeyFailureReasonSchema = _enum([
|
|
46001
|
+
"unknown-source",
|
|
46002
|
+
"not-admin",
|
|
46003
|
+
"no-builder",
|
|
46004
|
+
"no-ingress-url",
|
|
46005
|
+
"unreachable",
|
|
46006
|
+
"unknown-board",
|
|
46007
|
+
"no-encryption-key",
|
|
46008
|
+
"unreadable-config"
|
|
46009
|
+
]);
|
|
46010
|
+
var BoardKeySourceSchema = object({
|
|
46011
|
+
sourceId: string(),
|
|
46012
|
+
name: string()
|
|
46013
|
+
});
|
|
46014
|
+
var BoardKeyBoardSchema = object({
|
|
46015
|
+
/** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
|
|
46016
|
+
configuration: string(),
|
|
46017
|
+
/** The node name the builder gives the board. */
|
|
46018
|
+
name: string(),
|
|
46019
|
+
/** The address the builder knows the board by, when it has one. */
|
|
46020
|
+
address: string().nullable()
|
|
46021
|
+
});
|
|
46022
|
+
var BoardKeyFailureSchema = object({
|
|
46023
|
+
ok: literal(false),
|
|
46024
|
+
reason: BoardKeyFailureReasonSchema,
|
|
46025
|
+
detail: string().optional()
|
|
46026
|
+
});
|
|
46027
|
+
var ListBoardsResultSchema = discriminatedUnion("ok", [object({
|
|
46028
|
+
ok: literal(true),
|
|
46029
|
+
boards: array(BoardKeyBoardSchema).readonly()
|
|
46030
|
+
}), BoardKeyFailureSchema]);
|
|
46031
|
+
var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
|
|
46032
|
+
ok: literal(true),
|
|
46033
|
+
key: string()
|
|
46034
|
+
}), BoardKeyFailureSchema]);
|
|
46035
|
+
method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
|
|
46036
|
+
sourceId: string().min(1),
|
|
46037
|
+
configuration: string().min(1)
|
|
46038
|
+
}), GetBoardKeyResultSchema, { auth: "admin" });
|
|
46039
|
+
/**
|
|
45510
46040
|
* Dimmable-light brightness control. Co-exists with `switch` on the
|
|
45511
46041
|
* same device — the switch toggles on/off, this cap sets the level
|
|
45512
46042
|
* applied when the light is on. Drivers map their per-vendor dim
|
|
@@ -47595,6 +48125,188 @@ DeviceType.Control, method(object({
|
|
|
47595
48125
|
kind: "mutation",
|
|
47596
48126
|
auth: "protected"
|
|
47597
48127
|
});
|
|
48128
|
+
/**
|
|
48129
|
+
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
48130
|
+
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
48131
|
+
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
48132
|
+
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
48133
|
+
*
|
|
48134
|
+
* The cap declares a wide method surface; not every backend supports
|
|
48135
|
+
* every method. Drivers signal sub-capability via the
|
|
48136
|
+
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
48137
|
+
* corresponding method) so the UI gates buttons without a slice
|
|
48138
|
+
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
48139
|
+
*/
|
|
48140
|
+
var MediaPlayerStateSchema = _enum([
|
|
48141
|
+
"off",
|
|
48142
|
+
"on",
|
|
48143
|
+
"idle",
|
|
48144
|
+
"playing",
|
|
48145
|
+
"paused",
|
|
48146
|
+
"buffering",
|
|
48147
|
+
"standby"
|
|
48148
|
+
]);
|
|
48149
|
+
var MediaPlayerRepeatSchema = _enum([
|
|
48150
|
+
"off",
|
|
48151
|
+
"all",
|
|
48152
|
+
"one"
|
|
48153
|
+
]);
|
|
48154
|
+
var MediaInfoSchema = object({
|
|
48155
|
+
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
48156
|
+
* `podcast`, …). */
|
|
48157
|
+
type: string(),
|
|
48158
|
+
/** Human-readable title. */
|
|
48159
|
+
title: string(),
|
|
48160
|
+
/** Optional artist / channel / station label. */
|
|
48161
|
+
artist: string().optional(),
|
|
48162
|
+
/** Optional album / season / show name. */
|
|
48163
|
+
album: string().optional(),
|
|
48164
|
+
/** Optional cover-art / thumbnail URL. */
|
|
48165
|
+
imageUrl: string().optional()
|
|
48166
|
+
});
|
|
48167
|
+
/**
|
|
48168
|
+
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
48169
|
+
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
48170
|
+
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
48171
|
+
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
48172
|
+
* guess, never as a reading.
|
|
48173
|
+
*/
|
|
48174
|
+
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
48175
|
+
/** The fields of a media-player status a driver can only guess. */
|
|
48176
|
+
var MediaPlayerAssumedFieldSchema = _enum([
|
|
48177
|
+
"state",
|
|
48178
|
+
"volumeLevel",
|
|
48179
|
+
"isMuted",
|
|
48180
|
+
"source"
|
|
48181
|
+
]);
|
|
48182
|
+
var MediaPlayerStatusSchema = object({
|
|
48183
|
+
/** Playback lifecycle state. */
|
|
48184
|
+
state: MediaPlayerStateSchema,
|
|
48185
|
+
/**
|
|
48186
|
+
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
48187
|
+
* A slice written before this field existed parses as `reported`.
|
|
48188
|
+
*/
|
|
48189
|
+
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
48190
|
+
/**
|
|
48191
|
+
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
48192
|
+
* this is not empty; a field not listed here is a reading even then (power
|
|
48193
|
+
* from a running-state source, mute guessed from the last send).
|
|
48194
|
+
*/
|
|
48195
|
+
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
48196
|
+
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
48197
|
+
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
48198
|
+
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
48199
|
+
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
48200
|
+
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
48201
|
+
isMuted: boolean().nullable(),
|
|
48202
|
+
/** Active source / input. Empty when no source surface. */
|
|
48203
|
+
source: string(),
|
|
48204
|
+
/** Selectable sources. Empty when no source surface.
|
|
48205
|
+
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
48206
|
+
availableSources: array(string()),
|
|
48207
|
+
/** Currently-playing media info. Null when nothing is playing. */
|
|
48208
|
+
currentMedia: MediaInfoSchema.nullable(),
|
|
48209
|
+
/** Current playback position in ms. Null when not seekable or
|
|
48210
|
+
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
48211
|
+
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
48212
|
+
/** Total duration of the current media in ms. Null when unknown
|
|
48213
|
+
* (live stream) or nothing is playing. */
|
|
48214
|
+
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
48215
|
+
/** Shuffle toggle. Null when no shuffle surface.
|
|
48216
|
+
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
48217
|
+
shuffle: boolean().nullable(),
|
|
48218
|
+
/** Repeat mode. Null when no repeat surface.
|
|
48219
|
+
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
48220
|
+
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
48221
|
+
/** Ms epoch when the slice was last updated. */
|
|
48222
|
+
lastChangedAt: number()
|
|
48223
|
+
});
|
|
48224
|
+
var stepInput = object({
|
|
48225
|
+
deviceId: number().int().nonnegative(),
|
|
48226
|
+
/** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
|
|
48227
|
+
steps: number().int().min(1).max(50).default(1)
|
|
48228
|
+
});
|
|
48229
|
+
var deviceOnly = object({ deviceId: number().int().nonnegative() });
|
|
48230
|
+
DeviceType.MediaPlayer, method(deviceOnly, _void(), {
|
|
48231
|
+
kind: "mutation",
|
|
48232
|
+
auth: "protected"
|
|
48233
|
+
}), method(deviceOnly, _void(), {
|
|
48234
|
+
kind: "mutation",
|
|
48235
|
+
auth: "protected"
|
|
48236
|
+
}), method(stepInput, _void(), {
|
|
48237
|
+
kind: "mutation",
|
|
48238
|
+
auth: "protected"
|
|
48239
|
+
}), method(stepInput, _void(), {
|
|
48240
|
+
kind: "mutation",
|
|
48241
|
+
auth: "protected"
|
|
48242
|
+
}), method(stepInput, _void(), {
|
|
48243
|
+
kind: "mutation",
|
|
48244
|
+
auth: "protected"
|
|
48245
|
+
}), method(stepInput, _void(), {
|
|
48246
|
+
kind: "mutation",
|
|
48247
|
+
auth: "protected"
|
|
48248
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48249
|
+
kind: "mutation",
|
|
48250
|
+
auth: "protected"
|
|
48251
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48252
|
+
kind: "mutation",
|
|
48253
|
+
auth: "protected"
|
|
48254
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48255
|
+
kind: "mutation",
|
|
48256
|
+
auth: "protected"
|
|
48257
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48258
|
+
kind: "mutation",
|
|
48259
|
+
auth: "protected"
|
|
48260
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48261
|
+
kind: "mutation",
|
|
48262
|
+
auth: "protected"
|
|
48263
|
+
}), method(object({
|
|
48264
|
+
deviceId: number().int().nonnegative(),
|
|
48265
|
+
position: number().int().nonnegative()
|
|
48266
|
+
}), _void(), {
|
|
48267
|
+
kind: "mutation",
|
|
48268
|
+
auth: "protected"
|
|
48269
|
+
}), method(object({
|
|
48270
|
+
deviceId: number().int().nonnegative(),
|
|
48271
|
+
volumeLevel: number().min(0).max(100)
|
|
48272
|
+
}), _void(), {
|
|
48273
|
+
kind: "mutation",
|
|
48274
|
+
auth: "protected"
|
|
48275
|
+
}), method(object({
|
|
48276
|
+
deviceId: number().int().nonnegative(),
|
|
48277
|
+
muted: boolean()
|
|
48278
|
+
}), _void(), {
|
|
48279
|
+
kind: "mutation",
|
|
48280
|
+
auth: "protected"
|
|
48281
|
+
}), method(object({
|
|
48282
|
+
deviceId: number().int().nonnegative(),
|
|
48283
|
+
shuffle: boolean()
|
|
48284
|
+
}), _void(), {
|
|
48285
|
+
kind: "mutation",
|
|
48286
|
+
auth: "protected"
|
|
48287
|
+
}), method(object({
|
|
48288
|
+
deviceId: number().int().nonnegative(),
|
|
48289
|
+
repeat: MediaPlayerRepeatSchema
|
|
48290
|
+
}), _void(), {
|
|
48291
|
+
kind: "mutation",
|
|
48292
|
+
auth: "protected"
|
|
48293
|
+
}), method(object({
|
|
48294
|
+
deviceId: number().int().nonnegative(),
|
|
48295
|
+
source: string().min(1)
|
|
48296
|
+
}), _void(), {
|
|
48297
|
+
kind: "mutation",
|
|
48298
|
+
auth: "protected"
|
|
48299
|
+
}), method(object({
|
|
48300
|
+
deviceId: number().int().nonnegative(),
|
|
48301
|
+
/** Media identifier / URL. */
|
|
48302
|
+
mediaId: string().min(1),
|
|
48303
|
+
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
48304
|
+
* passes it through to the upstream service. */
|
|
48305
|
+
mediaType: string().min(1)
|
|
48306
|
+
}), _void(), {
|
|
48307
|
+
kind: "mutation",
|
|
48308
|
+
auth: "protected"
|
|
48309
|
+
});
|
|
47598
48310
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
|
|
47599
48311
|
var NUMBER = {
|
|
47600
48312
|
kind: "fixed",
|
|
@@ -48042,49 +48754,6 @@ function actuator(input) {
|
|
|
48042
48754
|
};
|
|
48043
48755
|
}
|
|
48044
48756
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
48045
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
48046
|
-
"no-power-source",
|
|
48047
|
-
"switch-missing",
|
|
48048
|
-
"switch-offline",
|
|
48049
|
-
"switch-unknown",
|
|
48050
|
-
"restart-in-progress",
|
|
48051
|
-
"switch-call-failed"
|
|
48052
|
-
]);
|
|
48053
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
48054
|
-
accepted: literal(false),
|
|
48055
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
48056
|
-
/** One line for the operator, naming the switch. */
|
|
48057
|
-
message: string()
|
|
48058
|
-
})]);
|
|
48059
|
-
var PowerSourceInfoSchema = object({
|
|
48060
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
48061
|
-
linked: boolean(),
|
|
48062
|
-
switchDeviceId: number().nullable(),
|
|
48063
|
-
switchName: string().nullable(),
|
|
48064
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
48065
|
-
switchOn: boolean().nullable(),
|
|
48066
|
-
switchOnline: boolean().nullable(),
|
|
48067
|
-
restartInProgress: boolean(),
|
|
48068
|
-
offSeconds: number().int()
|
|
48069
|
-
});
|
|
48070
|
-
object({
|
|
48071
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
48072
|
-
switchOn: boolean().nullable(),
|
|
48073
|
-
offSeconds: number().int(),
|
|
48074
|
-
lastFetchedAt: number()
|
|
48075
|
-
});
|
|
48076
|
-
DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
48077
|
-
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
48078
|
-
systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48079
|
-
kind: "mutation",
|
|
48080
|
-
auth: "admin"
|
|
48081
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48082
|
-
kind: "mutation",
|
|
48083
|
-
auth: "admin"
|
|
48084
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48085
|
-
kind: "mutation",
|
|
48086
|
-
auth: "admin"
|
|
48087
|
-
});
|
|
48088
48757
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
48089
48758
|
DeviceType.Camera;
|
|
48090
48759
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
@@ -48112,6 +48781,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
48112
48781
|
}).optional()
|
|
48113
48782
|
})) });
|
|
48114
48783
|
/**
|
|
48784
|
+
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
48785
|
+
* `z.infer`, they do not restate the shape.
|
|
48786
|
+
*/
|
|
48787
|
+
var OverrideSourceSchema = object({
|
|
48788
|
+
addonId: string().min(1),
|
|
48789
|
+
stableId: string().min(1),
|
|
48790
|
+
cap: string().min(1),
|
|
48791
|
+
fieldPath: string().min(1)
|
|
48792
|
+
});
|
|
48793
|
+
var IdentityTransformDraftSchema = object({ kind: literal("identity") });
|
|
48794
|
+
var InvertTransformDraftSchema = object({ kind: literal("invert") });
|
|
48795
|
+
var ThresholdTransformDraftSchema = object({
|
|
48796
|
+
kind: literal("threshold"),
|
|
48797
|
+
comparison: _enum(["gte", "lte"]),
|
|
48798
|
+
threshold: number(),
|
|
48799
|
+
startDwellMs: number().nonnegative(),
|
|
48800
|
+
stopDwellMs: number().nonnegative()
|
|
48801
|
+
});
|
|
48802
|
+
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
48803
|
+
IdentityTransformDraftSchema,
|
|
48804
|
+
InvertTransformDraftSchema,
|
|
48805
|
+
ThresholdTransformDraftSchema,
|
|
48806
|
+
object({
|
|
48807
|
+
kind: literal("linear"),
|
|
48808
|
+
scale: number(),
|
|
48809
|
+
offset: number(),
|
|
48810
|
+
clampMin: number().optional(),
|
|
48811
|
+
clampMax: number().optional()
|
|
48812
|
+
}),
|
|
48813
|
+
object({
|
|
48814
|
+
kind: literal("enum-map"),
|
|
48815
|
+
mapping: record(string(), string().nullable())
|
|
48816
|
+
}),
|
|
48817
|
+
object({ kind: literal("number") })
|
|
48818
|
+
]);
|
|
48819
|
+
var ScalarOverrideDraftSchema = object({
|
|
48820
|
+
kind: literal("scalar"),
|
|
48821
|
+
cap: string().min(1),
|
|
48822
|
+
targetId: string().min(1),
|
|
48823
|
+
source: OverrideSourceSchema,
|
|
48824
|
+
transform: CustomizeTransformDraftSchema
|
|
48825
|
+
});
|
|
48826
|
+
var KeyedArrayOverrideDraftSchema = object({
|
|
48827
|
+
kind: literal("keyedArray"),
|
|
48828
|
+
cap: string().min(1),
|
|
48829
|
+
targetId: string().min(1),
|
|
48830
|
+
key: string().min(1),
|
|
48831
|
+
label: string().min(1),
|
|
48832
|
+
fieldPath: string().min(1),
|
|
48833
|
+
source: OverrideSourceSchema,
|
|
48834
|
+
transform: CustomizeTransformDraftSchema
|
|
48835
|
+
});
|
|
48836
|
+
var PulseOverrideDraftSchema = object({
|
|
48837
|
+
kind: literal("pulse"),
|
|
48838
|
+
cap: string().min(1),
|
|
48839
|
+
targetId: string().min(1),
|
|
48840
|
+
enabled: boolean(),
|
|
48841
|
+
debounceMs: number().nonnegative(),
|
|
48842
|
+
edges: array(_enum([
|
|
48843
|
+
"rising",
|
|
48844
|
+
"button",
|
|
48845
|
+
"native-event"
|
|
48846
|
+
])).min(1).optional(),
|
|
48847
|
+
sources: array(OverrideSourceSchema).min(1)
|
|
48848
|
+
});
|
|
48849
|
+
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
48850
|
+
"in-addition",
|
|
48851
|
+
"confirm",
|
|
48852
|
+
"replace"
|
|
48853
|
+
]).optional() });
|
|
48854
|
+
discriminatedUnion("kind", [
|
|
48855
|
+
ScalarOverrideDraftSchema,
|
|
48856
|
+
KeyedArrayOverrideDraftSchema,
|
|
48857
|
+
PulseOverrideDraftSchema,
|
|
48858
|
+
object({
|
|
48859
|
+
kind: literal("span"),
|
|
48860
|
+
cap: string().min(1),
|
|
48861
|
+
targetId: string().min(1),
|
|
48862
|
+
timeoutMs: number().nonnegative(),
|
|
48863
|
+
cooldownMs: number().nonnegative().optional(),
|
|
48864
|
+
sources: array(SpanSourceDraftSchema)
|
|
48865
|
+
})
|
|
48866
|
+
]);
|
|
48867
|
+
object({
|
|
48868
|
+
targetId: string().min(1),
|
|
48869
|
+
configured: boolean(),
|
|
48870
|
+
source: _enum(["native", "assigned"]),
|
|
48871
|
+
state: _enum([
|
|
48872
|
+
"active",
|
|
48873
|
+
"stale",
|
|
48874
|
+
"released",
|
|
48875
|
+
"unavailable"
|
|
48876
|
+
]),
|
|
48877
|
+
reason: string().nullable()
|
|
48878
|
+
});
|
|
48879
|
+
/**
|
|
48880
|
+
* What a running-threshold proposal says (planning#405). The schema is the
|
|
48881
|
+
* type: the algorithm, the capability method and the UI all read `z.infer`.
|
|
48882
|
+
*
|
|
48883
|
+
* A proposal is read-only advice: it carries the numbers it was derived from
|
|
48884
|
+
* (`evidence`) so the operator can judge it, and an `insufficient` answer names
|
|
48885
|
+
* WHY with a typed reason and the catalog defaults, never an invented number.
|
|
48886
|
+
*/
|
|
48887
|
+
var RunningProposalTierSchema = _enum(["raw", "5m"]);
|
|
48888
|
+
var RunningProposalConfidenceSchema = _enum([
|
|
48889
|
+
"high",
|
|
48890
|
+
"medium",
|
|
48891
|
+
"low"
|
|
48892
|
+
]);
|
|
48893
|
+
var RunningProposalInsufficientReasonSchema = _enum([
|
|
48894
|
+
"no-history",
|
|
48895
|
+
"span-too-short",
|
|
48896
|
+
"truncated",
|
|
48897
|
+
"no-idle-floor",
|
|
48898
|
+
"no-runs",
|
|
48899
|
+
"no-separation"
|
|
48900
|
+
]);
|
|
48901
|
+
var RunningProposalReplaySchema = object({
|
|
48902
|
+
/** Intervals the real dwell expression held true over the window. */
|
|
48903
|
+
intervals: number().int().nonnegative(),
|
|
48904
|
+
/** Intervals outside every run, or a second interval inside one. */
|
|
48905
|
+
extra: number().int().nonnegative(),
|
|
48906
|
+
/** Runs without an interval of their own (none, or merged into a neighbour). */
|
|
48907
|
+
missed: number().int().nonnegative()
|
|
48908
|
+
});
|
|
48909
|
+
var RunningProposalEvidenceSchema = object({
|
|
48910
|
+
tier: RunningProposalTierSchema,
|
|
48911
|
+
spanMs: number().nonnegative(),
|
|
48912
|
+
from: number(),
|
|
48913
|
+
to: number(),
|
|
48914
|
+
points: number().int().nonnegative(),
|
|
48915
|
+
runsFound: number().int().nonnegative(),
|
|
48916
|
+
pausesFound: number().int().nonnegative(),
|
|
48917
|
+
longestPauseMs: number().nonnegative(),
|
|
48918
|
+
idleFloorW: number(),
|
|
48919
|
+
noiseCeilingW: number(),
|
|
48920
|
+
plateauW: number(),
|
|
48921
|
+
replay: RunningProposalReplaySchema
|
|
48922
|
+
});
|
|
48923
|
+
var RunningProposalInsufficientEvidenceSchema = object({
|
|
48924
|
+
spanMs: number().nonnegative(),
|
|
48925
|
+
points: number().int().nonnegative(),
|
|
48926
|
+
runsFound: number().int().nonnegative()
|
|
48927
|
+
});
|
|
48928
|
+
var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
|
|
48929
|
+
state: literal("proposal"),
|
|
48930
|
+
transform: ThresholdTransformDraftSchema,
|
|
48931
|
+
evidence: RunningProposalEvidenceSchema,
|
|
48932
|
+
confidence: RunningProposalConfidenceSchema,
|
|
48933
|
+
/** Why the confidence is not higher; empty when nothing held it back. */
|
|
48934
|
+
notes: array(string())
|
|
48935
|
+
}), object({
|
|
48936
|
+
state: literal("insufficient"),
|
|
48937
|
+
reason: RunningProposalInsufficientReasonSchema,
|
|
48938
|
+
evidence: RunningProposalInsufficientEvidenceSchema,
|
|
48939
|
+
/** The catalog defaults, offered as what stands when nothing better is known. */
|
|
48940
|
+
fallback: ThresholdTransformDraftSchema
|
|
48941
|
+
})]);
|
|
48942
|
+
/**
|
|
48115
48943
|
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
48116
48944
|
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
48117
48945
|
*
|
|
@@ -48401,6 +49229,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
48401
49229
|
kind: "mutation",
|
|
48402
49230
|
auth: "admin",
|
|
48403
49231
|
access: "view"
|
|
49232
|
+
}), method(object({
|
|
49233
|
+
deviceId: number().int(),
|
|
49234
|
+
cap: string().min(1),
|
|
49235
|
+
fieldPath: string().min(1),
|
|
49236
|
+
deviceType: _enum(DeviceType).optional()
|
|
49237
|
+
}), RunningThresholdProposalSchema, {
|
|
49238
|
+
auth: "admin",
|
|
49239
|
+
access: "view"
|
|
48404
49240
|
}), method(object({
|
|
48405
49241
|
blockId: string().min(1),
|
|
48406
49242
|
trace: AutomationRunTraceSchema.optional(),
|
|
@@ -49209,7 +50045,53 @@ method(object({
|
|
|
49209
50045
|
* exposes only the COMMON surface: link state, supported device
|
|
49210
50046
|
* kinds (so the UI can filter the device picker), and per-device
|
|
49211
50047
|
* expose/unexpose.
|
|
50048
|
+
*
|
|
50049
|
+
* INSTANCES. One export addon can serve several independent targets (a
|
|
50050
|
+
* HomeKit bridge, a Home Assistant broker). `listInstances` names them.
|
|
50051
|
+
* `instanceId` on a READ is optional: absent = the whole addon (linked if any
|
|
50052
|
+
* enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
|
|
50053
|
+
* default instance's); present = that instance; an id the provider does not
|
|
50054
|
+
* serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
|
|
50055
|
+
* never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
|
|
50056
|
+
* change always names the target it changes. A single-instance provider
|
|
50057
|
+
* accepts an absent id on a read or its own id, and refuses any other.
|
|
50058
|
+
*/
|
|
50059
|
+
/** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
|
|
50060
|
+
var InstanceIdSchema$1 = string().min(1);
|
|
50061
|
+
var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
|
|
50062
|
+
/** One independent export target of an addon. */
|
|
50063
|
+
var ExportInstanceSchema = object({
|
|
50064
|
+
instanceId: InstanceIdSchema$1,
|
|
50065
|
+
name: string(),
|
|
50066
|
+
enabled: boolean(),
|
|
50067
|
+
kind: string().optional()
|
|
50068
|
+
});
|
|
50069
|
+
var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
|
|
50070
|
+
/** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
|
|
50071
|
+
var ExportInstanceUnknownError = class extends Error {
|
|
50072
|
+
code = EXPORT_INSTANCE_UNKNOWN;
|
|
50073
|
+
instanceId;
|
|
50074
|
+
constructor(addon, instanceId) {
|
|
50075
|
+
super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
|
|
50076
|
+
this.name = "ExportInstanceUnknownError";
|
|
50077
|
+
this.instanceId = instanceId;
|
|
50078
|
+
}
|
|
50079
|
+
};
|
|
50080
|
+
/**
|
|
50081
|
+
* The instance a `getStatus` call names. The cap's `status` block injects a per-device
|
|
50082
|
+
* `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
|
|
50083
|
+
* both shapes; only the second names an instance (a per-device status read is addon-wide).
|
|
49212
50084
|
*/
|
|
50085
|
+
function statusInstanceOf(input) {
|
|
50086
|
+
return "instanceId" in input ? input.instanceId : void 0;
|
|
50087
|
+
}
|
|
50088
|
+
/**
|
|
50089
|
+
* A single-instance provider's check: an absent id or its own passes, any other throws
|
|
50090
|
+
* `ExportInstanceUnknownError`.
|
|
50091
|
+
*/
|
|
50092
|
+
function assertOwnExportInstance(addon, own, instanceId) {
|
|
50093
|
+
if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
|
|
50094
|
+
}
|
|
49213
50095
|
var LinkStateSchema = _enum([
|
|
49214
50096
|
"unlinked",
|
|
49215
50097
|
"linked",
|
|
@@ -49260,10 +50142,14 @@ var ExposedDeviceSchema = object({
|
|
|
49260
50142
|
capabilities: array(string()).optional()
|
|
49261
50143
|
});
|
|
49262
50144
|
var ExposeInputSchema = object({
|
|
50145
|
+
instanceId: InstanceIdSchema$1,
|
|
49263
50146
|
deviceId: string(),
|
|
49264
50147
|
capabilities: array(string()).optional()
|
|
49265
50148
|
});
|
|
49266
|
-
var UnexposeInputSchema = object({
|
|
50149
|
+
var UnexposeInputSchema = object({
|
|
50150
|
+
instanceId: InstanceIdSchema$1,
|
|
50151
|
+
deviceId: string()
|
|
50152
|
+
});
|
|
49267
50153
|
/**
|
|
49268
50154
|
* What an exporter may expose besides devices (D968). An action and a
|
|
49269
50155
|
* notification target are LIST ENTRIES, never devices (D954): they enter an
|
|
@@ -49292,8 +50178,14 @@ var ExposedEntitySchema = object({
|
|
|
49292
50178
|
entity: ExportEntityRefSchema,
|
|
49293
50179
|
exposedAs: string().optional()
|
|
49294
50180
|
});
|
|
49295
|
-
var ExposeEntityInputSchema = object({
|
|
49296
|
-
|
|
50181
|
+
var ExposeEntityInputSchema = object({
|
|
50182
|
+
instanceId: InstanceIdSchema$1,
|
|
50183
|
+
entity: ExportEntityRefSchema
|
|
50184
|
+
});
|
|
50185
|
+
var UnexposeEntityInputSchema = object({
|
|
50186
|
+
instanceId: InstanceIdSchema$1,
|
|
50187
|
+
entity: ExportEntityRefSchema
|
|
50188
|
+
});
|
|
49297
50189
|
var deviceExportCapability = {
|
|
49298
50190
|
name: "device-export",
|
|
49299
50191
|
scope: "system",
|
|
@@ -49313,9 +50205,10 @@ var deviceExportCapability = {
|
|
|
49313
50205
|
*/
|
|
49314
50206
|
exposesDeviceSettings: true,
|
|
49315
50207
|
methods: {
|
|
49316
|
-
getStatus: method(
|
|
49317
|
-
|
|
49318
|
-
|
|
50208
|
+
getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
|
|
50209
|
+
listInstances: method(_void(), array(ExportInstanceSchema)),
|
|
50210
|
+
listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
|
|
50211
|
+
listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
|
|
49319
50212
|
exposeDevice: method(ExposeInputSchema, _void(), {
|
|
49320
50213
|
kind: "mutation",
|
|
49321
50214
|
auth: "admin"
|
|
@@ -49325,7 +50218,7 @@ var deviceExportCapability = {
|
|
|
49325
50218
|
auth: "admin"
|
|
49326
50219
|
}),
|
|
49327
50220
|
listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
|
|
49328
|
-
listExposedEntities: optionalMethod(
|
|
50221
|
+
listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
|
|
49329
50222
|
exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
|
|
49330
50223
|
kind: "mutation",
|
|
49331
50224
|
auth: "admin"
|
|
@@ -51209,7 +52102,7 @@ object({
|
|
|
51209
52102
|
/** Ms epoch of the last value received from the appliance; 0 = never. */
|
|
51210
52103
|
lastFetchedAt: number()
|
|
51211
52104
|
});
|
|
51212
|
-
var DeviceIdSchema$
|
|
52105
|
+
var DeviceIdSchema$2 = number().int().nonnegative();
|
|
51213
52106
|
/** A value a program option or setting can take. */
|
|
51214
52107
|
var DishwasherValueSchema = union([
|
|
51215
52108
|
boolean(),
|
|
@@ -51273,77 +52166,77 @@ var DishwasherOptionsSchema = object({
|
|
|
51273
52166
|
options: array(DishwasherOptionDescriptorSchema)
|
|
51274
52167
|
});
|
|
51275
52168
|
DeviceType.Dishwasher, method(object({
|
|
51276
|
-
deviceId: DeviceIdSchema$
|
|
52169
|
+
deviceId: DeviceIdSchema$2,
|
|
51277
52170
|
program: string().min(1).optional(),
|
|
51278
52171
|
options: record(string(), DishwasherValueSchema).optional()
|
|
51279
52172
|
}), _void(), {
|
|
51280
52173
|
kind: "mutation",
|
|
51281
52174
|
auth: "protected"
|
|
51282
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52175
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51283
52176
|
kind: "mutation",
|
|
51284
52177
|
auth: "protected"
|
|
51285
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52178
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51286
52179
|
kind: "mutation",
|
|
51287
52180
|
auth: "protected"
|
|
51288
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52181
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51289
52182
|
kind: "mutation",
|
|
51290
52183
|
auth: "protected"
|
|
51291
52184
|
}), method(object({
|
|
51292
|
-
deviceId: DeviceIdSchema$
|
|
52185
|
+
deviceId: DeviceIdSchema$2,
|
|
51293
52186
|
program: string().min(1)
|
|
51294
52187
|
}), _void(), {
|
|
51295
52188
|
kind: "mutation",
|
|
51296
52189
|
auth: "protected"
|
|
51297
52190
|
}), method(object({
|
|
51298
|
-
deviceId: DeviceIdSchema$
|
|
52191
|
+
deviceId: DeviceIdSchema$2,
|
|
51299
52192
|
on: boolean()
|
|
51300
52193
|
}), _void(), {
|
|
51301
52194
|
kind: "mutation",
|
|
51302
52195
|
auth: "protected"
|
|
51303
52196
|
}), method(object({
|
|
51304
|
-
deviceId: DeviceIdSchema$
|
|
52197
|
+
deviceId: DeviceIdSchema$2,
|
|
51305
52198
|
on: boolean()
|
|
51306
52199
|
}), _void(), {
|
|
51307
52200
|
kind: "mutation",
|
|
51308
52201
|
auth: "protected"
|
|
51309
52202
|
}), method(object({
|
|
51310
|
-
deviceId: DeviceIdSchema$
|
|
52203
|
+
deviceId: DeviceIdSchema$2,
|
|
51311
52204
|
on: boolean()
|
|
51312
52205
|
}), _void(), {
|
|
51313
52206
|
kind: "mutation",
|
|
51314
52207
|
auth: "protected"
|
|
51315
52208
|
}), method(object({
|
|
51316
|
-
deviceId: DeviceIdSchema$
|
|
52209
|
+
deviceId: DeviceIdSchema$2,
|
|
51317
52210
|
on: boolean()
|
|
51318
52211
|
}), _void(), {
|
|
51319
52212
|
kind: "mutation",
|
|
51320
52213
|
auth: "protected"
|
|
51321
52214
|
}), method(object({
|
|
51322
|
-
deviceId: DeviceIdSchema$
|
|
52215
|
+
deviceId: DeviceIdSchema$2,
|
|
51323
52216
|
on: boolean()
|
|
51324
52217
|
}), _void(), {
|
|
51325
52218
|
kind: "mutation",
|
|
51326
52219
|
auth: "protected"
|
|
51327
52220
|
}), method(object({
|
|
51328
|
-
deviceId: DeviceIdSchema$
|
|
52221
|
+
deviceId: DeviceIdSchema$2,
|
|
51329
52222
|
on: boolean()
|
|
51330
52223
|
}), _void(), {
|
|
51331
52224
|
kind: "mutation",
|
|
51332
52225
|
auth: "protected"
|
|
51333
52226
|
}), method(object({
|
|
51334
|
-
deviceId: DeviceIdSchema$
|
|
52227
|
+
deviceId: DeviceIdSchema$2,
|
|
51335
52228
|
on: boolean()
|
|
51336
52229
|
}), _void(), {
|
|
51337
52230
|
kind: "mutation",
|
|
51338
52231
|
auth: "protected"
|
|
51339
52232
|
}), method(object({
|
|
51340
|
-
deviceId: DeviceIdSchema$
|
|
52233
|
+
deviceId: DeviceIdSchema$2,
|
|
51341
52234
|
key: string().min(1),
|
|
51342
52235
|
value: DishwasherValueSchema
|
|
51343
52236
|
}), _void(), {
|
|
51344
52237
|
kind: "mutation",
|
|
51345
52238
|
auth: "protected"
|
|
51346
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52239
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
|
|
51347
52240
|
/**
|
|
51348
52241
|
* Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
|
|
51349
52242
|
* not entries. `heatmapScrub` is a mark, not an event kind.
|
|
@@ -52530,15 +53423,15 @@ var FanPresetCaptureResultSchema = object({
|
|
|
52530
53423
|
items: array(FanCaptureItemSchema),
|
|
52531
53424
|
omitted: array(FanCaptureOmissionSchema)
|
|
52532
53425
|
});
|
|
52533
|
-
var deviceInput$
|
|
53426
|
+
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
52534
53427
|
DeviceType.Fan;
|
|
52535
|
-
method(deviceInput$
|
|
53428
|
+
method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
52536
53429
|
kind: "mutation",
|
|
52537
53430
|
auth: "admin"
|
|
52538
|
-
}), method(deviceInput$
|
|
53431
|
+
}), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
52539
53432
|
kind: "mutation",
|
|
52540
53433
|
auth: "protected"
|
|
52541
|
-
}), method(deviceInput$
|
|
53434
|
+
}), method(deviceInput$2.extend({
|
|
52542
53435
|
fields: array(FanCaptureFieldSchema).optional(),
|
|
52543
53436
|
steps: array(ActionStepSchema).max(20).default([])
|
|
52544
53437
|
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
@@ -52927,15 +53820,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
52927
53820
|
* branch on CAP — never on addon name. `device-adoption` integrations
|
|
52928
53821
|
* (Home Assistant, …) route through the broker step (Approach A);
|
|
52929
53822
|
* `device-provider` integrations (Reolink/ONVIF) keep the
|
|
52930
|
-
* legacy config → discovery flow.
|
|
52931
|
-
* connection as typed records (`integration-instances`, D985): no devices,
|
|
52932
|
-
* no discovery.
|
|
53823
|
+
* legacy config → discovery flow.
|
|
52933
53824
|
*/
|
|
52934
|
-
kind: _enum([
|
|
52935
|
-
"device-adoption",
|
|
52936
|
-
"device-provider",
|
|
52937
|
-
"connection"
|
|
52938
|
-
]),
|
|
53825
|
+
kind: _enum(["device-adoption", "device-provider"]),
|
|
52939
53826
|
/**
|
|
52940
53827
|
* For `device-adoption` addons: the broker kind to create/link
|
|
52941
53828
|
* (e.g. `home-assistant`), declared in the addon manifest. `null` for
|
|
@@ -53049,18 +53936,17 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
53049
53936
|
});
|
|
53050
53937
|
/**
|
|
53051
53938
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
53052
|
-
* (an account, a relay, a destination) as typed records,
|
|
53053
|
-
*
|
|
53939
|
+
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
53940
|
+
* own function page reads and writes them (Logging for Loki); the Integrations
|
|
53941
|
+
* page lists only the integrations that bring devices (D996).
|
|
53054
53942
|
*
|
|
53055
|
-
* A collection of providers: each addon that holds connections registers one
|
|
53056
|
-
*
|
|
53057
|
-
* `addonId`. It is internal and has no route: the operator-facing surface is
|
|
53058
|
-
* the `integrations` cap, which keeps ONE list.
|
|
53943
|
+
* A collection of providers: each addon that holds connections registers one and a
|
|
53944
|
+
* caller reaches a provider with the pinned `addonId`.
|
|
53059
53945
|
*
|
|
53060
|
-
* Identity: the instance id
|
|
53061
|
-
*
|
|
53062
|
-
*
|
|
53063
|
-
* editable label.
|
|
53946
|
+
* Identity: the instance id is immutable and opaque to the caller. A record the
|
|
53947
|
+
* Loki migration made keeps the `integrations` registry id it was created under
|
|
53948
|
+
* (`int_NNNN`); a single instance made by its function page takes the addon id.
|
|
53949
|
+
* `name` is the editable label.
|
|
53064
53950
|
*
|
|
53065
53951
|
* Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
|
|
53066
53952
|
* the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
|
|
@@ -53069,13 +53955,65 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
53069
53955
|
*/
|
|
53070
53956
|
var ConfigSchemaPassthrough$3 = custom();
|
|
53071
53957
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
53958
|
+
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
53959
|
+
/**
|
|
53960
|
+
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
53961
|
+
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
53962
|
+
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
53963
|
+
* interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
|
|
53964
|
+
* instance id.
|
|
53965
|
+
*/
|
|
53966
|
+
var IntegrationInstanceKindSchema = object({
|
|
53967
|
+
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
53968
|
+
id: string().min(1),
|
|
53969
|
+
label: string().min(1),
|
|
53970
|
+
/** The kind signs in through a server-held interactive session. */
|
|
53971
|
+
signIn: object({
|
|
53972
|
+
basePath: string().min(1),
|
|
53973
|
+
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
53974
|
+
}).optional(),
|
|
53975
|
+
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
53976
|
+
connectPath: string().min(1).optional(),
|
|
53977
|
+
/** Relative hub path to disconnect that account. */
|
|
53978
|
+
disconnectPath: string().min(1).optional()
|
|
53979
|
+
});
|
|
53072
53980
|
var IntegrationInstanceDescriptionSchema = object({
|
|
53981
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
53982
|
+
role: _enum([
|
|
53983
|
+
"devices",
|
|
53984
|
+
"services",
|
|
53985
|
+
"both"
|
|
53986
|
+
]),
|
|
53987
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
53988
|
+
discovery: object({
|
|
53989
|
+
mode: _enum([
|
|
53990
|
+
"none",
|
|
53991
|
+
"lan",
|
|
53992
|
+
"account"
|
|
53993
|
+
]),
|
|
53994
|
+
scopedToInstance: boolean()
|
|
53995
|
+
}).optional(),
|
|
53073
53996
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
53074
|
-
instanceMode:
|
|
53997
|
+
instanceMode: IntegrationInstanceModeSchema,
|
|
53075
53998
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
53076
53999
|
kind: string(),
|
|
53077
54000
|
/** True when `testInstance` really probes the remote. */
|
|
53078
|
-
canTest: boolean()
|
|
54001
|
+
canTest: boolean(),
|
|
54002
|
+
/**
|
|
54003
|
+
* The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
|
|
54004
|
+
* Add flow asks which first and sends it as `createInstance.kind`.
|
|
54005
|
+
*/
|
|
54006
|
+
kinds: array(IntegrationInstanceKindSchema).optional(),
|
|
54007
|
+
/**
|
|
54008
|
+
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
54009
|
+
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
54010
|
+
*/
|
|
54011
|
+
allowRestoreId: boolean().optional(),
|
|
54012
|
+
/**
|
|
54013
|
+
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
54014
|
+
* send an id (the UI then mints an opaque one).
|
|
54015
|
+
*/
|
|
54016
|
+
mintsId: boolean().optional()
|
|
53079
54017
|
});
|
|
53080
54018
|
var IntegrationInstanceStatusSchema = object({
|
|
53081
54019
|
state: _enum([
|
|
@@ -53084,16 +54022,28 @@ var IntegrationInstanceStatusSchema = object({
|
|
|
53084
54022
|
"error",
|
|
53085
54023
|
"unknown"
|
|
53086
54024
|
]),
|
|
53087
|
-
detail: string().optional()
|
|
54025
|
+
detail: string().optional(),
|
|
54026
|
+
/** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
|
|
54027
|
+
label: string().optional()
|
|
53088
54028
|
});
|
|
53089
54029
|
var IntegrationInstanceSchema = object({
|
|
53090
54030
|
id: IntegrationInstanceIdSchema,
|
|
53091
54031
|
name: string(),
|
|
53092
54032
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
53093
54033
|
configured: boolean(),
|
|
54034
|
+
/**
|
|
54035
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
54036
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
54037
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
54038
|
+
*/
|
|
54039
|
+
enabled: boolean().optional(),
|
|
54040
|
+
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
54041
|
+
kind: string().optional(),
|
|
53094
54042
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
53095
54043
|
formValues: record(string(), unknown()),
|
|
53096
|
-
status: IntegrationInstanceStatusSchema.optional()
|
|
54044
|
+
status: IntegrationInstanceStatusSchema.optional(),
|
|
54045
|
+
/** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
|
|
54046
|
+
lastCheckedAt: number().optional()
|
|
53097
54047
|
});
|
|
53098
54048
|
var IntegrationInstancePatchSchema = object({
|
|
53099
54049
|
id: IntegrationInstanceIdSchema,
|
|
@@ -53101,13 +54051,32 @@ var IntegrationInstancePatchSchema = object({
|
|
|
53101
54051
|
/** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
|
|
53102
54052
|
values: record(string(), unknown())
|
|
53103
54053
|
});
|
|
53104
|
-
method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
|
|
54054
|
+
method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
|
|
54055
|
+
id: IntegrationInstanceIdSchema.optional(),
|
|
54056
|
+
name: string().min(1),
|
|
54057
|
+
kind: string().min(1).optional()
|
|
54058
|
+
}), object({ id: string() }), {
|
|
54059
|
+
kind: "mutation",
|
|
54060
|
+
auth: "admin"
|
|
54061
|
+
}), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
|
|
54062
|
+
kind: "mutation",
|
|
54063
|
+
auth: "admin"
|
|
54064
|
+
}), method(object({
|
|
53105
54065
|
id: IntegrationInstanceIdSchema,
|
|
53106
|
-
|
|
53107
|
-
}), object({
|
|
54066
|
+
enabled: boolean()
|
|
54067
|
+
}), object({ ok: literal(true) }), {
|
|
54068
|
+
kind: "mutation",
|
|
54069
|
+
auth: "admin"
|
|
54070
|
+
}), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
|
|
54071
|
+
kind: "mutation",
|
|
54072
|
+
auth: "admin"
|
|
54073
|
+
}), optionalMethod(object({
|
|
53108
54074
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
53109
54075
|
values: record(string(), unknown())
|
|
53110
|
-
}), TestConnectionResultSchema$1, {
|
|
54076
|
+
}), TestConnectionResultSchema$1, {
|
|
54077
|
+
kind: "mutation",
|
|
54078
|
+
auth: "admin"
|
|
54079
|
+
});
|
|
53111
54080
|
/**
|
|
53112
54081
|
* Two-way audio / talk-back cap. Clients open a WebRTC audio-only
|
|
53113
54082
|
* session (server-initiated offer pattern, identical to the main
|
|
@@ -54906,6 +55875,11 @@ var LogEntrySchema = object({
|
|
|
54906
55875
|
* flight, and not asking for the next slice ends the scan.
|
|
54907
55876
|
*/
|
|
54908
55877
|
var LogReadQuerySchema = object({
|
|
55878
|
+
/**
|
|
55879
|
+
* Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
|
|
55880
|
+
* the provider's first readable one, so a caller written before instances existed is unchanged.
|
|
55881
|
+
*/
|
|
55882
|
+
instanceId: string().min(1).max(200).optional(),
|
|
54909
55883
|
/** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
|
|
54910
55884
|
requestId: string().min(1).max(64).optional(),
|
|
54911
55885
|
/** The device the line is about (`tags.deviceId`, numeric). */
|
|
@@ -54968,6 +55942,8 @@ var LogReadResultSchema = object({
|
|
|
54968
55942
|
/** True when `cancelRead` ended this slice early. */
|
|
54969
55943
|
cancelled: boolean().optional()
|
|
54970
55944
|
});
|
|
55945
|
+
/** Names one destination instance; absent ⇒ the provider's first readable one. */
|
|
55946
|
+
var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
|
|
54971
55947
|
var LogReadCapabilitiesSchema = object({
|
|
54972
55948
|
/** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
|
|
54973
55949
|
readable: boolean(),
|
|
@@ -54986,7 +55962,7 @@ var LogReadCapabilitiesSchema = object({
|
|
|
54986
55962
|
/** How far back the store reaches, when the provider knows (days). */
|
|
54987
55963
|
retentionDays: number().nullable()
|
|
54988
55964
|
});
|
|
54989
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(
|
|
55965
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
|
|
54990
55966
|
kind: "mutation",
|
|
54991
55967
|
auth: "admin"
|
|
54992
55968
|
});
|
|
@@ -55090,164 +56066,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
55090
56066
|
]);
|
|
55091
56067
|
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
55092
56068
|
/**
|
|
55093
|
-
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
55094
|
-
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
55095
|
-
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
55096
|
-
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
55097
|
-
*
|
|
55098
|
-
* The cap declares a wide method surface; not every backend supports
|
|
55099
|
-
* every method. Drivers signal sub-capability via the
|
|
55100
|
-
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
55101
|
-
* corresponding method) so the UI gates buttons without a slice
|
|
55102
|
-
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
55103
|
-
*/
|
|
55104
|
-
var MediaPlayerStateSchema = _enum([
|
|
55105
|
-
"off",
|
|
55106
|
-
"on",
|
|
55107
|
-
"idle",
|
|
55108
|
-
"playing",
|
|
55109
|
-
"paused",
|
|
55110
|
-
"buffering",
|
|
55111
|
-
"standby"
|
|
55112
|
-
]);
|
|
55113
|
-
var MediaPlayerRepeatSchema = _enum([
|
|
55114
|
-
"off",
|
|
55115
|
-
"all",
|
|
55116
|
-
"one"
|
|
55117
|
-
]);
|
|
55118
|
-
var MediaInfoSchema = object({
|
|
55119
|
-
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
55120
|
-
* `podcast`, …). */
|
|
55121
|
-
type: string(),
|
|
55122
|
-
/** Human-readable title. */
|
|
55123
|
-
title: string(),
|
|
55124
|
-
/** Optional artist / channel / station label. */
|
|
55125
|
-
artist: string().optional(),
|
|
55126
|
-
/** Optional album / season / show name. */
|
|
55127
|
-
album: string().optional(),
|
|
55128
|
-
/** Optional cover-art / thumbnail URL. */
|
|
55129
|
-
imageUrl: string().optional()
|
|
55130
|
-
});
|
|
55131
|
-
/**
|
|
55132
|
-
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
55133
|
-
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
55134
|
-
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
55135
|
-
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
55136
|
-
* guess, never as a reading.
|
|
55137
|
-
*/
|
|
55138
|
-
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
55139
|
-
/** The fields of a media-player status a driver can only guess. */
|
|
55140
|
-
var MediaPlayerAssumedFieldSchema = _enum([
|
|
55141
|
-
"state",
|
|
55142
|
-
"volumeLevel",
|
|
55143
|
-
"isMuted",
|
|
55144
|
-
"source"
|
|
55145
|
-
]);
|
|
55146
|
-
object({
|
|
55147
|
-
/** Playback lifecycle state. */
|
|
55148
|
-
state: MediaPlayerStateSchema,
|
|
55149
|
-
/**
|
|
55150
|
-
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
55151
|
-
* A slice written before this field existed parses as `reported`.
|
|
55152
|
-
*/
|
|
55153
|
-
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
55154
|
-
/**
|
|
55155
|
-
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
55156
|
-
* this is not empty; a field not listed here is a reading even then (power
|
|
55157
|
-
* from a running-state source, mute guessed from the last send).
|
|
55158
|
-
*/
|
|
55159
|
-
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
55160
|
-
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
55161
|
-
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
55162
|
-
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
55163
|
-
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
55164
|
-
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
55165
|
-
isMuted: boolean().nullable(),
|
|
55166
|
-
/** Active source / input. Empty when no source surface. */
|
|
55167
|
-
source: string(),
|
|
55168
|
-
/** Selectable sources. Empty when no source surface.
|
|
55169
|
-
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
55170
|
-
availableSources: array(string()),
|
|
55171
|
-
/** Currently-playing media info. Null when nothing is playing. */
|
|
55172
|
-
currentMedia: MediaInfoSchema.nullable(),
|
|
55173
|
-
/** Current playback position in ms. Null when not seekable or
|
|
55174
|
-
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
55175
|
-
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
55176
|
-
/** Total duration of the current media in ms. Null when unknown
|
|
55177
|
-
* (live stream) or nothing is playing. */
|
|
55178
|
-
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
55179
|
-
/** Shuffle toggle. Null when no shuffle surface.
|
|
55180
|
-
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
55181
|
-
shuffle: boolean().nullable(),
|
|
55182
|
-
/** Repeat mode. Null when no repeat surface.
|
|
55183
|
-
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
55184
|
-
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
55185
|
-
/** Ms epoch when the slice was last updated. */
|
|
55186
|
-
lastChangedAt: number()
|
|
55187
|
-
});
|
|
55188
|
-
DeviceType.MediaPlayer, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55189
|
-
kind: "mutation",
|
|
55190
|
-
auth: "protected"
|
|
55191
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55192
|
-
kind: "mutation",
|
|
55193
|
-
auth: "protected"
|
|
55194
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55195
|
-
kind: "mutation",
|
|
55196
|
-
auth: "protected"
|
|
55197
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55198
|
-
kind: "mutation",
|
|
55199
|
-
auth: "protected"
|
|
55200
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55201
|
-
kind: "mutation",
|
|
55202
|
-
auth: "protected"
|
|
55203
|
-
}), method(object({
|
|
55204
|
-
deviceId: number().int().nonnegative(),
|
|
55205
|
-
position: number().int().nonnegative()
|
|
55206
|
-
}), _void(), {
|
|
55207
|
-
kind: "mutation",
|
|
55208
|
-
auth: "protected"
|
|
55209
|
-
}), method(object({
|
|
55210
|
-
deviceId: number().int().nonnegative(),
|
|
55211
|
-
volumeLevel: number().min(0).max(100)
|
|
55212
|
-
}), _void(), {
|
|
55213
|
-
kind: "mutation",
|
|
55214
|
-
auth: "protected"
|
|
55215
|
-
}), method(object({
|
|
55216
|
-
deviceId: number().int().nonnegative(),
|
|
55217
|
-
muted: boolean()
|
|
55218
|
-
}), _void(), {
|
|
55219
|
-
kind: "mutation",
|
|
55220
|
-
auth: "protected"
|
|
55221
|
-
}), method(object({
|
|
55222
|
-
deviceId: number().int().nonnegative(),
|
|
55223
|
-
shuffle: boolean()
|
|
55224
|
-
}), _void(), {
|
|
55225
|
-
kind: "mutation",
|
|
55226
|
-
auth: "protected"
|
|
55227
|
-
}), method(object({
|
|
55228
|
-
deviceId: number().int().nonnegative(),
|
|
55229
|
-
repeat: MediaPlayerRepeatSchema
|
|
55230
|
-
}), _void(), {
|
|
55231
|
-
kind: "mutation",
|
|
55232
|
-
auth: "protected"
|
|
55233
|
-
}), method(object({
|
|
55234
|
-
deviceId: number().int().nonnegative(),
|
|
55235
|
-
source: string().min(1)
|
|
55236
|
-
}), _void(), {
|
|
55237
|
-
kind: "mutation",
|
|
55238
|
-
auth: "protected"
|
|
55239
|
-
}), method(object({
|
|
55240
|
-
deviceId: number().int().nonnegative(),
|
|
55241
|
-
/** Media identifier / URL. */
|
|
55242
|
-
mediaId: string().min(1),
|
|
55243
|
-
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
55244
|
-
* passes it through to the upstream service. */
|
|
55245
|
-
mediaType: string().min(1)
|
|
55246
|
-
}), _void(), {
|
|
55247
|
-
kind: "mutation",
|
|
55248
|
-
auth: "protected"
|
|
55249
|
-
});
|
|
55250
|
-
/**
|
|
55251
56069
|
* mesh-network — collection cap for mesh-VPN providers.
|
|
55252
56070
|
*
|
|
55253
56071
|
* Different shape from `network-access` (public tunnels):
|
|
@@ -63141,7 +63959,14 @@ var NcMediaPolicySchema = object({
|
|
|
63141
63959
|
*/
|
|
63142
63960
|
profile: CamProfileSchema.optional(),
|
|
63143
63961
|
/** See {@link NcLinkedCameraModeSchema}. */
|
|
63144
|
-
linkedCameras: NcLinkedCameraModeSchema.optional()
|
|
63962
|
+
linkedCameras: NcLinkedCameraModeSchema.optional(),
|
|
63963
|
+
/**
|
|
63964
|
+
* Sensor rules only: may this rule wake a SLEEPING battery camera to take
|
|
63965
|
+
* the linked still it attaches (D998)? Absent means yes, an explicit `false`
|
|
63966
|
+
* opts out. Deliberately not a Zod default: a rule that never chose keeps
|
|
63967
|
+
* following the hub's. One bounded wake per event; nothing is attached later.
|
|
63968
|
+
*/
|
|
63969
|
+
wakeSleepingCamera: boolean().optional()
|
|
63145
63970
|
});
|
|
63146
63971
|
/**
|
|
63147
63972
|
* Cooldown GRANULARITY over the subject's class — how much a fired
|
|
@@ -63533,6 +64358,21 @@ var NcTemplateVarKindSchema = _enum([
|
|
|
63533
64358
|
"sound",
|
|
63534
64359
|
"system"
|
|
63535
64360
|
]);
|
|
64361
|
+
/**
|
|
64362
|
+
* The default title/body a rule of one SITUATION is delivered with when the
|
|
64363
|
+
* operator wrote no template — served so an editor can pre-fill it (and the
|
|
64364
|
+
* operator can rebuild it from placeholders) instead of starting from a blank
|
|
64365
|
+
* box that, once saved, silently replaces it. `id` names the situation inside
|
|
64366
|
+
* a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
|
|
64367
|
+
* appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
|
|
64368
|
+
* the hub's current language and with its overrides applied.
|
|
64369
|
+
*/
|
|
64370
|
+
var NcTemplateDefaultSchema = object({
|
|
64371
|
+
id: _enum(["appliance-cycle"]),
|
|
64372
|
+
kind: NcRuleKindSchema,
|
|
64373
|
+
title: string(),
|
|
64374
|
+
body: string()
|
|
64375
|
+
});
|
|
63536
64376
|
/** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
|
|
63537
64377
|
var NcTemplateFamilySchema = _enum([
|
|
63538
64378
|
"rule",
|
|
@@ -64388,7 +65228,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
64388
65228
|
}), method(object({}), object({
|
|
64389
65229
|
catalog: array(NcConditionDescriptorSchema),
|
|
64390
65230
|
taxonomy: NcTaxonomySchema.optional()
|
|
64391
|
-
})), method(object({}), object({
|
|
65231
|
+
})), method(object({}), object({
|
|
65232
|
+
vars: array(NcTemplateVarDescriptorSchema),
|
|
65233
|
+
/** Per-situation default texts; absent on a hub that predates them. */
|
|
65234
|
+
defaults: array(NcTemplateDefaultSchema)
|
|
65235
|
+
})), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
|
|
64392
65236
|
kind: "mutation",
|
|
64393
65237
|
access: "view"
|
|
64394
65238
|
}), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
@@ -65152,52 +65996,27 @@ object({
|
|
|
65152
65996
|
empty: boolean().nullable(),
|
|
65153
65997
|
/** True while the pump is running. Null while unknown. */
|
|
65154
65998
|
pumpRunning: boolean().nullable(),
|
|
65155
|
-
/** True when the pump works on an on/off duty cycle rather than continuously. */
|
|
65156
|
-
pumpIntervalEnabled: boolean().nullable(),
|
|
65157
|
-
/** How long the pump runs per cycle, in seconds. */
|
|
65158
|
-
pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
65159
|
-
/** How long the pump rests per cycle, in seconds. */
|
|
65160
|
-
pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
65161
65999
|
/** Water drunk in the last drink, in litres. */
|
|
65162
66000
|
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65163
66001
|
/** Water drunk in the current hour, in litres. */
|
|
65164
66002
|
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65165
66003
|
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
65166
66004
|
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65167
|
-
/** Water drunk since local midnight, in litres. */
|
|
66005
|
+
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
65168
66006
|
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65169
66007
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
65170
66008
|
error: string().nullable(),
|
|
65171
66009
|
/** Ms epoch when the slice was last refreshed. */
|
|
65172
66010
|
lastFetchedAt: number()
|
|
65173
66011
|
});
|
|
65174
|
-
var DeviceIdSchema = number().int().nonnegative();
|
|
65175
|
-
var MinutesSchema = number().int().min(0);
|
|
66012
|
+
var DeviceIdSchema$1 = number().int().nonnegative();
|
|
65176
66013
|
DeviceType.PetFountain, method(object({
|
|
65177
|
-
deviceId: DeviceIdSchema,
|
|
65178
|
-
on: boolean()
|
|
65179
|
-
}), _void(), {
|
|
65180
|
-
kind: "mutation",
|
|
65181
|
-
auth: "protected"
|
|
65182
|
-
}), method(object({
|
|
65183
|
-
deviceId: DeviceIdSchema,
|
|
66014
|
+
deviceId: DeviceIdSchema$1,
|
|
65184
66015
|
on: boolean()
|
|
65185
66016
|
}), _void(), {
|
|
65186
66017
|
kind: "mutation",
|
|
65187
66018
|
auth: "protected"
|
|
65188
|
-
}), method(object({
|
|
65189
|
-
deviceId: DeviceIdSchema,
|
|
65190
|
-
minutes: MinutesSchema
|
|
65191
|
-
}), _void(), {
|
|
65192
|
-
kind: "mutation",
|
|
65193
|
-
auth: "protected"
|
|
65194
|
-
}), method(object({
|
|
65195
|
-
deviceId: DeviceIdSchema,
|
|
65196
|
-
minutes: MinutesSchema
|
|
65197
|
-
}), _void(), {
|
|
65198
|
-
kind: "mutation",
|
|
65199
|
-
auth: "protected"
|
|
65200
|
-
}), method(object({ deviceId: DeviceIdSchema }), _void(), {
|
|
66019
|
+
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
65201
66020
|
kind: "mutation",
|
|
65202
66021
|
auth: "protected"
|
|
65203
66022
|
});
|
|
@@ -66731,6 +67550,49 @@ object({
|
|
|
66731
67550
|
DeviceType.PetFeeder,
|
|
66732
67551
|
DeviceType.Heater
|
|
66733
67552
|
].filter((type) => type !== DeviceType.Sensor);
|
|
67553
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
67554
|
+
"no-power-source",
|
|
67555
|
+
"switch-missing",
|
|
67556
|
+
"switch-offline",
|
|
67557
|
+
"switch-unknown",
|
|
67558
|
+
"restart-in-progress",
|
|
67559
|
+
"switch-call-failed"
|
|
67560
|
+
]);
|
|
67561
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
67562
|
+
accepted: literal(false),
|
|
67563
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
67564
|
+
/** One line for the operator, naming the switch. */
|
|
67565
|
+
message: string()
|
|
67566
|
+
})]);
|
|
67567
|
+
var PowerSourceInfoSchema = object({
|
|
67568
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
67569
|
+
linked: boolean(),
|
|
67570
|
+
switchDeviceId: number().nullable(),
|
|
67571
|
+
switchName: string().nullable(),
|
|
67572
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
67573
|
+
switchOn: boolean().nullable(),
|
|
67574
|
+
switchOnline: boolean().nullable(),
|
|
67575
|
+
restartInProgress: boolean(),
|
|
67576
|
+
offSeconds: number().int()
|
|
67577
|
+
});
|
|
67578
|
+
object({
|
|
67579
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
67580
|
+
switchOn: boolean().nullable(),
|
|
67581
|
+
offSeconds: number().int(),
|
|
67582
|
+
lastFetchedAt: number()
|
|
67583
|
+
});
|
|
67584
|
+
DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
67585
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
67586
|
+
systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67587
|
+
kind: "mutation",
|
|
67588
|
+
auth: "admin"
|
|
67589
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67590
|
+
kind: "mutation",
|
|
67591
|
+
auth: "admin"
|
|
67592
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67593
|
+
kind: "mutation",
|
|
67594
|
+
auth: "admin"
|
|
67595
|
+
});
|
|
66734
67596
|
/**
|
|
66735
67597
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
66736
67598
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -67157,6 +68019,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
|
|
|
67157
68019
|
deviceId: number(),
|
|
67158
68020
|
status: PtzAutotrackStatusSchema
|
|
67159
68021
|
});
|
|
68022
|
+
object({
|
|
68023
|
+
/** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
|
|
68024
|
+
enabled: boolean().nullable(),
|
|
68025
|
+
/** How long the pump runs per cycle, in seconds. Null while unknown. */
|
|
68026
|
+
onTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
68027
|
+
/** How long the pump rests per cycle, in seconds. Null while unknown. */
|
|
68028
|
+
offTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
68029
|
+
/** Ms epoch when the slice was last refreshed. */
|
|
68030
|
+
lastFetchedAt: number()
|
|
68031
|
+
});
|
|
68032
|
+
var DeviceIdSchema = number().int().nonnegative();
|
|
68033
|
+
var MinutesSchema = number().int().min(0);
|
|
68034
|
+
DeviceType.PetFountain, method(object({
|
|
68035
|
+
deviceId: DeviceIdSchema,
|
|
68036
|
+
on: boolean()
|
|
68037
|
+
}), _void(), {
|
|
68038
|
+
kind: "mutation",
|
|
68039
|
+
auth: "protected"
|
|
68040
|
+
}), method(object({
|
|
68041
|
+
deviceId: DeviceIdSchema,
|
|
68042
|
+
minutes: MinutesSchema
|
|
68043
|
+
}), _void(), {
|
|
68044
|
+
kind: "mutation",
|
|
68045
|
+
auth: "protected"
|
|
68046
|
+
}), method(object({
|
|
68047
|
+
deviceId: DeviceIdSchema,
|
|
68048
|
+
minutes: MinutesSchema
|
|
68049
|
+
}), _void(), {
|
|
68050
|
+
kind: "mutation",
|
|
68051
|
+
auth: "protected"
|
|
68052
|
+
});
|
|
67160
68053
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
67161
68054
|
kind: "mutation",
|
|
67162
68055
|
auth: "admin"
|
|
@@ -69870,7 +70763,13 @@ var RemoteMediaCommandSchema = _enum([
|
|
|
69870
70763
|
"next",
|
|
69871
70764
|
"previous",
|
|
69872
70765
|
"setMute",
|
|
69873
|
-
"selectSource"
|
|
70766
|
+
"selectSource",
|
|
70767
|
+
"turnOn",
|
|
70768
|
+
"turnOff",
|
|
70769
|
+
"volumeUp",
|
|
70770
|
+
"volumeDown",
|
|
70771
|
+
"channelUp",
|
|
70772
|
+
"channelDown"
|
|
69874
70773
|
]);
|
|
69875
70774
|
/** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
|
|
69876
70775
|
var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
|
|
@@ -69891,7 +70790,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
|
|
|
69891
70790
|
}), RemoteSendResultSchema, {
|
|
69892
70791
|
kind: "mutation",
|
|
69893
70792
|
auth: "protected"
|
|
69894
|
-
}), method(deviceInput.extend({
|
|
70793
|
+
}), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
|
|
69895
70794
|
command: RemoteMediaCommandSchema,
|
|
69896
70795
|
muted: boolean().optional(),
|
|
69897
70796
|
source: string().optional(),
|
|
@@ -70825,7 +71724,16 @@ DeviceType.Sensor;
|
|
|
70825
71724
|
* future fields without breaking the existing call sites.
|
|
70826
71725
|
*/
|
|
70827
71726
|
var EmailAddressSchema = email();
|
|
71727
|
+
/**
|
|
71728
|
+
* Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
|
|
71729
|
+
* relay, so a caller written before relays existed keeps working unchanged. A provider with one
|
|
71730
|
+
* fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
|
|
71731
|
+
* collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
|
|
71732
|
+
*/
|
|
71733
|
+
var InstanceIdSchema = string().min(1).optional();
|
|
71734
|
+
var RelayPinSchema = object({ instanceId: InstanceIdSchema });
|
|
70828
71735
|
var SendEmailInputSchema = object({
|
|
71736
|
+
instanceId: InstanceIdSchema,
|
|
70829
71737
|
to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
|
|
70830
71738
|
cc: array(EmailAddressSchema).optional(),
|
|
70831
71739
|
bcc: array(EmailAddressSchema).optional(),
|
|
@@ -70861,11 +71769,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
|
|
|
70861
71769
|
kind: "mutation",
|
|
70862
71770
|
auth: "admin",
|
|
70863
71771
|
access: "create"
|
|
70864
|
-
}), method(
|
|
71772
|
+
}), method(RelayPinSchema, SmtpStatusSchema, {
|
|
70865
71773
|
kind: "mutation",
|
|
70866
71774
|
auth: "admin",
|
|
70867
71775
|
access: "view"
|
|
70868
|
-
}), method(
|
|
71776
|
+
}), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
|
|
70869
71777
|
/**
|
|
70870
71778
|
* A single device snapshot returned as base64 JPEG/PNG.
|
|
70871
71779
|
*
|
|
@@ -70897,10 +71805,12 @@ DeviceType.Camera, method(object({
|
|
|
70897
71805
|
* even when the cache is well within the device's
|
|
70898
71806
|
* `snapshotMaxAgeS` window.
|
|
70899
71807
|
*
|
|
70900
|
-
* **`force` is
|
|
71808
|
+
* **`force` is a demand with a named principal, not a freshness
|
|
71809
|
+
* preference** — an operator button, the scheduled refresh (D847), or a
|
|
71810
|
+
* notification rule that left the camera's wake allowed (D998). On a
|
|
70901
71811
|
* battery camera it is the one thing that walks past the wrapper's
|
|
70902
|
-
* sleep gate and wakes the camera, so a
|
|
70903
|
-
*
|
|
71812
|
+
* sleep gate and wakes the camera, so a poller, a thumbnail or a
|
|
71813
|
+
* prestream must NEVER set it. Every such caller
|
|
70904
71814
|
* gets the cached frame, which on a sleeping battery camera is the
|
|
70905
71815
|
* correct answer: stale but honest beats woken.
|
|
70906
71816
|
*/
|
|
@@ -71715,7 +72625,11 @@ Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly())
|
|
|
71715
72625
|
* `getSettingsUISchema()` surface.
|
|
71716
72626
|
*/
|
|
71717
72627
|
var SwitchStatusSchema = object({
|
|
71718
|
-
|
|
72628
|
+
/**
|
|
72629
|
+
* `null` = the device has never reported its state (a measurement that
|
|
72630
|
+
* has not happened is unknown, never `false`).
|
|
72631
|
+
*/
|
|
72632
|
+
on: boolean().nullable().meta({ label: "On" }),
|
|
71719
72633
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
71720
72634
|
lastChangedAt: number()
|
|
71721
72635
|
});
|
|
@@ -71727,7 +72641,7 @@ DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceTyp
|
|
|
71727
72641
|
auth: "protected"
|
|
71728
72642
|
}), object({
|
|
71729
72643
|
deviceId: number(),
|
|
71730
|
-
on: boolean(),
|
|
72644
|
+
on: boolean().nullable(),
|
|
71731
72645
|
lastChangedAt: number()
|
|
71732
72646
|
});
|
|
71733
72647
|
/** C0 controls, DEL and the C1 range: none of them belongs in a name. */
|
|
@@ -74739,6 +75653,26 @@ function buildDescriptor(capName, kind) {
|
|
|
74739
75653
|
* contributes one entry per bound cap present in this map.
|
|
74740
75654
|
*/
|
|
74741
75655
|
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
75656
|
+
/**
|
|
75657
|
+
* What a remote key is CALLED and what it LOOKS like, for every role (D963),
|
|
75658
|
+
* shared by the admin UI and the viewer. A role is data on the wire; each
|
|
75659
|
+
* client resolves its name from `label` (English and Italian side by side) and
|
|
75660
|
+
* its glyph from `icon`, a lucide id from the shared icon catalogue — the
|
|
75661
|
+
* server sends an id, a client maps it to its own icon set.
|
|
75662
|
+
*
|
|
75663
|
+
* `legend` is text printed on the key INSTEAD of a glyph (a digit has no
|
|
75664
|
+
* pictogram): a client that can draw text shows it, one that cannot falls back
|
|
75665
|
+
* to `icon`.
|
|
75666
|
+
*/
|
|
75667
|
+
function digit(n) {
|
|
75668
|
+
return {
|
|
75669
|
+
label: t(n, n),
|
|
75670
|
+
icon: "hash",
|
|
75671
|
+
legend: n
|
|
75672
|
+
};
|
|
75673
|
+
}
|
|
75674
|
+
digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
|
|
75675
|
+
DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
|
|
74742
75676
|
var btn = (idSuffix, row, col, init) => ({
|
|
74743
75677
|
idSuffix,
|
|
74744
75678
|
row,
|
|
@@ -74865,7 +75799,35 @@ discriminatedUnion("kind", [object({
|
|
|
74865
75799
|
kind: literal("pronto"),
|
|
74866
75800
|
code: string()
|
|
74867
75801
|
})]);
|
|
74868
|
-
|
|
75802
|
+
/**
|
|
75803
|
+
* Propose a running threshold from a device's own power history (planning#405).
|
|
75804
|
+
*
|
|
75805
|
+
* Pure and deterministic: the same series gives the same answer. The series is
|
|
75806
|
+
* a HELD-VALUE step series — a point's value stands until the next point — which
|
|
75807
|
+
* is how device-history stores a gauge, so "time at a level" is exact, not a
|
|
75808
|
+
* count of samples.
|
|
75809
|
+
*
|
|
75810
|
+
* 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
|
|
75811
|
+
* near F. A device that is not near one level most of the time has no floor.
|
|
75812
|
+
* 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
|
|
75813
|
+
* 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
|
|
75814
|
+
* the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
|
|
75815
|
+
* 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
|
|
75816
|
+
* grid a person would type; stop dwell covers the longest pause; start dwell
|
|
75817
|
+
* covers the longest standby blip above T.
|
|
75818
|
+
* 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
|
|
75819
|
+
* run must hold exactly one true interval and nothing may flap outside.
|
|
75820
|
+
*/
|
|
75821
|
+
var SECOND_MS = 1e3;
|
|
75822
|
+
var MINUTE_MS$1 = 60 * SECOND_MS;
|
|
75823
|
+
24 * (60 * MINUTE_MS$1);
|
|
75824
|
+
10 * MINUTE_MS$1;
|
|
75825
|
+
30 * SECOND_MS;
|
|
75826
|
+
60 * SECOND_MS;
|
|
75827
|
+
20 * MINUTE_MS$1;
|
|
75828
|
+
10 * SECOND_MS;
|
|
75829
|
+
10 * SECOND_MS;
|
|
75830
|
+
DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
|
|
74869
75831
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
74870
75832
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
74871
75833
|
DeviceRole.BinarySensor, DeviceRole.MotionSensor;
|
|
@@ -75846,6 +76808,27 @@ Object.freeze({
|
|
|
75846
76808
|
access: "view",
|
|
75847
76809
|
role: "viewer"
|
|
75848
76810
|
},
|
|
76811
|
+
"boardKeySource.getBoardKey": {
|
|
76812
|
+
capName: "board-key-source",
|
|
76813
|
+
capScope: "system",
|
|
76814
|
+
addonId: null,
|
|
76815
|
+
access: "view",
|
|
76816
|
+
role: "admin"
|
|
76817
|
+
},
|
|
76818
|
+
"boardKeySource.listBoards": {
|
|
76819
|
+
capName: "board-key-source",
|
|
76820
|
+
capScope: "system",
|
|
76821
|
+
addonId: null,
|
|
76822
|
+
access: "view",
|
|
76823
|
+
role: "admin"
|
|
76824
|
+
},
|
|
76825
|
+
"boardKeySource.listSources": {
|
|
76826
|
+
capName: "board-key-source",
|
|
76827
|
+
capScope: "system",
|
|
76828
|
+
addonId: null,
|
|
76829
|
+
access: "view",
|
|
76830
|
+
role: "admin"
|
|
76831
|
+
},
|
|
75849
76832
|
"brightness.getStatus": {
|
|
75850
76833
|
capName: "brightness",
|
|
75851
76834
|
capScope: "device",
|
|
@@ -76385,6 +77368,13 @@ Object.freeze({
|
|
|
76385
77368
|
access: "create",
|
|
76386
77369
|
role: "admin"
|
|
76387
77370
|
},
|
|
77371
|
+
"coreBlocks.proposeRunningThreshold": {
|
|
77372
|
+
capName: "core-blocks",
|
|
77373
|
+
capScope: "system",
|
|
77374
|
+
addonId: null,
|
|
77375
|
+
access: "view",
|
|
77376
|
+
role: "admin"
|
|
77377
|
+
},
|
|
76388
77378
|
"coreBlocks.reportAutomationRun": {
|
|
76389
77379
|
capName: "core-blocks",
|
|
76390
77380
|
capScope: "system",
|
|
@@ -76896,6 +77886,13 @@ Object.freeze({
|
|
|
76896
77886
|
access: "view",
|
|
76897
77887
|
role: "admin"
|
|
76898
77888
|
},
|
|
77889
|
+
"deviceExport.listInstances": {
|
|
77890
|
+
capName: "device-export",
|
|
77891
|
+
capScope: "system",
|
|
77892
|
+
addonId: null,
|
|
77893
|
+
access: "view",
|
|
77894
|
+
role: "admin"
|
|
77895
|
+
},
|
|
76899
77896
|
"deviceExport.listSupportedDeviceKinds": {
|
|
76900
77897
|
capName: "device-export",
|
|
76901
77898
|
capScope: "system",
|
|
@@ -78527,6 +79524,13 @@ Object.freeze({
|
|
|
78527
79524
|
access: "view",
|
|
78528
79525
|
role: "admin"
|
|
78529
79526
|
},
|
|
79527
|
+
"integrationInstances.setInstanceEnabled": {
|
|
79528
|
+
capName: "integration-instances",
|
|
79529
|
+
capScope: "system",
|
|
79530
|
+
addonId: null,
|
|
79531
|
+
access: "create",
|
|
79532
|
+
role: "admin"
|
|
79533
|
+
},
|
|
78530
79534
|
"integrationInstances.testInstance": {
|
|
78531
79535
|
capName: "integration-instances",
|
|
78532
79536
|
capScope: "system",
|
|
@@ -79325,6 +80329,20 @@ Object.freeze({
|
|
|
79325
80329
|
access: "view",
|
|
79326
80330
|
role: "admin"
|
|
79327
80331
|
},
|
|
80332
|
+
"mediaPlayer.channelDown": {
|
|
80333
|
+
capName: "media-player",
|
|
80334
|
+
capScope: "device",
|
|
80335
|
+
addonId: null,
|
|
80336
|
+
access: "create",
|
|
80337
|
+
role: "viewer"
|
|
80338
|
+
},
|
|
80339
|
+
"mediaPlayer.channelUp": {
|
|
80340
|
+
capName: "media-player",
|
|
80341
|
+
capScope: "device",
|
|
80342
|
+
addonId: null,
|
|
80343
|
+
access: "create",
|
|
80344
|
+
role: "viewer"
|
|
80345
|
+
},
|
|
79328
80346
|
"mediaPlayer.getStatus": {
|
|
79329
80347
|
capName: "media-player",
|
|
79330
80348
|
capScope: "device",
|
|
@@ -79416,6 +80434,34 @@ Object.freeze({
|
|
|
79416
80434
|
access: "create",
|
|
79417
80435
|
role: "viewer"
|
|
79418
80436
|
},
|
|
80437
|
+
"mediaPlayer.turnOff": {
|
|
80438
|
+
capName: "media-player",
|
|
80439
|
+
capScope: "device",
|
|
80440
|
+
addonId: null,
|
|
80441
|
+
access: "create",
|
|
80442
|
+
role: "viewer"
|
|
80443
|
+
},
|
|
80444
|
+
"mediaPlayer.turnOn": {
|
|
80445
|
+
capName: "media-player",
|
|
80446
|
+
capScope: "device",
|
|
80447
|
+
addonId: null,
|
|
80448
|
+
access: "create",
|
|
80449
|
+
role: "viewer"
|
|
80450
|
+
},
|
|
80451
|
+
"mediaPlayer.volumeDown": {
|
|
80452
|
+
capName: "media-player",
|
|
80453
|
+
capScope: "device",
|
|
80454
|
+
addonId: null,
|
|
80455
|
+
access: "create",
|
|
80456
|
+
role: "viewer"
|
|
80457
|
+
},
|
|
80458
|
+
"mediaPlayer.volumeUp": {
|
|
80459
|
+
capName: "media-player",
|
|
80460
|
+
capScope: "device",
|
|
80461
|
+
addonId: null,
|
|
80462
|
+
access: "create",
|
|
80463
|
+
role: "viewer"
|
|
80464
|
+
},
|
|
79419
80465
|
"meshNetwork.getStatus": {
|
|
79420
80466
|
capName: "mesh-network",
|
|
79421
80467
|
capScope: "system",
|
|
@@ -80662,27 +81708,6 @@ Object.freeze({
|
|
|
80662
81708
|
access: "create",
|
|
80663
81709
|
role: "viewer"
|
|
80664
81710
|
},
|
|
80665
|
-
"petFountain.setPumpInterval": {
|
|
80666
|
-
capName: "pet-fountain",
|
|
80667
|
-
capScope: "device",
|
|
80668
|
-
addonId: null,
|
|
80669
|
-
access: "create",
|
|
80670
|
-
role: "viewer"
|
|
80671
|
-
},
|
|
80672
|
-
"petFountain.setPumpOffMinutes": {
|
|
80673
|
-
capName: "pet-fountain",
|
|
80674
|
-
capScope: "device",
|
|
80675
|
-
addonId: null,
|
|
80676
|
-
access: "create",
|
|
80677
|
-
role: "viewer"
|
|
80678
|
-
},
|
|
80679
|
-
"petFountain.setPumpOnMinutes": {
|
|
80680
|
-
capName: "pet-fountain",
|
|
80681
|
-
capScope: "device",
|
|
80682
|
-
addonId: null,
|
|
80683
|
-
access: "create",
|
|
80684
|
-
role: "viewer"
|
|
80685
|
-
},
|
|
80686
81711
|
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
80687
81712
|
capName: "pipeline-analytics",
|
|
80688
81713
|
capScope: "device",
|
|
@@ -82461,6 +83486,34 @@ Object.freeze({
|
|
|
82461
83486
|
access: "create",
|
|
82462
83487
|
role: "admin"
|
|
82463
83488
|
},
|
|
83489
|
+
"pumpCycle.getStatus": {
|
|
83490
|
+
capName: "pump-cycle",
|
|
83491
|
+
capScope: "device",
|
|
83492
|
+
addonId: null,
|
|
83493
|
+
access: "view",
|
|
83494
|
+
role: "viewer"
|
|
83495
|
+
},
|
|
83496
|
+
"pumpCycle.setEnabled": {
|
|
83497
|
+
capName: "pump-cycle",
|
|
83498
|
+
capScope: "device",
|
|
83499
|
+
addonId: null,
|
|
83500
|
+
access: "create",
|
|
83501
|
+
role: "viewer"
|
|
83502
|
+
},
|
|
83503
|
+
"pumpCycle.setOffMinutes": {
|
|
83504
|
+
capName: "pump-cycle",
|
|
83505
|
+
capScope: "device",
|
|
83506
|
+
addonId: null,
|
|
83507
|
+
access: "create",
|
|
83508
|
+
role: "viewer"
|
|
83509
|
+
},
|
|
83510
|
+
"pumpCycle.setOnMinutes": {
|
|
83511
|
+
capName: "pump-cycle",
|
|
83512
|
+
capScope: "device",
|
|
83513
|
+
addonId: null,
|
|
83514
|
+
access: "create",
|
|
83515
|
+
role: "viewer"
|
|
83516
|
+
},
|
|
82464
83517
|
"reboot.reboot": {
|
|
82465
83518
|
capName: "reboot",
|
|
82466
83519
|
capScope: "device",
|
|
@@ -82965,6 +84018,13 @@ Object.freeze({
|
|
|
82965
84018
|
access: "create",
|
|
82966
84019
|
role: "admin"
|
|
82967
84020
|
},
|
|
84021
|
+
"remote.getAssumedStatus": {
|
|
84022
|
+
capName: "remote",
|
|
84023
|
+
capScope: "system",
|
|
84024
|
+
addonId: null,
|
|
84025
|
+
access: "view",
|
|
84026
|
+
role: "admin"
|
|
84027
|
+
},
|
|
82968
84028
|
"remote.getConfig": {
|
|
82969
84029
|
capName: "remote",
|
|
82970
84030
|
capScope: "system",
|
|
@@ -85805,6 +86865,11 @@ Object.freeze({
|
|
|
85805
86865
|
form: "single",
|
|
85806
86866
|
optional: false
|
|
85807
86867
|
}],
|
|
86868
|
+
"coreBlocks.proposeRunningThreshold": [{
|
|
86869
|
+
name: "deviceId",
|
|
86870
|
+
form: "single",
|
|
86871
|
+
optional: false
|
|
86872
|
+
}],
|
|
85808
86873
|
"cover.close": [{
|
|
85809
86874
|
name: "deviceId",
|
|
85810
86875
|
form: "single",
|
|
@@ -86656,6 +87721,16 @@ Object.freeze({
|
|
|
86656
87721
|
form: "single",
|
|
86657
87722
|
optional: true
|
|
86658
87723
|
}],
|
|
87724
|
+
"mediaPlayer.channelDown": [{
|
|
87725
|
+
name: "deviceId",
|
|
87726
|
+
form: "single",
|
|
87727
|
+
optional: false
|
|
87728
|
+
}],
|
|
87729
|
+
"mediaPlayer.channelUp": [{
|
|
87730
|
+
name: "deviceId",
|
|
87731
|
+
form: "single",
|
|
87732
|
+
optional: false
|
|
87733
|
+
}],
|
|
86659
87734
|
"mediaPlayer.getStatus": [{
|
|
86660
87735
|
name: "deviceId",
|
|
86661
87736
|
form: "single",
|
|
@@ -86721,6 +87796,26 @@ Object.freeze({
|
|
|
86721
87796
|
form: "single",
|
|
86722
87797
|
optional: false
|
|
86723
87798
|
}],
|
|
87799
|
+
"mediaPlayer.turnOff": [{
|
|
87800
|
+
name: "deviceId",
|
|
87801
|
+
form: "single",
|
|
87802
|
+
optional: false
|
|
87803
|
+
}],
|
|
87804
|
+
"mediaPlayer.turnOn": [{
|
|
87805
|
+
name: "deviceId",
|
|
87806
|
+
form: "single",
|
|
87807
|
+
optional: false
|
|
87808
|
+
}],
|
|
87809
|
+
"mediaPlayer.volumeDown": [{
|
|
87810
|
+
name: "deviceId",
|
|
87811
|
+
form: "single",
|
|
87812
|
+
optional: false
|
|
87813
|
+
}],
|
|
87814
|
+
"mediaPlayer.volumeUp": [{
|
|
87815
|
+
name: "deviceId",
|
|
87816
|
+
form: "single",
|
|
87817
|
+
optional: false
|
|
87818
|
+
}],
|
|
86724
87819
|
"meter.getStatus": [{
|
|
86725
87820
|
name: "deviceId",
|
|
86726
87821
|
form: "single",
|
|
@@ -87030,21 +88125,6 @@ Object.freeze({
|
|
|
87030
88125
|
form: "single",
|
|
87031
88126
|
optional: false
|
|
87032
88127
|
}],
|
|
87033
|
-
"petFountain.setPumpInterval": [{
|
|
87034
|
-
name: "deviceId",
|
|
87035
|
-
form: "single",
|
|
87036
|
-
optional: false
|
|
87037
|
-
}],
|
|
87038
|
-
"petFountain.setPumpOffMinutes": [{
|
|
87039
|
-
name: "deviceId",
|
|
87040
|
-
form: "single",
|
|
87041
|
-
optional: false
|
|
87042
|
-
}],
|
|
87043
|
-
"petFountain.setPumpOnMinutes": [{
|
|
87044
|
-
name: "deviceId",
|
|
87045
|
-
form: "single",
|
|
87046
|
-
optional: false
|
|
87047
|
-
}],
|
|
87048
88128
|
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
87049
88129
|
name: "deviceId",
|
|
87050
88130
|
form: "single",
|
|
@@ -87680,6 +88760,26 @@ Object.freeze({
|
|
|
87680
88760
|
form: "single",
|
|
87681
88761
|
optional: false
|
|
87682
88762
|
}],
|
|
88763
|
+
"pumpCycle.getStatus": [{
|
|
88764
|
+
name: "deviceId",
|
|
88765
|
+
form: "single",
|
|
88766
|
+
optional: false
|
|
88767
|
+
}],
|
|
88768
|
+
"pumpCycle.setEnabled": [{
|
|
88769
|
+
name: "deviceId",
|
|
88770
|
+
form: "single",
|
|
88771
|
+
optional: false
|
|
88772
|
+
}],
|
|
88773
|
+
"pumpCycle.setOffMinutes": [{
|
|
88774
|
+
name: "deviceId",
|
|
88775
|
+
form: "single",
|
|
88776
|
+
optional: false
|
|
88777
|
+
}],
|
|
88778
|
+
"pumpCycle.setOnMinutes": [{
|
|
88779
|
+
name: "deviceId",
|
|
88780
|
+
form: "single",
|
|
88781
|
+
optional: false
|
|
88782
|
+
}],
|
|
87683
88783
|
"reboot.reboot": [{
|
|
87684
88784
|
name: "deviceId",
|
|
87685
88785
|
form: "single",
|
|
@@ -87881,6 +88981,11 @@ Object.freeze({
|
|
|
87881
88981
|
form: "single",
|
|
87882
88982
|
optional: true
|
|
87883
88983
|
}],
|
|
88984
|
+
"remote.getAssumedStatus": [{
|
|
88985
|
+
name: "deviceId",
|
|
88986
|
+
form: "single",
|
|
88987
|
+
optional: false
|
|
88988
|
+
}],
|
|
87884
88989
|
"remote.getConfig": [{
|
|
87885
88990
|
name: "deviceId",
|
|
87886
88991
|
form: "single",
|
|
@@ -88428,99 +89533,6 @@ Object.freeze({
|
|
|
88428
89533
|
"network-access": "ingress",
|
|
88429
89534
|
"smtp-provider": "email"
|
|
88430
89535
|
});
|
|
88431
|
-
/**
|
|
88432
|
-
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
88433
|
-
* `z.infer`, they do not restate the shape.
|
|
88434
|
-
*/
|
|
88435
|
-
var OverrideSourceSchema = object({
|
|
88436
|
-
addonId: string().min(1),
|
|
88437
|
-
stableId: string().min(1),
|
|
88438
|
-
cap: string().min(1),
|
|
88439
|
-
fieldPath: string().min(1)
|
|
88440
|
-
});
|
|
88441
|
-
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
88442
|
-
object({ kind: literal("identity") }),
|
|
88443
|
-
object({ kind: literal("invert") }),
|
|
88444
|
-
object({
|
|
88445
|
-
kind: literal("threshold"),
|
|
88446
|
-
comparison: _enum(["gte", "lte"]),
|
|
88447
|
-
threshold: number(),
|
|
88448
|
-
startDwellMs: number().nonnegative(),
|
|
88449
|
-
stopDwellMs: number().nonnegative()
|
|
88450
|
-
}),
|
|
88451
|
-
object({
|
|
88452
|
-
kind: literal("linear"),
|
|
88453
|
-
scale: number(),
|
|
88454
|
-
offset: number(),
|
|
88455
|
-
clampMin: number().optional(),
|
|
88456
|
-
clampMax: number().optional()
|
|
88457
|
-
}),
|
|
88458
|
-
object({
|
|
88459
|
-
kind: literal("enum-map"),
|
|
88460
|
-
mapping: record(string(), string().nullable())
|
|
88461
|
-
}),
|
|
88462
|
-
object({ kind: literal("number") })
|
|
88463
|
-
]);
|
|
88464
|
-
var ScalarOverrideDraftSchema = object({
|
|
88465
|
-
kind: literal("scalar"),
|
|
88466
|
-
cap: string().min(1),
|
|
88467
|
-
targetId: string().min(1),
|
|
88468
|
-
source: OverrideSourceSchema,
|
|
88469
|
-
transform: CustomizeTransformDraftSchema
|
|
88470
|
-
});
|
|
88471
|
-
var KeyedArrayOverrideDraftSchema = object({
|
|
88472
|
-
kind: literal("keyedArray"),
|
|
88473
|
-
cap: string().min(1),
|
|
88474
|
-
targetId: string().min(1),
|
|
88475
|
-
key: string().min(1),
|
|
88476
|
-
label: string().min(1),
|
|
88477
|
-
fieldPath: string().min(1),
|
|
88478
|
-
source: OverrideSourceSchema,
|
|
88479
|
-
transform: CustomizeTransformDraftSchema
|
|
88480
|
-
});
|
|
88481
|
-
var PulseOverrideDraftSchema = object({
|
|
88482
|
-
kind: literal("pulse"),
|
|
88483
|
-
cap: string().min(1),
|
|
88484
|
-
targetId: string().min(1),
|
|
88485
|
-
enabled: boolean(),
|
|
88486
|
-
debounceMs: number().nonnegative(),
|
|
88487
|
-
edges: array(_enum([
|
|
88488
|
-
"rising",
|
|
88489
|
-
"button",
|
|
88490
|
-
"native-event"
|
|
88491
|
-
])).min(1).optional(),
|
|
88492
|
-
sources: array(OverrideSourceSchema).min(1)
|
|
88493
|
-
});
|
|
88494
|
-
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
88495
|
-
"in-addition",
|
|
88496
|
-
"confirm",
|
|
88497
|
-
"replace"
|
|
88498
|
-
]).optional() });
|
|
88499
|
-
discriminatedUnion("kind", [
|
|
88500
|
-
ScalarOverrideDraftSchema,
|
|
88501
|
-
KeyedArrayOverrideDraftSchema,
|
|
88502
|
-
PulseOverrideDraftSchema,
|
|
88503
|
-
object({
|
|
88504
|
-
kind: literal("span"),
|
|
88505
|
-
cap: string().min(1),
|
|
88506
|
-
targetId: string().min(1),
|
|
88507
|
-
timeoutMs: number().nonnegative(),
|
|
88508
|
-
cooldownMs: number().nonnegative().optional(),
|
|
88509
|
-
sources: array(SpanSourceDraftSchema)
|
|
88510
|
-
})
|
|
88511
|
-
]);
|
|
88512
|
-
object({
|
|
88513
|
-
targetId: string().min(1),
|
|
88514
|
-
configured: boolean(),
|
|
88515
|
-
source: _enum(["native", "assigned"]),
|
|
88516
|
-
state: _enum([
|
|
88517
|
-
"active",
|
|
88518
|
-
"stale",
|
|
88519
|
-
"released",
|
|
88520
|
-
"unavailable"
|
|
88521
|
-
]),
|
|
88522
|
-
reason: string().nullable()
|
|
88523
|
-
});
|
|
88524
89536
|
var G711_SCALE_CORRECTION_DB = {
|
|
88525
89537
|
PCMU: 20 * Math.log10(4),
|
|
88526
89538
|
PCMA: 20 * Math.log10(8)
|
|
@@ -89136,6 +90148,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
89136
90148
|
[...RULE_TEXT],
|
|
89137
90149
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
89138
90150
|
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
90151
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
89139
90152
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
89140
90153
|
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
89141
90154
|
([...RULE_TEXT], [...CONSUMABLE]),
|
|
@@ -90044,6 +91057,44 @@ var ActionSceneExports = class {
|
|
|
90044
91057
|
}
|
|
90045
91058
|
};
|
|
90046
91059
|
//#endregion
|
|
91060
|
+
//#region src/export-records.ts
|
|
91061
|
+
/**
|
|
91062
|
+
* What the Google export exposes, as a record (planning#408 P4): ONE `google-exports` record per
|
|
91063
|
+
* instance id (`export-google` today) holds the devices Google syncs and the actions it sees as
|
|
91064
|
+
* scenes. The addon is its only writer; the in-memory copy it loads at boot is what every
|
|
91065
|
+
* fulfillment intent reads.
|
|
91066
|
+
*/
|
|
91067
|
+
/** A single-instance addon keeps its records under its own addon id. */
|
|
91068
|
+
var GOOGLE_INSTANCE_ID = "export-google";
|
|
91069
|
+
var ExposedDeviceEntrySchema = object({
|
|
91070
|
+
deviceId: number(),
|
|
91071
|
+
exposedAt: number()
|
|
91072
|
+
});
|
|
91073
|
+
var ActionSceneEntrySchema = object({
|
|
91074
|
+
actionId: string(),
|
|
91075
|
+
displayName: string(),
|
|
91076
|
+
addedAt: number()
|
|
91077
|
+
});
|
|
91078
|
+
var GoogleExportsBodySchema = object({
|
|
91079
|
+
name: string().min(1),
|
|
91080
|
+
devices: array(ExposedDeviceEntrySchema),
|
|
91081
|
+
actions: array(ActionSceneEntrySchema)
|
|
91082
|
+
});
|
|
91083
|
+
var GOOGLE_EXPORTS_KIND_NAME = "google-exports";
|
|
91084
|
+
var GOOGLE_EXPORTS_NAME = "Google exposure";
|
|
91085
|
+
var googleExportsKind = defineEntryKind(GOOGLE_EXPORTS_KIND_NAME, {
|
|
91086
|
+
title: "Google exposure",
|
|
91087
|
+
nameField: "name",
|
|
91088
|
+
schema: GoogleExportsBodySchema
|
|
91089
|
+
});
|
|
91090
|
+
var EMPTY_GOOGLE_EXPORTS = {
|
|
91091
|
+
name: GOOGLE_EXPORTS_NAME,
|
|
91092
|
+
devices: [],
|
|
91093
|
+
actions: []
|
|
91094
|
+
};
|
|
91095
|
+
/** The settings keys that moved into the record; the migrations name them. */
|
|
91096
|
+
var MOVED_EXPOSURE_KEYS = ["exposed", "exposedActions"];
|
|
91097
|
+
//#endregion
|
|
90047
91098
|
//#region src/google-home/trait-catalog.ts
|
|
90048
91099
|
/**
|
|
90049
91100
|
* The trait catalog — one ROW per camstack capability, and that row is the
|
|
@@ -90874,24 +91925,151 @@ async function planDropPublicHubUrl(ports) {
|
|
|
90874
91925
|
}] };
|
|
90875
91926
|
}
|
|
90876
91927
|
//#endregion
|
|
91928
|
+
//#region src/migrations/exposure-to-record.ts
|
|
91929
|
+
/**
|
|
91930
|
+
* The Google exposure lists move into the `google-exports` record (planning#408 P4). Two
|
|
91931
|
+
* migrations, both `block-owner`: the addon must not serve a membership it cannot trust, and
|
|
91932
|
+
* after them nothing reads the old keys.
|
|
91933
|
+
*
|
|
91934
|
+
* 1. `moveExposureToRecord` (procedure): `exposed` and `exposedActions` become the record under
|
|
91935
|
+
* the instance id. An existing record is never overwritten. A record this pass just wrote is
|
|
91936
|
+
* read BACK and must equal what the settings carried, or the pass throws.
|
|
91937
|
+
* 2. `planDropMovedExposure` (plan): the two keys are deleted only while the record holds every
|
|
91938
|
+
* device and action the settings carried; a record that cannot be read leaves them in place.
|
|
91939
|
+
*/
|
|
91940
|
+
function devicesOf(value) {
|
|
91941
|
+
if (!Array.isArray(value)) return [];
|
|
91942
|
+
return value.flatMap((entry) => {
|
|
91943
|
+
const parsed = ExposedDeviceEntrySchema.safeParse(entry);
|
|
91944
|
+
return parsed.success ? [parsed.data] : [];
|
|
91945
|
+
});
|
|
91946
|
+
}
|
|
91947
|
+
function actionsOf(value) {
|
|
91948
|
+
if (!Array.isArray(value)) return [];
|
|
91949
|
+
return value.flatMap((entry) => {
|
|
91950
|
+
const parsed = ActionSceneEntrySchema.safeParse(entry);
|
|
91951
|
+
return parsed.success ? [parsed.data] : [];
|
|
91952
|
+
});
|
|
91953
|
+
}
|
|
91954
|
+
/** Key-order-independent JSON, so "identical" does not depend on how a store orders keys. */
|
|
91955
|
+
function canonical(value) {
|
|
91956
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
91957
|
+
if (typeof value === "object" && value !== null) return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(",")}}`;
|
|
91958
|
+
return JSON.stringify(value) ?? "null";
|
|
91959
|
+
}
|
|
91960
|
+
async function moveExposureToRecord(ports) {
|
|
91961
|
+
const stored = await ports.readStored();
|
|
91962
|
+
if (!MOVED_EXPOSURE_KEYS.some((key) => key in stored)) return {
|
|
91963
|
+
outcome: "already-done",
|
|
91964
|
+
summary: { moved: false }
|
|
91965
|
+
};
|
|
91966
|
+
const devices = devicesOf(stored["exposed"]);
|
|
91967
|
+
const actions = actionsOf(stored["exposedActions"]);
|
|
91968
|
+
const dropped = (Array.isArray(stored["exposed"]) ? stored["exposed"].length : 0) - devices.length + ((Array.isArray(stored["exposedActions"]) ? stored["exposedActions"].length : 0) - actions.length);
|
|
91969
|
+
if (dropped > 0) ports.warn(`Google migration: ${dropped} exposure entr(ies) were not understood and are left out`);
|
|
91970
|
+
const body = {
|
|
91971
|
+
name: GOOGLE_EXPORTS_NAME,
|
|
91972
|
+
devices,
|
|
91973
|
+
actions
|
|
91974
|
+
};
|
|
91975
|
+
if (await ports.putExports(body) === "exists") return {
|
|
91976
|
+
outcome: "already-done",
|
|
91977
|
+
summary: { moved: false }
|
|
91978
|
+
};
|
|
91979
|
+
const held = await ports.readExports();
|
|
91980
|
+
if (held === null || canonical(held.devices) !== canonical(devices) || canonical(held.actions) !== canonical(actions)) throw new Error("the Google exposure record does not match the legacy settings; nothing was cleared");
|
|
91981
|
+
return {
|
|
91982
|
+
outcome: "done",
|
|
91983
|
+
summary: {
|
|
91984
|
+
moved: true,
|
|
91985
|
+
devices: devices.length,
|
|
91986
|
+
actions: actions.length
|
|
91987
|
+
}
|
|
91988
|
+
};
|
|
91989
|
+
}
|
|
91990
|
+
var rowId = (key) => `${GOOGLE_INSTANCE_ID}.${key}`;
|
|
91991
|
+
async function planDropMovedExposure(ports) {
|
|
91992
|
+
const stored = await ports.readStored();
|
|
91993
|
+
const present = MOVED_EXPOSURE_KEYS.filter((key) => key in stored);
|
|
91994
|
+
if (present.length === 0) return { edits: [] };
|
|
91995
|
+
const refuse = (reason) => {
|
|
91996
|
+
ports.warn(`Google migration: the legacy exposure keys are kept: ${reason}`);
|
|
91997
|
+
throw new Error(`the legacy Google exposure keys are not deleted: ${reason}`);
|
|
91998
|
+
};
|
|
91999
|
+
const held = await ports.readExports();
|
|
92000
|
+
if (held === null) return refuse("no exposure record exists");
|
|
92001
|
+
const heldDevices = new Set(held.devices.map((d) => d.deviceId));
|
|
92002
|
+
for (const device of devicesOf(stored["exposed"])) if (!heldDevices.has(device.deviceId)) return refuse(`the record lacks the device ${device.deviceId}`);
|
|
92003
|
+
const heldActions = new Set(held.actions.map((a) => a.actionId));
|
|
92004
|
+
for (const action of actionsOf(stored["exposedActions"])) if (!heldActions.has(action.actionId)) return refuse(`the record lacks the action ${action.actionId}`);
|
|
92005
|
+
return { edits: [{
|
|
92006
|
+
op: "deleteKeys",
|
|
92007
|
+
scope: ADDON_SETTINGS_TABLE,
|
|
92008
|
+
keys: present.map(rowId),
|
|
92009
|
+
precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
92010
|
+
addonId: GOOGLE_INSTANCE_ID,
|
|
92011
|
+
key,
|
|
92012
|
+
value: stored[key]
|
|
92013
|
+
}])))
|
|
92014
|
+
}] };
|
|
92015
|
+
}
|
|
92016
|
+
//#endregion
|
|
90877
92017
|
//#region src/migrations/index.ts
|
|
92018
|
+
var DROP_PUBLIC_HUB_URL_ID = "export-google/2026-11-02-drop-public-hub-url";
|
|
92019
|
+
var EXPOSURE_TO_RECORD_ID = "export-google/2026-11-04-exposure-to-record";
|
|
92020
|
+
var DROP_MOVED_EXPOSURE_ID = "export-google/2026-11-04-drop-moved-exposure";
|
|
92021
|
+
var FIXTURE_MARK = "the linked account list the migration does not know";
|
|
90878
92022
|
/** The `export-google` catalogue (D987): offered to the engine when the addon initialises. */
|
|
90879
|
-
var ADDON_MIGRATIONS = [
|
|
90880
|
-
|
|
90881
|
-
|
|
90882
|
-
|
|
90883
|
-
|
|
90884
|
-
|
|
90885
|
-
|
|
90886
|
-
|
|
90887
|
-
|
|
90888
|
-
|
|
90889
|
-
|
|
90890
|
-
|
|
90891
|
-
|
|
90892
|
-
|
|
90893
|
-
|
|
90894
|
-
|
|
92023
|
+
var ADDON_MIGRATIONS = [
|
|
92024
|
+
{
|
|
92025
|
+
meta: {
|
|
92026
|
+
id: DROP_PUBLIC_HUB_URL_ID,
|
|
92027
|
+
owner: "export-google",
|
|
92028
|
+
level: "addon-state",
|
|
92029
|
+
seq: 1,
|
|
92030
|
+
dependsOn: [],
|
|
92031
|
+
store: "settings",
|
|
92032
|
+
scope: "cluster",
|
|
92033
|
+
onFailure: "tolerate",
|
|
92034
|
+
bodyKind: "plan",
|
|
92035
|
+
description: "Delete the retired publicHubUrl and detectedPublicHubUrl settings; the public URL is the publicEndpoint role",
|
|
92036
|
+
fixtureMark: FIXTURE_MARK
|
|
92037
|
+
},
|
|
92038
|
+
plan: planDropPublicHubUrl
|
|
92039
|
+
},
|
|
92040
|
+
{
|
|
92041
|
+
meta: {
|
|
92042
|
+
id: EXPOSURE_TO_RECORD_ID,
|
|
92043
|
+
owner: "export-google",
|
|
92044
|
+
level: "addon-state",
|
|
92045
|
+
seq: 2,
|
|
92046
|
+
dependsOn: [],
|
|
92047
|
+
store: "settings",
|
|
92048
|
+
scope: "cluster",
|
|
92049
|
+
onFailure: "block-owner",
|
|
92050
|
+
bodyKind: "procedure",
|
|
92051
|
+
description: "Move the exposed devices and actions into the google-exports record; the record is read back before anything is deleted",
|
|
92052
|
+
fixtureMark: FIXTURE_MARK
|
|
92053
|
+
},
|
|
92054
|
+
procedure: moveExposureToRecord
|
|
92055
|
+
},
|
|
92056
|
+
{
|
|
92057
|
+
meta: {
|
|
92058
|
+
id: DROP_MOVED_EXPOSURE_ID,
|
|
92059
|
+
owner: "export-google",
|
|
92060
|
+
level: "addon-state",
|
|
92061
|
+
seq: 3,
|
|
92062
|
+
dependsOn: [EXPOSURE_TO_RECORD_ID],
|
|
92063
|
+
store: "settings",
|
|
92064
|
+
scope: "cluster",
|
|
92065
|
+
onFailure: "block-owner",
|
|
92066
|
+
bodyKind: "plan",
|
|
92067
|
+
description: "Delete the exposed and exposedActions settings keys once the record holds what they carried",
|
|
92068
|
+
fixtureMark: FIXTURE_MARK
|
|
92069
|
+
},
|
|
92070
|
+
plan: planDropMovedExposure
|
|
92071
|
+
}
|
|
92072
|
+
];
|
|
90895
92073
|
//#endregion
|
|
90896
92074
|
//#region src/public-endpoint.ts
|
|
90897
92075
|
/** The typed refusal when the role resolves to nothing. */
|
|
@@ -90961,11 +92139,7 @@ var buildConsoleSetupFromRole = async (input) => {
|
|
|
90961
92139
|
};
|
|
90962
92140
|
//#endregion
|
|
90963
92141
|
//#region src/types.ts
|
|
90964
|
-
var DEFAULT_SETTINGS = {
|
|
90965
|
-
exposed: [],
|
|
90966
|
-
exposedActions: [],
|
|
90967
|
-
linkedAccounts: []
|
|
90968
|
-
};
|
|
92142
|
+
var DEFAULT_SETTINGS = { linkedAccounts: [] };
|
|
90969
92143
|
//#endregion
|
|
90970
92144
|
//#region src/export-google.addon.ts
|
|
90971
92145
|
/**
|
|
@@ -91007,6 +92181,31 @@ var DEFAULT_SETTINGS = {
|
|
|
91007
92181
|
var ADDON_ID = "export-google";
|
|
91008
92182
|
var ExportGoogleAddon = class extends BaseAddon {
|
|
91009
92183
|
gateway = null;
|
|
92184
|
+
/**
|
|
92185
|
+
* The `google-exports` record: what Google syncs. Loaded once at boot after the migrations;
|
|
92186
|
+
* this addon is its only writer, so the in-memory copy is the synchronous read the fulfillment
|
|
92187
|
+
* path needs. No settings key backs it.
|
|
92188
|
+
*/
|
|
92189
|
+
exportsRow = EMPTY_GOOGLE_EXPORTS;
|
|
92190
|
+
exportsHandle = null;
|
|
92191
|
+
get exposedDevices() {
|
|
92192
|
+
return this.exportsRow.devices;
|
|
92193
|
+
}
|
|
92194
|
+
/** Persist a change of the exposure: the record first, the in-memory copy after it landed. */
|
|
92195
|
+
async writeExports(patch) {
|
|
92196
|
+
const handle = this.exportsHandle;
|
|
92197
|
+
if (handle === null) throw new Error("export-google: the exposure record is not open");
|
|
92198
|
+
const next = {
|
|
92199
|
+
name: this.exportsRow.name,
|
|
92200
|
+
devices: patch.devices ?? this.exportsRow.devices,
|
|
92201
|
+
actions: patch.actions ?? this.exportsRow.actions
|
|
92202
|
+
};
|
|
92203
|
+
await handle.put({
|
|
92204
|
+
id: GOOGLE_INSTANCE_ID,
|
|
92205
|
+
data: next
|
|
92206
|
+
});
|
|
92207
|
+
this.exportsRow = next;
|
|
92208
|
+
}
|
|
91010
92209
|
constructor() {
|
|
91011
92210
|
super({ ...DEFAULT_SETTINGS });
|
|
91012
92211
|
}
|
|
@@ -91016,42 +92215,95 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91016
92215
|
logger: this.ctx.logger
|
|
91017
92216
|
});
|
|
91018
92217
|
this.gateway = gateway;
|
|
91019
|
-
|
|
92218
|
+
const records = this.ctx.records;
|
|
92219
|
+
if (records === void 0) throw new Error("export-google needs ctx.records — check execution.placement (hub-only)");
|
|
92220
|
+
await records.declare({ "google-exports": googleExportsKind });
|
|
92221
|
+
const exportsHandle = records.kind(googleExportsKind);
|
|
92222
|
+
this.exportsHandle = exportsHandle;
|
|
92223
|
+
await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, {
|
|
92224
|
+
readStored: async () => this.resolveGlobalStore(),
|
|
92225
|
+
warn: (message) => {
|
|
92226
|
+
this.ctx.logger.warn(message, { tags: {
|
|
92227
|
+
topic: "export-google",
|
|
92228
|
+
phase: "migration"
|
|
92229
|
+
} });
|
|
92230
|
+
},
|
|
92231
|
+
putExports: async (body) => {
|
|
92232
|
+
if (await exportsHandle.get("export-google") !== null) return "exists";
|
|
92233
|
+
try {
|
|
92234
|
+
await exportsHandle.put({
|
|
92235
|
+
id: GOOGLE_INSTANCE_ID,
|
|
92236
|
+
data: body
|
|
92237
|
+
}, { ifRev: 0 });
|
|
92238
|
+
} catch (err) {
|
|
92239
|
+
if (err instanceof RevConflictError) return "exists";
|
|
92240
|
+
throw err;
|
|
92241
|
+
}
|
|
92242
|
+
return "created";
|
|
92243
|
+
},
|
|
92244
|
+
readExports: async () => (await exportsHandle.get("export-google"))?.data ?? null
|
|
92245
|
+
}));
|
|
92246
|
+
this.exportsRow = (await exportsHandle.get("export-google"))?.data ?? EMPTY_GOOGLE_EXPORTS;
|
|
91020
92247
|
const actionScenes = new ActionSceneExports({
|
|
91021
92248
|
api: this.ctx.api,
|
|
91022
92249
|
logger: this.ctx.logger,
|
|
91023
92250
|
isAdminUser: async (userId) => {
|
|
91024
92251
|
return (await this.ctx.api.userManagement.listUsers.query()).some((u) => u.id === userId && u.isAdmin);
|
|
91025
92252
|
},
|
|
91026
|
-
persist: (entries) => this.
|
|
91027
|
-
}, this.
|
|
92253
|
+
persist: (entries) => this.writeExports({ actions: [...entries] })
|
|
92254
|
+
}, this.exportsRow.actions);
|
|
91028
92255
|
actionScenes.reconcile().catch((err) => {
|
|
91029
92256
|
this.ctx.logger.warn("export-google: action scene reconcile at boot failed", { meta: { error: errMsg$1(err) } });
|
|
91030
92257
|
});
|
|
92258
|
+
const ownInstance = (instanceId) => assertOwnExportInstance("export-google", ADDON_ID, instanceId);
|
|
91031
92259
|
const deviceExportProvider = {
|
|
91032
|
-
getStatus: async () =>
|
|
91033
|
-
|
|
91034
|
-
|
|
91035
|
-
|
|
91036
|
-
|
|
91037
|
-
|
|
91038
|
-
|
|
91039
|
-
|
|
91040
|
-
|
|
92260
|
+
getStatus: async (input) => {
|
|
92261
|
+
ownInstance(statusInstanceOf(input));
|
|
92262
|
+
return {
|
|
92263
|
+
linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
|
|
92264
|
+
exposedDeviceCount: this.exposedDevices.length,
|
|
92265
|
+
setup: await this.buildSetupBlock()
|
|
92266
|
+
};
|
|
92267
|
+
},
|
|
92268
|
+
listInstances: async () => [{
|
|
92269
|
+
instanceId: ADDON_ID,
|
|
92270
|
+
name: "Google Home",
|
|
92271
|
+
enabled: true,
|
|
92272
|
+
kind: "google-home"
|
|
92273
|
+
}],
|
|
92274
|
+
listSupportedDeviceKinds: async ({ instanceId }) => {
|
|
92275
|
+
ownInstance(instanceId);
|
|
92276
|
+
return [...SUPPORTED_DEVICE_KINDS];
|
|
92277
|
+
},
|
|
92278
|
+
listExposedDevices: async ({ instanceId }) => {
|
|
92279
|
+
ownInstance(instanceId);
|
|
92280
|
+
return this.exposedDevices.map((entry) => ({ deviceId: String(entry.deviceId) }));
|
|
92281
|
+
},
|
|
92282
|
+
exposeDevice: async ({ instanceId, deviceId }) => {
|
|
92283
|
+
ownInstance(instanceId);
|
|
92284
|
+
return this.exposeDevice(deviceId);
|
|
92285
|
+
},
|
|
92286
|
+
unexposeDevice: async ({ instanceId, deviceId }) => {
|
|
92287
|
+
ownInstance(instanceId);
|
|
92288
|
+
return this.unexposeDevice(deviceId);
|
|
92289
|
+
},
|
|
91041
92290
|
listSupportedEntityKinds: async () => ["device", "action"],
|
|
91042
|
-
listExposedEntities: async () => {
|
|
92291
|
+
listExposedEntities: async ({ instanceId }) => {
|
|
92292
|
+
ownInstance(instanceId);
|
|
91043
92293
|
await actionScenes.reconcile();
|
|
91044
|
-
return [...this.
|
|
92294
|
+
return [...this.exposedDevices.map((entry) => ({ entity: {
|
|
91045
92295
|
kind: "device",
|
|
91046
92296
|
deviceId: String(entry.deviceId)
|
|
91047
92297
|
} })), ...actionScenes.list()];
|
|
91048
92298
|
},
|
|
91049
|
-
exposeEntity: async ({ entity }) => {
|
|
92299
|
+
exposeEntity: async ({ instanceId, entity }) => {
|
|
92300
|
+
ownInstance(instanceId);
|
|
91050
92301
|
if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
|
|
91051
92302
|
if (entity.kind === "action") return actionScenes.expose(entity.actionId);
|
|
91052
92303
|
throw new Error("export-google: a notification target cannot be exported to Google Home");
|
|
91053
92304
|
},
|
|
91054
|
-
unexposeEntity: async ({ entity }) => {
|
|
92305
|
+
unexposeEntity: async ({ instanceId, entity }) => {
|
|
92306
|
+
ownInstance(instanceId);
|
|
91055
92307
|
if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
|
|
91056
92308
|
if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
|
|
91057
92309
|
throw new Error("export-google: a notification target cannot be exported to Google Home");
|
|
@@ -91068,7 +92320,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91068
92320
|
sync: {
|
|
91069
92321
|
gateway,
|
|
91070
92322
|
logger: this.ctx.logger,
|
|
91071
|
-
listExposed: () => this.
|
|
92323
|
+
listExposed: () => this.exposedDevices.map((entry) => entry.deviceId),
|
|
91072
92324
|
actions: actionScenes
|
|
91073
92325
|
},
|
|
91074
92326
|
query: {
|
|
@@ -91089,7 +92341,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91089
92341
|
}));
|
|
91090
92342
|
const oauthIntegrationProvider = { getDescriptor: async () => buildGoogleOauthIntegration() };
|
|
91091
92343
|
this.ctx.logger.info("export-google: initialized", { meta: {
|
|
91092
|
-
exposedCount: this.
|
|
92344
|
+
exposedCount: this.exposedDevices.length,
|
|
91093
92345
|
linkedAccounts: this.config.linkedAccounts.length,
|
|
91094
92346
|
willReportState: false
|
|
91095
92347
|
} });
|
|
@@ -91112,7 +92364,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91112
92364
|
this.gateway = null;
|
|
91113
92365
|
}
|
|
91114
92366
|
isExposed(deviceId) {
|
|
91115
|
-
return this.
|
|
92367
|
+
return this.exposedDevices.some((entry) => entry.deviceId === deviceId);
|
|
91116
92368
|
}
|
|
91117
92369
|
async exposeDevice(deviceIdRaw) {
|
|
91118
92370
|
const deviceId = Number.parseInt(deviceIdRaw, 10);
|
|
@@ -91131,20 +92383,20 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91131
92383
|
});
|
|
91132
92384
|
throw new Error(`export-google: device ${deviceId} has no capability this addon exports (bound: ${facts.capNames.join(", ") || "none"})`);
|
|
91133
92385
|
}
|
|
91134
|
-
const next = this.
|
|
92386
|
+
const next = this.exposedDevices.filter((e) => e.deviceId !== deviceId);
|
|
91135
92387
|
next.push({
|
|
91136
92388
|
deviceId,
|
|
91137
92389
|
exposedAt: Date.now()
|
|
91138
92390
|
});
|
|
91139
|
-
await this.
|
|
92391
|
+
await this.writeExports({ devices: next });
|
|
91140
92392
|
this.ctx.logger.info("export-google: exposed device — visible after the next Google SYNC (\"Hey Google, sync my devices\")", { tags: { deviceId } });
|
|
91141
92393
|
}
|
|
91142
92394
|
async unexposeDevice(deviceIdRaw) {
|
|
91143
92395
|
const deviceId = Number.parseInt(deviceIdRaw, 10);
|
|
91144
92396
|
if (!Number.isFinite(deviceId)) return;
|
|
91145
|
-
const next = this.
|
|
91146
|
-
if (next.length === this.
|
|
91147
|
-
await this.
|
|
92397
|
+
const next = this.exposedDevices.filter((e) => e.deviceId !== deviceId);
|
|
92398
|
+
if (next.length === this.exposedDevices.length) return;
|
|
92399
|
+
await this.writeExports({ devices: next });
|
|
91148
92400
|
this.ctx.logger.info("export-google: unexposed device — removed from Google on its next SYNC", { tags: { deviceId } });
|
|
91149
92401
|
}
|
|
91150
92402
|
requireGateway() {
|