@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
|
@@ -863,7 +863,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
863
863
|
return EventCategory;
|
|
864
864
|
}({});
|
|
865
865
|
//#endregion
|
|
866
|
-
//#region ../types/dist/device-type-
|
|
866
|
+
//#region ../types/dist/device-type-D1fH5kaC.mjs
|
|
867
867
|
/**
|
|
868
868
|
import { errMsg } from '@camstack/types'
|
|
869
869
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1052,6 +1052,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1052
1052
|
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
1053
1053
|
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
1054
1054
|
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
1055
|
+
/** Cover has a real stop: `stop` halts the travel in place. Gates the stop
|
|
1056
|
+
* control in exporters; a provider whose `stop` is a no-op never declares it. */
|
|
1057
|
+
DeviceFeature["CoverStoppable"] = "cover-stoppable";
|
|
1055
1058
|
/** Valve exposes intermediate position control (0..100). Gates the
|
|
1056
1059
|
* position slider / drag surface UI. */
|
|
1057
1060
|
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
@@ -1091,6 +1094,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1091
1094
|
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
1092
1095
|
/** Media player exposes stop distinct from pause. */
|
|
1093
1096
|
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
1097
|
+
/** Media player exposes volume up / down in steps (an infrared TV has no level). */
|
|
1098
|
+
DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
|
|
1099
|
+
/** Media player exposes channel up / down in steps. */
|
|
1100
|
+
DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
|
|
1101
|
+
/** Media player exposes power on / off. */
|
|
1102
|
+
DeviceFeature["MediaPlayerPower"] = "media-player-power";
|
|
1094
1103
|
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
1095
1104
|
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
1096
1105
|
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
@@ -4627,6 +4636,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4627
4636
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4628
4637
|
json.type = "boolean";
|
|
4629
4638
|
};
|
|
4639
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4640
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4641
|
+
};
|
|
4642
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4643
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4644
|
+
};
|
|
4630
4645
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4631
4646
|
if (ctx.target === "openapi-3.0") {
|
|
4632
4647
|
json.type = "string";
|
|
@@ -4634,12 +4649,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4634
4649
|
json.enum = [null];
|
|
4635
4650
|
} else json.type = "null";
|
|
4636
4651
|
};
|
|
4652
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4653
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4654
|
+
};
|
|
4637
4655
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4638
4656
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4639
4657
|
};
|
|
4640
4658
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4641
4659
|
json.not = {};
|
|
4642
4660
|
};
|
|
4661
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4662
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4643
4663
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4644
4664
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4645
4665
|
};
|
|
@@ -4671,12 +4691,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4671
4691
|
json.enum = vals;
|
|
4672
4692
|
}
|
|
4673
4693
|
};
|
|
4694
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4695
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4696
|
+
};
|
|
4697
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4698
|
+
const _json = json;
|
|
4699
|
+
const pattern = schema._zod.pattern;
|
|
4700
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4701
|
+
_json.type = "string";
|
|
4702
|
+
_json.pattern = pattern.source;
|
|
4703
|
+
};
|
|
4704
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4705
|
+
const _json = json;
|
|
4706
|
+
const file = {
|
|
4707
|
+
type: "string",
|
|
4708
|
+
format: "binary",
|
|
4709
|
+
contentEncoding: "binary"
|
|
4710
|
+
};
|
|
4711
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4712
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4713
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4714
|
+
if (mime) if (mime.length === 1) {
|
|
4715
|
+
file.contentMediaType = mime[0];
|
|
4716
|
+
Object.assign(_json, file);
|
|
4717
|
+
} else {
|
|
4718
|
+
Object.assign(_json, file);
|
|
4719
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4720
|
+
}
|
|
4721
|
+
else Object.assign(_json, file);
|
|
4722
|
+
};
|
|
4723
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4724
|
+
json.type = "boolean";
|
|
4725
|
+
};
|
|
4674
4726
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4675
4727
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4676
4728
|
};
|
|
4729
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4730
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4731
|
+
};
|
|
4677
4732
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4678
4733
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4679
4734
|
};
|
|
4735
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4736
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4737
|
+
};
|
|
4738
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4739
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4740
|
+
};
|
|
4680
4741
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4681
4742
|
const json = _json;
|
|
4682
4743
|
const def = schema._zod.def;
|
|
@@ -4881,6 +4942,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4881
4942
|
seen.ref = def.innerType;
|
|
4882
4943
|
json.readOnly = true;
|
|
4883
4944
|
};
|
|
4945
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4946
|
+
const def = schema._zod.def;
|
|
4947
|
+
process(def.innerType, ctx, params);
|
|
4948
|
+
const seen = ctx.seen.get(schema);
|
|
4949
|
+
seen.ref = def.innerType;
|
|
4950
|
+
};
|
|
4884
4951
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4885
4952
|
const def = schema._zod.def;
|
|
4886
4953
|
process(def.innerType, ctx, params);
|
|
@@ -4893,6 +4960,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4893
4960
|
const seen = ctx.seen.get(schema);
|
|
4894
4961
|
seen.ref = innerType;
|
|
4895
4962
|
};
|
|
4963
|
+
var allProcessors = {
|
|
4964
|
+
string: stringProcessor,
|
|
4965
|
+
number: numberProcessor,
|
|
4966
|
+
boolean: booleanProcessor,
|
|
4967
|
+
bigint: bigintProcessor,
|
|
4968
|
+
symbol: symbolProcessor,
|
|
4969
|
+
null: nullProcessor,
|
|
4970
|
+
undefined: undefinedProcessor,
|
|
4971
|
+
void: voidProcessor,
|
|
4972
|
+
never: neverProcessor,
|
|
4973
|
+
any: anyProcessor,
|
|
4974
|
+
unknown: unknownProcessor,
|
|
4975
|
+
date: dateProcessor,
|
|
4976
|
+
enum: enumProcessor,
|
|
4977
|
+
literal: literalProcessor,
|
|
4978
|
+
nan: nanProcessor,
|
|
4979
|
+
template_literal: templateLiteralProcessor,
|
|
4980
|
+
file: fileProcessor,
|
|
4981
|
+
success: successProcessor,
|
|
4982
|
+
custom: customProcessor,
|
|
4983
|
+
function: functionProcessor,
|
|
4984
|
+
transform: transformProcessor,
|
|
4985
|
+
map: mapProcessor,
|
|
4986
|
+
set: setProcessor,
|
|
4987
|
+
array: arrayProcessor,
|
|
4988
|
+
object: objectProcessor,
|
|
4989
|
+
union: unionProcessor,
|
|
4990
|
+
intersection: intersectionProcessor,
|
|
4991
|
+
tuple: tupleProcessor,
|
|
4992
|
+
record: recordProcessor,
|
|
4993
|
+
nullable: nullableProcessor,
|
|
4994
|
+
nonoptional: nonoptionalProcessor,
|
|
4995
|
+
default: defaultProcessor,
|
|
4996
|
+
prefault: prefaultProcessor,
|
|
4997
|
+
catch: catchProcessor,
|
|
4998
|
+
pipe: pipeProcessor,
|
|
4999
|
+
readonly: readonlyProcessor,
|
|
5000
|
+
promise: promiseProcessor,
|
|
5001
|
+
optional: optionalProcessor,
|
|
5002
|
+
lazy: lazyProcessor
|
|
5003
|
+
};
|
|
5004
|
+
function toJSONSchema(input, params) {
|
|
5005
|
+
if ("_idmap" in input) {
|
|
5006
|
+
const registry = input;
|
|
5007
|
+
const ctx = initializeContext({
|
|
5008
|
+
...params,
|
|
5009
|
+
processors: allProcessors
|
|
5010
|
+
});
|
|
5011
|
+
const defs = {};
|
|
5012
|
+
for (const entry of registry._idmap.entries()) {
|
|
5013
|
+
const [_, schema] = entry;
|
|
5014
|
+
process(schema, ctx);
|
|
5015
|
+
}
|
|
5016
|
+
const schemas = {};
|
|
5017
|
+
ctx.external = {
|
|
5018
|
+
registry,
|
|
5019
|
+
uri: params?.uri,
|
|
5020
|
+
defs
|
|
5021
|
+
};
|
|
5022
|
+
for (const entry of registry._idmap.entries()) {
|
|
5023
|
+
const [key, schema] = entry;
|
|
5024
|
+
extractDefs(ctx, schema);
|
|
5025
|
+
schemas[key] = finalize(ctx, schema);
|
|
5026
|
+
}
|
|
5027
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
5028
|
+
return { schemas };
|
|
5029
|
+
}
|
|
5030
|
+
const ctx = initializeContext({
|
|
5031
|
+
...params,
|
|
5032
|
+
processors: allProcessors
|
|
5033
|
+
});
|
|
5034
|
+
process(input, ctx);
|
|
5035
|
+
extractDefs(ctx, input);
|
|
5036
|
+
return finalize(ctx, input);
|
|
5037
|
+
}
|
|
4896
5038
|
//#endregion
|
|
4897
5039
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4898
5040
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5917,7 +6059,7 @@ var ZodIssueCode = {
|
|
|
5917
6059
|
var ZodFirstPartyTypeKind;
|
|
5918
6060
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5919
6061
|
//#endregion
|
|
5920
|
-
//#region ../types/dist/sleep-
|
|
6062
|
+
//#region ../types/dist/sleep-BaWhXZFm.mjs
|
|
5921
6063
|
/**
|
|
5922
6064
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5923
6065
|
* window to float samples (D455).
|
|
@@ -5996,6 +6138,22 @@ function buildAlawTable() {
|
|
|
5996
6138
|
}
|
|
5997
6139
|
buildUlawTable();
|
|
5998
6140
|
buildAlawTable();
|
|
6141
|
+
/**
|
|
6142
|
+
* An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
|
|
6143
|
+
* so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
|
|
6144
|
+
* co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
|
|
6145
|
+
* bundles its own copy of this module, so the class the runner sees is not the one that threw.
|
|
6146
|
+
*/
|
|
6147
|
+
var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
|
|
6148
|
+
var AddonMigrationsBlockedError = class extends Error {
|
|
6149
|
+
/** The ledger ids that did not apply and block the owner. */
|
|
6150
|
+
migrationIds;
|
|
6151
|
+
constructor(migrationIds) {
|
|
6152
|
+
super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
|
|
6153
|
+
this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
|
|
6154
|
+
this.migrationIds = migrationIds;
|
|
6155
|
+
}
|
|
6156
|
+
};
|
|
5999
6157
|
/** Is this field's stored value a credential? */
|
|
6000
6158
|
function isSecretConfigField(field) {
|
|
6001
6159
|
if (field.type === "password") return true;
|
|
@@ -6864,7 +7022,7 @@ async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
|
6864
7022
|
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6865
7023
|
return out;
|
|
6866
7024
|
}
|
|
6867
|
-
function rowId(row, idKey) {
|
|
7025
|
+
function rowId$1(row, idKey) {
|
|
6868
7026
|
const raw = row[idKey];
|
|
6869
7027
|
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6870
7028
|
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
@@ -6881,7 +7039,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6881
7039
|
}
|
|
6882
7040
|
const storedById = /* @__PURE__ */ new Map();
|
|
6883
7041
|
for (const row of storedRows) {
|
|
6884
|
-
const id = rowId(row, node.idKey);
|
|
7042
|
+
const id = rowId$1(row, node.idKey);
|
|
6885
7043
|
if (id !== null) storedById.set(id, row);
|
|
6886
7044
|
}
|
|
6887
7045
|
const kept = /* @__PURE__ */ new Set();
|
|
@@ -6891,13 +7049,13 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6891
7049
|
rows.push(row);
|
|
6892
7050
|
continue;
|
|
6893
7051
|
}
|
|
6894
|
-
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7052
|
+
const id = rowId$1(row, node.idKey) ?? ctx.mintId();
|
|
6895
7053
|
kept.add(id);
|
|
6896
7054
|
const withId = {
|
|
6897
7055
|
...row,
|
|
6898
7056
|
[node.idKey]: row[node.idKey] ?? id
|
|
6899
7057
|
};
|
|
6900
|
-
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7058
|
+
if (rowId$1(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6901
7059
|
const storedRow = storedById.get(id) ?? {};
|
|
6902
7060
|
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6903
7061
|
}
|
|
@@ -7649,7 +7807,7 @@ var BaseAddon = class {
|
|
|
7649
7807
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7650
7808
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7651
7809
|
}, migrations, this.ctx.logger);
|
|
7652
|
-
if (report.blockOwner.length > 0) throw new
|
|
7810
|
+
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7653
7811
|
return report;
|
|
7654
7812
|
}
|
|
7655
7813
|
/**
|
|
@@ -7989,6 +8147,10 @@ var BaseAddon = class {
|
|
|
7989
8147
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7990
8148
|
const patch = {};
|
|
7991
8149
|
for (const key of keys) {
|
|
8150
|
+
if (tree.get(key)?.kind === "array") {
|
|
8151
|
+
patch[key] = [];
|
|
8152
|
+
continue;
|
|
8153
|
+
}
|
|
7992
8154
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7993
8155
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7994
8156
|
}
|
|
@@ -8628,6 +8790,38 @@ function normalizeAddonInitResult(result) {
|
|
|
8628
8790
|
if (Array.isArray(result)) return { providers: result };
|
|
8629
8791
|
return result;
|
|
8630
8792
|
}
|
|
8793
|
+
var PREFIX$1 = "records/";
|
|
8794
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8795
|
+
var RecordsError = class extends Error {
|
|
8796
|
+
code;
|
|
8797
|
+
detail;
|
|
8798
|
+
constructor(code, detail) {
|
|
8799
|
+
super(`${PREFIX$1}${code}: ${detail}`);
|
|
8800
|
+
this.name = "RecordsError";
|
|
8801
|
+
this.code = code;
|
|
8802
|
+
this.detail = detail;
|
|
8803
|
+
}
|
|
8804
|
+
};
|
|
8805
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8806
|
+
var RevConflictError = class extends RecordsError {
|
|
8807
|
+
constructor(detail) {
|
|
8808
|
+
super("rev-conflict", detail);
|
|
8809
|
+
this.name = "RevConflictError";
|
|
8810
|
+
}
|
|
8811
|
+
};
|
|
8812
|
+
var InvalidRecordError = class extends RecordsError {
|
|
8813
|
+
constructor(detail) {
|
|
8814
|
+
super("invalid-record", detail);
|
|
8815
|
+
this.name = "InvalidRecordError";
|
|
8816
|
+
}
|
|
8817
|
+
};
|
|
8818
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8819
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
8820
|
+
constructor(detail) {
|
|
8821
|
+
super("declaration-refused", detail);
|
|
8822
|
+
this.name = "DeclarationRefusedError";
|
|
8823
|
+
}
|
|
8824
|
+
};
|
|
8631
8825
|
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8632
8826
|
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8633
8827
|
var RECORD_DATABASES = ["settings", "events"];
|
|
@@ -8643,6 +8837,50 @@ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
|
8643
8837
|
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8644
8838
|
var RECORD_BATCH_MAX = 1e3;
|
|
8645
8839
|
var RECORD_QUERY_MAX = 1e3;
|
|
8840
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8841
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8842
|
+
/**
|
|
8843
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8844
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8845
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8846
|
+
*
|
|
8847
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8848
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8849
|
+
* key releases exactly that key's secret.
|
|
8850
|
+
*
|
|
8851
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8852
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8853
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8854
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8855
|
+
*
|
|
8856
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8857
|
+
*/
|
|
8858
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8859
|
+
function parseSecretPath(path) {
|
|
8860
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8861
|
+
return path.split(".").map((raw) => {
|
|
8862
|
+
const each = raw.endsWith("[]");
|
|
8863
|
+
const map = raw.endsWith("{}");
|
|
8864
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8865
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8866
|
+
return {
|
|
8867
|
+
key,
|
|
8868
|
+
each,
|
|
8869
|
+
map
|
|
8870
|
+
};
|
|
8871
|
+
});
|
|
8872
|
+
}
|
|
8873
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8874
|
+
function secretArrayPrefixes(path) {
|
|
8875
|
+
const segments = parseSecretPath(path);
|
|
8876
|
+
const prefixes = [];
|
|
8877
|
+
const walked = [];
|
|
8878
|
+
for (const segment of segments) {
|
|
8879
|
+
walked.push(segment.key);
|
|
8880
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8881
|
+
}
|
|
8882
|
+
return prefixes;
|
|
8883
|
+
}
|
|
8646
8884
|
/**
|
|
8647
8885
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
8648
8886
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -8667,6 +8905,75 @@ var PeerBytesTicketSchema = object({
|
|
|
8667
8905
|
*/
|
|
8668
8906
|
declaredBytes: number().int().nonnegative().nullable()
|
|
8669
8907
|
});
|
|
8908
|
+
function defOf(schema) {
|
|
8909
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
8910
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
8911
|
+
const def = Reflect.get(zodBag, "def");
|
|
8912
|
+
if (typeof def !== "object" || def === null) return {};
|
|
8913
|
+
return def;
|
|
8914
|
+
}
|
|
8915
|
+
function declaredHere(schema) {
|
|
8916
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8917
|
+
}
|
|
8918
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8919
|
+
var WRAPPERS = new Set([
|
|
8920
|
+
"optional",
|
|
8921
|
+
"nullable",
|
|
8922
|
+
"default",
|
|
8923
|
+
"prefault",
|
|
8924
|
+
"catch",
|
|
8925
|
+
"readonly",
|
|
8926
|
+
"nonoptional"
|
|
8927
|
+
]);
|
|
8928
|
+
/**
|
|
8929
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8930
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8931
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8932
|
+
* `.transform` on `in`).
|
|
8933
|
+
*/
|
|
8934
|
+
function layersOf(schema) {
|
|
8935
|
+
const out = [];
|
|
8936
|
+
const queue = [schema];
|
|
8937
|
+
while (queue.length > 0) {
|
|
8938
|
+
const s = queue.shift();
|
|
8939
|
+
if (!s || out.includes(s)) continue;
|
|
8940
|
+
out.push(s);
|
|
8941
|
+
const def = defOf(s);
|
|
8942
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8943
|
+
if (def.type === "pipe") {
|
|
8944
|
+
if (def.in) queue.push(def.in);
|
|
8945
|
+
if (def.out) queue.push(def.out);
|
|
8946
|
+
}
|
|
8947
|
+
}
|
|
8948
|
+
return out;
|
|
8949
|
+
}
|
|
8950
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8951
|
+
function isZodSecret(schema) {
|
|
8952
|
+
return layersOf(schema).some(declaredHere);
|
|
8953
|
+
}
|
|
8954
|
+
/**
|
|
8955
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8956
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
8957
|
+
* map" (`applianceSecrets{}`). A declared
|
|
8958
|
+
* object or array is reported as one path and not descended into — everything
|
|
8959
|
+
* under it is secret.
|
|
8960
|
+
*/
|
|
8961
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8962
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8963
|
+
const paths = [];
|
|
8964
|
+
for (const layer of layersOf(schema)) {
|
|
8965
|
+
const def = defOf(layer);
|
|
8966
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8967
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8968
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
8969
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8970
|
+
else if (def.type === "intersection") {
|
|
8971
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8972
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8973
|
+
}
|
|
8974
|
+
}
|
|
8975
|
+
return [...new Set(paths)];
|
|
8976
|
+
}
|
|
8670
8977
|
/**
|
|
8671
8978
|
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8672
8979
|
* Zod row schema that describes it, and the helper that turns the two into the
|
|
@@ -8733,6 +9040,111 @@ var RecordKindDeclarationSchema = object({
|
|
|
8733
9040
|
}).strict();
|
|
8734
9041
|
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8735
9042
|
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9043
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9044
|
+
function assertValidDeclaration(name, decl) {
|
|
9045
|
+
const refuse = (why) => {
|
|
9046
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9047
|
+
};
|
|
9048
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9049
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9050
|
+
for (const index of decl.indexes) {
|
|
9051
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9052
|
+
seen.add(index.name);
|
|
9053
|
+
}
|
|
9054
|
+
const { retention } = decl;
|
|
9055
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
9056
|
+
if ("ttlMs" in retention) {
|
|
9057
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9058
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9059
|
+
}
|
|
9060
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9061
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9062
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9063
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9064
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9065
|
+
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)`);
|
|
9066
|
+
}
|
|
9067
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9068
|
+
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`);
|
|
9069
|
+
}
|
|
9070
|
+
function bodyFieldsOf(schema) {
|
|
9071
|
+
return { ...toJSONSchema(schema, {
|
|
9072
|
+
unrepresentable: "any",
|
|
9073
|
+
io: "input"
|
|
9074
|
+
}) };
|
|
9075
|
+
}
|
|
9076
|
+
function isRecordLike(value) {
|
|
9077
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9078
|
+
}
|
|
9079
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9080
|
+
function hasNameField(json, field) {
|
|
9081
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9082
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9083
|
+
const properties = json["properties"];
|
|
9084
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9085
|
+
}
|
|
9086
|
+
/**
|
|
9087
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9088
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9089
|
+
* types its handle from.
|
|
9090
|
+
*/
|
|
9091
|
+
function defineRecordKinds(specs) {
|
|
9092
|
+
const out = {};
|
|
9093
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
9094
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9095
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
9096
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
9097
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9098
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
9099
|
+
database: spec.database,
|
|
9100
|
+
class: spec.class,
|
|
9101
|
+
writeTrigger: spec.writeTrigger,
|
|
9102
|
+
device: spec.device,
|
|
9103
|
+
at: spec.at,
|
|
9104
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9105
|
+
retention: spec.retention,
|
|
9106
|
+
deviceRemoval: spec.deviceRemoval,
|
|
9107
|
+
maxDataBytes: spec.maxDataBytes,
|
|
9108
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9109
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9110
|
+
transactFamily: spec.transactFamily,
|
|
9111
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
9112
|
+
title: spec.entry.title,
|
|
9113
|
+
nameField,
|
|
9114
|
+
fields
|
|
9115
|
+
}
|
|
9116
|
+
});
|
|
9117
|
+
assertValidDeclaration(name, parsed);
|
|
9118
|
+
out[name] = {
|
|
9119
|
+
name,
|
|
9120
|
+
schema: spec.schema,
|
|
9121
|
+
declaration: parsed
|
|
9122
|
+
};
|
|
9123
|
+
}
|
|
9124
|
+
return out;
|
|
9125
|
+
}
|
|
9126
|
+
/**
|
|
9127
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9128
|
+
* engine, never aged, belonging to no device.
|
|
9129
|
+
*/
|
|
9130
|
+
function defineEntryKind(name, spec) {
|
|
9131
|
+
const defined = defineRecordKinds({ [name]: {
|
|
9132
|
+
schema: spec.schema,
|
|
9133
|
+
class: "config",
|
|
9134
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9135
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9136
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9137
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9138
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9139
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9140
|
+
entry: {
|
|
9141
|
+
title: spec.title,
|
|
9142
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9143
|
+
}
|
|
9144
|
+
} })[name];
|
|
9145
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9146
|
+
return defined;
|
|
9147
|
+
}
|
|
8736
9148
|
object({
|
|
8737
9149
|
field: string().min(1),
|
|
8738
9150
|
on: literal("advance")
|
|
@@ -9385,6 +9797,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9385
9797
|
"backup",
|
|
9386
9798
|
"battery",
|
|
9387
9799
|
"binary",
|
|
9800
|
+
"board-key-source",
|
|
9388
9801
|
"brightness",
|
|
9389
9802
|
"broker",
|
|
9390
9803
|
"button",
|
|
@@ -9506,6 +9919,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9506
9919
|
"privacy-mask",
|
|
9507
9920
|
"ptz",
|
|
9508
9921
|
"ptz-autotrack",
|
|
9922
|
+
"pump-cycle",
|
|
9509
9923
|
"reboot",
|
|
9510
9924
|
"record-entries",
|
|
9511
9925
|
"recording",
|
|
@@ -10798,18 +11212,6 @@ Object.freeze({
|
|
|
10798
11212
|
"path": "pumpRunning",
|
|
10799
11213
|
"valueType": "boolean"
|
|
10800
11214
|
},
|
|
10801
|
-
{
|
|
10802
|
-
"path": "pumpIntervalEnabled",
|
|
10803
|
-
"valueType": "boolean"
|
|
10804
|
-
},
|
|
10805
|
-
{
|
|
10806
|
-
"path": "pumpOnTime",
|
|
10807
|
-
"valueType": "number"
|
|
10808
|
-
},
|
|
10809
|
-
{
|
|
10810
|
-
"path": "pumpOffTime",
|
|
10811
|
-
"valueType": "number"
|
|
10812
|
-
},
|
|
10813
11215
|
{
|
|
10814
11216
|
"path": "lastDrink",
|
|
10815
11217
|
"valueType": "number"
|
|
@@ -10933,6 +11335,20 @@ Object.freeze({
|
|
|
10933
11335
|
"valueType": "number"
|
|
10934
11336
|
}
|
|
10935
11337
|
],
|
|
11338
|
+
"pump-cycle": [
|
|
11339
|
+
{
|
|
11340
|
+
"path": "enabled",
|
|
11341
|
+
"valueType": "boolean"
|
|
11342
|
+
},
|
|
11343
|
+
{
|
|
11344
|
+
"path": "onTime",
|
|
11345
|
+
"valueType": "number"
|
|
11346
|
+
},
|
|
11347
|
+
{
|
|
11348
|
+
"path": "offTime",
|
|
11349
|
+
"valueType": "number"
|
|
11350
|
+
}
|
|
11351
|
+
],
|
|
10936
11352
|
"recording-archive": [
|
|
10937
11353
|
{
|
|
10938
11354
|
"path": "deviceId",
|
|
@@ -11382,7 +11798,7 @@ object({
|
|
|
11382
11798
|
params: record(string(), union([string(), number()])).optional()
|
|
11383
11799
|
});
|
|
11384
11800
|
//#endregion
|
|
11385
|
-
//#region ../types/dist/composition-
|
|
11801
|
+
//#region ../types/dist/composition-CRNwcFYY.mjs
|
|
11386
11802
|
/**
|
|
11387
11803
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11388
11804
|
*
|
|
@@ -12145,38 +12561,6 @@ function validateExpressionSource(src) {
|
|
|
12145
12561
|
return null;
|
|
12146
12562
|
}
|
|
12147
12563
|
/**
|
|
12148
|
-
* One power reading becomes a washer, dryer or dishwasher (D944 helper).
|
|
12149
|
-
*
|
|
12150
|
-
* Standby of the control board is under 5 W; a motor or a heater is far
|
|
12151
|
-
* above that, so 5 W is the line. A door lock or a short pump spike is not
|
|
12152
|
-
* a cycle, so running starts only after 30 s above the line.
|
|
12153
|
-
*
|
|
12154
|
-
* A wash, dry or dishwasher pause (soak, heat-wait, heater off between
|
|
12155
|
-
* bursts) lasts several minutes. Ending the cycle on the first dip would
|
|
12156
|
-
* report "finished" in the middle of the program, so the stop dwell is
|
|
12157
|
-
* 10 minutes on every type. The number is stored per type so one machine
|
|
12158
|
-
* can move later without moving the others.
|
|
12159
|
-
*/
|
|
12160
|
-
var APPLIANCE_TEMPLATE_ID = "appliance";
|
|
12161
|
-
var APPLIANCE_KINDS = [
|
|
12162
|
-
"washer",
|
|
12163
|
-
"dryer",
|
|
12164
|
-
"dishwasher"
|
|
12165
|
-
];
|
|
12166
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
|
|
12167
|
-
/**
|
|
12168
|
-
* A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
|
|
12169
|
-
*
|
|
12170
|
-
* The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
|
|
12171
|
-
* (D967), so the heater switches exactly as the plug does. Running is the
|
|
12172
|
-
* plug being on; when a power reading is also named, running is the draw
|
|
12173
|
-
* staying above the line instead (a plug left on with the stove's own
|
|
12174
|
-
* thermostat open is not heating). 50 W is far above any standby and below
|
|
12175
|
-
* the smallest radiator.
|
|
12176
|
-
*/
|
|
12177
|
-
var HEATER_TEMPLATE_ID = "heater";
|
|
12178
|
-
DeviceType.Heater;
|
|
12179
|
-
/**
|
|
12180
12564
|
* Statistics and integrals over a history read (D944).
|
|
12181
12565
|
*
|
|
12182
12566
|
* Pure: the same points always give the same answer, so a restart recomputes
|
|
@@ -12320,34 +12704,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
|
|
|
12320
12704
|
/** Actuator groups only. Readings leave this unset. */
|
|
12321
12705
|
active: ActiveCriterionSchema.optional()
|
|
12322
12706
|
}),
|
|
12323
|
-
object({
|
|
12324
|
-
kind: literal("appliance"),
|
|
12325
|
-
templateId: literal(APPLIANCE_TEMPLATE_ID),
|
|
12326
|
-
appliance: _enum(APPLIANCE_KINDS),
|
|
12327
|
-
thresholdWatts: number().positive(),
|
|
12328
|
-
startDwellMs: number().int().nonnegative(),
|
|
12329
|
-
stopDwellMs: number().int().nonnegative(),
|
|
12330
|
-
member: HelperMemberSchema,
|
|
12331
|
-
/**
|
|
12332
|
-
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
12333
|
-
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
12334
|
-
* that plug (power-source link of a NEW-target composition).
|
|
12335
|
-
*/
|
|
12336
|
-
powerSwitch: HelperMemberSchema.optional(),
|
|
12337
|
-
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
12338
|
-
offSeconds: number().optional()
|
|
12339
|
-
}),
|
|
12340
|
-
object({
|
|
12341
|
-
kind: literal("heater"),
|
|
12342
|
-
templateId: literal(HEATER_TEMPLATE_ID),
|
|
12343
|
-
/** The plug, read and commanded at `switch.on`. */
|
|
12344
|
-
plug: HelperMemberSchema,
|
|
12345
|
-
/** The plug's power reading, when it has one: running is then the draw, not the switch. */
|
|
12346
|
-
meter: HelperMemberSchema.optional(),
|
|
12347
|
-
thresholdWatts: number().positive(),
|
|
12348
|
-
startDwellMs: number().int().nonnegative(),
|
|
12349
|
-
stopDwellMs: number().int().nonnegative()
|
|
12350
|
-
}),
|
|
12351
12707
|
object({
|
|
12352
12708
|
kind: literal("statistic"),
|
|
12353
12709
|
stat: _enum(STATISTIC_STATS),
|
|
@@ -12519,7 +12875,14 @@ var CompositionForwardCommandSchema = object({
|
|
|
12519
12875
|
method: string().min(1),
|
|
12520
12876
|
args: record(string().min(1), CompositionForwardArgSchema).optional()
|
|
12521
12877
|
});
|
|
12522
|
-
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
12878
|
+
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
12879
|
+
CompositionForwardCommandSchema,
|
|
12880
|
+
CompositionCodeSourceSchema,
|
|
12881
|
+
object({
|
|
12882
|
+
kind: literal("extension"),
|
|
12883
|
+
target: literal("remote")
|
|
12884
|
+
})
|
|
12885
|
+
]);
|
|
12523
12886
|
/** An item key inside an item-array cap (`consumables.items[<key>]`). */
|
|
12524
12887
|
var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
|
|
12525
12888
|
/**
|
|
@@ -12564,7 +12927,7 @@ var CompositionSchema = object({
|
|
|
12564
12927
|
kind: literal("existing"),
|
|
12565
12928
|
device: CompositionSourceRefSchema
|
|
12566
12929
|
})]),
|
|
12567
|
-
features: array(CompositionFeatureSchema).min(
|
|
12930
|
+
features: array(CompositionFeatureSchema).min(0).max(16),
|
|
12568
12931
|
/**
|
|
12569
12932
|
* Present when the block is a helper template. Absent on a free
|
|
12570
12933
|
* composition (the room example, device 4603). The editor reads this,
|
|
@@ -12596,6 +12959,73 @@ var NodeColorIdSchema = _enum([
|
|
|
12596
12959
|
"node-g",
|
|
12597
12960
|
"node-h"
|
|
12598
12961
|
]);
|
|
12962
|
+
//#endregion
|
|
12963
|
+
//#region ../types/dist/index.mjs
|
|
12964
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
12965
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
12966
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
12967
|
+
/** The text excerpt a message carries on the bus. */
|
|
12968
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
12969
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
12970
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
12971
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
12972
|
+
object({
|
|
12973
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
12974
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
12975
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
12976
|
+
requireAuth: boolean().default(true),
|
|
12977
|
+
username: string().default(""),
|
|
12978
|
+
password: string().default("").meta({ secret: true }),
|
|
12979
|
+
starttls: boolean().default(false),
|
|
12980
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
12981
|
+
});
|
|
12982
|
+
object({
|
|
12983
|
+
host: string().min(1).nullable(),
|
|
12984
|
+
hostReason: string().nullable(),
|
|
12985
|
+
port: PortSchema,
|
|
12986
|
+
domain: string().min(1),
|
|
12987
|
+
requireAuth: boolean(),
|
|
12988
|
+
username: string(),
|
|
12989
|
+
password: string(),
|
|
12990
|
+
starttls: boolean()
|
|
12991
|
+
});
|
|
12992
|
+
object({
|
|
12993
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
12994
|
+
/**
|
|
12995
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
12996
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
12997
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
12998
|
+
* Absent, the subscriber is anonymous and unique.
|
|
12999
|
+
*/
|
|
13000
|
+
subscriberId: string().min(1).max(64).optional()
|
|
13001
|
+
});
|
|
13002
|
+
var SmtpInboundAttachmentSchema = object({
|
|
13003
|
+
filename: string(),
|
|
13004
|
+
contentType: string(),
|
|
13005
|
+
bytes: number().int().nonnegative()
|
|
13006
|
+
});
|
|
13007
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13008
|
+
var SmtpInboundMessageSchema = object({
|
|
13009
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13010
|
+
seq: number().int().positive(),
|
|
13011
|
+
messageId: string(),
|
|
13012
|
+
receivedAt: number().int().nonnegative(),
|
|
13013
|
+
from: string(),
|
|
13014
|
+
to: string(),
|
|
13015
|
+
subject: string(),
|
|
13016
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13017
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
13018
|
+
});
|
|
13019
|
+
object({
|
|
13020
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
13021
|
+
lastSeq: number().int().nonnegative(),
|
|
13022
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
13023
|
+
oldestSeq: number().int().nonnegative(),
|
|
13024
|
+
messages: array(object({
|
|
13025
|
+
key: string(),
|
|
13026
|
+
message: SmtpInboundMessageSchema
|
|
13027
|
+
}))
|
|
13028
|
+
});
|
|
12599
13029
|
new Set([
|
|
12600
13030
|
"track",
|
|
12601
13031
|
"face",
|
|
@@ -19002,24 +19432,52 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19002
19432
|
args: { on: false }
|
|
19003
19433
|
},
|
|
19004
19434
|
{
|
|
19005
|
-
id: "petFountain.
|
|
19006
|
-
method: "
|
|
19435
|
+
id: "petFountain.resetDailyConsumption",
|
|
19436
|
+
method: "resetDailyConsumption",
|
|
19437
|
+
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19438
|
+
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19439
|
+
icon: "rotate-ccw"
|
|
19440
|
+
}
|
|
19441
|
+
],
|
|
19442
|
+
state: [{
|
|
19443
|
+
kind: "boolean",
|
|
19444
|
+
field: "empty",
|
|
19445
|
+
label: t("Tank empty", "Serbatoio vuoto"),
|
|
19446
|
+
whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
|
|
19447
|
+
whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
|
|
19448
|
+
icon: "droplet"
|
|
19449
|
+
}, {
|
|
19450
|
+
kind: "numeric",
|
|
19451
|
+
field: "waterLevel",
|
|
19452
|
+
quantity: t("the water level", "il livello dell’acqua"),
|
|
19453
|
+
label: t("Water level", "Livello dell’acqua"),
|
|
19454
|
+
unit: "%",
|
|
19455
|
+
icon: "droplets"
|
|
19456
|
+
}]
|
|
19457
|
+
},
|
|
19458
|
+
"pump-cycle": {
|
|
19459
|
+
scope: "device",
|
|
19460
|
+
noun: t("Pump cycle", "Ciclo della pompa"),
|
|
19461
|
+
actions: [
|
|
19462
|
+
{
|
|
19463
|
+
id: "pumpCycle.on",
|
|
19464
|
+
method: "setEnabled",
|
|
19007
19465
|
label: t("Pump cycle on", "Ciclo pompa attivo"),
|
|
19008
19466
|
phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
|
|
19009
19467
|
icon: "timer",
|
|
19010
19468
|
args: { on: true }
|
|
19011
19469
|
},
|
|
19012
19470
|
{
|
|
19013
|
-
id: "
|
|
19014
|
-
method: "
|
|
19471
|
+
id: "pumpCycle.off",
|
|
19472
|
+
method: "setEnabled",
|
|
19015
19473
|
label: t("Pump cycle off", "Ciclo pompa spento"),
|
|
19016
19474
|
phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
|
|
19017
19475
|
icon: "timer-off",
|
|
19018
19476
|
args: { on: false }
|
|
19019
19477
|
},
|
|
19020
19478
|
{
|
|
19021
|
-
id: "
|
|
19022
|
-
method: "
|
|
19479
|
+
id: "pumpCycle.onMinutes",
|
|
19480
|
+
method: "setOnMinutes",
|
|
19023
19481
|
label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
|
|
19024
19482
|
phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
|
|
19025
19483
|
icon: "timer",
|
|
@@ -19035,8 +19493,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19035
19493
|
}]
|
|
19036
19494
|
},
|
|
19037
19495
|
{
|
|
19038
|
-
id: "
|
|
19039
|
-
method: "
|
|
19496
|
+
id: "pumpCycle.offMinutes",
|
|
19497
|
+
method: "setOffMinutes",
|
|
19040
19498
|
label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
|
|
19041
19499
|
phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
|
|
19042
19500
|
icon: "timer-off",
|
|
@@ -19050,35 +19508,63 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
19050
19508
|
unit: "min"
|
|
19051
19509
|
}
|
|
19052
19510
|
}]
|
|
19053
|
-
},
|
|
19054
|
-
{
|
|
19055
|
-
id: "petFountain.resetDailyConsumption",
|
|
19056
|
-
method: "resetDailyConsumption",
|
|
19057
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19058
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19059
|
-
icon: "rotate-ccw"
|
|
19060
19511
|
}
|
|
19061
19512
|
],
|
|
19062
19513
|
state: [{
|
|
19063
19514
|
kind: "boolean",
|
|
19064
|
-
field: "
|
|
19065
|
-
label: t("
|
|
19066
|
-
whenTrue: t("When
|
|
19067
|
-
whenFalse: t("When
|
|
19068
|
-
icon: "
|
|
19069
|
-
}, {
|
|
19070
|
-
kind: "numeric",
|
|
19071
|
-
field: "waterLevel",
|
|
19072
|
-
quantity: t("the water level", "il livello dell’acqua"),
|
|
19073
|
-
label: t("Water level", "Livello dell’acqua"),
|
|
19074
|
-
unit: "%",
|
|
19075
|
-
icon: "droplets"
|
|
19515
|
+
field: "enabled",
|
|
19516
|
+
label: t("Pump cycle", "Ciclo pompa"),
|
|
19517
|
+
whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
|
|
19518
|
+
whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
|
|
19519
|
+
icon: "timer"
|
|
19076
19520
|
}]
|
|
19077
19521
|
},
|
|
19078
19522
|
"media-player": {
|
|
19079
19523
|
scope: "device",
|
|
19080
19524
|
noun: t("Media player", "Lettore multimediale"),
|
|
19081
19525
|
actions: [
|
|
19526
|
+
{
|
|
19527
|
+
id: "media.turnOn",
|
|
19528
|
+
method: "turnOn",
|
|
19529
|
+
label: t("Turn on", "Accendi"),
|
|
19530
|
+
phrase: t("Turn on {device}", "Accendi {device}"),
|
|
19531
|
+
icon: "power"
|
|
19532
|
+
},
|
|
19533
|
+
{
|
|
19534
|
+
id: "media.turnOff",
|
|
19535
|
+
method: "turnOff",
|
|
19536
|
+
label: t("Turn off", "Spegni"),
|
|
19537
|
+
phrase: t("Turn off {device}", "Spegni {device}"),
|
|
19538
|
+
icon: "power"
|
|
19539
|
+
},
|
|
19540
|
+
{
|
|
19541
|
+
id: "media.volumeUp",
|
|
19542
|
+
method: "volumeUp",
|
|
19543
|
+
label: t("Volume up", "Alza il volume"),
|
|
19544
|
+
phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
|
|
19545
|
+
icon: "volume-2"
|
|
19546
|
+
},
|
|
19547
|
+
{
|
|
19548
|
+
id: "media.volumeDown",
|
|
19549
|
+
method: "volumeDown",
|
|
19550
|
+
label: t("Volume down", "Abbassa il volume"),
|
|
19551
|
+
phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
|
|
19552
|
+
icon: "volume-2"
|
|
19553
|
+
},
|
|
19554
|
+
{
|
|
19555
|
+
id: "media.channelUp",
|
|
19556
|
+
method: "channelUp",
|
|
19557
|
+
label: t("Channel up", "Canale successivo"),
|
|
19558
|
+
phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
|
|
19559
|
+
icon: "skip-forward"
|
|
19560
|
+
},
|
|
19561
|
+
{
|
|
19562
|
+
id: "media.channelDown",
|
|
19563
|
+
method: "channelDown",
|
|
19564
|
+
label: t("Channel down", "Canale precedente"),
|
|
19565
|
+
phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
|
|
19566
|
+
icon: "skip-back"
|
|
19567
|
+
},
|
|
19082
19568
|
{
|
|
19083
19569
|
id: "media.play",
|
|
19084
19570
|
method: "play",
|
|
@@ -20965,6 +21451,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
20965
21451
|
"audio-analyzer": system(PIPELINE),
|
|
20966
21452
|
"audio-codec": system(INTERNAL),
|
|
20967
21453
|
"auth-provider": system(IDENTITY),
|
|
21454
|
+
"board-key-source": system(INTERNAL),
|
|
20968
21455
|
backup: system("system backups — run and restored from the Backups page"),
|
|
20969
21456
|
broker: system("message-broker connections — configured, not actuated"),
|
|
20970
21457
|
"calendar-source": system(INTERNAL),
|
|
@@ -45511,6 +45998,49 @@ object({
|
|
|
45511
45998
|
});
|
|
45512
45999
|
DeviceType.Sensor;
|
|
45513
46000
|
/**
|
|
46001
|
+
* Why a board key could not be read. Typed so a caller reports the cause and
|
|
46002
|
+
* never treats "could not read" as "has no key" (D49).
|
|
46003
|
+
*/
|
|
46004
|
+
var BoardKeyFailureReasonSchema = _enum([
|
|
46005
|
+
"unknown-source",
|
|
46006
|
+
"not-admin",
|
|
46007
|
+
"no-builder",
|
|
46008
|
+
"no-ingress-url",
|
|
46009
|
+
"unreachable",
|
|
46010
|
+
"unknown-board",
|
|
46011
|
+
"no-encryption-key",
|
|
46012
|
+
"unreadable-config"
|
|
46013
|
+
]);
|
|
46014
|
+
var BoardKeySourceSchema = object({
|
|
46015
|
+
sourceId: string(),
|
|
46016
|
+
name: string()
|
|
46017
|
+
});
|
|
46018
|
+
var BoardKeyBoardSchema = object({
|
|
46019
|
+
/** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
|
|
46020
|
+
configuration: string(),
|
|
46021
|
+
/** The node name the builder gives the board. */
|
|
46022
|
+
name: string(),
|
|
46023
|
+
/** The address the builder knows the board by, when it has one. */
|
|
46024
|
+
address: string().nullable()
|
|
46025
|
+
});
|
|
46026
|
+
var BoardKeyFailureSchema = object({
|
|
46027
|
+
ok: literal(false),
|
|
46028
|
+
reason: BoardKeyFailureReasonSchema,
|
|
46029
|
+
detail: string().optional()
|
|
46030
|
+
});
|
|
46031
|
+
var ListBoardsResultSchema = discriminatedUnion("ok", [object({
|
|
46032
|
+
ok: literal(true),
|
|
46033
|
+
boards: array(BoardKeyBoardSchema).readonly()
|
|
46034
|
+
}), BoardKeyFailureSchema]);
|
|
46035
|
+
var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
|
|
46036
|
+
ok: literal(true),
|
|
46037
|
+
key: string()
|
|
46038
|
+
}), BoardKeyFailureSchema]);
|
|
46039
|
+
method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
|
|
46040
|
+
sourceId: string().min(1),
|
|
46041
|
+
configuration: string().min(1)
|
|
46042
|
+
}), GetBoardKeyResultSchema, { auth: "admin" });
|
|
46043
|
+
/**
|
|
45514
46044
|
* Dimmable-light brightness control. Co-exists with `switch` on the
|
|
45515
46045
|
* same device — the switch toggles on/off, this cap sets the level
|
|
45516
46046
|
* applied when the light is on. Drivers map their per-vendor dim
|
|
@@ -47599,6 +48129,188 @@ DeviceType.Control, method(object({
|
|
|
47599
48129
|
kind: "mutation",
|
|
47600
48130
|
auth: "protected"
|
|
47601
48131
|
});
|
|
48132
|
+
/**
|
|
48133
|
+
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
48134
|
+
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
48135
|
+
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
48136
|
+
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
48137
|
+
*
|
|
48138
|
+
* The cap declares a wide method surface; not every backend supports
|
|
48139
|
+
* every method. Drivers signal sub-capability via the
|
|
48140
|
+
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
48141
|
+
* corresponding method) so the UI gates buttons without a slice
|
|
48142
|
+
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
48143
|
+
*/
|
|
48144
|
+
var MediaPlayerStateSchema = _enum([
|
|
48145
|
+
"off",
|
|
48146
|
+
"on",
|
|
48147
|
+
"idle",
|
|
48148
|
+
"playing",
|
|
48149
|
+
"paused",
|
|
48150
|
+
"buffering",
|
|
48151
|
+
"standby"
|
|
48152
|
+
]);
|
|
48153
|
+
var MediaPlayerRepeatSchema = _enum([
|
|
48154
|
+
"off",
|
|
48155
|
+
"all",
|
|
48156
|
+
"one"
|
|
48157
|
+
]);
|
|
48158
|
+
var MediaInfoSchema = object({
|
|
48159
|
+
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
48160
|
+
* `podcast`, …). */
|
|
48161
|
+
type: string(),
|
|
48162
|
+
/** Human-readable title. */
|
|
48163
|
+
title: string(),
|
|
48164
|
+
/** Optional artist / channel / station label. */
|
|
48165
|
+
artist: string().optional(),
|
|
48166
|
+
/** Optional album / season / show name. */
|
|
48167
|
+
album: string().optional(),
|
|
48168
|
+
/** Optional cover-art / thumbnail URL. */
|
|
48169
|
+
imageUrl: string().optional()
|
|
48170
|
+
});
|
|
48171
|
+
/**
|
|
48172
|
+
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
48173
|
+
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
48174
|
+
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
48175
|
+
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
48176
|
+
* guess, never as a reading.
|
|
48177
|
+
*/
|
|
48178
|
+
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
48179
|
+
/** The fields of a media-player status a driver can only guess. */
|
|
48180
|
+
var MediaPlayerAssumedFieldSchema = _enum([
|
|
48181
|
+
"state",
|
|
48182
|
+
"volumeLevel",
|
|
48183
|
+
"isMuted",
|
|
48184
|
+
"source"
|
|
48185
|
+
]);
|
|
48186
|
+
var MediaPlayerStatusSchema = object({
|
|
48187
|
+
/** Playback lifecycle state. */
|
|
48188
|
+
state: MediaPlayerStateSchema,
|
|
48189
|
+
/**
|
|
48190
|
+
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
48191
|
+
* A slice written before this field existed parses as `reported`.
|
|
48192
|
+
*/
|
|
48193
|
+
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
48194
|
+
/**
|
|
48195
|
+
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
48196
|
+
* this is not empty; a field not listed here is a reading even then (power
|
|
48197
|
+
* from a running-state source, mute guessed from the last send).
|
|
48198
|
+
*/
|
|
48199
|
+
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
48200
|
+
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
48201
|
+
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
48202
|
+
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
48203
|
+
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
48204
|
+
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
48205
|
+
isMuted: boolean().nullable(),
|
|
48206
|
+
/** Active source / input. Empty when no source surface. */
|
|
48207
|
+
source: string(),
|
|
48208
|
+
/** Selectable sources. Empty when no source surface.
|
|
48209
|
+
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
48210
|
+
availableSources: array(string()),
|
|
48211
|
+
/** Currently-playing media info. Null when nothing is playing. */
|
|
48212
|
+
currentMedia: MediaInfoSchema.nullable(),
|
|
48213
|
+
/** Current playback position in ms. Null when not seekable or
|
|
48214
|
+
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
48215
|
+
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
48216
|
+
/** Total duration of the current media in ms. Null when unknown
|
|
48217
|
+
* (live stream) or nothing is playing. */
|
|
48218
|
+
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
48219
|
+
/** Shuffle toggle. Null when no shuffle surface.
|
|
48220
|
+
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
48221
|
+
shuffle: boolean().nullable(),
|
|
48222
|
+
/** Repeat mode. Null when no repeat surface.
|
|
48223
|
+
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
48224
|
+
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
48225
|
+
/** Ms epoch when the slice was last updated. */
|
|
48226
|
+
lastChangedAt: number()
|
|
48227
|
+
});
|
|
48228
|
+
var stepInput = object({
|
|
48229
|
+
deviceId: number().int().nonnegative(),
|
|
48230
|
+
/** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
|
|
48231
|
+
steps: number().int().min(1).max(50).default(1)
|
|
48232
|
+
});
|
|
48233
|
+
var deviceOnly = object({ deviceId: number().int().nonnegative() });
|
|
48234
|
+
DeviceType.MediaPlayer, method(deviceOnly, _void(), {
|
|
48235
|
+
kind: "mutation",
|
|
48236
|
+
auth: "protected"
|
|
48237
|
+
}), method(deviceOnly, _void(), {
|
|
48238
|
+
kind: "mutation",
|
|
48239
|
+
auth: "protected"
|
|
48240
|
+
}), method(stepInput, _void(), {
|
|
48241
|
+
kind: "mutation",
|
|
48242
|
+
auth: "protected"
|
|
48243
|
+
}), method(stepInput, _void(), {
|
|
48244
|
+
kind: "mutation",
|
|
48245
|
+
auth: "protected"
|
|
48246
|
+
}), method(stepInput, _void(), {
|
|
48247
|
+
kind: "mutation",
|
|
48248
|
+
auth: "protected"
|
|
48249
|
+
}), method(stepInput, _void(), {
|
|
48250
|
+
kind: "mutation",
|
|
48251
|
+
auth: "protected"
|
|
48252
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48253
|
+
kind: "mutation",
|
|
48254
|
+
auth: "protected"
|
|
48255
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48256
|
+
kind: "mutation",
|
|
48257
|
+
auth: "protected"
|
|
48258
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48259
|
+
kind: "mutation",
|
|
48260
|
+
auth: "protected"
|
|
48261
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48262
|
+
kind: "mutation",
|
|
48263
|
+
auth: "protected"
|
|
48264
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
48265
|
+
kind: "mutation",
|
|
48266
|
+
auth: "protected"
|
|
48267
|
+
}), method(object({
|
|
48268
|
+
deviceId: number().int().nonnegative(),
|
|
48269
|
+
position: number().int().nonnegative()
|
|
48270
|
+
}), _void(), {
|
|
48271
|
+
kind: "mutation",
|
|
48272
|
+
auth: "protected"
|
|
48273
|
+
}), method(object({
|
|
48274
|
+
deviceId: number().int().nonnegative(),
|
|
48275
|
+
volumeLevel: number().min(0).max(100)
|
|
48276
|
+
}), _void(), {
|
|
48277
|
+
kind: "mutation",
|
|
48278
|
+
auth: "protected"
|
|
48279
|
+
}), method(object({
|
|
48280
|
+
deviceId: number().int().nonnegative(),
|
|
48281
|
+
muted: boolean()
|
|
48282
|
+
}), _void(), {
|
|
48283
|
+
kind: "mutation",
|
|
48284
|
+
auth: "protected"
|
|
48285
|
+
}), method(object({
|
|
48286
|
+
deviceId: number().int().nonnegative(),
|
|
48287
|
+
shuffle: boolean()
|
|
48288
|
+
}), _void(), {
|
|
48289
|
+
kind: "mutation",
|
|
48290
|
+
auth: "protected"
|
|
48291
|
+
}), method(object({
|
|
48292
|
+
deviceId: number().int().nonnegative(),
|
|
48293
|
+
repeat: MediaPlayerRepeatSchema
|
|
48294
|
+
}), _void(), {
|
|
48295
|
+
kind: "mutation",
|
|
48296
|
+
auth: "protected"
|
|
48297
|
+
}), method(object({
|
|
48298
|
+
deviceId: number().int().nonnegative(),
|
|
48299
|
+
source: string().min(1)
|
|
48300
|
+
}), _void(), {
|
|
48301
|
+
kind: "mutation",
|
|
48302
|
+
auth: "protected"
|
|
48303
|
+
}), method(object({
|
|
48304
|
+
deviceId: number().int().nonnegative(),
|
|
48305
|
+
/** Media identifier / URL. */
|
|
48306
|
+
mediaId: string().min(1),
|
|
48307
|
+
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
48308
|
+
* passes it through to the upstream service. */
|
|
48309
|
+
mediaType: string().min(1)
|
|
48310
|
+
}), _void(), {
|
|
48311
|
+
kind: "mutation",
|
|
48312
|
+
auth: "protected"
|
|
48313
|
+
});
|
|
47602
48314
|
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;
|
|
47603
48315
|
var NUMBER = {
|
|
47604
48316
|
kind: "fixed",
|
|
@@ -48046,49 +48758,6 @@ function actuator(input) {
|
|
|
48046
48758
|
};
|
|
48047
48759
|
}
|
|
48048
48760
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
48049
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
48050
|
-
"no-power-source",
|
|
48051
|
-
"switch-missing",
|
|
48052
|
-
"switch-offline",
|
|
48053
|
-
"switch-unknown",
|
|
48054
|
-
"restart-in-progress",
|
|
48055
|
-
"switch-call-failed"
|
|
48056
|
-
]);
|
|
48057
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
48058
|
-
accepted: literal(false),
|
|
48059
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
48060
|
-
/** One line for the operator, naming the switch. */
|
|
48061
|
-
message: string()
|
|
48062
|
-
})]);
|
|
48063
|
-
var PowerSourceInfoSchema = object({
|
|
48064
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
48065
|
-
linked: boolean(),
|
|
48066
|
-
switchDeviceId: number().nullable(),
|
|
48067
|
-
switchName: string().nullable(),
|
|
48068
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
48069
|
-
switchOn: boolean().nullable(),
|
|
48070
|
-
switchOnline: boolean().nullable(),
|
|
48071
|
-
restartInProgress: boolean(),
|
|
48072
|
-
offSeconds: number().int()
|
|
48073
|
-
});
|
|
48074
|
-
object({
|
|
48075
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
48076
|
-
switchOn: boolean().nullable(),
|
|
48077
|
-
offSeconds: number().int(),
|
|
48078
|
-
lastFetchedAt: number()
|
|
48079
|
-
});
|
|
48080
|
-
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;
|
|
48081
|
-
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
48082
|
-
systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48083
|
-
kind: "mutation",
|
|
48084
|
-
auth: "admin"
|
|
48085
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48086
|
-
kind: "mutation",
|
|
48087
|
-
auth: "admin"
|
|
48088
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
48089
|
-
kind: "mutation",
|
|
48090
|
-
auth: "admin"
|
|
48091
|
-
});
|
|
48092
48761
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
48093
48762
|
DeviceType.Camera;
|
|
48094
48763
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
@@ -48116,6 +48785,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
48116
48785
|
}).optional()
|
|
48117
48786
|
})) });
|
|
48118
48787
|
/**
|
|
48788
|
+
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
48789
|
+
* `z.infer`, they do not restate the shape.
|
|
48790
|
+
*/
|
|
48791
|
+
var OverrideSourceSchema = object({
|
|
48792
|
+
addonId: string().min(1),
|
|
48793
|
+
stableId: string().min(1),
|
|
48794
|
+
cap: string().min(1),
|
|
48795
|
+
fieldPath: string().min(1)
|
|
48796
|
+
});
|
|
48797
|
+
var IdentityTransformDraftSchema = object({ kind: literal("identity") });
|
|
48798
|
+
var InvertTransformDraftSchema = object({ kind: literal("invert") });
|
|
48799
|
+
var ThresholdTransformDraftSchema = object({
|
|
48800
|
+
kind: literal("threshold"),
|
|
48801
|
+
comparison: _enum(["gte", "lte"]),
|
|
48802
|
+
threshold: number(),
|
|
48803
|
+
startDwellMs: number().nonnegative(),
|
|
48804
|
+
stopDwellMs: number().nonnegative()
|
|
48805
|
+
});
|
|
48806
|
+
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
48807
|
+
IdentityTransformDraftSchema,
|
|
48808
|
+
InvertTransformDraftSchema,
|
|
48809
|
+
ThresholdTransformDraftSchema,
|
|
48810
|
+
object({
|
|
48811
|
+
kind: literal("linear"),
|
|
48812
|
+
scale: number(),
|
|
48813
|
+
offset: number(),
|
|
48814
|
+
clampMin: number().optional(),
|
|
48815
|
+
clampMax: number().optional()
|
|
48816
|
+
}),
|
|
48817
|
+
object({
|
|
48818
|
+
kind: literal("enum-map"),
|
|
48819
|
+
mapping: record(string(), string().nullable())
|
|
48820
|
+
}),
|
|
48821
|
+
object({ kind: literal("number") })
|
|
48822
|
+
]);
|
|
48823
|
+
var ScalarOverrideDraftSchema = object({
|
|
48824
|
+
kind: literal("scalar"),
|
|
48825
|
+
cap: string().min(1),
|
|
48826
|
+
targetId: string().min(1),
|
|
48827
|
+
source: OverrideSourceSchema,
|
|
48828
|
+
transform: CustomizeTransformDraftSchema
|
|
48829
|
+
});
|
|
48830
|
+
var KeyedArrayOverrideDraftSchema = object({
|
|
48831
|
+
kind: literal("keyedArray"),
|
|
48832
|
+
cap: string().min(1),
|
|
48833
|
+
targetId: string().min(1),
|
|
48834
|
+
key: string().min(1),
|
|
48835
|
+
label: string().min(1),
|
|
48836
|
+
fieldPath: string().min(1),
|
|
48837
|
+
source: OverrideSourceSchema,
|
|
48838
|
+
transform: CustomizeTransformDraftSchema
|
|
48839
|
+
});
|
|
48840
|
+
var PulseOverrideDraftSchema = object({
|
|
48841
|
+
kind: literal("pulse"),
|
|
48842
|
+
cap: string().min(1),
|
|
48843
|
+
targetId: string().min(1),
|
|
48844
|
+
enabled: boolean(),
|
|
48845
|
+
debounceMs: number().nonnegative(),
|
|
48846
|
+
edges: array(_enum([
|
|
48847
|
+
"rising",
|
|
48848
|
+
"button",
|
|
48849
|
+
"native-event"
|
|
48850
|
+
])).min(1).optional(),
|
|
48851
|
+
sources: array(OverrideSourceSchema).min(1)
|
|
48852
|
+
});
|
|
48853
|
+
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
48854
|
+
"in-addition",
|
|
48855
|
+
"confirm",
|
|
48856
|
+
"replace"
|
|
48857
|
+
]).optional() });
|
|
48858
|
+
discriminatedUnion("kind", [
|
|
48859
|
+
ScalarOverrideDraftSchema,
|
|
48860
|
+
KeyedArrayOverrideDraftSchema,
|
|
48861
|
+
PulseOverrideDraftSchema,
|
|
48862
|
+
object({
|
|
48863
|
+
kind: literal("span"),
|
|
48864
|
+
cap: string().min(1),
|
|
48865
|
+
targetId: string().min(1),
|
|
48866
|
+
timeoutMs: number().nonnegative(),
|
|
48867
|
+
cooldownMs: number().nonnegative().optional(),
|
|
48868
|
+
sources: array(SpanSourceDraftSchema)
|
|
48869
|
+
})
|
|
48870
|
+
]);
|
|
48871
|
+
object({
|
|
48872
|
+
targetId: string().min(1),
|
|
48873
|
+
configured: boolean(),
|
|
48874
|
+
source: _enum(["native", "assigned"]),
|
|
48875
|
+
state: _enum([
|
|
48876
|
+
"active",
|
|
48877
|
+
"stale",
|
|
48878
|
+
"released",
|
|
48879
|
+
"unavailable"
|
|
48880
|
+
]),
|
|
48881
|
+
reason: string().nullable()
|
|
48882
|
+
});
|
|
48883
|
+
/**
|
|
48884
|
+
* What a running-threshold proposal says (planning#405). The schema is the
|
|
48885
|
+
* type: the algorithm, the capability method and the UI all read `z.infer`.
|
|
48886
|
+
*
|
|
48887
|
+
* A proposal is read-only advice: it carries the numbers it was derived from
|
|
48888
|
+
* (`evidence`) so the operator can judge it, and an `insufficient` answer names
|
|
48889
|
+
* WHY with a typed reason and the catalog defaults, never an invented number.
|
|
48890
|
+
*/
|
|
48891
|
+
var RunningProposalTierSchema = _enum(["raw", "5m"]);
|
|
48892
|
+
var RunningProposalConfidenceSchema = _enum([
|
|
48893
|
+
"high",
|
|
48894
|
+
"medium",
|
|
48895
|
+
"low"
|
|
48896
|
+
]);
|
|
48897
|
+
var RunningProposalInsufficientReasonSchema = _enum([
|
|
48898
|
+
"no-history",
|
|
48899
|
+
"span-too-short",
|
|
48900
|
+
"truncated",
|
|
48901
|
+
"no-idle-floor",
|
|
48902
|
+
"no-runs",
|
|
48903
|
+
"no-separation"
|
|
48904
|
+
]);
|
|
48905
|
+
var RunningProposalReplaySchema = object({
|
|
48906
|
+
/** Intervals the real dwell expression held true over the window. */
|
|
48907
|
+
intervals: number().int().nonnegative(),
|
|
48908
|
+
/** Intervals outside every run, or a second interval inside one. */
|
|
48909
|
+
extra: number().int().nonnegative(),
|
|
48910
|
+
/** Runs without an interval of their own (none, or merged into a neighbour). */
|
|
48911
|
+
missed: number().int().nonnegative()
|
|
48912
|
+
});
|
|
48913
|
+
var RunningProposalEvidenceSchema = object({
|
|
48914
|
+
tier: RunningProposalTierSchema,
|
|
48915
|
+
spanMs: number().nonnegative(),
|
|
48916
|
+
from: number(),
|
|
48917
|
+
to: number(),
|
|
48918
|
+
points: number().int().nonnegative(),
|
|
48919
|
+
runsFound: number().int().nonnegative(),
|
|
48920
|
+
pausesFound: number().int().nonnegative(),
|
|
48921
|
+
longestPauseMs: number().nonnegative(),
|
|
48922
|
+
idleFloorW: number(),
|
|
48923
|
+
noiseCeilingW: number(),
|
|
48924
|
+
plateauW: number(),
|
|
48925
|
+
replay: RunningProposalReplaySchema
|
|
48926
|
+
});
|
|
48927
|
+
var RunningProposalInsufficientEvidenceSchema = object({
|
|
48928
|
+
spanMs: number().nonnegative(),
|
|
48929
|
+
points: number().int().nonnegative(),
|
|
48930
|
+
runsFound: number().int().nonnegative()
|
|
48931
|
+
});
|
|
48932
|
+
var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
|
|
48933
|
+
state: literal("proposal"),
|
|
48934
|
+
transform: ThresholdTransformDraftSchema,
|
|
48935
|
+
evidence: RunningProposalEvidenceSchema,
|
|
48936
|
+
confidence: RunningProposalConfidenceSchema,
|
|
48937
|
+
/** Why the confidence is not higher; empty when nothing held it back. */
|
|
48938
|
+
notes: array(string())
|
|
48939
|
+
}), object({
|
|
48940
|
+
state: literal("insufficient"),
|
|
48941
|
+
reason: RunningProposalInsufficientReasonSchema,
|
|
48942
|
+
evidence: RunningProposalInsufficientEvidenceSchema,
|
|
48943
|
+
/** The catalog defaults, offered as what stands when nothing better is known. */
|
|
48944
|
+
fallback: ThresholdTransformDraftSchema
|
|
48945
|
+
})]);
|
|
48946
|
+
/**
|
|
48119
48947
|
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
48120
48948
|
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
48121
48949
|
*
|
|
@@ -48405,6 +49233,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
48405
49233
|
kind: "mutation",
|
|
48406
49234
|
auth: "admin",
|
|
48407
49235
|
access: "view"
|
|
49236
|
+
}), method(object({
|
|
49237
|
+
deviceId: number().int(),
|
|
49238
|
+
cap: string().min(1),
|
|
49239
|
+
fieldPath: string().min(1),
|
|
49240
|
+
deviceType: _enum(DeviceType).optional()
|
|
49241
|
+
}), RunningThresholdProposalSchema, {
|
|
49242
|
+
auth: "admin",
|
|
49243
|
+
access: "view"
|
|
48408
49244
|
}), method(object({
|
|
48409
49245
|
blockId: string().min(1),
|
|
48410
49246
|
trace: AutomationRunTraceSchema.optional(),
|
|
@@ -49213,7 +50049,53 @@ method(object({
|
|
|
49213
50049
|
* exposes only the COMMON surface: link state, supported device
|
|
49214
50050
|
* kinds (so the UI can filter the device picker), and per-device
|
|
49215
50051
|
* expose/unexpose.
|
|
50052
|
+
*
|
|
50053
|
+
* INSTANCES. One export addon can serve several independent targets (a
|
|
50054
|
+
* HomeKit bridge, a Home Assistant broker). `listInstances` names them.
|
|
50055
|
+
* `instanceId` on a READ is optional: absent = the whole addon (linked if any
|
|
50056
|
+
* enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
|
|
50057
|
+
* default instance's); present = that instance; an id the provider does not
|
|
50058
|
+
* serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
|
|
50059
|
+
* never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
|
|
50060
|
+
* change always names the target it changes. A single-instance provider
|
|
50061
|
+
* accepts an absent id on a read or its own id, and refuses any other.
|
|
50062
|
+
*/
|
|
50063
|
+
/** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
|
|
50064
|
+
var InstanceIdSchema$1 = string().min(1);
|
|
50065
|
+
var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
|
|
50066
|
+
/** One independent export target of an addon. */
|
|
50067
|
+
var ExportInstanceSchema = object({
|
|
50068
|
+
instanceId: InstanceIdSchema$1,
|
|
50069
|
+
name: string(),
|
|
50070
|
+
enabled: boolean(),
|
|
50071
|
+
kind: string().optional()
|
|
50072
|
+
});
|
|
50073
|
+
var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
|
|
50074
|
+
/** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
|
|
50075
|
+
var ExportInstanceUnknownError = class extends Error {
|
|
50076
|
+
code = EXPORT_INSTANCE_UNKNOWN;
|
|
50077
|
+
instanceId;
|
|
50078
|
+
constructor(addon, instanceId) {
|
|
50079
|
+
super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
|
|
50080
|
+
this.name = "ExportInstanceUnknownError";
|
|
50081
|
+
this.instanceId = instanceId;
|
|
50082
|
+
}
|
|
50083
|
+
};
|
|
50084
|
+
/**
|
|
50085
|
+
* The instance a `getStatus` call names. The cap's `status` block injects a per-device
|
|
50086
|
+
* `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
|
|
50087
|
+
* both shapes; only the second names an instance (a per-device status read is addon-wide).
|
|
49216
50088
|
*/
|
|
50089
|
+
function statusInstanceOf(input) {
|
|
50090
|
+
return "instanceId" in input ? input.instanceId : void 0;
|
|
50091
|
+
}
|
|
50092
|
+
/**
|
|
50093
|
+
* A single-instance provider's check: an absent id or its own passes, any other throws
|
|
50094
|
+
* `ExportInstanceUnknownError`.
|
|
50095
|
+
*/
|
|
50096
|
+
function assertOwnExportInstance(addon, own, instanceId) {
|
|
50097
|
+
if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
|
|
50098
|
+
}
|
|
49217
50099
|
var LinkStateSchema = _enum([
|
|
49218
50100
|
"unlinked",
|
|
49219
50101
|
"linked",
|
|
@@ -49264,10 +50146,14 @@ var ExposedDeviceSchema = object({
|
|
|
49264
50146
|
capabilities: array(string()).optional()
|
|
49265
50147
|
});
|
|
49266
50148
|
var ExposeInputSchema = object({
|
|
50149
|
+
instanceId: InstanceIdSchema$1,
|
|
49267
50150
|
deviceId: string(),
|
|
49268
50151
|
capabilities: array(string()).optional()
|
|
49269
50152
|
});
|
|
49270
|
-
var UnexposeInputSchema = object({
|
|
50153
|
+
var UnexposeInputSchema = object({
|
|
50154
|
+
instanceId: InstanceIdSchema$1,
|
|
50155
|
+
deviceId: string()
|
|
50156
|
+
});
|
|
49271
50157
|
/**
|
|
49272
50158
|
* What an exporter may expose besides devices (D968). An action and a
|
|
49273
50159
|
* notification target are LIST ENTRIES, never devices (D954): they enter an
|
|
@@ -49296,8 +50182,14 @@ var ExposedEntitySchema = object({
|
|
|
49296
50182
|
entity: ExportEntityRefSchema,
|
|
49297
50183
|
exposedAs: string().optional()
|
|
49298
50184
|
});
|
|
49299
|
-
var ExposeEntityInputSchema = object({
|
|
49300
|
-
|
|
50185
|
+
var ExposeEntityInputSchema = object({
|
|
50186
|
+
instanceId: InstanceIdSchema$1,
|
|
50187
|
+
entity: ExportEntityRefSchema
|
|
50188
|
+
});
|
|
50189
|
+
var UnexposeEntityInputSchema = object({
|
|
50190
|
+
instanceId: InstanceIdSchema$1,
|
|
50191
|
+
entity: ExportEntityRefSchema
|
|
50192
|
+
});
|
|
49301
50193
|
var deviceExportCapability = {
|
|
49302
50194
|
name: "device-export",
|
|
49303
50195
|
scope: "system",
|
|
@@ -49317,9 +50209,10 @@ var deviceExportCapability = {
|
|
|
49317
50209
|
*/
|
|
49318
50210
|
exposesDeviceSettings: true,
|
|
49319
50211
|
methods: {
|
|
49320
|
-
getStatus: method(
|
|
49321
|
-
|
|
49322
|
-
|
|
50212
|
+
getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
|
|
50213
|
+
listInstances: method(_void(), array(ExportInstanceSchema)),
|
|
50214
|
+
listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
|
|
50215
|
+
listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
|
|
49323
50216
|
exposeDevice: method(ExposeInputSchema, _void(), {
|
|
49324
50217
|
kind: "mutation",
|
|
49325
50218
|
auth: "admin"
|
|
@@ -49329,7 +50222,7 @@ var deviceExportCapability = {
|
|
|
49329
50222
|
auth: "admin"
|
|
49330
50223
|
}),
|
|
49331
50224
|
listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
|
|
49332
|
-
listExposedEntities: optionalMethod(
|
|
50225
|
+
listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
|
|
49333
50226
|
exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
|
|
49334
50227
|
kind: "mutation",
|
|
49335
50228
|
auth: "admin"
|
|
@@ -51213,7 +52106,7 @@ object({
|
|
|
51213
52106
|
/** Ms epoch of the last value received from the appliance; 0 = never. */
|
|
51214
52107
|
lastFetchedAt: number()
|
|
51215
52108
|
});
|
|
51216
|
-
var DeviceIdSchema$
|
|
52109
|
+
var DeviceIdSchema$2 = number().int().nonnegative();
|
|
51217
52110
|
/** A value a program option or setting can take. */
|
|
51218
52111
|
var DishwasherValueSchema = union([
|
|
51219
52112
|
boolean(),
|
|
@@ -51277,77 +52170,77 @@ var DishwasherOptionsSchema = object({
|
|
|
51277
52170
|
options: array(DishwasherOptionDescriptorSchema)
|
|
51278
52171
|
});
|
|
51279
52172
|
DeviceType.Dishwasher, method(object({
|
|
51280
|
-
deviceId: DeviceIdSchema$
|
|
52173
|
+
deviceId: DeviceIdSchema$2,
|
|
51281
52174
|
program: string().min(1).optional(),
|
|
51282
52175
|
options: record(string(), DishwasherValueSchema).optional()
|
|
51283
52176
|
}), _void(), {
|
|
51284
52177
|
kind: "mutation",
|
|
51285
52178
|
auth: "protected"
|
|
51286
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52179
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51287
52180
|
kind: "mutation",
|
|
51288
52181
|
auth: "protected"
|
|
51289
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52182
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51290
52183
|
kind: "mutation",
|
|
51291
52184
|
auth: "protected"
|
|
51292
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52185
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
51293
52186
|
kind: "mutation",
|
|
51294
52187
|
auth: "protected"
|
|
51295
52188
|
}), method(object({
|
|
51296
|
-
deviceId: DeviceIdSchema$
|
|
52189
|
+
deviceId: DeviceIdSchema$2,
|
|
51297
52190
|
program: string().min(1)
|
|
51298
52191
|
}), _void(), {
|
|
51299
52192
|
kind: "mutation",
|
|
51300
52193
|
auth: "protected"
|
|
51301
52194
|
}), method(object({
|
|
51302
|
-
deviceId: DeviceIdSchema$
|
|
52195
|
+
deviceId: DeviceIdSchema$2,
|
|
51303
52196
|
on: boolean()
|
|
51304
52197
|
}), _void(), {
|
|
51305
52198
|
kind: "mutation",
|
|
51306
52199
|
auth: "protected"
|
|
51307
52200
|
}), method(object({
|
|
51308
|
-
deviceId: DeviceIdSchema$
|
|
52201
|
+
deviceId: DeviceIdSchema$2,
|
|
51309
52202
|
on: boolean()
|
|
51310
52203
|
}), _void(), {
|
|
51311
52204
|
kind: "mutation",
|
|
51312
52205
|
auth: "protected"
|
|
51313
52206
|
}), method(object({
|
|
51314
|
-
deviceId: DeviceIdSchema$
|
|
52207
|
+
deviceId: DeviceIdSchema$2,
|
|
51315
52208
|
on: boolean()
|
|
51316
52209
|
}), _void(), {
|
|
51317
52210
|
kind: "mutation",
|
|
51318
52211
|
auth: "protected"
|
|
51319
52212
|
}), method(object({
|
|
51320
|
-
deviceId: DeviceIdSchema$
|
|
52213
|
+
deviceId: DeviceIdSchema$2,
|
|
51321
52214
|
on: boolean()
|
|
51322
52215
|
}), _void(), {
|
|
51323
52216
|
kind: "mutation",
|
|
51324
52217
|
auth: "protected"
|
|
51325
52218
|
}), method(object({
|
|
51326
|
-
deviceId: DeviceIdSchema$
|
|
52219
|
+
deviceId: DeviceIdSchema$2,
|
|
51327
52220
|
on: boolean()
|
|
51328
52221
|
}), _void(), {
|
|
51329
52222
|
kind: "mutation",
|
|
51330
52223
|
auth: "protected"
|
|
51331
52224
|
}), method(object({
|
|
51332
|
-
deviceId: DeviceIdSchema$
|
|
52225
|
+
deviceId: DeviceIdSchema$2,
|
|
51333
52226
|
on: boolean()
|
|
51334
52227
|
}), _void(), {
|
|
51335
52228
|
kind: "mutation",
|
|
51336
52229
|
auth: "protected"
|
|
51337
52230
|
}), method(object({
|
|
51338
|
-
deviceId: DeviceIdSchema$
|
|
52231
|
+
deviceId: DeviceIdSchema$2,
|
|
51339
52232
|
on: boolean()
|
|
51340
52233
|
}), _void(), {
|
|
51341
52234
|
kind: "mutation",
|
|
51342
52235
|
auth: "protected"
|
|
51343
52236
|
}), method(object({
|
|
51344
|
-
deviceId: DeviceIdSchema$
|
|
52237
|
+
deviceId: DeviceIdSchema$2,
|
|
51345
52238
|
key: string().min(1),
|
|
51346
52239
|
value: DishwasherValueSchema
|
|
51347
52240
|
}), _void(), {
|
|
51348
52241
|
kind: "mutation",
|
|
51349
52242
|
auth: "protected"
|
|
51350
|
-
}), method(object({ deviceId: DeviceIdSchema$
|
|
52243
|
+
}), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
|
|
51351
52244
|
/**
|
|
51352
52245
|
* Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
|
|
51353
52246
|
* not entries. `heatmapScrub` is a mark, not an event kind.
|
|
@@ -52534,15 +53427,15 @@ var FanPresetCaptureResultSchema = object({
|
|
|
52534
53427
|
items: array(FanCaptureItemSchema),
|
|
52535
53428
|
omitted: array(FanCaptureOmissionSchema)
|
|
52536
53429
|
});
|
|
52537
|
-
var deviceInput$
|
|
53430
|
+
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
52538
53431
|
DeviceType.Fan;
|
|
52539
|
-
method(deviceInput$
|
|
53432
|
+
method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
52540
53433
|
kind: "mutation",
|
|
52541
53434
|
auth: "admin"
|
|
52542
|
-
}), method(deviceInput$
|
|
53435
|
+
}), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
52543
53436
|
kind: "mutation",
|
|
52544
53437
|
auth: "protected"
|
|
52545
|
-
}), method(deviceInput$
|
|
53438
|
+
}), method(deviceInput$2.extend({
|
|
52546
53439
|
fields: array(FanCaptureFieldSchema).optional(),
|
|
52547
53440
|
steps: array(ActionStepSchema).max(20).default([])
|
|
52548
53441
|
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
@@ -52931,15 +53824,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
52931
53824
|
* branch on CAP — never on addon name. `device-adoption` integrations
|
|
52932
53825
|
* (Home Assistant, …) route through the broker step (Approach A);
|
|
52933
53826
|
* `device-provider` integrations (Reolink/ONVIF) keep the
|
|
52934
|
-
* legacy config → discovery flow.
|
|
52935
|
-
* connection as typed records (`integration-instances`, D985): no devices,
|
|
52936
|
-
* no discovery.
|
|
53827
|
+
* legacy config → discovery flow.
|
|
52937
53828
|
*/
|
|
52938
|
-
kind: _enum([
|
|
52939
|
-
"device-adoption",
|
|
52940
|
-
"device-provider",
|
|
52941
|
-
"connection"
|
|
52942
|
-
]),
|
|
53829
|
+
kind: _enum(["device-adoption", "device-provider"]),
|
|
52943
53830
|
/**
|
|
52944
53831
|
* For `device-adoption` addons: the broker kind to create/link
|
|
52945
53832
|
* (e.g. `home-assistant`), declared in the addon manifest. `null` for
|
|
@@ -53053,18 +53940,17 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
53053
53940
|
});
|
|
53054
53941
|
/**
|
|
53055
53942
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
53056
|
-
* (an account, a relay, a destination) as typed records,
|
|
53057
|
-
*
|
|
53943
|
+
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
53944
|
+
* own function page reads and writes them (Logging for Loki); the Integrations
|
|
53945
|
+
* page lists only the integrations that bring devices (D996).
|
|
53058
53946
|
*
|
|
53059
|
-
* A collection of providers: each addon that holds connections registers one
|
|
53060
|
-
*
|
|
53061
|
-
* `addonId`. It is internal and has no route: the operator-facing surface is
|
|
53062
|
-
* the `integrations` cap, which keeps ONE list.
|
|
53947
|
+
* A collection of providers: each addon that holds connections registers one and a
|
|
53948
|
+
* caller reaches a provider with the pinned `addonId`.
|
|
53063
53949
|
*
|
|
53064
|
-
* Identity: the instance id
|
|
53065
|
-
*
|
|
53066
|
-
*
|
|
53067
|
-
* editable label.
|
|
53950
|
+
* Identity: the instance id is immutable and opaque to the caller. A record the
|
|
53951
|
+
* Loki migration made keeps the `integrations` registry id it was created under
|
|
53952
|
+
* (`int_NNNN`); a single instance made by its function page takes the addon id.
|
|
53953
|
+
* `name` is the editable label.
|
|
53068
53954
|
*
|
|
53069
53955
|
* Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
|
|
53070
53956
|
* the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
|
|
@@ -53073,13 +53959,65 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
53073
53959
|
*/
|
|
53074
53960
|
var ConfigSchemaPassthrough$3 = custom();
|
|
53075
53961
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
53962
|
+
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
53963
|
+
/**
|
|
53964
|
+
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
53965
|
+
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
53966
|
+
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
53967
|
+
* interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
|
|
53968
|
+
* instance id.
|
|
53969
|
+
*/
|
|
53970
|
+
var IntegrationInstanceKindSchema = object({
|
|
53971
|
+
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
53972
|
+
id: string().min(1),
|
|
53973
|
+
label: string().min(1),
|
|
53974
|
+
/** The kind signs in through a server-held interactive session. */
|
|
53975
|
+
signIn: object({
|
|
53976
|
+
basePath: string().min(1),
|
|
53977
|
+
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
53978
|
+
}).optional(),
|
|
53979
|
+
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
53980
|
+
connectPath: string().min(1).optional(),
|
|
53981
|
+
/** Relative hub path to disconnect that account. */
|
|
53982
|
+
disconnectPath: string().min(1).optional()
|
|
53983
|
+
});
|
|
53076
53984
|
var IntegrationInstanceDescriptionSchema = object({
|
|
53985
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
53986
|
+
role: _enum([
|
|
53987
|
+
"devices",
|
|
53988
|
+
"services",
|
|
53989
|
+
"both"
|
|
53990
|
+
]),
|
|
53991
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
53992
|
+
discovery: object({
|
|
53993
|
+
mode: _enum([
|
|
53994
|
+
"none",
|
|
53995
|
+
"lan",
|
|
53996
|
+
"account"
|
|
53997
|
+
]),
|
|
53998
|
+
scopedToInstance: boolean()
|
|
53999
|
+
}).optional(),
|
|
53077
54000
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
53078
|
-
instanceMode:
|
|
54001
|
+
instanceMode: IntegrationInstanceModeSchema,
|
|
53079
54002
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
53080
54003
|
kind: string(),
|
|
53081
54004
|
/** True when `testInstance` really probes the remote. */
|
|
53082
|
-
canTest: boolean()
|
|
54005
|
+
canTest: boolean(),
|
|
54006
|
+
/**
|
|
54007
|
+
* The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
|
|
54008
|
+
* Add flow asks which first and sends it as `createInstance.kind`.
|
|
54009
|
+
*/
|
|
54010
|
+
kinds: array(IntegrationInstanceKindSchema).optional(),
|
|
54011
|
+
/**
|
|
54012
|
+
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
54013
|
+
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
54014
|
+
*/
|
|
54015
|
+
allowRestoreId: boolean().optional(),
|
|
54016
|
+
/**
|
|
54017
|
+
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
54018
|
+
* send an id (the UI then mints an opaque one).
|
|
54019
|
+
*/
|
|
54020
|
+
mintsId: boolean().optional()
|
|
53083
54021
|
});
|
|
53084
54022
|
var IntegrationInstanceStatusSchema = object({
|
|
53085
54023
|
state: _enum([
|
|
@@ -53088,16 +54026,28 @@ var IntegrationInstanceStatusSchema = object({
|
|
|
53088
54026
|
"error",
|
|
53089
54027
|
"unknown"
|
|
53090
54028
|
]),
|
|
53091
|
-
detail: string().optional()
|
|
54029
|
+
detail: string().optional(),
|
|
54030
|
+
/** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
|
|
54031
|
+
label: string().optional()
|
|
53092
54032
|
});
|
|
53093
54033
|
var IntegrationInstanceSchema = object({
|
|
53094
54034
|
id: IntegrationInstanceIdSchema,
|
|
53095
54035
|
name: string(),
|
|
53096
54036
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
53097
54037
|
configured: boolean(),
|
|
54038
|
+
/**
|
|
54039
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
54040
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
54041
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
54042
|
+
*/
|
|
54043
|
+
enabled: boolean().optional(),
|
|
54044
|
+
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
54045
|
+
kind: string().optional(),
|
|
53098
54046
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
53099
54047
|
formValues: record(string(), unknown()),
|
|
53100
|
-
status: IntegrationInstanceStatusSchema.optional()
|
|
54048
|
+
status: IntegrationInstanceStatusSchema.optional(),
|
|
54049
|
+
/** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
|
|
54050
|
+
lastCheckedAt: number().optional()
|
|
53101
54051
|
});
|
|
53102
54052
|
var IntegrationInstancePatchSchema = object({
|
|
53103
54053
|
id: IntegrationInstanceIdSchema,
|
|
@@ -53105,13 +54055,32 @@ var IntegrationInstancePatchSchema = object({
|
|
|
53105
54055
|
/** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
|
|
53106
54056
|
values: record(string(), unknown())
|
|
53107
54057
|
});
|
|
53108
|
-
method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
|
|
54058
|
+
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({
|
|
54059
|
+
id: IntegrationInstanceIdSchema.optional(),
|
|
54060
|
+
name: string().min(1),
|
|
54061
|
+
kind: string().min(1).optional()
|
|
54062
|
+
}), object({ id: string() }), {
|
|
54063
|
+
kind: "mutation",
|
|
54064
|
+
auth: "admin"
|
|
54065
|
+
}), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
|
|
54066
|
+
kind: "mutation",
|
|
54067
|
+
auth: "admin"
|
|
54068
|
+
}), method(object({
|
|
53109
54069
|
id: IntegrationInstanceIdSchema,
|
|
53110
|
-
|
|
53111
|
-
}), object({
|
|
54070
|
+
enabled: boolean()
|
|
54071
|
+
}), object({ ok: literal(true) }), {
|
|
54072
|
+
kind: "mutation",
|
|
54073
|
+
auth: "admin"
|
|
54074
|
+
}), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
|
|
54075
|
+
kind: "mutation",
|
|
54076
|
+
auth: "admin"
|
|
54077
|
+
}), optionalMethod(object({
|
|
53112
54078
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
53113
54079
|
values: record(string(), unknown())
|
|
53114
|
-
}), TestConnectionResultSchema$1, {
|
|
54080
|
+
}), TestConnectionResultSchema$1, {
|
|
54081
|
+
kind: "mutation",
|
|
54082
|
+
auth: "admin"
|
|
54083
|
+
});
|
|
53115
54084
|
/**
|
|
53116
54085
|
* Two-way audio / talk-back cap. Clients open a WebRTC audio-only
|
|
53117
54086
|
* session (server-initiated offer pattern, identical to the main
|
|
@@ -54910,6 +55879,11 @@ var LogEntrySchema = object({
|
|
|
54910
55879
|
* flight, and not asking for the next slice ends the scan.
|
|
54911
55880
|
*/
|
|
54912
55881
|
var LogReadQuerySchema = object({
|
|
55882
|
+
/**
|
|
55883
|
+
* Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
|
|
55884
|
+
* the provider's first readable one, so a caller written before instances existed is unchanged.
|
|
55885
|
+
*/
|
|
55886
|
+
instanceId: string().min(1).max(200).optional(),
|
|
54913
55887
|
/** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
|
|
54914
55888
|
requestId: string().min(1).max(64).optional(),
|
|
54915
55889
|
/** The device the line is about (`tags.deviceId`, numeric). */
|
|
@@ -54972,6 +55946,8 @@ var LogReadResultSchema = object({
|
|
|
54972
55946
|
/** True when `cancelRead` ended this slice early. */
|
|
54973
55947
|
cancelled: boolean().optional()
|
|
54974
55948
|
});
|
|
55949
|
+
/** Names one destination instance; absent ⇒ the provider's first readable one. */
|
|
55950
|
+
var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
|
|
54975
55951
|
var LogReadCapabilitiesSchema = object({
|
|
54976
55952
|
/** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
|
|
54977
55953
|
readable: boolean(),
|
|
@@ -54990,7 +55966,7 @@ var LogReadCapabilitiesSchema = object({
|
|
|
54990
55966
|
/** How far back the store reaches, when the provider knows (days). */
|
|
54991
55967
|
retentionDays: number().nullable()
|
|
54992
55968
|
});
|
|
54993
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(
|
|
55969
|
+
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() }), {
|
|
54994
55970
|
kind: "mutation",
|
|
54995
55971
|
auth: "admin"
|
|
54996
55972
|
});
|
|
@@ -55094,164 +56070,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
55094
56070
|
]);
|
|
55095
56071
|
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
55096
56072
|
/**
|
|
55097
|
-
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
55098
|
-
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
55099
|
-
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
55100
|
-
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
55101
|
-
*
|
|
55102
|
-
* The cap declares a wide method surface; not every backend supports
|
|
55103
|
-
* every method. Drivers signal sub-capability via the
|
|
55104
|
-
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
55105
|
-
* corresponding method) so the UI gates buttons without a slice
|
|
55106
|
-
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
55107
|
-
*/
|
|
55108
|
-
var MediaPlayerStateSchema = _enum([
|
|
55109
|
-
"off",
|
|
55110
|
-
"on",
|
|
55111
|
-
"idle",
|
|
55112
|
-
"playing",
|
|
55113
|
-
"paused",
|
|
55114
|
-
"buffering",
|
|
55115
|
-
"standby"
|
|
55116
|
-
]);
|
|
55117
|
-
var MediaPlayerRepeatSchema = _enum([
|
|
55118
|
-
"off",
|
|
55119
|
-
"all",
|
|
55120
|
-
"one"
|
|
55121
|
-
]);
|
|
55122
|
-
var MediaInfoSchema = object({
|
|
55123
|
-
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
55124
|
-
* `podcast`, …). */
|
|
55125
|
-
type: string(),
|
|
55126
|
-
/** Human-readable title. */
|
|
55127
|
-
title: string(),
|
|
55128
|
-
/** Optional artist / channel / station label. */
|
|
55129
|
-
artist: string().optional(),
|
|
55130
|
-
/** Optional album / season / show name. */
|
|
55131
|
-
album: string().optional(),
|
|
55132
|
-
/** Optional cover-art / thumbnail URL. */
|
|
55133
|
-
imageUrl: string().optional()
|
|
55134
|
-
});
|
|
55135
|
-
/**
|
|
55136
|
-
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
55137
|
-
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
55138
|
-
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
55139
|
-
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
55140
|
-
* guess, never as a reading.
|
|
55141
|
-
*/
|
|
55142
|
-
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
55143
|
-
/** The fields of a media-player status a driver can only guess. */
|
|
55144
|
-
var MediaPlayerAssumedFieldSchema = _enum([
|
|
55145
|
-
"state",
|
|
55146
|
-
"volumeLevel",
|
|
55147
|
-
"isMuted",
|
|
55148
|
-
"source"
|
|
55149
|
-
]);
|
|
55150
|
-
object({
|
|
55151
|
-
/** Playback lifecycle state. */
|
|
55152
|
-
state: MediaPlayerStateSchema,
|
|
55153
|
-
/**
|
|
55154
|
-
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
55155
|
-
* A slice written before this field existed parses as `reported`.
|
|
55156
|
-
*/
|
|
55157
|
-
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
55158
|
-
/**
|
|
55159
|
-
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
55160
|
-
* this is not empty; a field not listed here is a reading even then (power
|
|
55161
|
-
* from a running-state source, mute guessed from the last send).
|
|
55162
|
-
*/
|
|
55163
|
-
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
55164
|
-
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
55165
|
-
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
55166
|
-
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
55167
|
-
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
55168
|
-
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
55169
|
-
isMuted: boolean().nullable(),
|
|
55170
|
-
/** Active source / input. Empty when no source surface. */
|
|
55171
|
-
source: string(),
|
|
55172
|
-
/** Selectable sources. Empty when no source surface.
|
|
55173
|
-
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
55174
|
-
availableSources: array(string()),
|
|
55175
|
-
/** Currently-playing media info. Null when nothing is playing. */
|
|
55176
|
-
currentMedia: MediaInfoSchema.nullable(),
|
|
55177
|
-
/** Current playback position in ms. Null when not seekable or
|
|
55178
|
-
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
55179
|
-
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
55180
|
-
/** Total duration of the current media in ms. Null when unknown
|
|
55181
|
-
* (live stream) or nothing is playing. */
|
|
55182
|
-
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
55183
|
-
/** Shuffle toggle. Null when no shuffle surface.
|
|
55184
|
-
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
55185
|
-
shuffle: boolean().nullable(),
|
|
55186
|
-
/** Repeat mode. Null when no repeat surface.
|
|
55187
|
-
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
55188
|
-
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
55189
|
-
/** Ms epoch when the slice was last updated. */
|
|
55190
|
-
lastChangedAt: number()
|
|
55191
|
-
});
|
|
55192
|
-
DeviceType.MediaPlayer, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55193
|
-
kind: "mutation",
|
|
55194
|
-
auth: "protected"
|
|
55195
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55196
|
-
kind: "mutation",
|
|
55197
|
-
auth: "protected"
|
|
55198
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55199
|
-
kind: "mutation",
|
|
55200
|
-
auth: "protected"
|
|
55201
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55202
|
-
kind: "mutation",
|
|
55203
|
-
auth: "protected"
|
|
55204
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55205
|
-
kind: "mutation",
|
|
55206
|
-
auth: "protected"
|
|
55207
|
-
}), method(object({
|
|
55208
|
-
deviceId: number().int().nonnegative(),
|
|
55209
|
-
position: number().int().nonnegative()
|
|
55210
|
-
}), _void(), {
|
|
55211
|
-
kind: "mutation",
|
|
55212
|
-
auth: "protected"
|
|
55213
|
-
}), method(object({
|
|
55214
|
-
deviceId: number().int().nonnegative(),
|
|
55215
|
-
volumeLevel: number().min(0).max(100)
|
|
55216
|
-
}), _void(), {
|
|
55217
|
-
kind: "mutation",
|
|
55218
|
-
auth: "protected"
|
|
55219
|
-
}), method(object({
|
|
55220
|
-
deviceId: number().int().nonnegative(),
|
|
55221
|
-
muted: boolean()
|
|
55222
|
-
}), _void(), {
|
|
55223
|
-
kind: "mutation",
|
|
55224
|
-
auth: "protected"
|
|
55225
|
-
}), method(object({
|
|
55226
|
-
deviceId: number().int().nonnegative(),
|
|
55227
|
-
shuffle: boolean()
|
|
55228
|
-
}), _void(), {
|
|
55229
|
-
kind: "mutation",
|
|
55230
|
-
auth: "protected"
|
|
55231
|
-
}), method(object({
|
|
55232
|
-
deviceId: number().int().nonnegative(),
|
|
55233
|
-
repeat: MediaPlayerRepeatSchema
|
|
55234
|
-
}), _void(), {
|
|
55235
|
-
kind: "mutation",
|
|
55236
|
-
auth: "protected"
|
|
55237
|
-
}), method(object({
|
|
55238
|
-
deviceId: number().int().nonnegative(),
|
|
55239
|
-
source: string().min(1)
|
|
55240
|
-
}), _void(), {
|
|
55241
|
-
kind: "mutation",
|
|
55242
|
-
auth: "protected"
|
|
55243
|
-
}), method(object({
|
|
55244
|
-
deviceId: number().int().nonnegative(),
|
|
55245
|
-
/** Media identifier / URL. */
|
|
55246
|
-
mediaId: string().min(1),
|
|
55247
|
-
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
55248
|
-
* passes it through to the upstream service. */
|
|
55249
|
-
mediaType: string().min(1)
|
|
55250
|
-
}), _void(), {
|
|
55251
|
-
kind: "mutation",
|
|
55252
|
-
auth: "protected"
|
|
55253
|
-
});
|
|
55254
|
-
/**
|
|
55255
56073
|
* mesh-network — collection cap for mesh-VPN providers.
|
|
55256
56074
|
*
|
|
55257
56075
|
* Different shape from `network-access` (public tunnels):
|
|
@@ -63145,7 +63963,14 @@ var NcMediaPolicySchema = object({
|
|
|
63145
63963
|
*/
|
|
63146
63964
|
profile: CamProfileSchema.optional(),
|
|
63147
63965
|
/** See {@link NcLinkedCameraModeSchema}. */
|
|
63148
|
-
linkedCameras: NcLinkedCameraModeSchema.optional()
|
|
63966
|
+
linkedCameras: NcLinkedCameraModeSchema.optional(),
|
|
63967
|
+
/**
|
|
63968
|
+
* Sensor rules only: may this rule wake a SLEEPING battery camera to take
|
|
63969
|
+
* the linked still it attaches (D998)? Absent means yes, an explicit `false`
|
|
63970
|
+
* opts out. Deliberately not a Zod default: a rule that never chose keeps
|
|
63971
|
+
* following the hub's. One bounded wake per event; nothing is attached later.
|
|
63972
|
+
*/
|
|
63973
|
+
wakeSleepingCamera: boolean().optional()
|
|
63149
63974
|
});
|
|
63150
63975
|
/**
|
|
63151
63976
|
* Cooldown GRANULARITY over the subject's class — how much a fired
|
|
@@ -63537,6 +64362,21 @@ var NcTemplateVarKindSchema = _enum([
|
|
|
63537
64362
|
"sound",
|
|
63538
64363
|
"system"
|
|
63539
64364
|
]);
|
|
64365
|
+
/**
|
|
64366
|
+
* The default title/body a rule of one SITUATION is delivered with when the
|
|
64367
|
+
* operator wrote no template — served so an editor can pre-fill it (and the
|
|
64368
|
+
* operator can rebuild it from placeholders) instead of starting from a blank
|
|
64369
|
+
* box that, once saved, silently replaces it. `id` names the situation inside
|
|
64370
|
+
* a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
|
|
64371
|
+
* appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
|
|
64372
|
+
* the hub's current language and with its overrides applied.
|
|
64373
|
+
*/
|
|
64374
|
+
var NcTemplateDefaultSchema = object({
|
|
64375
|
+
id: _enum(["appliance-cycle"]),
|
|
64376
|
+
kind: NcRuleKindSchema,
|
|
64377
|
+
title: string(),
|
|
64378
|
+
body: string()
|
|
64379
|
+
});
|
|
63540
64380
|
/** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
|
|
63541
64381
|
var NcTemplateFamilySchema = _enum([
|
|
63542
64382
|
"rule",
|
|
@@ -64392,7 +65232,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
64392
65232
|
}), method(object({}), object({
|
|
64393
65233
|
catalog: array(NcConditionDescriptorSchema),
|
|
64394
65234
|
taxonomy: NcTaxonomySchema.optional()
|
|
64395
|
-
})), method(object({}), object({
|
|
65235
|
+
})), method(object({}), object({
|
|
65236
|
+
vars: array(NcTemplateVarDescriptorSchema),
|
|
65237
|
+
/** Per-situation default texts; absent on a hub that predates them. */
|
|
65238
|
+
defaults: array(NcTemplateDefaultSchema)
|
|
65239
|
+
})), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
|
|
64396
65240
|
kind: "mutation",
|
|
64397
65241
|
access: "view"
|
|
64398
65242
|
}), 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 }), {
|
|
@@ -65156,52 +66000,27 @@ object({
|
|
|
65156
66000
|
empty: boolean().nullable(),
|
|
65157
66001
|
/** True while the pump is running. Null while unknown. */
|
|
65158
66002
|
pumpRunning: boolean().nullable(),
|
|
65159
|
-
/** True when the pump works on an on/off duty cycle rather than continuously. */
|
|
65160
|
-
pumpIntervalEnabled: boolean().nullable(),
|
|
65161
|
-
/** How long the pump runs per cycle, in seconds. */
|
|
65162
|
-
pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
65163
|
-
/** How long the pump rests per cycle, in seconds. */
|
|
65164
|
-
pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
65165
66003
|
/** Water drunk in the last drink, in litres. */
|
|
65166
66004
|
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65167
66005
|
/** Water drunk in the current hour, in litres. */
|
|
65168
66006
|
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65169
66007
|
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
65170
66008
|
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65171
|
-
/** Water drunk since local midnight, in litres. */
|
|
66009
|
+
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
65172
66010
|
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
65173
66011
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
65174
66012
|
error: string().nullable(),
|
|
65175
66013
|
/** Ms epoch when the slice was last refreshed. */
|
|
65176
66014
|
lastFetchedAt: number()
|
|
65177
66015
|
});
|
|
65178
|
-
var DeviceIdSchema = number().int().nonnegative();
|
|
65179
|
-
var MinutesSchema = number().int().min(0);
|
|
66016
|
+
var DeviceIdSchema$1 = number().int().nonnegative();
|
|
65180
66017
|
DeviceType.PetFountain, method(object({
|
|
65181
|
-
deviceId: DeviceIdSchema,
|
|
65182
|
-
on: boolean()
|
|
65183
|
-
}), _void(), {
|
|
65184
|
-
kind: "mutation",
|
|
65185
|
-
auth: "protected"
|
|
65186
|
-
}), method(object({
|
|
65187
|
-
deviceId: DeviceIdSchema,
|
|
66018
|
+
deviceId: DeviceIdSchema$1,
|
|
65188
66019
|
on: boolean()
|
|
65189
66020
|
}), _void(), {
|
|
65190
66021
|
kind: "mutation",
|
|
65191
66022
|
auth: "protected"
|
|
65192
|
-
}), method(object({
|
|
65193
|
-
deviceId: DeviceIdSchema,
|
|
65194
|
-
minutes: MinutesSchema
|
|
65195
|
-
}), _void(), {
|
|
65196
|
-
kind: "mutation",
|
|
65197
|
-
auth: "protected"
|
|
65198
|
-
}), method(object({
|
|
65199
|
-
deviceId: DeviceIdSchema,
|
|
65200
|
-
minutes: MinutesSchema
|
|
65201
|
-
}), _void(), {
|
|
65202
|
-
kind: "mutation",
|
|
65203
|
-
auth: "protected"
|
|
65204
|
-
}), method(object({ deviceId: DeviceIdSchema }), _void(), {
|
|
66023
|
+
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
65205
66024
|
kind: "mutation",
|
|
65206
66025
|
auth: "protected"
|
|
65207
66026
|
});
|
|
@@ -66735,6 +67554,49 @@ object({
|
|
|
66735
67554
|
DeviceType.PetFeeder,
|
|
66736
67555
|
DeviceType.Heater
|
|
66737
67556
|
].filter((type) => type !== DeviceType.Sensor);
|
|
67557
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
67558
|
+
"no-power-source",
|
|
67559
|
+
"switch-missing",
|
|
67560
|
+
"switch-offline",
|
|
67561
|
+
"switch-unknown",
|
|
67562
|
+
"restart-in-progress",
|
|
67563
|
+
"switch-call-failed"
|
|
67564
|
+
]);
|
|
67565
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
67566
|
+
accepted: literal(false),
|
|
67567
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
67568
|
+
/** One line for the operator, naming the switch. */
|
|
67569
|
+
message: string()
|
|
67570
|
+
})]);
|
|
67571
|
+
var PowerSourceInfoSchema = object({
|
|
67572
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
67573
|
+
linked: boolean(),
|
|
67574
|
+
switchDeviceId: number().nullable(),
|
|
67575
|
+
switchName: string().nullable(),
|
|
67576
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
67577
|
+
switchOn: boolean().nullable(),
|
|
67578
|
+
switchOnline: boolean().nullable(),
|
|
67579
|
+
restartInProgress: boolean(),
|
|
67580
|
+
offSeconds: number().int()
|
|
67581
|
+
});
|
|
67582
|
+
object({
|
|
67583
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
67584
|
+
switchOn: boolean().nullable(),
|
|
67585
|
+
offSeconds: number().int(),
|
|
67586
|
+
lastFetchedAt: number()
|
|
67587
|
+
});
|
|
67588
|
+
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;
|
|
67589
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
67590
|
+
systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67591
|
+
kind: "mutation",
|
|
67592
|
+
auth: "admin"
|
|
67593
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67594
|
+
kind: "mutation",
|
|
67595
|
+
auth: "admin"
|
|
67596
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
67597
|
+
kind: "mutation",
|
|
67598
|
+
auth: "admin"
|
|
67599
|
+
});
|
|
66738
67600
|
/**
|
|
66739
67601
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
66740
67602
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -67161,6 +68023,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
|
|
|
67161
68023
|
deviceId: number(),
|
|
67162
68024
|
status: PtzAutotrackStatusSchema
|
|
67163
68025
|
});
|
|
68026
|
+
object({
|
|
68027
|
+
/** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
|
|
68028
|
+
enabled: boolean().nullable(),
|
|
68029
|
+
/** How long the pump runs per cycle, in seconds. Null while unknown. */
|
|
68030
|
+
onTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
68031
|
+
/** How long the pump rests per cycle, in seconds. Null while unknown. */
|
|
68032
|
+
offTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
68033
|
+
/** Ms epoch when the slice was last refreshed. */
|
|
68034
|
+
lastFetchedAt: number()
|
|
68035
|
+
});
|
|
68036
|
+
var DeviceIdSchema = number().int().nonnegative();
|
|
68037
|
+
var MinutesSchema = number().int().min(0);
|
|
68038
|
+
DeviceType.PetFountain, method(object({
|
|
68039
|
+
deviceId: DeviceIdSchema,
|
|
68040
|
+
on: boolean()
|
|
68041
|
+
}), _void(), {
|
|
68042
|
+
kind: "mutation",
|
|
68043
|
+
auth: "protected"
|
|
68044
|
+
}), method(object({
|
|
68045
|
+
deviceId: DeviceIdSchema,
|
|
68046
|
+
minutes: MinutesSchema
|
|
68047
|
+
}), _void(), {
|
|
68048
|
+
kind: "mutation",
|
|
68049
|
+
auth: "protected"
|
|
68050
|
+
}), method(object({
|
|
68051
|
+
deviceId: DeviceIdSchema,
|
|
68052
|
+
minutes: MinutesSchema
|
|
68053
|
+
}), _void(), {
|
|
68054
|
+
kind: "mutation",
|
|
68055
|
+
auth: "protected"
|
|
68056
|
+
});
|
|
67164
68057
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
67165
68058
|
kind: "mutation",
|
|
67166
68059
|
auth: "admin"
|
|
@@ -69874,7 +70767,13 @@ var RemoteMediaCommandSchema = _enum([
|
|
|
69874
70767
|
"next",
|
|
69875
70768
|
"previous",
|
|
69876
70769
|
"setMute",
|
|
69877
|
-
"selectSource"
|
|
70770
|
+
"selectSource",
|
|
70771
|
+
"turnOn",
|
|
70772
|
+
"turnOff",
|
|
70773
|
+
"volumeUp",
|
|
70774
|
+
"volumeDown",
|
|
70775
|
+
"channelUp",
|
|
70776
|
+
"channelDown"
|
|
69878
70777
|
]);
|
|
69879
70778
|
/** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
|
|
69880
70779
|
var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
|
|
@@ -69895,7 +70794,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
|
|
|
69895
70794
|
}), RemoteSendResultSchema, {
|
|
69896
70795
|
kind: "mutation",
|
|
69897
70796
|
auth: "protected"
|
|
69898
|
-
}), method(deviceInput.extend({
|
|
70797
|
+
}), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
|
|
69899
70798
|
command: RemoteMediaCommandSchema,
|
|
69900
70799
|
muted: boolean().optional(),
|
|
69901
70800
|
source: string().optional(),
|
|
@@ -70829,7 +71728,16 @@ DeviceType.Sensor;
|
|
|
70829
71728
|
* future fields without breaking the existing call sites.
|
|
70830
71729
|
*/
|
|
70831
71730
|
var EmailAddressSchema = email();
|
|
71731
|
+
/**
|
|
71732
|
+
* Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
|
|
71733
|
+
* relay, so a caller written before relays existed keeps working unchanged. A provider with one
|
|
71734
|
+
* fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
|
|
71735
|
+
* collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
|
|
71736
|
+
*/
|
|
71737
|
+
var InstanceIdSchema = string().min(1).optional();
|
|
71738
|
+
var RelayPinSchema = object({ instanceId: InstanceIdSchema });
|
|
70832
71739
|
var SendEmailInputSchema = object({
|
|
71740
|
+
instanceId: InstanceIdSchema,
|
|
70833
71741
|
to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
|
|
70834
71742
|
cc: array(EmailAddressSchema).optional(),
|
|
70835
71743
|
bcc: array(EmailAddressSchema).optional(),
|
|
@@ -70865,11 +71773,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
|
|
|
70865
71773
|
kind: "mutation",
|
|
70866
71774
|
auth: "admin",
|
|
70867
71775
|
access: "create"
|
|
70868
|
-
}), method(
|
|
71776
|
+
}), method(RelayPinSchema, SmtpStatusSchema, {
|
|
70869
71777
|
kind: "mutation",
|
|
70870
71778
|
auth: "admin",
|
|
70871
71779
|
access: "view"
|
|
70872
|
-
}), method(
|
|
71780
|
+
}), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
|
|
70873
71781
|
/**
|
|
70874
71782
|
* A single device snapshot returned as base64 JPEG/PNG.
|
|
70875
71783
|
*
|
|
@@ -70901,10 +71809,12 @@ DeviceType.Camera, method(object({
|
|
|
70901
71809
|
* even when the cache is well within the device's
|
|
70902
71810
|
* `snapshotMaxAgeS` window.
|
|
70903
71811
|
*
|
|
70904
|
-
* **`force` is
|
|
71812
|
+
* **`force` is a demand with a named principal, not a freshness
|
|
71813
|
+
* preference** — an operator button, the scheduled refresh (D847), or a
|
|
71814
|
+
* notification rule that left the camera's wake allowed (D998). On a
|
|
70905
71815
|
* battery camera it is the one thing that walks past the wrapper's
|
|
70906
|
-
* sleep gate and wakes the camera, so a
|
|
70907
|
-
*
|
|
71816
|
+
* sleep gate and wakes the camera, so a poller, a thumbnail or a
|
|
71817
|
+
* prestream must NEVER set it. Every such caller
|
|
70908
71818
|
* gets the cached frame, which on a sleeping battery camera is the
|
|
70909
71819
|
* correct answer: stale but honest beats woken.
|
|
70910
71820
|
*/
|
|
@@ -71719,7 +72629,11 @@ Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly())
|
|
|
71719
72629
|
* `getSettingsUISchema()` surface.
|
|
71720
72630
|
*/
|
|
71721
72631
|
var SwitchStatusSchema = object({
|
|
71722
|
-
|
|
72632
|
+
/**
|
|
72633
|
+
* `null` = the device has never reported its state (a measurement that
|
|
72634
|
+
* has not happened is unknown, never `false`).
|
|
72635
|
+
*/
|
|
72636
|
+
on: boolean().nullable().meta({ label: "On" }),
|
|
71723
72637
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
71724
72638
|
lastChangedAt: number()
|
|
71725
72639
|
});
|
|
@@ -71731,7 +72645,7 @@ DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceTyp
|
|
|
71731
72645
|
auth: "protected"
|
|
71732
72646
|
}), object({
|
|
71733
72647
|
deviceId: number(),
|
|
71734
|
-
on: boolean(),
|
|
72648
|
+
on: boolean().nullable(),
|
|
71735
72649
|
lastChangedAt: number()
|
|
71736
72650
|
});
|
|
71737
72651
|
/** C0 controls, DEL and the C1 range: none of them belongs in a name. */
|
|
@@ -74743,6 +75657,26 @@ function buildDescriptor(capName, kind) {
|
|
|
74743
75657
|
* contributes one entry per bound cap present in this map.
|
|
74744
75658
|
*/
|
|
74745
75659
|
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
75660
|
+
/**
|
|
75661
|
+
* What a remote key is CALLED and what it LOOKS like, for every role (D963),
|
|
75662
|
+
* shared by the admin UI and the viewer. A role is data on the wire; each
|
|
75663
|
+
* client resolves its name from `label` (English and Italian side by side) and
|
|
75664
|
+
* its glyph from `icon`, a lucide id from the shared icon catalogue — the
|
|
75665
|
+
* server sends an id, a client maps it to its own icon set.
|
|
75666
|
+
*
|
|
75667
|
+
* `legend` is text printed on the key INSTEAD of a glyph (a digit has no
|
|
75668
|
+
* pictogram): a client that can draw text shows it, one that cannot falls back
|
|
75669
|
+
* to `icon`.
|
|
75670
|
+
*/
|
|
75671
|
+
function digit(n) {
|
|
75672
|
+
return {
|
|
75673
|
+
label: t(n, n),
|
|
75674
|
+
icon: "hash",
|
|
75675
|
+
legend: n
|
|
75676
|
+
};
|
|
75677
|
+
}
|
|
75678
|
+
digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
|
|
75679
|
+
DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
|
|
74746
75680
|
var btn = (idSuffix, row, col, init) => ({
|
|
74747
75681
|
idSuffix,
|
|
74748
75682
|
row,
|
|
@@ -74869,7 +75803,35 @@ discriminatedUnion("kind", [object({
|
|
|
74869
75803
|
kind: literal("pronto"),
|
|
74870
75804
|
code: string()
|
|
74871
75805
|
})]);
|
|
74872
|
-
|
|
75806
|
+
/**
|
|
75807
|
+
* Propose a running threshold from a device's own power history (planning#405).
|
|
75808
|
+
*
|
|
75809
|
+
* Pure and deterministic: the same series gives the same answer. The series is
|
|
75810
|
+
* a HELD-VALUE step series — a point's value stands until the next point — which
|
|
75811
|
+
* is how device-history stores a gauge, so "time at a level" is exact, not a
|
|
75812
|
+
* count of samples.
|
|
75813
|
+
*
|
|
75814
|
+
* 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
|
|
75815
|
+
* near F. A device that is not near one level most of the time has no floor.
|
|
75816
|
+
* 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
|
|
75817
|
+
* 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
|
|
75818
|
+
* the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
|
|
75819
|
+
* 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
|
|
75820
|
+
* grid a person would type; stop dwell covers the longest pause; start dwell
|
|
75821
|
+
* covers the longest standby blip above T.
|
|
75822
|
+
* 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
|
|
75823
|
+
* run must hold exactly one true interval and nothing may flap outside.
|
|
75824
|
+
*/
|
|
75825
|
+
var SECOND_MS = 1e3;
|
|
75826
|
+
var MINUTE_MS$1 = 60 * SECOND_MS;
|
|
75827
|
+
24 * (60 * MINUTE_MS$1);
|
|
75828
|
+
10 * MINUTE_MS$1;
|
|
75829
|
+
30 * SECOND_MS;
|
|
75830
|
+
60 * SECOND_MS;
|
|
75831
|
+
20 * MINUTE_MS$1;
|
|
75832
|
+
10 * SECOND_MS;
|
|
75833
|
+
10 * SECOND_MS;
|
|
75834
|
+
DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
|
|
74873
75835
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
74874
75836
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
74875
75837
|
DeviceRole.BinarySensor, DeviceRole.MotionSensor;
|
|
@@ -75850,6 +76812,27 @@ Object.freeze({
|
|
|
75850
76812
|
access: "view",
|
|
75851
76813
|
role: "viewer"
|
|
75852
76814
|
},
|
|
76815
|
+
"boardKeySource.getBoardKey": {
|
|
76816
|
+
capName: "board-key-source",
|
|
76817
|
+
capScope: "system",
|
|
76818
|
+
addonId: null,
|
|
76819
|
+
access: "view",
|
|
76820
|
+
role: "admin"
|
|
76821
|
+
},
|
|
76822
|
+
"boardKeySource.listBoards": {
|
|
76823
|
+
capName: "board-key-source",
|
|
76824
|
+
capScope: "system",
|
|
76825
|
+
addonId: null,
|
|
76826
|
+
access: "view",
|
|
76827
|
+
role: "admin"
|
|
76828
|
+
},
|
|
76829
|
+
"boardKeySource.listSources": {
|
|
76830
|
+
capName: "board-key-source",
|
|
76831
|
+
capScope: "system",
|
|
76832
|
+
addonId: null,
|
|
76833
|
+
access: "view",
|
|
76834
|
+
role: "admin"
|
|
76835
|
+
},
|
|
75853
76836
|
"brightness.getStatus": {
|
|
75854
76837
|
capName: "brightness",
|
|
75855
76838
|
capScope: "device",
|
|
@@ -76389,6 +77372,13 @@ Object.freeze({
|
|
|
76389
77372
|
access: "create",
|
|
76390
77373
|
role: "admin"
|
|
76391
77374
|
},
|
|
77375
|
+
"coreBlocks.proposeRunningThreshold": {
|
|
77376
|
+
capName: "core-blocks",
|
|
77377
|
+
capScope: "system",
|
|
77378
|
+
addonId: null,
|
|
77379
|
+
access: "view",
|
|
77380
|
+
role: "admin"
|
|
77381
|
+
},
|
|
76392
77382
|
"coreBlocks.reportAutomationRun": {
|
|
76393
77383
|
capName: "core-blocks",
|
|
76394
77384
|
capScope: "system",
|
|
@@ -76900,6 +77890,13 @@ Object.freeze({
|
|
|
76900
77890
|
access: "view",
|
|
76901
77891
|
role: "admin"
|
|
76902
77892
|
},
|
|
77893
|
+
"deviceExport.listInstances": {
|
|
77894
|
+
capName: "device-export",
|
|
77895
|
+
capScope: "system",
|
|
77896
|
+
addonId: null,
|
|
77897
|
+
access: "view",
|
|
77898
|
+
role: "admin"
|
|
77899
|
+
},
|
|
76903
77900
|
"deviceExport.listSupportedDeviceKinds": {
|
|
76904
77901
|
capName: "device-export",
|
|
76905
77902
|
capScope: "system",
|
|
@@ -78531,6 +79528,13 @@ Object.freeze({
|
|
|
78531
79528
|
access: "view",
|
|
78532
79529
|
role: "admin"
|
|
78533
79530
|
},
|
|
79531
|
+
"integrationInstances.setInstanceEnabled": {
|
|
79532
|
+
capName: "integration-instances",
|
|
79533
|
+
capScope: "system",
|
|
79534
|
+
addonId: null,
|
|
79535
|
+
access: "create",
|
|
79536
|
+
role: "admin"
|
|
79537
|
+
},
|
|
78534
79538
|
"integrationInstances.testInstance": {
|
|
78535
79539
|
capName: "integration-instances",
|
|
78536
79540
|
capScope: "system",
|
|
@@ -79329,6 +80333,20 @@ Object.freeze({
|
|
|
79329
80333
|
access: "view",
|
|
79330
80334
|
role: "admin"
|
|
79331
80335
|
},
|
|
80336
|
+
"mediaPlayer.channelDown": {
|
|
80337
|
+
capName: "media-player",
|
|
80338
|
+
capScope: "device",
|
|
80339
|
+
addonId: null,
|
|
80340
|
+
access: "create",
|
|
80341
|
+
role: "viewer"
|
|
80342
|
+
},
|
|
80343
|
+
"mediaPlayer.channelUp": {
|
|
80344
|
+
capName: "media-player",
|
|
80345
|
+
capScope: "device",
|
|
80346
|
+
addonId: null,
|
|
80347
|
+
access: "create",
|
|
80348
|
+
role: "viewer"
|
|
80349
|
+
},
|
|
79332
80350
|
"mediaPlayer.getStatus": {
|
|
79333
80351
|
capName: "media-player",
|
|
79334
80352
|
capScope: "device",
|
|
@@ -79420,6 +80438,34 @@ Object.freeze({
|
|
|
79420
80438
|
access: "create",
|
|
79421
80439
|
role: "viewer"
|
|
79422
80440
|
},
|
|
80441
|
+
"mediaPlayer.turnOff": {
|
|
80442
|
+
capName: "media-player",
|
|
80443
|
+
capScope: "device",
|
|
80444
|
+
addonId: null,
|
|
80445
|
+
access: "create",
|
|
80446
|
+
role: "viewer"
|
|
80447
|
+
},
|
|
80448
|
+
"mediaPlayer.turnOn": {
|
|
80449
|
+
capName: "media-player",
|
|
80450
|
+
capScope: "device",
|
|
80451
|
+
addonId: null,
|
|
80452
|
+
access: "create",
|
|
80453
|
+
role: "viewer"
|
|
80454
|
+
},
|
|
80455
|
+
"mediaPlayer.volumeDown": {
|
|
80456
|
+
capName: "media-player",
|
|
80457
|
+
capScope: "device",
|
|
80458
|
+
addonId: null,
|
|
80459
|
+
access: "create",
|
|
80460
|
+
role: "viewer"
|
|
80461
|
+
},
|
|
80462
|
+
"mediaPlayer.volumeUp": {
|
|
80463
|
+
capName: "media-player",
|
|
80464
|
+
capScope: "device",
|
|
80465
|
+
addonId: null,
|
|
80466
|
+
access: "create",
|
|
80467
|
+
role: "viewer"
|
|
80468
|
+
},
|
|
79423
80469
|
"meshNetwork.getStatus": {
|
|
79424
80470
|
capName: "mesh-network",
|
|
79425
80471
|
capScope: "system",
|
|
@@ -80666,27 +81712,6 @@ Object.freeze({
|
|
|
80666
81712
|
access: "create",
|
|
80667
81713
|
role: "viewer"
|
|
80668
81714
|
},
|
|
80669
|
-
"petFountain.setPumpInterval": {
|
|
80670
|
-
capName: "pet-fountain",
|
|
80671
|
-
capScope: "device",
|
|
80672
|
-
addonId: null,
|
|
80673
|
-
access: "create",
|
|
80674
|
-
role: "viewer"
|
|
80675
|
-
},
|
|
80676
|
-
"petFountain.setPumpOffMinutes": {
|
|
80677
|
-
capName: "pet-fountain",
|
|
80678
|
-
capScope: "device",
|
|
80679
|
-
addonId: null,
|
|
80680
|
-
access: "create",
|
|
80681
|
-
role: "viewer"
|
|
80682
|
-
},
|
|
80683
|
-
"petFountain.setPumpOnMinutes": {
|
|
80684
|
-
capName: "pet-fountain",
|
|
80685
|
-
capScope: "device",
|
|
80686
|
-
addonId: null,
|
|
80687
|
-
access: "create",
|
|
80688
|
-
role: "viewer"
|
|
80689
|
-
},
|
|
80690
81715
|
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
80691
81716
|
capName: "pipeline-analytics",
|
|
80692
81717
|
capScope: "device",
|
|
@@ -82465,6 +83490,34 @@ Object.freeze({
|
|
|
82465
83490
|
access: "create",
|
|
82466
83491
|
role: "admin"
|
|
82467
83492
|
},
|
|
83493
|
+
"pumpCycle.getStatus": {
|
|
83494
|
+
capName: "pump-cycle",
|
|
83495
|
+
capScope: "device",
|
|
83496
|
+
addonId: null,
|
|
83497
|
+
access: "view",
|
|
83498
|
+
role: "viewer"
|
|
83499
|
+
},
|
|
83500
|
+
"pumpCycle.setEnabled": {
|
|
83501
|
+
capName: "pump-cycle",
|
|
83502
|
+
capScope: "device",
|
|
83503
|
+
addonId: null,
|
|
83504
|
+
access: "create",
|
|
83505
|
+
role: "viewer"
|
|
83506
|
+
},
|
|
83507
|
+
"pumpCycle.setOffMinutes": {
|
|
83508
|
+
capName: "pump-cycle",
|
|
83509
|
+
capScope: "device",
|
|
83510
|
+
addonId: null,
|
|
83511
|
+
access: "create",
|
|
83512
|
+
role: "viewer"
|
|
83513
|
+
},
|
|
83514
|
+
"pumpCycle.setOnMinutes": {
|
|
83515
|
+
capName: "pump-cycle",
|
|
83516
|
+
capScope: "device",
|
|
83517
|
+
addonId: null,
|
|
83518
|
+
access: "create",
|
|
83519
|
+
role: "viewer"
|
|
83520
|
+
},
|
|
82468
83521
|
"reboot.reboot": {
|
|
82469
83522
|
capName: "reboot",
|
|
82470
83523
|
capScope: "device",
|
|
@@ -82969,6 +84022,13 @@ Object.freeze({
|
|
|
82969
84022
|
access: "create",
|
|
82970
84023
|
role: "admin"
|
|
82971
84024
|
},
|
|
84025
|
+
"remote.getAssumedStatus": {
|
|
84026
|
+
capName: "remote",
|
|
84027
|
+
capScope: "system",
|
|
84028
|
+
addonId: null,
|
|
84029
|
+
access: "view",
|
|
84030
|
+
role: "admin"
|
|
84031
|
+
},
|
|
82972
84032
|
"remote.getConfig": {
|
|
82973
84033
|
capName: "remote",
|
|
82974
84034
|
capScope: "system",
|
|
@@ -85809,6 +86869,11 @@ Object.freeze({
|
|
|
85809
86869
|
form: "single",
|
|
85810
86870
|
optional: false
|
|
85811
86871
|
}],
|
|
86872
|
+
"coreBlocks.proposeRunningThreshold": [{
|
|
86873
|
+
name: "deviceId",
|
|
86874
|
+
form: "single",
|
|
86875
|
+
optional: false
|
|
86876
|
+
}],
|
|
85812
86877
|
"cover.close": [{
|
|
85813
86878
|
name: "deviceId",
|
|
85814
86879
|
form: "single",
|
|
@@ -86660,6 +87725,16 @@ Object.freeze({
|
|
|
86660
87725
|
form: "single",
|
|
86661
87726
|
optional: true
|
|
86662
87727
|
}],
|
|
87728
|
+
"mediaPlayer.channelDown": [{
|
|
87729
|
+
name: "deviceId",
|
|
87730
|
+
form: "single",
|
|
87731
|
+
optional: false
|
|
87732
|
+
}],
|
|
87733
|
+
"mediaPlayer.channelUp": [{
|
|
87734
|
+
name: "deviceId",
|
|
87735
|
+
form: "single",
|
|
87736
|
+
optional: false
|
|
87737
|
+
}],
|
|
86663
87738
|
"mediaPlayer.getStatus": [{
|
|
86664
87739
|
name: "deviceId",
|
|
86665
87740
|
form: "single",
|
|
@@ -86725,6 +87800,26 @@ Object.freeze({
|
|
|
86725
87800
|
form: "single",
|
|
86726
87801
|
optional: false
|
|
86727
87802
|
}],
|
|
87803
|
+
"mediaPlayer.turnOff": [{
|
|
87804
|
+
name: "deviceId",
|
|
87805
|
+
form: "single",
|
|
87806
|
+
optional: false
|
|
87807
|
+
}],
|
|
87808
|
+
"mediaPlayer.turnOn": [{
|
|
87809
|
+
name: "deviceId",
|
|
87810
|
+
form: "single",
|
|
87811
|
+
optional: false
|
|
87812
|
+
}],
|
|
87813
|
+
"mediaPlayer.volumeDown": [{
|
|
87814
|
+
name: "deviceId",
|
|
87815
|
+
form: "single",
|
|
87816
|
+
optional: false
|
|
87817
|
+
}],
|
|
87818
|
+
"mediaPlayer.volumeUp": [{
|
|
87819
|
+
name: "deviceId",
|
|
87820
|
+
form: "single",
|
|
87821
|
+
optional: false
|
|
87822
|
+
}],
|
|
86728
87823
|
"meter.getStatus": [{
|
|
86729
87824
|
name: "deviceId",
|
|
86730
87825
|
form: "single",
|
|
@@ -87034,21 +88129,6 @@ Object.freeze({
|
|
|
87034
88129
|
form: "single",
|
|
87035
88130
|
optional: false
|
|
87036
88131
|
}],
|
|
87037
|
-
"petFountain.setPumpInterval": [{
|
|
87038
|
-
name: "deviceId",
|
|
87039
|
-
form: "single",
|
|
87040
|
-
optional: false
|
|
87041
|
-
}],
|
|
87042
|
-
"petFountain.setPumpOffMinutes": [{
|
|
87043
|
-
name: "deviceId",
|
|
87044
|
-
form: "single",
|
|
87045
|
-
optional: false
|
|
87046
|
-
}],
|
|
87047
|
-
"petFountain.setPumpOnMinutes": [{
|
|
87048
|
-
name: "deviceId",
|
|
87049
|
-
form: "single",
|
|
87050
|
-
optional: false
|
|
87051
|
-
}],
|
|
87052
88132
|
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
87053
88133
|
name: "deviceId",
|
|
87054
88134
|
form: "single",
|
|
@@ -87684,6 +88764,26 @@ Object.freeze({
|
|
|
87684
88764
|
form: "single",
|
|
87685
88765
|
optional: false
|
|
87686
88766
|
}],
|
|
88767
|
+
"pumpCycle.getStatus": [{
|
|
88768
|
+
name: "deviceId",
|
|
88769
|
+
form: "single",
|
|
88770
|
+
optional: false
|
|
88771
|
+
}],
|
|
88772
|
+
"pumpCycle.setEnabled": [{
|
|
88773
|
+
name: "deviceId",
|
|
88774
|
+
form: "single",
|
|
88775
|
+
optional: false
|
|
88776
|
+
}],
|
|
88777
|
+
"pumpCycle.setOffMinutes": [{
|
|
88778
|
+
name: "deviceId",
|
|
88779
|
+
form: "single",
|
|
88780
|
+
optional: false
|
|
88781
|
+
}],
|
|
88782
|
+
"pumpCycle.setOnMinutes": [{
|
|
88783
|
+
name: "deviceId",
|
|
88784
|
+
form: "single",
|
|
88785
|
+
optional: false
|
|
88786
|
+
}],
|
|
87687
88787
|
"reboot.reboot": [{
|
|
87688
88788
|
name: "deviceId",
|
|
87689
88789
|
form: "single",
|
|
@@ -87885,6 +88985,11 @@ Object.freeze({
|
|
|
87885
88985
|
form: "single",
|
|
87886
88986
|
optional: true
|
|
87887
88987
|
}],
|
|
88988
|
+
"remote.getAssumedStatus": [{
|
|
88989
|
+
name: "deviceId",
|
|
88990
|
+
form: "single",
|
|
88991
|
+
optional: false
|
|
88992
|
+
}],
|
|
87888
88993
|
"remote.getConfig": [{
|
|
87889
88994
|
name: "deviceId",
|
|
87890
88995
|
form: "single",
|
|
@@ -88432,99 +89537,6 @@ Object.freeze({
|
|
|
88432
89537
|
"network-access": "ingress",
|
|
88433
89538
|
"smtp-provider": "email"
|
|
88434
89539
|
});
|
|
88435
|
-
/**
|
|
88436
|
-
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
88437
|
-
* `z.infer`, they do not restate the shape.
|
|
88438
|
-
*/
|
|
88439
|
-
var OverrideSourceSchema = object({
|
|
88440
|
-
addonId: string().min(1),
|
|
88441
|
-
stableId: string().min(1),
|
|
88442
|
-
cap: string().min(1),
|
|
88443
|
-
fieldPath: string().min(1)
|
|
88444
|
-
});
|
|
88445
|
-
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
88446
|
-
object({ kind: literal("identity") }),
|
|
88447
|
-
object({ kind: literal("invert") }),
|
|
88448
|
-
object({
|
|
88449
|
-
kind: literal("threshold"),
|
|
88450
|
-
comparison: _enum(["gte", "lte"]),
|
|
88451
|
-
threshold: number(),
|
|
88452
|
-
startDwellMs: number().nonnegative(),
|
|
88453
|
-
stopDwellMs: number().nonnegative()
|
|
88454
|
-
}),
|
|
88455
|
-
object({
|
|
88456
|
-
kind: literal("linear"),
|
|
88457
|
-
scale: number(),
|
|
88458
|
-
offset: number(),
|
|
88459
|
-
clampMin: number().optional(),
|
|
88460
|
-
clampMax: number().optional()
|
|
88461
|
-
}),
|
|
88462
|
-
object({
|
|
88463
|
-
kind: literal("enum-map"),
|
|
88464
|
-
mapping: record(string(), string().nullable())
|
|
88465
|
-
}),
|
|
88466
|
-
object({ kind: literal("number") })
|
|
88467
|
-
]);
|
|
88468
|
-
var ScalarOverrideDraftSchema = object({
|
|
88469
|
-
kind: literal("scalar"),
|
|
88470
|
-
cap: string().min(1),
|
|
88471
|
-
targetId: string().min(1),
|
|
88472
|
-
source: OverrideSourceSchema,
|
|
88473
|
-
transform: CustomizeTransformDraftSchema
|
|
88474
|
-
});
|
|
88475
|
-
var KeyedArrayOverrideDraftSchema = object({
|
|
88476
|
-
kind: literal("keyedArray"),
|
|
88477
|
-
cap: string().min(1),
|
|
88478
|
-
targetId: string().min(1),
|
|
88479
|
-
key: string().min(1),
|
|
88480
|
-
label: string().min(1),
|
|
88481
|
-
fieldPath: string().min(1),
|
|
88482
|
-
source: OverrideSourceSchema,
|
|
88483
|
-
transform: CustomizeTransformDraftSchema
|
|
88484
|
-
});
|
|
88485
|
-
var PulseOverrideDraftSchema = object({
|
|
88486
|
-
kind: literal("pulse"),
|
|
88487
|
-
cap: string().min(1),
|
|
88488
|
-
targetId: string().min(1),
|
|
88489
|
-
enabled: boolean(),
|
|
88490
|
-
debounceMs: number().nonnegative(),
|
|
88491
|
-
edges: array(_enum([
|
|
88492
|
-
"rising",
|
|
88493
|
-
"button",
|
|
88494
|
-
"native-event"
|
|
88495
|
-
])).min(1).optional(),
|
|
88496
|
-
sources: array(OverrideSourceSchema).min(1)
|
|
88497
|
-
});
|
|
88498
|
-
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
88499
|
-
"in-addition",
|
|
88500
|
-
"confirm",
|
|
88501
|
-
"replace"
|
|
88502
|
-
]).optional() });
|
|
88503
|
-
discriminatedUnion("kind", [
|
|
88504
|
-
ScalarOverrideDraftSchema,
|
|
88505
|
-
KeyedArrayOverrideDraftSchema,
|
|
88506
|
-
PulseOverrideDraftSchema,
|
|
88507
|
-
object({
|
|
88508
|
-
kind: literal("span"),
|
|
88509
|
-
cap: string().min(1),
|
|
88510
|
-
targetId: string().min(1),
|
|
88511
|
-
timeoutMs: number().nonnegative(),
|
|
88512
|
-
cooldownMs: number().nonnegative().optional(),
|
|
88513
|
-
sources: array(SpanSourceDraftSchema)
|
|
88514
|
-
})
|
|
88515
|
-
]);
|
|
88516
|
-
object({
|
|
88517
|
-
targetId: string().min(1),
|
|
88518
|
-
configured: boolean(),
|
|
88519
|
-
source: _enum(["native", "assigned"]),
|
|
88520
|
-
state: _enum([
|
|
88521
|
-
"active",
|
|
88522
|
-
"stale",
|
|
88523
|
-
"released",
|
|
88524
|
-
"unavailable"
|
|
88525
|
-
]),
|
|
88526
|
-
reason: string().nullable()
|
|
88527
|
-
});
|
|
88528
89540
|
var G711_SCALE_CORRECTION_DB = {
|
|
88529
89541
|
PCMU: 20 * Math.log10(4),
|
|
88530
89542
|
PCMA: 20 * Math.log10(8)
|
|
@@ -89140,6 +90152,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
89140
90152
|
[...RULE_TEXT],
|
|
89141
90153
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
89142
90154
|
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
90155
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
89143
90156
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
89144
90157
|
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
89145
90158
|
([...RULE_TEXT], [...CONSUMABLE]),
|
|
@@ -90048,6 +91061,44 @@ var ActionSceneExports = class {
|
|
|
90048
91061
|
}
|
|
90049
91062
|
};
|
|
90050
91063
|
//#endregion
|
|
91064
|
+
//#region src/export-records.ts
|
|
91065
|
+
/**
|
|
91066
|
+
* What the Google export exposes, as a record (planning#408 P4): ONE `google-exports` record per
|
|
91067
|
+
* instance id (`export-google` today) holds the devices Google syncs and the actions it sees as
|
|
91068
|
+
* scenes. The addon is its only writer; the in-memory copy it loads at boot is what every
|
|
91069
|
+
* fulfillment intent reads.
|
|
91070
|
+
*/
|
|
91071
|
+
/** A single-instance addon keeps its records under its own addon id. */
|
|
91072
|
+
var GOOGLE_INSTANCE_ID = "export-google";
|
|
91073
|
+
var ExposedDeviceEntrySchema = object({
|
|
91074
|
+
deviceId: number(),
|
|
91075
|
+
exposedAt: number()
|
|
91076
|
+
});
|
|
91077
|
+
var ActionSceneEntrySchema = object({
|
|
91078
|
+
actionId: string(),
|
|
91079
|
+
displayName: string(),
|
|
91080
|
+
addedAt: number()
|
|
91081
|
+
});
|
|
91082
|
+
var GoogleExportsBodySchema = object({
|
|
91083
|
+
name: string().min(1),
|
|
91084
|
+
devices: array(ExposedDeviceEntrySchema),
|
|
91085
|
+
actions: array(ActionSceneEntrySchema)
|
|
91086
|
+
});
|
|
91087
|
+
var GOOGLE_EXPORTS_KIND_NAME = "google-exports";
|
|
91088
|
+
var GOOGLE_EXPORTS_NAME = "Google exposure";
|
|
91089
|
+
var googleExportsKind = defineEntryKind(GOOGLE_EXPORTS_KIND_NAME, {
|
|
91090
|
+
title: "Google exposure",
|
|
91091
|
+
nameField: "name",
|
|
91092
|
+
schema: GoogleExportsBodySchema
|
|
91093
|
+
});
|
|
91094
|
+
var EMPTY_GOOGLE_EXPORTS = {
|
|
91095
|
+
name: GOOGLE_EXPORTS_NAME,
|
|
91096
|
+
devices: [],
|
|
91097
|
+
actions: []
|
|
91098
|
+
};
|
|
91099
|
+
/** The settings keys that moved into the record; the migrations name them. */
|
|
91100
|
+
var MOVED_EXPOSURE_KEYS = ["exposed", "exposedActions"];
|
|
91101
|
+
//#endregion
|
|
90051
91102
|
//#region src/google-home/trait-catalog.ts
|
|
90052
91103
|
/**
|
|
90053
91104
|
* The trait catalog — one ROW per camstack capability, and that row is the
|
|
@@ -90878,24 +91929,151 @@ async function planDropPublicHubUrl(ports) {
|
|
|
90878
91929
|
}] };
|
|
90879
91930
|
}
|
|
90880
91931
|
//#endregion
|
|
91932
|
+
//#region src/migrations/exposure-to-record.ts
|
|
91933
|
+
/**
|
|
91934
|
+
* The Google exposure lists move into the `google-exports` record (planning#408 P4). Two
|
|
91935
|
+
* migrations, both `block-owner`: the addon must not serve a membership it cannot trust, and
|
|
91936
|
+
* after them nothing reads the old keys.
|
|
91937
|
+
*
|
|
91938
|
+
* 1. `moveExposureToRecord` (procedure): `exposed` and `exposedActions` become the record under
|
|
91939
|
+
* the instance id. An existing record is never overwritten. A record this pass just wrote is
|
|
91940
|
+
* read BACK and must equal what the settings carried, or the pass throws.
|
|
91941
|
+
* 2. `planDropMovedExposure` (plan): the two keys are deleted only while the record holds every
|
|
91942
|
+
* device and action the settings carried; a record that cannot be read leaves them in place.
|
|
91943
|
+
*/
|
|
91944
|
+
function devicesOf(value) {
|
|
91945
|
+
if (!Array.isArray(value)) return [];
|
|
91946
|
+
return value.flatMap((entry) => {
|
|
91947
|
+
const parsed = ExposedDeviceEntrySchema.safeParse(entry);
|
|
91948
|
+
return parsed.success ? [parsed.data] : [];
|
|
91949
|
+
});
|
|
91950
|
+
}
|
|
91951
|
+
function actionsOf(value) {
|
|
91952
|
+
if (!Array.isArray(value)) return [];
|
|
91953
|
+
return value.flatMap((entry) => {
|
|
91954
|
+
const parsed = ActionSceneEntrySchema.safeParse(entry);
|
|
91955
|
+
return parsed.success ? [parsed.data] : [];
|
|
91956
|
+
});
|
|
91957
|
+
}
|
|
91958
|
+
/** Key-order-independent JSON, so "identical" does not depend on how a store orders keys. */
|
|
91959
|
+
function canonical(value) {
|
|
91960
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
91961
|
+
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(",")}}`;
|
|
91962
|
+
return JSON.stringify(value) ?? "null";
|
|
91963
|
+
}
|
|
91964
|
+
async function moveExposureToRecord(ports) {
|
|
91965
|
+
const stored = await ports.readStored();
|
|
91966
|
+
if (!MOVED_EXPOSURE_KEYS.some((key) => key in stored)) return {
|
|
91967
|
+
outcome: "already-done",
|
|
91968
|
+
summary: { moved: false }
|
|
91969
|
+
};
|
|
91970
|
+
const devices = devicesOf(stored["exposed"]);
|
|
91971
|
+
const actions = actionsOf(stored["exposedActions"]);
|
|
91972
|
+
const dropped = (Array.isArray(stored["exposed"]) ? stored["exposed"].length : 0) - devices.length + ((Array.isArray(stored["exposedActions"]) ? stored["exposedActions"].length : 0) - actions.length);
|
|
91973
|
+
if (dropped > 0) ports.warn(`Google migration: ${dropped} exposure entr(ies) were not understood and are left out`);
|
|
91974
|
+
const body = {
|
|
91975
|
+
name: GOOGLE_EXPORTS_NAME,
|
|
91976
|
+
devices,
|
|
91977
|
+
actions
|
|
91978
|
+
};
|
|
91979
|
+
if (await ports.putExports(body) === "exists") return {
|
|
91980
|
+
outcome: "already-done",
|
|
91981
|
+
summary: { moved: false }
|
|
91982
|
+
};
|
|
91983
|
+
const held = await ports.readExports();
|
|
91984
|
+
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");
|
|
91985
|
+
return {
|
|
91986
|
+
outcome: "done",
|
|
91987
|
+
summary: {
|
|
91988
|
+
moved: true,
|
|
91989
|
+
devices: devices.length,
|
|
91990
|
+
actions: actions.length
|
|
91991
|
+
}
|
|
91992
|
+
};
|
|
91993
|
+
}
|
|
91994
|
+
var rowId = (key) => `${GOOGLE_INSTANCE_ID}.${key}`;
|
|
91995
|
+
async function planDropMovedExposure(ports) {
|
|
91996
|
+
const stored = await ports.readStored();
|
|
91997
|
+
const present = MOVED_EXPOSURE_KEYS.filter((key) => key in stored);
|
|
91998
|
+
if (present.length === 0) return { edits: [] };
|
|
91999
|
+
const refuse = (reason) => {
|
|
92000
|
+
ports.warn(`Google migration: the legacy exposure keys are kept: ${reason}`);
|
|
92001
|
+
throw new Error(`the legacy Google exposure keys are not deleted: ${reason}`);
|
|
92002
|
+
};
|
|
92003
|
+
const held = await ports.readExports();
|
|
92004
|
+
if (held === null) return refuse("no exposure record exists");
|
|
92005
|
+
const heldDevices = new Set(held.devices.map((d) => d.deviceId));
|
|
92006
|
+
for (const device of devicesOf(stored["exposed"])) if (!heldDevices.has(device.deviceId)) return refuse(`the record lacks the device ${device.deviceId}`);
|
|
92007
|
+
const heldActions = new Set(held.actions.map((a) => a.actionId));
|
|
92008
|
+
for (const action of actionsOf(stored["exposedActions"])) if (!heldActions.has(action.actionId)) return refuse(`the record lacks the action ${action.actionId}`);
|
|
92009
|
+
return { edits: [{
|
|
92010
|
+
op: "deleteKeys",
|
|
92011
|
+
scope: ADDON_SETTINGS_TABLE,
|
|
92012
|
+
keys: present.map(rowId),
|
|
92013
|
+
precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
92014
|
+
addonId: GOOGLE_INSTANCE_ID,
|
|
92015
|
+
key,
|
|
92016
|
+
value: stored[key]
|
|
92017
|
+
}])))
|
|
92018
|
+
}] };
|
|
92019
|
+
}
|
|
92020
|
+
//#endregion
|
|
90881
92021
|
//#region src/migrations/index.ts
|
|
92022
|
+
var DROP_PUBLIC_HUB_URL_ID = "export-google/2026-11-02-drop-public-hub-url";
|
|
92023
|
+
var EXPOSURE_TO_RECORD_ID = "export-google/2026-11-04-exposure-to-record";
|
|
92024
|
+
var DROP_MOVED_EXPOSURE_ID = "export-google/2026-11-04-drop-moved-exposure";
|
|
92025
|
+
var FIXTURE_MARK = "the linked account list the migration does not know";
|
|
90882
92026
|
/** The `export-google` catalogue (D987): offered to the engine when the addon initialises. */
|
|
90883
|
-
var ADDON_MIGRATIONS = [
|
|
90884
|
-
|
|
90885
|
-
|
|
90886
|
-
|
|
90887
|
-
|
|
90888
|
-
|
|
90889
|
-
|
|
90890
|
-
|
|
90891
|
-
|
|
90892
|
-
|
|
90893
|
-
|
|
90894
|
-
|
|
90895
|
-
|
|
90896
|
-
|
|
90897
|
-
|
|
90898
|
-
|
|
92027
|
+
var ADDON_MIGRATIONS = [
|
|
92028
|
+
{
|
|
92029
|
+
meta: {
|
|
92030
|
+
id: DROP_PUBLIC_HUB_URL_ID,
|
|
92031
|
+
owner: "export-google",
|
|
92032
|
+
level: "addon-state",
|
|
92033
|
+
seq: 1,
|
|
92034
|
+
dependsOn: [],
|
|
92035
|
+
store: "settings",
|
|
92036
|
+
scope: "cluster",
|
|
92037
|
+
onFailure: "tolerate",
|
|
92038
|
+
bodyKind: "plan",
|
|
92039
|
+
description: "Delete the retired publicHubUrl and detectedPublicHubUrl settings; the public URL is the publicEndpoint role",
|
|
92040
|
+
fixtureMark: FIXTURE_MARK
|
|
92041
|
+
},
|
|
92042
|
+
plan: planDropPublicHubUrl
|
|
92043
|
+
},
|
|
92044
|
+
{
|
|
92045
|
+
meta: {
|
|
92046
|
+
id: EXPOSURE_TO_RECORD_ID,
|
|
92047
|
+
owner: "export-google",
|
|
92048
|
+
level: "addon-state",
|
|
92049
|
+
seq: 2,
|
|
92050
|
+
dependsOn: [],
|
|
92051
|
+
store: "settings",
|
|
92052
|
+
scope: "cluster",
|
|
92053
|
+
onFailure: "block-owner",
|
|
92054
|
+
bodyKind: "procedure",
|
|
92055
|
+
description: "Move the exposed devices and actions into the google-exports record; the record is read back before anything is deleted",
|
|
92056
|
+
fixtureMark: FIXTURE_MARK
|
|
92057
|
+
},
|
|
92058
|
+
procedure: moveExposureToRecord
|
|
92059
|
+
},
|
|
92060
|
+
{
|
|
92061
|
+
meta: {
|
|
92062
|
+
id: DROP_MOVED_EXPOSURE_ID,
|
|
92063
|
+
owner: "export-google",
|
|
92064
|
+
level: "addon-state",
|
|
92065
|
+
seq: 3,
|
|
92066
|
+
dependsOn: [EXPOSURE_TO_RECORD_ID],
|
|
92067
|
+
store: "settings",
|
|
92068
|
+
scope: "cluster",
|
|
92069
|
+
onFailure: "block-owner",
|
|
92070
|
+
bodyKind: "plan",
|
|
92071
|
+
description: "Delete the exposed and exposedActions settings keys once the record holds what they carried",
|
|
92072
|
+
fixtureMark: FIXTURE_MARK
|
|
92073
|
+
},
|
|
92074
|
+
plan: planDropMovedExposure
|
|
92075
|
+
}
|
|
92076
|
+
];
|
|
90899
92077
|
//#endregion
|
|
90900
92078
|
//#region src/public-endpoint.ts
|
|
90901
92079
|
/** The typed refusal when the role resolves to nothing. */
|
|
@@ -90965,11 +92143,7 @@ var buildConsoleSetupFromRole = async (input) => {
|
|
|
90965
92143
|
};
|
|
90966
92144
|
//#endregion
|
|
90967
92145
|
//#region src/types.ts
|
|
90968
|
-
var DEFAULT_SETTINGS = {
|
|
90969
|
-
exposed: [],
|
|
90970
|
-
exposedActions: [],
|
|
90971
|
-
linkedAccounts: []
|
|
90972
|
-
};
|
|
92146
|
+
var DEFAULT_SETTINGS = { linkedAccounts: [] };
|
|
90973
92147
|
//#endregion
|
|
90974
92148
|
//#region src/export-google.addon.ts
|
|
90975
92149
|
/**
|
|
@@ -91011,6 +92185,31 @@ var DEFAULT_SETTINGS = {
|
|
|
91011
92185
|
var ADDON_ID = "export-google";
|
|
91012
92186
|
var ExportGoogleAddon = class extends BaseAddon {
|
|
91013
92187
|
gateway = null;
|
|
92188
|
+
/**
|
|
92189
|
+
* The `google-exports` record: what Google syncs. Loaded once at boot after the migrations;
|
|
92190
|
+
* this addon is its only writer, so the in-memory copy is the synchronous read the fulfillment
|
|
92191
|
+
* path needs. No settings key backs it.
|
|
92192
|
+
*/
|
|
92193
|
+
exportsRow = EMPTY_GOOGLE_EXPORTS;
|
|
92194
|
+
exportsHandle = null;
|
|
92195
|
+
get exposedDevices() {
|
|
92196
|
+
return this.exportsRow.devices;
|
|
92197
|
+
}
|
|
92198
|
+
/** Persist a change of the exposure: the record first, the in-memory copy after it landed. */
|
|
92199
|
+
async writeExports(patch) {
|
|
92200
|
+
const handle = this.exportsHandle;
|
|
92201
|
+
if (handle === null) throw new Error("export-google: the exposure record is not open");
|
|
92202
|
+
const next = {
|
|
92203
|
+
name: this.exportsRow.name,
|
|
92204
|
+
devices: patch.devices ?? this.exportsRow.devices,
|
|
92205
|
+
actions: patch.actions ?? this.exportsRow.actions
|
|
92206
|
+
};
|
|
92207
|
+
await handle.put({
|
|
92208
|
+
id: GOOGLE_INSTANCE_ID,
|
|
92209
|
+
data: next
|
|
92210
|
+
});
|
|
92211
|
+
this.exportsRow = next;
|
|
92212
|
+
}
|
|
91014
92213
|
constructor() {
|
|
91015
92214
|
super({ ...DEFAULT_SETTINGS });
|
|
91016
92215
|
}
|
|
@@ -91020,42 +92219,95 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91020
92219
|
logger: this.ctx.logger
|
|
91021
92220
|
});
|
|
91022
92221
|
this.gateway = gateway;
|
|
91023
|
-
|
|
92222
|
+
const records = this.ctx.records;
|
|
92223
|
+
if (records === void 0) throw new Error("export-google needs ctx.records — check execution.placement (hub-only)");
|
|
92224
|
+
await records.declare({ "google-exports": googleExportsKind });
|
|
92225
|
+
const exportsHandle = records.kind(googleExportsKind);
|
|
92226
|
+
this.exportsHandle = exportsHandle;
|
|
92227
|
+
await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, {
|
|
92228
|
+
readStored: async () => this.resolveGlobalStore(),
|
|
92229
|
+
warn: (message) => {
|
|
92230
|
+
this.ctx.logger.warn(message, { tags: {
|
|
92231
|
+
topic: "export-google",
|
|
92232
|
+
phase: "migration"
|
|
92233
|
+
} });
|
|
92234
|
+
},
|
|
92235
|
+
putExports: async (body) => {
|
|
92236
|
+
if (await exportsHandle.get("export-google") !== null) return "exists";
|
|
92237
|
+
try {
|
|
92238
|
+
await exportsHandle.put({
|
|
92239
|
+
id: GOOGLE_INSTANCE_ID,
|
|
92240
|
+
data: body
|
|
92241
|
+
}, { ifRev: 0 });
|
|
92242
|
+
} catch (err) {
|
|
92243
|
+
if (err instanceof RevConflictError) return "exists";
|
|
92244
|
+
throw err;
|
|
92245
|
+
}
|
|
92246
|
+
return "created";
|
|
92247
|
+
},
|
|
92248
|
+
readExports: async () => (await exportsHandle.get("export-google"))?.data ?? null
|
|
92249
|
+
}));
|
|
92250
|
+
this.exportsRow = (await exportsHandle.get("export-google"))?.data ?? EMPTY_GOOGLE_EXPORTS;
|
|
91024
92251
|
const actionScenes = new ActionSceneExports({
|
|
91025
92252
|
api: this.ctx.api,
|
|
91026
92253
|
logger: this.ctx.logger,
|
|
91027
92254
|
isAdminUser: async (userId) => {
|
|
91028
92255
|
return (await this.ctx.api.userManagement.listUsers.query()).some((u) => u.id === userId && u.isAdmin);
|
|
91029
92256
|
},
|
|
91030
|
-
persist: (entries) => this.
|
|
91031
|
-
}, this.
|
|
92257
|
+
persist: (entries) => this.writeExports({ actions: [...entries] })
|
|
92258
|
+
}, this.exportsRow.actions);
|
|
91032
92259
|
actionScenes.reconcile().catch((err) => {
|
|
91033
92260
|
this.ctx.logger.warn("export-google: action scene reconcile at boot failed", { meta: { error: errMsg$1(err) } });
|
|
91034
92261
|
});
|
|
92262
|
+
const ownInstance = (instanceId) => assertOwnExportInstance("export-google", ADDON_ID, instanceId);
|
|
91035
92263
|
const deviceExportProvider = {
|
|
91036
|
-
getStatus: async () =>
|
|
91037
|
-
|
|
91038
|
-
|
|
91039
|
-
|
|
91040
|
-
|
|
91041
|
-
|
|
91042
|
-
|
|
91043
|
-
|
|
91044
|
-
|
|
92264
|
+
getStatus: async (input) => {
|
|
92265
|
+
ownInstance(statusInstanceOf(input));
|
|
92266
|
+
return {
|
|
92267
|
+
linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
|
|
92268
|
+
exposedDeviceCount: this.exposedDevices.length,
|
|
92269
|
+
setup: await this.buildSetupBlock()
|
|
92270
|
+
};
|
|
92271
|
+
},
|
|
92272
|
+
listInstances: async () => [{
|
|
92273
|
+
instanceId: ADDON_ID,
|
|
92274
|
+
name: "Google Home",
|
|
92275
|
+
enabled: true,
|
|
92276
|
+
kind: "google-home"
|
|
92277
|
+
}],
|
|
92278
|
+
listSupportedDeviceKinds: async ({ instanceId }) => {
|
|
92279
|
+
ownInstance(instanceId);
|
|
92280
|
+
return [...SUPPORTED_DEVICE_KINDS];
|
|
92281
|
+
},
|
|
92282
|
+
listExposedDevices: async ({ instanceId }) => {
|
|
92283
|
+
ownInstance(instanceId);
|
|
92284
|
+
return this.exposedDevices.map((entry) => ({ deviceId: String(entry.deviceId) }));
|
|
92285
|
+
},
|
|
92286
|
+
exposeDevice: async ({ instanceId, deviceId }) => {
|
|
92287
|
+
ownInstance(instanceId);
|
|
92288
|
+
return this.exposeDevice(deviceId);
|
|
92289
|
+
},
|
|
92290
|
+
unexposeDevice: async ({ instanceId, deviceId }) => {
|
|
92291
|
+
ownInstance(instanceId);
|
|
92292
|
+
return this.unexposeDevice(deviceId);
|
|
92293
|
+
},
|
|
91045
92294
|
listSupportedEntityKinds: async () => ["device", "action"],
|
|
91046
|
-
listExposedEntities: async () => {
|
|
92295
|
+
listExposedEntities: async ({ instanceId }) => {
|
|
92296
|
+
ownInstance(instanceId);
|
|
91047
92297
|
await actionScenes.reconcile();
|
|
91048
|
-
return [...this.
|
|
92298
|
+
return [...this.exposedDevices.map((entry) => ({ entity: {
|
|
91049
92299
|
kind: "device",
|
|
91050
92300
|
deviceId: String(entry.deviceId)
|
|
91051
92301
|
} })), ...actionScenes.list()];
|
|
91052
92302
|
},
|
|
91053
|
-
exposeEntity: async ({ entity }) => {
|
|
92303
|
+
exposeEntity: async ({ instanceId, entity }) => {
|
|
92304
|
+
ownInstance(instanceId);
|
|
91054
92305
|
if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
|
|
91055
92306
|
if (entity.kind === "action") return actionScenes.expose(entity.actionId);
|
|
91056
92307
|
throw new Error("export-google: a notification target cannot be exported to Google Home");
|
|
91057
92308
|
},
|
|
91058
|
-
unexposeEntity: async ({ entity }) => {
|
|
92309
|
+
unexposeEntity: async ({ instanceId, entity }) => {
|
|
92310
|
+
ownInstance(instanceId);
|
|
91059
92311
|
if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
|
|
91060
92312
|
if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
|
|
91061
92313
|
throw new Error("export-google: a notification target cannot be exported to Google Home");
|
|
@@ -91072,7 +92324,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91072
92324
|
sync: {
|
|
91073
92325
|
gateway,
|
|
91074
92326
|
logger: this.ctx.logger,
|
|
91075
|
-
listExposed: () => this.
|
|
92327
|
+
listExposed: () => this.exposedDevices.map((entry) => entry.deviceId),
|
|
91076
92328
|
actions: actionScenes
|
|
91077
92329
|
},
|
|
91078
92330
|
query: {
|
|
@@ -91093,7 +92345,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91093
92345
|
}));
|
|
91094
92346
|
const oauthIntegrationProvider = { getDescriptor: async () => buildGoogleOauthIntegration() };
|
|
91095
92347
|
this.ctx.logger.info("export-google: initialized", { meta: {
|
|
91096
|
-
exposedCount: this.
|
|
92348
|
+
exposedCount: this.exposedDevices.length,
|
|
91097
92349
|
linkedAccounts: this.config.linkedAccounts.length,
|
|
91098
92350
|
willReportState: false
|
|
91099
92351
|
} });
|
|
@@ -91116,7 +92368,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91116
92368
|
this.gateway = null;
|
|
91117
92369
|
}
|
|
91118
92370
|
isExposed(deviceId) {
|
|
91119
|
-
return this.
|
|
92371
|
+
return this.exposedDevices.some((entry) => entry.deviceId === deviceId);
|
|
91120
92372
|
}
|
|
91121
92373
|
async exposeDevice(deviceIdRaw) {
|
|
91122
92374
|
const deviceId = Number.parseInt(deviceIdRaw, 10);
|
|
@@ -91135,20 +92387,20 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91135
92387
|
});
|
|
91136
92388
|
throw new Error(`export-google: device ${deviceId} has no capability this addon exports (bound: ${facts.capNames.join(", ") || "none"})`);
|
|
91137
92389
|
}
|
|
91138
|
-
const next = this.
|
|
92390
|
+
const next = this.exposedDevices.filter((e) => e.deviceId !== deviceId);
|
|
91139
92391
|
next.push({
|
|
91140
92392
|
deviceId,
|
|
91141
92393
|
exposedAt: Date.now()
|
|
91142
92394
|
});
|
|
91143
|
-
await this.
|
|
92395
|
+
await this.writeExports({ devices: next });
|
|
91144
92396
|
this.ctx.logger.info("export-google: exposed device — visible after the next Google SYNC (\"Hey Google, sync my devices\")", { tags: { deviceId } });
|
|
91145
92397
|
}
|
|
91146
92398
|
async unexposeDevice(deviceIdRaw) {
|
|
91147
92399
|
const deviceId = Number.parseInt(deviceIdRaw, 10);
|
|
91148
92400
|
if (!Number.isFinite(deviceId)) return;
|
|
91149
|
-
const next = this.
|
|
91150
|
-
if (next.length === this.
|
|
91151
|
-
await this.
|
|
92401
|
+
const next = this.exposedDevices.filter((e) => e.deviceId !== deviceId);
|
|
92402
|
+
if (next.length === this.exposedDevices.length) return;
|
|
92403
|
+
await this.writeExports({ devices: next });
|
|
91152
92404
|
this.ctx.logger.info("export-google: unexposed device — removed from Google on its next SYNC", { tags: { deviceId } });
|
|
91153
92405
|
}
|
|
91154
92406
|
requireGateway() {
|