@camstack/types 1.2.561 → 1.2.563
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 +28 -0
- package/dist/addon/instances-of-cap.d.ts +7 -2
- package/dist/addon.js +4 -3
- package/dist/addon.mjs +4 -3
- package/dist/automation/codegen.d.ts +6 -0
- package/dist/automation/recipe-literal.d.ts +35 -0
- package/dist/automation/recipe.d.ts +46 -0
- package/dist/automation/template-link.d.ts +206 -0
- package/dist/capabilities/cluster-update.cap.d.ts +16 -0
- package/dist/capabilities/device-manager.cap.d.ts +2 -1
- package/dist/capabilities/device-search.d.ts +4 -2
- package/dist/capabilities/energy-system.cap.d.ts +281 -0
- package/dist/capabilities/index.d.ts +4 -2
- package/dist/capabilities/integration-instances.cap.d.ts +9 -0
- package/dist/capabilities/notification-rules.cap.d.ts +4 -0
- package/dist/capabilities/smtp-provider.cap.d.ts +2 -0
- package/dist/capabilities/switch.cap.d.ts +5 -0
- package/dist/capabilities/template.cap.d.ts +39 -2
- package/dist/client.js +54 -1
- package/dist/client.mjs +54 -1
- package/dist/{composed-stable-id-iddnCQ51.mjs → composed-stable-id-B3wcvtvW.mjs} +4 -0
- package/dist/{composed-stable-id-BmJ_5GiE.js → composed-stable-id-Bp33yrYi.js} +4 -0
- package/dist/device/cap-vocabulary/index.d.ts +1 -1
- package/dist/device/cap-vocabulary/resolve.d.ts +6 -0
- package/dist/device/device-control-resolution.d.ts +1 -1
- package/dist/device/device-icon.d.ts +1 -0
- package/dist/device/device-type.d.ts +5 -1
- package/dist/device/hero/hero-layout.d.ts +1 -0
- package/dist/device/hero/hero-look.d.ts +6 -0
- package/dist/device/hero/hero-scene.d.ts +1 -0
- package/dist/generated/addon-api.d.ts +21 -0
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/cap-status-types.d.ts +3 -1
- package/dist/generated/cap-vocabulary.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/customize-catalog.d.ts +1 -1
- package/dist/generated/device-local-state.d.ts +3 -0
- package/dist/generated/device-proxy.d.ts +3 -0
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/history-catalog.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/runtime-state-durability.d.ts +1 -1
- package/dist/{implemented-methods-CfaRR_ki.js → implemented-methods-CDYOCn9a.js} +1 -1
- package/dist/{implemented-methods-CSTk6zYK.mjs → implemented-methods-CgUBu6uM.mjs} +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1889 -209
- package/dist/index.mjs +1834 -210
- package/dist/node.js +2 -2
- package/dist/node.mjs +2 -2
- package/dist/notification/degrade-engine.d.ts +5 -0
- package/dist/notification/email-image-bytes.d.ts +26 -0
- package/dist/notification/email-mime.d.ts +52 -0
- package/dist/{sleep-C9PbO6Nb.mjs → sleep-BCWQQG52.mjs} +154 -35
- package/dist/{sleep-CcUFeK6k.js → sleep-RUgd-FgK.js} +154 -35
- package/dist/template/automation-template.d.ts +782 -0
- package/dist/template/builtin-automation-templates.d.ts +17 -0
- package/dist/template/template-kinds.d.ts +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-RUgd-FgK.js");
|
|
3
3
|
const require_event_category = require("./event-category-Ps2LC8dN.js");
|
|
4
|
-
const require_composed_stable_id = require("./composed-stable-id-
|
|
5
|
-
const require_implemented_methods = require("./implemented-methods-
|
|
4
|
+
const require_composed_stable_id = require("./composed-stable-id-Bp33yrYi.js");
|
|
5
|
+
const require_implemented_methods = require("./implemented-methods-CDYOCn9a.js");
|
|
6
6
|
const require_node_color = require("./node-color.js");
|
|
7
7
|
const require_convert = require("./convert-BmtM6K-5.js");
|
|
8
8
|
const require_enums = require("./enums.js");
|
|
@@ -1364,11 +1364,18 @@ var notificationOutputCapability = {
|
|
|
1364
1364
|
};
|
|
1365
1365
|
//#endregion
|
|
1366
1366
|
//#region src/addon/instances-of-cap.ts
|
|
1367
|
+
/**
|
|
1368
|
+
* The kind's instances answer for `cap`: it is the kind's `functionCap`, or one the kind declares in
|
|
1369
|
+
* `alsoServes`. The one rule a link (a picker, a resolver, a delete guard) matches a target by.
|
|
1370
|
+
*/
|
|
1371
|
+
function kindServesCap(kind, cap) {
|
|
1372
|
+
return kind.functionCap === cap || (kind.alsoServes ?? []).includes(cap);
|
|
1373
|
+
}
|
|
1367
1374
|
async function instancesOfCap(source, cap, filter = {}) {
|
|
1368
1375
|
const instances = [];
|
|
1369
1376
|
const unreadable = [];
|
|
1370
1377
|
for (const addonId of await source.holders(cap)) try {
|
|
1371
|
-
const kinds = ((await source.describe(addonId)).kinds ?? []).filter((kind) => kind
|
|
1378
|
+
const kinds = ((await source.describe(addonId)).kinds ?? []).filter((kind) => kindServesCap(kind, cap));
|
|
1372
1379
|
if (kinds.length === 0) continue;
|
|
1373
1380
|
for (const instance of await source.listInstances(addonId)) {
|
|
1374
1381
|
const kind = kinds.find((candidate) => candidate.id === instance.kind);
|
|
@@ -1680,7 +1687,9 @@ function notificationTargetParts(records, spec) {
|
|
|
1680
1687
|
label: descriptor.label,
|
|
1681
1688
|
functionCap: NOTIFICATION_OUTPUT_CAP,
|
|
1682
1689
|
role: "services",
|
|
1683
|
-
canTest
|
|
1690
|
+
canTest,
|
|
1691
|
+
...descriptor.iconUrl !== void 0 ? { iconUrl: descriptor.iconUrl } : {},
|
|
1692
|
+
...descriptor.iconMediaType !== void 0 ? { iconMediaType: descriptor.iconMediaType } : {}
|
|
1684
1693
|
};
|
|
1685
1694
|
return [{
|
|
1686
1695
|
kind,
|
|
@@ -5742,12 +5751,12 @@ function toStreamSourceEntry(stream) {
|
|
|
5742
5751
|
function isString(v) {
|
|
5743
5752
|
return typeof v === "string";
|
|
5744
5753
|
}
|
|
5745
|
-
function isRecord$
|
|
5754
|
+
function isRecord$7(v) {
|
|
5746
5755
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
5747
5756
|
}
|
|
5748
5757
|
function parseStreamEntry(v) {
|
|
5749
5758
|
if (isString(v) && v.trim()) return { url: v };
|
|
5750
|
-
if (isRecord$
|
|
5759
|
+
if (isRecord$7(v) && isString(v["url"]) && v["url"].trim()) return {
|
|
5751
5760
|
url: v["url"],
|
|
5752
5761
|
label: isString(v["label"]) ? v["label"] : void 0
|
|
5753
5762
|
};
|
|
@@ -6388,20 +6397,20 @@ var SURVIVING_TRIGGER_KEYS = [
|
|
|
6388
6397
|
"objectClasses",
|
|
6389
6398
|
"sensorDeviceIds"
|
|
6390
6399
|
];
|
|
6391
|
-
function isRecord$
|
|
6400
|
+
function isRecord$6(value) {
|
|
6392
6401
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6393
6402
|
}
|
|
6394
6403
|
function listensToLegacySignal(band) {
|
|
6395
|
-
return isRecord$
|
|
6404
|
+
return isRecord$6(band) && isRecord$6(band.triggers) && band.triggers.deviceSignal === true;
|
|
6396
6405
|
}
|
|
6397
6406
|
function hasSurvivingTrigger(band) {
|
|
6398
6407
|
const triggers = band.triggers;
|
|
6399
|
-
if (!isRecord$
|
|
6408
|
+
if (!isRecord$6(triggers)) return false;
|
|
6400
6409
|
return SURVIVING_TRIGGER_KEYS.some((key) => triggers[key] !== void 0);
|
|
6401
6410
|
}
|
|
6402
6411
|
function withoutLegacySignal(band) {
|
|
6403
6412
|
const triggers = band.triggers;
|
|
6404
|
-
if (!isRecord$
|
|
6413
|
+
if (!isRecord$6(triggers)) return band;
|
|
6405
6414
|
const { deviceSignal: _retired, ...rest } = triggers;
|
|
6406
6415
|
return {
|
|
6407
6416
|
...band,
|
|
@@ -6431,11 +6440,11 @@ function migrateLegacyDeviceSignalConfig(raw) {
|
|
|
6431
6440
|
migrated: false,
|
|
6432
6441
|
strippedOnly: false
|
|
6433
6442
|
};
|
|
6434
|
-
if (!isRecord$
|
|
6443
|
+
if (!isRecord$6(raw) || !Array.isArray(raw.bands)) return unchanged;
|
|
6435
6444
|
if (!raw.bands.some(listensToLegacySignal)) return unchanged;
|
|
6436
6445
|
const kept = [];
|
|
6437
6446
|
for (const band of raw.bands) {
|
|
6438
|
-
if (!listensToLegacySignal(band) || !isRecord$
|
|
6447
|
+
if (!listensToLegacySignal(band) || !isRecord$6(band)) {
|
|
6439
6448
|
kept.push(band);
|
|
6440
6449
|
continue;
|
|
6441
6450
|
}
|
|
@@ -31175,6 +31184,211 @@ var ActionTargetResolver = class {
|
|
|
31175
31184
|
}
|
|
31176
31185
|
};
|
|
31177
31186
|
//#endregion
|
|
31187
|
+
//#region src/capabilities/event-vocabulary.ts
|
|
31188
|
+
/**
|
|
31189
|
+
* The declared vocabulary of an `event-emitter` device (D1044): what the
|
|
31190
|
+
* device can fire, named for a person and typed for a rule.
|
|
31191
|
+
*
|
|
31192
|
+
* `id` is the native token, verbatim. `kind` is the meaning shared by every
|
|
31193
|
+
* integration, so "any long press" can be asked without knowing a vendor's
|
|
31194
|
+
* token. A device with several buttons declares one entry per button and
|
|
31195
|
+
* token: an entry is identified by its token AND its source.
|
|
31196
|
+
*/
|
|
31197
|
+
/** The cross-integration meaning of an event. */
|
|
31198
|
+
var EVENT_VOCABULARY_KINDS = [
|
|
31199
|
+
"press",
|
|
31200
|
+
"long-press",
|
|
31201
|
+
"long-press-start",
|
|
31202
|
+
"release",
|
|
31203
|
+
"repeat",
|
|
31204
|
+
"double-press",
|
|
31205
|
+
"other"
|
|
31206
|
+
];
|
|
31207
|
+
var EventVocabularyKindSchema = zod.z.enum(EVENT_VOCABULARY_KINDS);
|
|
31208
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
31209
|
+
var EventVocabularySourceSchema = zod.z.object({
|
|
31210
|
+
id: zod.z.string().min(1),
|
|
31211
|
+
label: zod.z.string().min(1)
|
|
31212
|
+
});
|
|
31213
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
31214
|
+
var EventVocabularyFieldSchema = zod.z.object({
|
|
31215
|
+
path: zod.z.string().min(1),
|
|
31216
|
+
kind: zod.z.enum([
|
|
31217
|
+
"string",
|
|
31218
|
+
"number",
|
|
31219
|
+
"boolean",
|
|
31220
|
+
"enum"
|
|
31221
|
+
]),
|
|
31222
|
+
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
31223
|
+
label: zod.z.string().min(1).optional()
|
|
31224
|
+
});
|
|
31225
|
+
var EventVocabularyEntrySchema = zod.z.object({
|
|
31226
|
+
/** The native token, verbatim. */
|
|
31227
|
+
id: zod.z.string().min(1),
|
|
31228
|
+
source: EventVocabularySourceSchema.optional(),
|
|
31229
|
+
label: zod.z.string().min(1),
|
|
31230
|
+
description: zod.z.string().optional(),
|
|
31231
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
31232
|
+
payload: zod.z.array(EventVocabularyFieldSchema).optional()
|
|
31233
|
+
});
|
|
31234
|
+
/**
|
|
31235
|
+
* The vocabulary of a source that declares tokens and nothing else: one
|
|
31236
|
+
* entry per token, labelled with the token itself.
|
|
31237
|
+
*/
|
|
31238
|
+
function plainEventVocabulary(eventTypes) {
|
|
31239
|
+
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
31240
|
+
id: eventType,
|
|
31241
|
+
label: eventType
|
|
31242
|
+
}));
|
|
31243
|
+
}
|
|
31244
|
+
/**
|
|
31245
|
+
* Tokens many integrations use for a button, by their normalised spelling
|
|
31246
|
+
* (lower case, words joined by `_`). Exact matches only: a token that
|
|
31247
|
+
* merely contains one of these words gets no kind.
|
|
31248
|
+
*/
|
|
31249
|
+
var CONVENTIONAL_KINDS = {
|
|
31250
|
+
press: "press",
|
|
31251
|
+
pressed: "press",
|
|
31252
|
+
single: "press",
|
|
31253
|
+
single_press: "press",
|
|
31254
|
+
single_click: "press",
|
|
31255
|
+
short_press: "press",
|
|
31256
|
+
press_short: "press",
|
|
31257
|
+
click: "press",
|
|
31258
|
+
initial_press: "press",
|
|
31259
|
+
long_press: "long-press",
|
|
31260
|
+
press_long: "long-press",
|
|
31261
|
+
long_click: "long-press",
|
|
31262
|
+
hold: "long-press",
|
|
31263
|
+
long_press_start: "long-press-start",
|
|
31264
|
+
press_long_start: "long-press-start",
|
|
31265
|
+
release: "release",
|
|
31266
|
+
released: "release",
|
|
31267
|
+
long_release: "release",
|
|
31268
|
+
long_press_release: "release",
|
|
31269
|
+
press_long_release: "release",
|
|
31270
|
+
short_release: "release",
|
|
31271
|
+
repeat: "repeat",
|
|
31272
|
+
hold_repeat: "repeat",
|
|
31273
|
+
press_cont: "repeat",
|
|
31274
|
+
double_press: "double-press",
|
|
31275
|
+
double_click: "double-press",
|
|
31276
|
+
double: "double-press",
|
|
31277
|
+
multi_press_2: "double-press"
|
|
31278
|
+
};
|
|
31279
|
+
function normalisedToken(token) {
|
|
31280
|
+
return token.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
31281
|
+
}
|
|
31282
|
+
function readableToken(token) {
|
|
31283
|
+
const words = normalisedToken(token).replace(/_/g, " ");
|
|
31284
|
+
if (words === "") return token;
|
|
31285
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
31286
|
+
}
|
|
31287
|
+
/**
|
|
31288
|
+
* The vocabulary of a source that declares tokens only, read by convention:
|
|
31289
|
+
* a readable label, and the shared kind when the token is one many
|
|
31290
|
+
* integrations use for a button. The token itself is kept verbatim.
|
|
31291
|
+
*/
|
|
31292
|
+
function conventionalEventVocabulary(eventTypes) {
|
|
31293
|
+
return plainEventVocabulary(eventTypes).map((entry) => {
|
|
31294
|
+
const kind = CONVENTIONAL_KINDS[normalisedToken(entry.id)];
|
|
31295
|
+
const label = readableToken(entry.id);
|
|
31296
|
+
return kind === void 0 ? {
|
|
31297
|
+
id: entry.id,
|
|
31298
|
+
label
|
|
31299
|
+
} : {
|
|
31300
|
+
id: entry.id,
|
|
31301
|
+
label,
|
|
31302
|
+
kind
|
|
31303
|
+
};
|
|
31304
|
+
});
|
|
31305
|
+
}
|
|
31306
|
+
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
31307
|
+
function eventTypesOfVocabulary(vocabulary) {
|
|
31308
|
+
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
31309
|
+
}
|
|
31310
|
+
/**
|
|
31311
|
+
* The vocabulary to show and match against. A status with none declared
|
|
31312
|
+
* answers with its plain tokens, so an older provider is still usable.
|
|
31313
|
+
*/
|
|
31314
|
+
function readEventVocabulary(status) {
|
|
31315
|
+
const declared = status.vocabulary;
|
|
31316
|
+
if (declared !== void 0 && declared.length > 0) return declared;
|
|
31317
|
+
return plainEventVocabulary(status.eventTypes);
|
|
31318
|
+
}
|
|
31319
|
+
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
31320
|
+
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
31321
|
+
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
31322
|
+
}
|
|
31323
|
+
//#endregion
|
|
31324
|
+
//#region src/automation/template-link.ts
|
|
31325
|
+
/**
|
|
31326
|
+
* The link an automation made FROM a template carries (#527): which template,
|
|
31327
|
+
* the values the operator filled in, and — when the template has since changed
|
|
31328
|
+
* so that those values no longer fit — the problems that say why.
|
|
31329
|
+
*
|
|
31330
|
+
* It lives inside the recipe (`AutomationRecipe.template`), so the one row in
|
|
31331
|
+
* `core_blocks` stays the one artefact: there is no second store of instances
|
|
31332
|
+
* to drift from the blocks, and deleting the automation deletes the link.
|
|
31333
|
+
* "Convert to a free automation" is dropping this field.
|
|
31334
|
+
*
|
|
31335
|
+
* This file depends on nothing in `recipe.ts`, so the recipe can embed it and
|
|
31336
|
+
* the template engine (`template/automation-template.ts`) can import both.
|
|
31337
|
+
*/
|
|
31338
|
+
/** An `event` input's value: the same three narrowing lists a `device-fired` row takes. */
|
|
31339
|
+
var TemplateEventValueSchema = zod.z.object({
|
|
31340
|
+
eventIds: zod.z.array(zod.z.string().min(1)).min(1).max(64).optional(),
|
|
31341
|
+
sourceIds: zod.z.array(zod.z.string().min(1)).min(1).max(64).optional(),
|
|
31342
|
+
kinds: zod.z.array(EventVocabularyKindSchema).min(1).optional()
|
|
31343
|
+
}).refine((value) => value.eventIds !== void 0 || value.sourceIds !== void 0 || value.kinds !== void 0, { message: "an event names at least one event, part or kind" });
|
|
31344
|
+
/** An `action` input's value: a vocabulary action and its open args. */
|
|
31345
|
+
var TemplateActionValueSchema = zod.z.object({
|
|
31346
|
+
actionId: zod.z.string().min(1),
|
|
31347
|
+
args: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
31348
|
+
});
|
|
31349
|
+
/** The value of one non-group input. Which member is right is the input kind's to judge. */
|
|
31350
|
+
var TemplateScalarValueSchema = zod.z.union([
|
|
31351
|
+
zod.z.number(),
|
|
31352
|
+
zod.z.string(),
|
|
31353
|
+
zod.z.boolean(),
|
|
31354
|
+
zod.z.array(zod.z.number().int().nonnegative()),
|
|
31355
|
+
TemplateEventValueSchema,
|
|
31356
|
+
TemplateActionValueSchema
|
|
31357
|
+
]);
|
|
31358
|
+
/** One row of a repeatable group: row-input key → value. */
|
|
31359
|
+
var TemplateGroupRowSchema = zod.z.record(zod.z.string(), TemplateScalarValueSchema);
|
|
31360
|
+
var TemplateInputValueSchema = zod.z.union([TemplateScalarValueSchema, zod.z.array(TemplateGroupRowSchema)]);
|
|
31361
|
+
/** Input key → value. */
|
|
31362
|
+
var TemplateInputValuesSchema = zod.z.record(zod.z.string(), TemplateInputValueSchema);
|
|
31363
|
+
var TEMPLATE_INSTANCE_PROBLEM_CODES = [
|
|
31364
|
+
"missing-input",
|
|
31365
|
+
"invalid-input",
|
|
31366
|
+
"invalid-recipe",
|
|
31367
|
+
"missing-template",
|
|
31368
|
+
"edited-by-hand"
|
|
31369
|
+
];
|
|
31370
|
+
var TemplateInstanceProblemSchema = zod.z.object({
|
|
31371
|
+
code: zod.z.enum(TEMPLATE_INSTANCE_PROBLEM_CODES),
|
|
31372
|
+
/** Dotted input address (`buttons.2.targets`); absent for a whole-recipe problem. */
|
|
31373
|
+
input: zod.z.string().optional(),
|
|
31374
|
+
detail: zod.z.string()
|
|
31375
|
+
});
|
|
31376
|
+
var AutomationTemplateLinkSchema = zod.z.object({
|
|
31377
|
+
templateId: zod.z.string().min(1),
|
|
31378
|
+
values: TemplateInputValuesSchema,
|
|
31379
|
+
/**
|
|
31380
|
+
* Fingerprint of the generated code with this literal blanked
|
|
31381
|
+
* (`instanceCodeHash`), stamped by `generateAutomationBlock`. Code that no
|
|
31382
|
+
* longer matches it was edited by hand, and is never regenerated over.
|
|
31383
|
+
*/
|
|
31384
|
+
codeHash: zod.z.string().optional(),
|
|
31385
|
+
/**
|
|
31386
|
+
* Present when the last re-expansion refused these values. The automation
|
|
31387
|
+
* keeps running the body of its last good expansion; nothing is dropped.
|
|
31388
|
+
*/
|
|
31389
|
+
problems: zod.z.array(TemplateInstanceProblemSchema).min(1).optional()
|
|
31390
|
+
});
|
|
31391
|
+
//#endregion
|
|
31178
31392
|
//#region src/expression/binding-source.ts
|
|
31179
31393
|
/**
|
|
31180
31394
|
* What an expression's named bindings READ from.
|
|
@@ -32224,143 +32438,6 @@ function anySubjectMatches(subjects, observed) {
|
|
|
32224
32438
|
};
|
|
32225
32439
|
}
|
|
32226
32440
|
//#endregion
|
|
32227
|
-
//#region src/capabilities/event-vocabulary.ts
|
|
32228
|
-
/**
|
|
32229
|
-
* The declared vocabulary of an `event-emitter` device (D1044): what the
|
|
32230
|
-
* device can fire, named for a person and typed for a rule.
|
|
32231
|
-
*
|
|
32232
|
-
* `id` is the native token, verbatim. `kind` is the meaning shared by every
|
|
32233
|
-
* integration, so "any long press" can be asked without knowing a vendor's
|
|
32234
|
-
* token. A device with several buttons declares one entry per button and
|
|
32235
|
-
* token: an entry is identified by its token AND its source.
|
|
32236
|
-
*/
|
|
32237
|
-
/** The cross-integration meaning of an event. */
|
|
32238
|
-
var EVENT_VOCABULARY_KINDS = [
|
|
32239
|
-
"press",
|
|
32240
|
-
"long-press",
|
|
32241
|
-
"long-press-start",
|
|
32242
|
-
"release",
|
|
32243
|
-
"repeat",
|
|
32244
|
-
"double-press",
|
|
32245
|
-
"other"
|
|
32246
|
-
];
|
|
32247
|
-
var EventVocabularyKindSchema = zod.z.enum(EVENT_VOCABULARY_KINDS);
|
|
32248
|
-
/** The part of the device an event comes from: a button, a channel. */
|
|
32249
|
-
var EventVocabularySourceSchema = zod.z.object({
|
|
32250
|
-
id: zod.z.string().min(1),
|
|
32251
|
-
label: zod.z.string().min(1)
|
|
32252
|
-
});
|
|
32253
|
-
/** One scalar field of an event's `data`, by dotted path. */
|
|
32254
|
-
var EventVocabularyFieldSchema = zod.z.object({
|
|
32255
|
-
path: zod.z.string().min(1),
|
|
32256
|
-
kind: zod.z.enum([
|
|
32257
|
-
"string",
|
|
32258
|
-
"number",
|
|
32259
|
-
"boolean",
|
|
32260
|
-
"enum"
|
|
32261
|
-
]),
|
|
32262
|
-
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
32263
|
-
label: zod.z.string().min(1).optional()
|
|
32264
|
-
});
|
|
32265
|
-
var EventVocabularyEntrySchema = zod.z.object({
|
|
32266
|
-
/** The native token, verbatim. */
|
|
32267
|
-
id: zod.z.string().min(1),
|
|
32268
|
-
source: EventVocabularySourceSchema.optional(),
|
|
32269
|
-
label: zod.z.string().min(1),
|
|
32270
|
-
description: zod.z.string().optional(),
|
|
32271
|
-
kind: EventVocabularyKindSchema.optional(),
|
|
32272
|
-
payload: zod.z.array(EventVocabularyFieldSchema).optional()
|
|
32273
|
-
});
|
|
32274
|
-
/**
|
|
32275
|
-
* The vocabulary of a source that declares tokens and nothing else: one
|
|
32276
|
-
* entry per token, labelled with the token itself.
|
|
32277
|
-
*/
|
|
32278
|
-
function plainEventVocabulary(eventTypes) {
|
|
32279
|
-
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
32280
|
-
id: eventType,
|
|
32281
|
-
label: eventType
|
|
32282
|
-
}));
|
|
32283
|
-
}
|
|
32284
|
-
/**
|
|
32285
|
-
* Tokens many integrations use for a button, by their normalised spelling
|
|
32286
|
-
* (lower case, words joined by `_`). Exact matches only: a token that
|
|
32287
|
-
* merely contains one of these words gets no kind.
|
|
32288
|
-
*/
|
|
32289
|
-
var CONVENTIONAL_KINDS = {
|
|
32290
|
-
press: "press",
|
|
32291
|
-
pressed: "press",
|
|
32292
|
-
single: "press",
|
|
32293
|
-
single_press: "press",
|
|
32294
|
-
single_click: "press",
|
|
32295
|
-
short_press: "press",
|
|
32296
|
-
press_short: "press",
|
|
32297
|
-
click: "press",
|
|
32298
|
-
initial_press: "press",
|
|
32299
|
-
long_press: "long-press",
|
|
32300
|
-
press_long: "long-press",
|
|
32301
|
-
long_click: "long-press",
|
|
32302
|
-
hold: "long-press",
|
|
32303
|
-
long_press_start: "long-press-start",
|
|
32304
|
-
press_long_start: "long-press-start",
|
|
32305
|
-
release: "release",
|
|
32306
|
-
released: "release",
|
|
32307
|
-
long_release: "release",
|
|
32308
|
-
long_press_release: "release",
|
|
32309
|
-
press_long_release: "release",
|
|
32310
|
-
short_release: "release",
|
|
32311
|
-
repeat: "repeat",
|
|
32312
|
-
hold_repeat: "repeat",
|
|
32313
|
-
press_cont: "repeat",
|
|
32314
|
-
double_press: "double-press",
|
|
32315
|
-
double_click: "double-press",
|
|
32316
|
-
double: "double-press",
|
|
32317
|
-
multi_press_2: "double-press"
|
|
32318
|
-
};
|
|
32319
|
-
function normalisedToken(token) {
|
|
32320
|
-
return token.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
32321
|
-
}
|
|
32322
|
-
function readableToken(token) {
|
|
32323
|
-
const words = normalisedToken(token).replace(/_/g, " ");
|
|
32324
|
-
if (words === "") return token;
|
|
32325
|
-
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
32326
|
-
}
|
|
32327
|
-
/**
|
|
32328
|
-
* The vocabulary of a source that declares tokens only, read by convention:
|
|
32329
|
-
* a readable label, and the shared kind when the token is one many
|
|
32330
|
-
* integrations use for a button. The token itself is kept verbatim.
|
|
32331
|
-
*/
|
|
32332
|
-
function conventionalEventVocabulary(eventTypes) {
|
|
32333
|
-
return plainEventVocabulary(eventTypes).map((entry) => {
|
|
32334
|
-
const kind = CONVENTIONAL_KINDS[normalisedToken(entry.id)];
|
|
32335
|
-
const label = readableToken(entry.id);
|
|
32336
|
-
return kind === void 0 ? {
|
|
32337
|
-
id: entry.id,
|
|
32338
|
-
label
|
|
32339
|
-
} : {
|
|
32340
|
-
id: entry.id,
|
|
32341
|
-
label,
|
|
32342
|
-
kind
|
|
32343
|
-
};
|
|
32344
|
-
});
|
|
32345
|
-
}
|
|
32346
|
-
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
32347
|
-
function eventTypesOfVocabulary(vocabulary) {
|
|
32348
|
-
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
32349
|
-
}
|
|
32350
|
-
/**
|
|
32351
|
-
* The vocabulary to show and match against. A status with none declared
|
|
32352
|
-
* answers with its plain tokens, so an older provider is still usable.
|
|
32353
|
-
*/
|
|
32354
|
-
function readEventVocabulary(status) {
|
|
32355
|
-
const declared = status.vocabulary;
|
|
32356
|
-
if (declared !== void 0 && declared.length > 0) return declared;
|
|
32357
|
-
return plainEventVocabulary(status.eventTypes);
|
|
32358
|
-
}
|
|
32359
|
-
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
32360
|
-
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
32361
|
-
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
32362
|
-
}
|
|
32363
|
-
//#endregion
|
|
32364
32441
|
//#region src/time/solar.ts
|
|
32365
32442
|
/**
|
|
32366
32443
|
* Where the sun is, from a latitude and a longitude — the one solar
|
|
@@ -33991,7 +34068,13 @@ var CurrentAutomationRecipeSchema = zod.z.object({
|
|
|
33991
34068
|
actions: zod.z.array(AutomationActionSchema),
|
|
33992
34069
|
runMode: AutomationRunModeSchema.optional(),
|
|
33993
34070
|
/** How many run traces the automation keeps (default {@link DEFAULT_TRACE_KEEP}). */
|
|
33994
|
-
keepTraces: zod.z.number().int().min(1).max(100).optional()
|
|
34071
|
+
keepTraces: zod.z.number().int().min(1).max(100).optional(),
|
|
34072
|
+
/**
|
|
34073
|
+
* Set when the automation was made from a template (#527): the template and
|
|
34074
|
+
* the values filled in. The rest of the recipe is then the expansion, which
|
|
34075
|
+
* the template engine rewrites when the template changes.
|
|
34076
|
+
*/
|
|
34077
|
+
template: AutomationTemplateLinkSchema.optional()
|
|
33995
34078
|
});
|
|
33996
34079
|
/** A recipe as it was stored before the single tree. Read-only: nothing writes this. */
|
|
33997
34080
|
var LegacyAutomationRecipeSchema = zod.z.object({
|
|
@@ -36170,6 +36253,105 @@ function evaluateConditionTree(cond, reader, now) {
|
|
|
36170
36253
|
return evaluateWhenTree(convertLegacyCondition(cond), reader, now, { rootPath: "conditions" });
|
|
36171
36254
|
}
|
|
36172
36255
|
//#endregion
|
|
36256
|
+
//#region src/automation/recipe-literal.ts
|
|
36257
|
+
/**
|
|
36258
|
+
* Reads the `AUTOMATION_RECIPE` literal `generateAutomationBlock` embeds in a
|
|
36259
|
+
* block's code — parsed as JSON, never evaluated — for code that runs where the
|
|
36260
|
+
* admin UI's reader does not (the hub re-expanding template instances, #527).
|
|
36261
|
+
*
|
|
36262
|
+
* A brace scan, not a regex: the recipe nests. Strings are tracked so a `}`
|
|
36263
|
+
* inside a device name cannot close the object early; the value is
|
|
36264
|
+
* `JSON.stringify` output, so `"` is the only quote that can open one.
|
|
36265
|
+
*/
|
|
36266
|
+
/** The declaration the generator emits, matched whole. */
|
|
36267
|
+
var AUTOMATION_RECIPE_DECLARATION = "const AUTOMATION_RECIPE =";
|
|
36268
|
+
/** The JSON text of the literal, or null when the code declares none. */
|
|
36269
|
+
function findRecipeLiteralJson(code) {
|
|
36270
|
+
const declStart = code.indexOf(AUTOMATION_RECIPE_DECLARATION);
|
|
36271
|
+
if (declStart < 0) return null;
|
|
36272
|
+
const start = code.indexOf("{", declStart + 25);
|
|
36273
|
+
if (start < 0) return null;
|
|
36274
|
+
let depth = 0;
|
|
36275
|
+
let inString = false;
|
|
36276
|
+
let escaped = false;
|
|
36277
|
+
for (let i = start; i < code.length; i += 1) {
|
|
36278
|
+
const ch = code.charAt(i);
|
|
36279
|
+
if (inString) {
|
|
36280
|
+
if (escaped) escaped = false;
|
|
36281
|
+
else if (ch === "\\") escaped = true;
|
|
36282
|
+
else if (ch === "\"") inString = false;
|
|
36283
|
+
continue;
|
|
36284
|
+
}
|
|
36285
|
+
if (ch === "\"") {
|
|
36286
|
+
inString = true;
|
|
36287
|
+
continue;
|
|
36288
|
+
}
|
|
36289
|
+
if (ch === "{") depth += 1;
|
|
36290
|
+
else if (ch === "}") {
|
|
36291
|
+
depth -= 1;
|
|
36292
|
+
if (depth === 0) return code.slice(start, i + 1);
|
|
36293
|
+
}
|
|
36294
|
+
}
|
|
36295
|
+
return null;
|
|
36296
|
+
}
|
|
36297
|
+
function readRecipeLiteral(code) {
|
|
36298
|
+
const json = findRecipeLiteralJson(code);
|
|
36299
|
+
if (json === null) return { status: "none" };
|
|
36300
|
+
let raw;
|
|
36301
|
+
try {
|
|
36302
|
+
raw = JSON.parse(json);
|
|
36303
|
+
} catch (error) {
|
|
36304
|
+
return {
|
|
36305
|
+
status: "invalid",
|
|
36306
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
36307
|
+
};
|
|
36308
|
+
}
|
|
36309
|
+
const parsed = AutomationRecipeSchema.safeParse(raw);
|
|
36310
|
+
if (parsed.success) return {
|
|
36311
|
+
status: "recipe",
|
|
36312
|
+
recipe: parsed.data
|
|
36313
|
+
};
|
|
36314
|
+
const first = parsed.error.issues[0];
|
|
36315
|
+
return {
|
|
36316
|
+
status: "invalid",
|
|
36317
|
+
detail: first === void 0 ? "not a recipe" : `${first.path.join(".")}: ${first.message}`
|
|
36318
|
+
};
|
|
36319
|
+
}
|
|
36320
|
+
/** Where the literal's JSON sits in the code, or null when there is none. */
|
|
36321
|
+
function literalSpan(code) {
|
|
36322
|
+
const json = findRecipeLiteralJson(code);
|
|
36323
|
+
if (json === null) return null;
|
|
36324
|
+
const start = code.indexOf(json, code.indexOf(AUTOMATION_RECIPE_DECLARATION));
|
|
36325
|
+
return {
|
|
36326
|
+
start,
|
|
36327
|
+
end: start + json.length
|
|
36328
|
+
};
|
|
36329
|
+
}
|
|
36330
|
+
/** FNV-1a, 32 bit, hex: a fingerprint, not a security boundary. */
|
|
36331
|
+
function fnv1a(text) {
|
|
36332
|
+
let hash = 2166136261;
|
|
36333
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
36334
|
+
hash ^= text.charCodeAt(i);
|
|
36335
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
36336
|
+
}
|
|
36337
|
+
return hash.toString(16).padStart(8, "0");
|
|
36338
|
+
}
|
|
36339
|
+
/**
|
|
36340
|
+
* The fingerprint of a block's code with its recipe literal blanked, so the
|
|
36341
|
+
* hash a literal carries does not change the hash. Null when there is no literal.
|
|
36342
|
+
*/
|
|
36343
|
+
function instanceCodeHash(code) {
|
|
36344
|
+
const span = literalSpan(code);
|
|
36345
|
+
if (span === null) return null;
|
|
36346
|
+
return fnv1a(`${code.slice(0, span.start)}{}${code.slice(span.end)}`);
|
|
36347
|
+
}
|
|
36348
|
+
/** The same code with only its recipe literal replaced; everything else is kept byte for byte. */
|
|
36349
|
+
function replaceRecipeLiteral(code, recipe) {
|
|
36350
|
+
const span = literalSpan(code);
|
|
36351
|
+
if (span === null) return null;
|
|
36352
|
+
return `${code.slice(0, span.start)}${JSON.stringify(recipe, null, 2)}${code.slice(span.end)}`;
|
|
36353
|
+
}
|
|
36354
|
+
//#endregion
|
|
36173
36355
|
//#region src/automation/trigger-variables.ts
|
|
36174
36356
|
var DETECTION_DESCRIPTIONS = {
|
|
36175
36357
|
deviceId: "the camera that saw it",
|
|
@@ -36688,7 +36870,41 @@ function emitAction(action, index) {
|
|
|
36688
36870
|
* discover that, but it is the last place it can still be caught before code
|
|
36689
36871
|
* that the operator did not author starts running.
|
|
36690
36872
|
*/
|
|
36873
|
+
/**
|
|
36874
|
+
* An instance of an automation template (#527) also carries the fingerprint of
|
|
36875
|
+
* the code it was generated as (`template.codeHash`), so the hub can tell a
|
|
36876
|
+
* block edited by hand from one it may regenerate. The fingerprint blanks the
|
|
36877
|
+
* literal, so stamping it does not change it.
|
|
36878
|
+
*/
|
|
36691
36879
|
function generateAutomationBlock(input) {
|
|
36880
|
+
const link = input.recipe.template;
|
|
36881
|
+
if (link === void 0) return renderAutomationBlock(input);
|
|
36882
|
+
const unstamped = {
|
|
36883
|
+
templateId: link.templateId,
|
|
36884
|
+
values: link.values,
|
|
36885
|
+
...link.problems === void 0 ? {} : { problems: link.problems }
|
|
36886
|
+
};
|
|
36887
|
+
const first = renderAutomationBlock({
|
|
36888
|
+
...input,
|
|
36889
|
+
recipe: {
|
|
36890
|
+
...input.recipe,
|
|
36891
|
+
template: unstamped
|
|
36892
|
+
}
|
|
36893
|
+
});
|
|
36894
|
+
const codeHash = instanceCodeHash(first);
|
|
36895
|
+
if (codeHash === null) return first;
|
|
36896
|
+
return renderAutomationBlock({
|
|
36897
|
+
...input,
|
|
36898
|
+
recipe: {
|
|
36899
|
+
...input.recipe,
|
|
36900
|
+
template: {
|
|
36901
|
+
...unstamped,
|
|
36902
|
+
codeHash
|
|
36903
|
+
}
|
|
36904
|
+
}
|
|
36905
|
+
});
|
|
36906
|
+
}
|
|
36907
|
+
function renderAutomationBlock(input) {
|
|
36692
36908
|
const boundsError = validateRecipeBounds(input.recipe);
|
|
36693
36909
|
if (boundsError !== null) throw new Error(`cannot generate an automation from an invalid recipe: ${boundsError}`);
|
|
36694
36910
|
const { name, recipe } = input;
|
|
@@ -37794,10 +38010,10 @@ var eventEmitterCapability = {
|
|
|
37794
38010
|
/** How deep a payload is walked, and how many variables one fire may add. */
|
|
37795
38011
|
var MAX_DATA_DEPTH = 3;
|
|
37796
38012
|
var MAX_DATA_VARS = 32;
|
|
37797
|
-
function isScalar(value) {
|
|
38013
|
+
function isScalar$1(value) {
|
|
37798
38014
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
37799
38015
|
}
|
|
37800
|
-
function isRecord$
|
|
38016
|
+
function isRecord$5(value) {
|
|
37801
38017
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
37802
38018
|
}
|
|
37803
38019
|
/** The scalars of a fire's payload as `data.<path>` variables; lists and nulls are left out. */
|
|
@@ -37805,20 +38021,20 @@ function firedDataVars(data) {
|
|
|
37805
38021
|
const out = {};
|
|
37806
38022
|
const walk = (value, path, depth) => {
|
|
37807
38023
|
if (Object.keys(out).length >= MAX_DATA_VARS) return;
|
|
37808
|
-
if (isScalar(value)) {
|
|
38024
|
+
if (isScalar$1(value)) {
|
|
37809
38025
|
out[path] = value;
|
|
37810
38026
|
return;
|
|
37811
38027
|
}
|
|
37812
|
-
if (!isRecord$
|
|
38028
|
+
if (!isRecord$5(value) || depth >= MAX_DATA_DEPTH) return;
|
|
37813
38029
|
for (const [key, child] of Object.entries(value)) walk(child, `${path}.${key}`, depth + 1);
|
|
37814
38030
|
};
|
|
37815
|
-
if (isRecord$
|
|
38031
|
+
if (isRecord$5(data)) for (const [key, child] of Object.entries(data)) walk(child, `data.${key}`, 1);
|
|
37816
38032
|
return out;
|
|
37817
38033
|
}
|
|
37818
38034
|
function readPath(data, path) {
|
|
37819
38035
|
let cursor = data;
|
|
37820
38036
|
for (const part of path.split(".")) {
|
|
37821
|
-
if (!isRecord$
|
|
38037
|
+
if (!isRecord$5(cursor)) return void 0;
|
|
37822
38038
|
cursor = cursor[part];
|
|
37823
38039
|
}
|
|
37824
38040
|
return cursor;
|
|
@@ -46106,7 +46322,9 @@ var ClusterUpdateFailureReasonSchema = zod.z.enum([
|
|
|
46106
46322
|
"status-unreadable",
|
|
46107
46323
|
"addon-update-failed",
|
|
46108
46324
|
"addons-not-converged",
|
|
46109
|
-
"interrupted"
|
|
46325
|
+
"interrupted",
|
|
46326
|
+
"timeout-stall",
|
|
46327
|
+
"timeout-ceiling"
|
|
46110
46328
|
]);
|
|
46111
46329
|
var ClusterUpdateStepSchema = zod.z.object({
|
|
46112
46330
|
kind: ClusterUpdateStepKindSchema,
|
|
@@ -48518,7 +48736,8 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
48518
48736
|
require_composed_stable_id.DeviceType.Washer,
|
|
48519
48737
|
require_composed_stable_id.DeviceType.Dryer,
|
|
48520
48738
|
require_composed_stable_id.DeviceType.Gateway,
|
|
48521
|
-
require_composed_stable_id.DeviceType.HeatPump
|
|
48739
|
+
require_composed_stable_id.DeviceType.HeatPump,
|
|
48740
|
+
require_composed_stable_id.DeviceType.EnergySystem
|
|
48522
48741
|
],
|
|
48523
48742
|
apply: "add",
|
|
48524
48743
|
vocabularyCap: "consumables",
|
|
@@ -49813,9 +50032,17 @@ function forwardSourceRefs(composition) {
|
|
|
49813
50032
|
const refs = composition.features.flatMap((feature, index) => feature.kind === "fields" && require_implemented_methods.compositionFeatureEnabled(feature) ? featureForwards(feature, index).map((forward) => forward.command.source) : []);
|
|
49814
50033
|
return [...new Map(refs.map((ref) => [require_implemented_methods.compositionSourceKey(ref), ref])).values()];
|
|
49815
50034
|
}
|
|
50035
|
+
/**
|
|
50036
|
+
* `switch.toggle` is not a forward. Native-cap registration installs one
|
|
50037
|
+
* default that reads the slice and calls this provider's `setState`, and a
|
|
50038
|
+
* composed switch already forwards `setState`.
|
|
50039
|
+
*/
|
|
50040
|
+
function servedByRegistrationDefault(def, method) {
|
|
50041
|
+
return def.name === "switch" && method === "toggle";
|
|
50042
|
+
}
|
|
49816
50043
|
/** The methods a BUILT cap must give a command: served, and not answered by the composer itself. */
|
|
49817
50044
|
function commandedMethods(def) {
|
|
49818
|
-
return Object.entries(def.methods).filter(([name, m]) => m.systemOnly !== true && def.composedMethods?.[name] === void 0).map(([name]) => name);
|
|
50045
|
+
return Object.entries(def.methods).filter(([name, m]) => m.systemOnly !== true && def.composedMethods?.[name] === void 0 && !servedByRegistrationDefault(def, name)).map(([name]) => name);
|
|
49819
50046
|
}
|
|
49820
50047
|
/**
|
|
49821
50048
|
* The `commands` of a `media-player` feature served by the `remote` extension:
|
|
@@ -50341,7 +50568,7 @@ function groupTemplate(id) {
|
|
|
50341
50568
|
//#region src/generated/history-catalog.ts
|
|
50342
50569
|
/**
|
|
50343
50570
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
50344
|
-
*
|
|
50571
|
+
* 45 caps with series (103 series), 37 caps answered `'none'`.
|
|
50345
50572
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
50346
50573
|
*/
|
|
50347
50574
|
var HISTORY_CATALOG = {
|
|
@@ -50485,6 +50712,85 @@ var HISTORY_CATALOG = {
|
|
|
50485
50712
|
"powerOn": { kind: "boolean" }
|
|
50486
50713
|
},
|
|
50487
50714
|
"do-not-disturb": { "enabled": { kind: "boolean" } },
|
|
50715
|
+
"energy-system": {
|
|
50716
|
+
"solar.powerW": {
|
|
50717
|
+
kind: "gauge",
|
|
50718
|
+
unit: "W",
|
|
50719
|
+
deadband: 50,
|
|
50720
|
+
displayName: "Solar power"
|
|
50721
|
+
},
|
|
50722
|
+
"solar.energyKwh": {
|
|
50723
|
+
kind: "counter",
|
|
50724
|
+
unit: "kWh",
|
|
50725
|
+
displayName: "Solar energy"
|
|
50726
|
+
},
|
|
50727
|
+
"grid.powerW": {
|
|
50728
|
+
kind: "gauge",
|
|
50729
|
+
unit: "W",
|
|
50730
|
+
deadband: 50,
|
|
50731
|
+
displayName: "Grid power"
|
|
50732
|
+
},
|
|
50733
|
+
"grid.importKwh": {
|
|
50734
|
+
kind: "counter",
|
|
50735
|
+
unit: "kWh",
|
|
50736
|
+
displayName: "Grid import"
|
|
50737
|
+
},
|
|
50738
|
+
"grid.exportKwh": {
|
|
50739
|
+
kind: "counter",
|
|
50740
|
+
unit: "kWh",
|
|
50741
|
+
displayName: "Grid export"
|
|
50742
|
+
},
|
|
50743
|
+
"house.powerW": {
|
|
50744
|
+
kind: "gauge",
|
|
50745
|
+
unit: "W",
|
|
50746
|
+
deadband: 50,
|
|
50747
|
+
displayName: "House power"
|
|
50748
|
+
},
|
|
50749
|
+
"house.energyKwh": {
|
|
50750
|
+
kind: "counter",
|
|
50751
|
+
unit: "kWh",
|
|
50752
|
+
displayName: "House energy"
|
|
50753
|
+
},
|
|
50754
|
+
"heatPump.powerW": {
|
|
50755
|
+
kind: "gauge",
|
|
50756
|
+
unit: "W",
|
|
50757
|
+
deadband: 50,
|
|
50758
|
+
displayName: "Heat pump power"
|
|
50759
|
+
},
|
|
50760
|
+
"heatPump.energyKwh": {
|
|
50761
|
+
kind: "counter",
|
|
50762
|
+
unit: "kWh",
|
|
50763
|
+
displayName: "Heat pump energy"
|
|
50764
|
+
},
|
|
50765
|
+
"storage.stateOfChargePct": {
|
|
50766
|
+
kind: "gauge",
|
|
50767
|
+
unit: "%",
|
|
50768
|
+
deadband: 1,
|
|
50769
|
+
displayName: "Storage charge"
|
|
50770
|
+
},
|
|
50771
|
+
"storage.storedKwh": {
|
|
50772
|
+
kind: "gauge",
|
|
50773
|
+
unit: "kWh",
|
|
50774
|
+
deadband: .05,
|
|
50775
|
+
displayName: "Stored energy"
|
|
50776
|
+
},
|
|
50777
|
+
"storage.powerW": {
|
|
50778
|
+
kind: "gauge",
|
|
50779
|
+
unit: "W",
|
|
50780
|
+
deadband: 50,
|
|
50781
|
+
displayName: "Storage power"
|
|
50782
|
+
},
|
|
50783
|
+
"storage.chargedKwh": {
|
|
50784
|
+
kind: "counter",
|
|
50785
|
+
unit: "kWh",
|
|
50786
|
+
displayName: "Storage charged"
|
|
50787
|
+
},
|
|
50788
|
+
"storage.dischargedKwh": {
|
|
50789
|
+
kind: "counter",
|
|
50790
|
+
unit: "kWh",
|
|
50791
|
+
displayName: "Storage discharged"
|
|
50792
|
+
}
|
|
50793
|
+
},
|
|
50488
50794
|
"enum-sensor": { "value": {
|
|
50489
50795
|
kind: "enum",
|
|
50490
50796
|
skipWhenSet: "timestamp"
|
|
@@ -54987,13 +55293,13 @@ var DeviceTemplateRenderSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
|
|
|
54987
55293
|
function templateCapKey(cap) {
|
|
54988
55294
|
return cap.replace(/-/g, "_");
|
|
54989
55295
|
}
|
|
54990
|
-
function isRecord$
|
|
55296
|
+
function isRecord$4(value) {
|
|
54991
55297
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54992
55298
|
}
|
|
54993
55299
|
function pickPath(root, path) {
|
|
54994
55300
|
let cursor = root;
|
|
54995
55301
|
for (const part of path) if (Array.isArray(cursor) && typeof part === "number") cursor = cursor[part];
|
|
54996
|
-
else if (isRecord$
|
|
55302
|
+
else if (isRecord$4(cursor) && Object.hasOwn(cursor, String(part))) cursor = cursor[String(part)];
|
|
54997
55303
|
else return;
|
|
54998
55304
|
return cursor;
|
|
54999
55305
|
}
|
|
@@ -55030,7 +55336,7 @@ function resolveTemplateRef(view, path) {
|
|
|
55030
55336
|
}
|
|
55031
55337
|
const owners = caps.filter((cap) => {
|
|
55032
55338
|
const slice = view.slices[cap];
|
|
55033
|
-
return isRecord$
|
|
55339
|
+
return isRecord$4(slice) && Object.hasOwn(slice, String(head));
|
|
55034
55340
|
});
|
|
55035
55341
|
if (owners.length === 0) return {
|
|
55036
55342
|
kind: "missing",
|
|
@@ -55132,9 +55438,15 @@ function siteZoneKey(label) {
|
|
|
55132
55438
|
var DEVICE_SEARCH_DEFAULT_LIMIT = 50;
|
|
55133
55439
|
var DEVICE_SEARCH_MAX_LIMIT = 200;
|
|
55134
55440
|
var DeviceSearchRequiresSchema = zod.z.object({
|
|
55135
|
-
/** Capability names the field wants a value of. */
|
|
55136
|
-
caps: zod.z.array(zod.z.string()).readonly(),
|
|
55137
|
-
/**
|
|
55441
|
+
/** Capability names the field wants a value of. Absent when the field wants actions only. */
|
|
55442
|
+
caps: zod.z.array(zod.z.string()).readonly().optional(),
|
|
55443
|
+
/**
|
|
55444
|
+
* Vocabulary action ids (`cover.open`) the device must offer. Compatible means
|
|
55445
|
+
* the device's bindings resolve those actions; `values` stays empty when no
|
|
55446
|
+
* cap was required. `mode` applies the same way as for `caps`.
|
|
55447
|
+
*/
|
|
55448
|
+
actions: zod.z.array(zod.z.string()).readonly().optional(),
|
|
55449
|
+
/** `any` (default): one of the named caps, and one of the named actions, is enough. `all`: every one. */
|
|
55138
55450
|
mode: zod.z.enum(["any", "all"]).optional()
|
|
55139
55451
|
});
|
|
55140
55452
|
var DeviceSearchFiltersSchema = zod.z.object({
|
|
@@ -59930,6 +60242,200 @@ var embeddingEncoderCapability = {
|
|
|
59930
60242
|
vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.ML }
|
|
59931
60243
|
};
|
|
59932
60244
|
//#endregion
|
|
60245
|
+
//#region src/capabilities/energy-system.cap.ts
|
|
60246
|
+
/**
|
|
60247
|
+
* Energy system (#513): the one READ-ONLY cap of a home energy installation —
|
|
60248
|
+
* solar production, the grid connection, the house, a heat pump where the
|
|
60249
|
+
* system meters one, and the storage. Each part is a branch of one bus.
|
|
60250
|
+
*
|
|
60251
|
+
* A part the system does not have is `null` (the whole object); a value the
|
|
60252
|
+
* system did not report is `null`, never `0` (D393).
|
|
60253
|
+
*
|
|
60254
|
+
* Signs, all in watts:
|
|
60255
|
+
* - `solar.powerW`, `house.powerW`, `heatPump.powerW` are magnitudes (≥ 0);
|
|
60256
|
+
* - `grid.powerW` is + importing, − exporting;
|
|
60257
|
+
* - `storage.powerW` is + charging, − discharging.
|
|
60258
|
+
*
|
|
60259
|
+
* The storage is a FIELD of this model, never the `battery` cap: that cap says
|
|
60260
|
+
* a device runs on a battery and feeds the low-battery alerts, and a home
|
|
60261
|
+
* storage at 19 % is not a device about to go flat (#522).
|
|
60262
|
+
*
|
|
60263
|
+
* Lifetime kWh are counters (D944); a `…TodayKwh` is the system's own day total.
|
|
60264
|
+
* The self-consumption share is not a field: it derives at read time
|
|
60265
|
+
* ({@link energySystemSelfConsumptionPct}).
|
|
60266
|
+
*/
|
|
60267
|
+
/** Production: the panels. */
|
|
60268
|
+
var EnergySolarSchema = zod.z.object({
|
|
60269
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60270
|
+
/** Lifetime production, kWh. */
|
|
60271
|
+
energyKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60272
|
+
/** Produced today, kWh. */
|
|
60273
|
+
todayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60274
|
+
});
|
|
60275
|
+
/** The grid connection: + import, − export. */
|
|
60276
|
+
var EnergyGridSchema = zod.z.object({
|
|
60277
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60278
|
+
/** Lifetime imported, kWh. */
|
|
60279
|
+
importKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60280
|
+
/** Lifetime exported, kWh. */
|
|
60281
|
+
exportKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60282
|
+
importTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60283
|
+
exportTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60284
|
+
});
|
|
60285
|
+
/** A consumer on the bus (the house, the heat pump): power and energy drawn. */
|
|
60286
|
+
var EnergyConsumerSchema = zod.z.object({
|
|
60287
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60288
|
+
/** Lifetime consumption, kWh. */
|
|
60289
|
+
energyKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60290
|
+
/** Consumed today, kWh. */
|
|
60291
|
+
todayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60292
|
+
});
|
|
60293
|
+
/** The home storage (accumulo): + charging, − discharging. */
|
|
60294
|
+
var EnergyStorageSchema = zod.z.object({
|
|
60295
|
+
/** State of charge, 0..100. */
|
|
60296
|
+
stateOfChargePct: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage")),
|
|
60297
|
+
/** Energy held now, kWh. */
|
|
60298
|
+
storedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60299
|
+
/** Usable capacity, kWh. */
|
|
60300
|
+
capacityKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60301
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60302
|
+
/** Lifetime charged, kWh. */
|
|
60303
|
+
chargedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60304
|
+
/** Lifetime discharged, kWh. */
|
|
60305
|
+
dischargedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60306
|
+
chargedTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60307
|
+
dischargedTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60308
|
+
});
|
|
60309
|
+
var EnergySystemStatusSchema = zod.z.object({
|
|
60310
|
+
solar: EnergySolarSchema.nullable(),
|
|
60311
|
+
grid: EnergyGridSchema.nullable(),
|
|
60312
|
+
house: EnergyConsumerSchema.nullable(),
|
|
60313
|
+
heatPump: EnergyConsumerSchema.nullable(),
|
|
60314
|
+
storage: EnergyStorageSchema.nullable(),
|
|
60315
|
+
/** Ms epoch when the slice was last read from the system. */
|
|
60316
|
+
lastFetchedAt: zod.z.number()
|
|
60317
|
+
});
|
|
60318
|
+
/**
|
|
60319
|
+
* Today's self-consumption: the share of today's production that was not
|
|
60320
|
+
* exported, in percent. Null unless both totals are known and something was
|
|
60321
|
+
* produced — a missing total is never a 0 or a division by it (D393).
|
|
60322
|
+
*/
|
|
60323
|
+
function energySystemSelfConsumptionPct(status) {
|
|
60324
|
+
const produced = status.solar?.todayKwh ?? null;
|
|
60325
|
+
const exported = status.grid?.exportTodayKwh ?? null;
|
|
60326
|
+
if (produced === null || exported === null || produced <= 0) return null;
|
|
60327
|
+
return Math.max(0, Math.min(100, (produced - exported) / produced * 100));
|
|
60328
|
+
}
|
|
60329
|
+
var energySystemCapability = {
|
|
60330
|
+
name: "energy-system",
|
|
60331
|
+
scope: "device",
|
|
60332
|
+
deviceNative: true,
|
|
60333
|
+
mode: "singleton",
|
|
60334
|
+
deviceTypes: [require_composed_stable_id.DeviceType.EnergySystem],
|
|
60335
|
+
methods: {},
|
|
60336
|
+
status: {
|
|
60337
|
+
schema: EnergySystemStatusSchema,
|
|
60338
|
+
kind: "push"
|
|
60339
|
+
},
|
|
60340
|
+
runtimeState: EnergySystemStatusSchema,
|
|
60341
|
+
/**
|
|
60342
|
+
* Runtime-state durability: **session** — the system answers on the next
|
|
60343
|
+
* poll, so a restart that clears the slice loses nothing a reader needs (the
|
|
60344
|
+
* series are recorded). See `RuntimeStateDurability`.
|
|
60345
|
+
*/
|
|
60346
|
+
durability: "session",
|
|
60347
|
+
/**
|
|
60348
|
+
* History (D850): every power is a gauge, every lifetime kWh a counter (the
|
|
60349
|
+
* kWh of a period is computed at read time, D944). A part the system does not
|
|
60350
|
+
* have is null and records nothing. Day totals are not recorded: they are the
|
|
60351
|
+
* counters' difference over the day.
|
|
60352
|
+
*/
|
|
60353
|
+
history: { fields: {
|
|
60354
|
+
"solar.powerW": {
|
|
60355
|
+
kind: "gauge",
|
|
60356
|
+
unit: "W",
|
|
60357
|
+
deadband: 50,
|
|
60358
|
+
displayName: "Solar power"
|
|
60359
|
+
},
|
|
60360
|
+
"solar.energyKwh": {
|
|
60361
|
+
kind: "counter",
|
|
60362
|
+
unit: "kWh",
|
|
60363
|
+
displayName: "Solar energy"
|
|
60364
|
+
},
|
|
60365
|
+
"grid.powerW": {
|
|
60366
|
+
kind: "gauge",
|
|
60367
|
+
unit: "W",
|
|
60368
|
+
deadband: 50,
|
|
60369
|
+
displayName: "Grid power"
|
|
60370
|
+
},
|
|
60371
|
+
"grid.importKwh": {
|
|
60372
|
+
kind: "counter",
|
|
60373
|
+
unit: "kWh",
|
|
60374
|
+
displayName: "Grid import"
|
|
60375
|
+
},
|
|
60376
|
+
"grid.exportKwh": {
|
|
60377
|
+
kind: "counter",
|
|
60378
|
+
unit: "kWh",
|
|
60379
|
+
displayName: "Grid export"
|
|
60380
|
+
},
|
|
60381
|
+
"house.powerW": {
|
|
60382
|
+
kind: "gauge",
|
|
60383
|
+
unit: "W",
|
|
60384
|
+
deadband: 50,
|
|
60385
|
+
displayName: "House power"
|
|
60386
|
+
},
|
|
60387
|
+
"house.energyKwh": {
|
|
60388
|
+
kind: "counter",
|
|
60389
|
+
unit: "kWh",
|
|
60390
|
+
displayName: "House energy"
|
|
60391
|
+
},
|
|
60392
|
+
"heatPump.powerW": {
|
|
60393
|
+
kind: "gauge",
|
|
60394
|
+
unit: "W",
|
|
60395
|
+
deadband: 50,
|
|
60396
|
+
displayName: "Heat pump power"
|
|
60397
|
+
},
|
|
60398
|
+
"heatPump.energyKwh": {
|
|
60399
|
+
kind: "counter",
|
|
60400
|
+
unit: "kWh",
|
|
60401
|
+
displayName: "Heat pump energy"
|
|
60402
|
+
},
|
|
60403
|
+
"storage.stateOfChargePct": {
|
|
60404
|
+
kind: "gauge",
|
|
60405
|
+
unit: "%",
|
|
60406
|
+
deadband: 1,
|
|
60407
|
+
displayName: "Storage charge"
|
|
60408
|
+
},
|
|
60409
|
+
"storage.storedKwh": {
|
|
60410
|
+
kind: "gauge",
|
|
60411
|
+
unit: "kWh",
|
|
60412
|
+
deadband: .05,
|
|
60413
|
+
displayName: "Stored energy"
|
|
60414
|
+
},
|
|
60415
|
+
"storage.powerW": {
|
|
60416
|
+
kind: "gauge",
|
|
60417
|
+
unit: "W",
|
|
60418
|
+
deadband: 50,
|
|
60419
|
+
displayName: "Storage power"
|
|
60420
|
+
},
|
|
60421
|
+
"storage.chargedKwh": {
|
|
60422
|
+
kind: "counter",
|
|
60423
|
+
unit: "kWh",
|
|
60424
|
+
displayName: "Storage charged"
|
|
60425
|
+
},
|
|
60426
|
+
"storage.dischargedKwh": {
|
|
60427
|
+
kind: "counter",
|
|
60428
|
+
unit: "kWh",
|
|
60429
|
+
displayName: "Storage discharged"
|
|
60430
|
+
}
|
|
60431
|
+
} },
|
|
60432
|
+
volatileStateFields: ["lastFetchedAt"],
|
|
60433
|
+
vocabulary: {
|
|
60434
|
+
noun: require_sleep.t("Energy system", "Sistema energetico"),
|
|
60435
|
+
order: 4020
|
|
60436
|
+
}
|
|
60437
|
+
};
|
|
60438
|
+
//#endregion
|
|
59933
60439
|
//#region src/capabilities/enum-sensor.cap.ts
|
|
59934
60440
|
/**
|
|
59935
60441
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
@@ -62853,6 +63359,7 @@ var HERO_SCENE_BY_TYPE = {
|
|
|
62853
63359
|
[require_composed_stable_id.DeviceType.Humidifier]: "control-dial",
|
|
62854
63360
|
[require_composed_stable_id.DeviceType.WaterHeater]: "heater",
|
|
62855
63361
|
[require_composed_stable_id.DeviceType.HeatPump]: "heat-pump",
|
|
63362
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "generic",
|
|
62856
63363
|
[require_composed_stable_id.DeviceType.Fan]: "fan",
|
|
62857
63364
|
[require_composed_stable_id.DeviceType.MediaPlayer]: "tv",
|
|
62858
63365
|
[require_composed_stable_id.DeviceType.AlarmPanel]: "alarm",
|
|
@@ -64388,6 +64895,19 @@ var IntegrationInstanceKindSchema = zod.z.object({
|
|
|
64388
64895
|
* finds the instances whose kind names it; absent takes the kind `id`.
|
|
64389
64896
|
*/
|
|
64390
64897
|
brokerKind: zod.z.string().min(1).optional(),
|
|
64898
|
+
/**
|
|
64899
|
+
* Other function caps an instance of this kind also serves (a Google account sends mail, so it
|
|
64900
|
+
* serves `smtp-provider` beside being a `broker`). A link to one of these caps lists and accepts
|
|
64901
|
+
* the instance; a page section stays the kinds whose `functionCap` it names. Absent means none.
|
|
64902
|
+
*/
|
|
64903
|
+
alsoServes: zod.z.array(zod.z.string().min(1)).optional(),
|
|
64904
|
+
/**
|
|
64905
|
+
* The kind's own icon (a brand mark), hub-relative or a `data:` URI. Absent: the client shows
|
|
64906
|
+
* the provider addon's icon.
|
|
64907
|
+
*/
|
|
64908
|
+
iconUrl: zod.z.string().min(1).optional(),
|
|
64909
|
+
/** The media type `iconUrl` serves (`image/svg+xml`, `image/png`); the URL carries no extension. */
|
|
64910
|
+
iconMediaType: zod.z.string().min(1).optional(),
|
|
64391
64911
|
/** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
|
|
64392
64912
|
role: IntegrationInstanceRoleSchema.optional(),
|
|
64393
64913
|
/** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
|
|
@@ -81327,6 +81847,13 @@ var NcHistoryEntrySchema = zod.z.object({
|
|
|
81327
81847
|
error: zod.z.string().optional(),
|
|
81328
81848
|
subject: NcHistorySubjectSchema,
|
|
81329
81849
|
/**
|
|
81850
|
+
* The title and body actually sent, frozen at delivery. Absent on a row
|
|
81851
|
+
* still pending, a row suppressed before a notification was built, and a
|
|
81852
|
+
* row delivered before this field shipped.
|
|
81853
|
+
*/
|
|
81854
|
+
title: zod.z.string().optional(),
|
|
81855
|
+
body: zod.z.string().optional(),
|
|
81856
|
+
/**
|
|
81330
81857
|
* Ids of the artefacts (still, then gif, then clip) this row's successful
|
|
81331
81858
|
* delivery indexed in the artefact library — a REFERENCE, never the bytes
|
|
81332
81859
|
* (an artefact is often megabytes; this row is durable JSON rewritten on
|
|
@@ -93083,7 +93610,8 @@ var ServerUpdateActionResultSchema = zod.z.object({
|
|
|
93083
93610
|
outcome: ServerUpdateOutcomeSchema.optional(),
|
|
93084
93611
|
/**
|
|
93085
93612
|
* Stable, greppable cause for `refused` / `failed` (the engine's
|
|
93086
|
-
* `UpdateRefusalReason`, `staging-failed`,
|
|
93613
|
+
* `UpdateRefusalReason`, `staging-failed`, `timeout-stall`,
|
|
93614
|
+
* `timeout-ceiling`). `null` on success.
|
|
93087
93615
|
*/
|
|
93088
93616
|
reason: zod.z.string().nullable().optional(),
|
|
93089
93617
|
/**
|
|
@@ -93252,6 +93780,157 @@ var smokeCapability = {
|
|
|
93252
93780
|
}
|
|
93253
93781
|
};
|
|
93254
93782
|
//#endregion
|
|
93783
|
+
//#region src/notification/email-mime.ts
|
|
93784
|
+
/**
|
|
93785
|
+
* One RFC 5322 body for every mail sender.
|
|
93786
|
+
*
|
|
93787
|
+
* Gmail and the SMTP relay both call this. An HTML message with an inline image is
|
|
93788
|
+
* `multipart/related` (the HTML sits in `multipart/alternative` and references
|
|
93789
|
+
* `cid:`). A text message carries the same bytes as a normal attachment
|
|
93790
|
+
* (`multipart/mixed`). The image bytes are already in hand — a sender reads them
|
|
93791
|
+
* off a `peerBytes` ticket before calling in ({@link assembleEmailMime}).
|
|
93792
|
+
*/
|
|
93793
|
+
/** How many images one email will carry. */
|
|
93794
|
+
var EMAIL_IMAGE_MAX_COUNT = 3;
|
|
93795
|
+
/** Total image bytes one email will carry. */
|
|
93796
|
+
var EMAIL_IMAGE_MAX_TOTAL_BYTES = 5 * 1024 * 1024;
|
|
93797
|
+
/**
|
|
93798
|
+
* Where an HTML body leaves room for the inline images: under the text, above
|
|
93799
|
+
* the click link. The builder replaces it; a message with no image loses it.
|
|
93800
|
+
*/
|
|
93801
|
+
var EMAIL_IMAGE_SLOT = "<!--camstack-images-->";
|
|
93802
|
+
var EmailImagePartSchema = zod.z.object({
|
|
93803
|
+
ticket: require_sleep.PeerBytesTicketSchema,
|
|
93804
|
+
mime: zod.z.string().min(1),
|
|
93805
|
+
name: zod.z.string().min(1),
|
|
93806
|
+
contentId: zod.z.string().min(1),
|
|
93807
|
+
placement: zod.z.enum(["inline", "attachment"]),
|
|
93808
|
+
deviceId: zod.z.number().int().nonnegative().optional()
|
|
93809
|
+
});
|
|
93810
|
+
var mimeSeq = 0;
|
|
93811
|
+
function nextBoundary(kind) {
|
|
93812
|
+
mimeSeq += 1;
|
|
93813
|
+
return `camstack_${kind}_${mimeSeq.toString(36)}_${Date.now().toString(36)}`;
|
|
93814
|
+
}
|
|
93815
|
+
function encodeHeaderWord(value) {
|
|
93816
|
+
if (/^[\x20-\x7E]*$/.test(value)) return value;
|
|
93817
|
+
return `=?UTF-8?B?${Buffer.from(value, "utf8").toString("base64")}?=`;
|
|
93818
|
+
}
|
|
93819
|
+
function formatAddressList(addrs) {
|
|
93820
|
+
return (Array.isArray(addrs) ? addrs : [addrs]).join(", ");
|
|
93821
|
+
}
|
|
93822
|
+
function escapeHtml$1(value) {
|
|
93823
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
93824
|
+
}
|
|
93825
|
+
function safeToken(value, fallback) {
|
|
93826
|
+
const cleaned = value.replace(/[\r\n"]/g, "").trim();
|
|
93827
|
+
return cleaned.length > 0 ? cleaned : fallback;
|
|
93828
|
+
}
|
|
93829
|
+
function base64Body(bytes) {
|
|
93830
|
+
const b64 = Buffer.from(bytes).toString("base64");
|
|
93831
|
+
const lines = [];
|
|
93832
|
+
for (let i = 0; i < b64.length; i += 76) lines.push(b64.slice(i, i + 76));
|
|
93833
|
+
return lines.join("\r\n");
|
|
93834
|
+
}
|
|
93835
|
+
function imgTag(image) {
|
|
93836
|
+
return `<img src="cid:${escapeHtml$1(image.contentId)}" alt="">`;
|
|
93837
|
+
}
|
|
93838
|
+
function fillSlot(html, inline) {
|
|
93839
|
+
return html.replaceAll(EMAIL_IMAGE_SLOT, inline.map(imgTag).join(""));
|
|
93840
|
+
}
|
|
93841
|
+
function headerLines(input) {
|
|
93842
|
+
const lines = [`From: ${input.from}`, `To: ${formatAddressList(input.to)}`];
|
|
93843
|
+
if (input.cc !== void 0 && input.cc.length > 0) lines.push(`Cc: ${formatAddressList(input.cc)}`);
|
|
93844
|
+
if (input.bcc !== void 0 && input.bcc.length > 0) lines.push(`Bcc: ${formatAddressList(input.bcc)}`);
|
|
93845
|
+
if (input.replyTo !== void 0 && input.replyTo.length > 0) lines.push(`Reply-To: ${input.replyTo}`);
|
|
93846
|
+
lines.push(`Subject: ${encodeHeaderWord(input.subject)}`);
|
|
93847
|
+
lines.push("MIME-Version: 1.0");
|
|
93848
|
+
return lines;
|
|
93849
|
+
}
|
|
93850
|
+
function textPart(boundary, text) {
|
|
93851
|
+
return [
|
|
93852
|
+
`--${boundary}`,
|
|
93853
|
+
"Content-Type: text/plain; charset=\"UTF-8\"",
|
|
93854
|
+
"Content-Transfer-Encoding: 8bit",
|
|
93855
|
+
"",
|
|
93856
|
+
text
|
|
93857
|
+
];
|
|
93858
|
+
}
|
|
93859
|
+
function htmlPart(boundary, html) {
|
|
93860
|
+
return [
|
|
93861
|
+
`--${boundary}`,
|
|
93862
|
+
"Content-Type: text/html; charset=\"UTF-8\"",
|
|
93863
|
+
"Content-Transfer-Encoding: 8bit",
|
|
93864
|
+
"",
|
|
93865
|
+
html
|
|
93866
|
+
];
|
|
93867
|
+
}
|
|
93868
|
+
function imagePart(boundary, image) {
|
|
93869
|
+
const mime = safeToken(image.mime, "image/jpeg");
|
|
93870
|
+
const name = safeToken(image.name, "image.jpg");
|
|
93871
|
+
const disposition = image.placement === "inline" ? "inline" : "attachment";
|
|
93872
|
+
const lines = [
|
|
93873
|
+
`--${boundary}`,
|
|
93874
|
+
`Content-Type: ${mime}`,
|
|
93875
|
+
"Content-Transfer-Encoding: base64",
|
|
93876
|
+
`Content-Disposition: ${disposition}; filename="${name}"`
|
|
93877
|
+
];
|
|
93878
|
+
if (image.placement === "inline") lines.push(`Content-ID: <${safeToken(image.contentId, "image")}>`);
|
|
93879
|
+
lines.push("", base64Body(image.bytes));
|
|
93880
|
+
return lines;
|
|
93881
|
+
}
|
|
93882
|
+
function alternative(outer, text, html) {
|
|
93883
|
+
const inner = nextBoundary("alt");
|
|
93884
|
+
return [
|
|
93885
|
+
`--${outer}`,
|
|
93886
|
+
`Content-Type: multipart/alternative; boundary="${inner}"`,
|
|
93887
|
+
"",
|
|
93888
|
+
...textPart(inner, text),
|
|
93889
|
+
...htmlPart(inner, html),
|
|
93890
|
+
`--${inner}--`
|
|
93891
|
+
];
|
|
93892
|
+
}
|
|
93893
|
+
function simpleMessage(input, html) {
|
|
93894
|
+
const lines = headerLines(input);
|
|
93895
|
+
if (html !== void 0) {
|
|
93896
|
+
const boundary = nextBoundary("alt");
|
|
93897
|
+
lines.push(`Content-Type: multipart/alternative; boundary="${boundary}"`, "");
|
|
93898
|
+
lines.push(...textPart(boundary, input.text), ...htmlPart(boundary, html), `--${boundary}--`);
|
|
93899
|
+
return lines;
|
|
93900
|
+
}
|
|
93901
|
+
lines.push("Content-Type: text/plain; charset=\"UTF-8\"", "Content-Transfer-Encoding: 8bit", "", input.text);
|
|
93902
|
+
return lines;
|
|
93903
|
+
}
|
|
93904
|
+
function mixedMessage(input, html, files) {
|
|
93905
|
+
const boundary = nextBoundary("mix");
|
|
93906
|
+
const lines = headerLines(input);
|
|
93907
|
+
lines.push(`Content-Type: multipart/mixed; boundary="${boundary}"`, "");
|
|
93908
|
+
if (html !== void 0) lines.push(...alternative(boundary, input.text, html));
|
|
93909
|
+
else lines.push(...textPart(boundary, input.text));
|
|
93910
|
+
for (const image of files) lines.push(...imagePart(boundary, image));
|
|
93911
|
+
lines.push(`--${boundary}--`);
|
|
93912
|
+
return lines;
|
|
93913
|
+
}
|
|
93914
|
+
function relatedMessage(input, html, inline, attached) {
|
|
93915
|
+
const boundary = nextBoundary("rel");
|
|
93916
|
+
const lines = headerLines(input);
|
|
93917
|
+
lines.push(`Content-Type: multipart/related; boundary="${boundary}"; type="multipart/alternative"`, "", ...alternative(boundary, input.text, html));
|
|
93918
|
+
for (const image of inline) lines.push(...imagePart(boundary, image));
|
|
93919
|
+
for (const image of attached) lines.push(...imagePart(boundary, image));
|
|
93920
|
+
lines.push(`--${boundary}--`);
|
|
93921
|
+
return lines;
|
|
93922
|
+
}
|
|
93923
|
+
/** Render one mail. No I/O: the caller has already decided which images survived. */
|
|
93924
|
+
function buildRawMime(input) {
|
|
93925
|
+
const images = input.images ?? [];
|
|
93926
|
+
const inline = images.filter((image) => image.placement === "inline");
|
|
93927
|
+
const attached = images.filter((image) => image.placement === "attachment");
|
|
93928
|
+
const html = input.html !== void 0 && input.html.length > 0 ? fillSlot(input.html, inline) : void 0;
|
|
93929
|
+
if (html !== void 0 && inline.length > 0) return relatedMessage(input, html, inline, attached).join("\r\n");
|
|
93930
|
+
if (attached.length > 0 || inline.length > 0) return mixedMessage(input, html, attached.length > 0 ? attached : inline).join("\r\n");
|
|
93931
|
+
return simpleMessage(input, html).join("\r\n");
|
|
93932
|
+
}
|
|
93933
|
+
//#endregion
|
|
93255
93934
|
//#region src/capabilities/smtp-provider.cap.ts
|
|
93256
93935
|
/**
|
|
93257
93936
|
* `smtp-provider` — pluggable email delivery surface.
|
|
@@ -93262,8 +93941,8 @@ var smokeCapability = {
|
|
|
93262
93941
|
* ready provider OR target a specific addonId.
|
|
93263
93942
|
*
|
|
93264
93943
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
93265
|
-
* 90% case.
|
|
93266
|
-
*
|
|
93944
|
+
* 90% case. An image is not a byte field on this method (D613): `images`
|
|
93945
|
+
* names `peerBytes` tickets the sender opens and folds into one MIME body.
|
|
93267
93946
|
*/
|
|
93268
93947
|
var EmailAddressSchema = zod.z.email();
|
|
93269
93948
|
/**
|
|
@@ -93290,7 +93969,12 @@ var SendEmailInputSchema = zod.z.object({
|
|
|
93290
93969
|
* for clients that strip HTML — including most spam filters). */
|
|
93291
93970
|
text: zod.z.string(),
|
|
93292
93971
|
/** Optional HTML body. Renders alongside `text` as multi-part. */
|
|
93293
|
-
html: zod.z.string().optional()
|
|
93972
|
+
html: zod.z.string().optional(),
|
|
93973
|
+
/**
|
|
93974
|
+
* Images the caller already offered over `peerBytes`. Absent = a mail with
|
|
93975
|
+
* no image. The sender opens each ticket; one it cannot read is left out.
|
|
93976
|
+
*/
|
|
93977
|
+
images: zod.z.array(EmailImagePartSchema).max(3).optional()
|
|
93294
93978
|
});
|
|
93295
93979
|
var SendEmailResultSchema = zod.z.object({
|
|
93296
93980
|
messageId: zod.z.string(),
|
|
@@ -94751,34 +95435,46 @@ var switchCapability = {
|
|
|
94751
95435
|
require_composed_stable_id.DeviceType.Light,
|
|
94752
95436
|
require_composed_stable_id.DeviceType.Fan
|
|
94753
95437
|
],
|
|
94754
|
-
methods: {
|
|
94755
|
-
|
|
94756
|
-
|
|
94757
|
-
|
|
94758
|
-
|
|
94759
|
-
|
|
94760
|
-
|
|
94761
|
-
|
|
94762
|
-
|
|
94763
|
-
|
|
94764
|
-
|
|
94765
|
-
|
|
94766
|
-
|
|
94767
|
-
|
|
94768
|
-
|
|
94769
|
-
|
|
94770
|
-
|
|
94771
|
-
|
|
94772
|
-
|
|
94773
|
-
|
|
94774
|
-
|
|
94775
|
-
|
|
94776
|
-
|
|
94777
|
-
|
|
94778
|
-
|
|
94779
|
-
|
|
94780
|
-
|
|
94781
|
-
|
|
95438
|
+
methods: {
|
|
95439
|
+
setState: require_sleep.method(zod.z.object({
|
|
95440
|
+
deviceId: zod.z.number(),
|
|
95441
|
+
on: zod.z.boolean()
|
|
95442
|
+
}), zod.z.void(), {
|
|
95443
|
+
kind: "mutation",
|
|
95444
|
+
auth: "protected",
|
|
95445
|
+
actions: [{
|
|
95446
|
+
id: "switch.on",
|
|
95447
|
+
label: require_sleep.t("Turn on", "Accendi"),
|
|
95448
|
+
phrase: require_sleep.t("Turn on {device}", "Accendi {device}"),
|
|
95449
|
+
icon: "power",
|
|
95450
|
+
effect: {
|
|
95451
|
+
field: "on",
|
|
95452
|
+
value: true
|
|
95453
|
+
},
|
|
95454
|
+
args: { on: true }
|
|
95455
|
+
}, {
|
|
95456
|
+
id: "switch.off",
|
|
95457
|
+
label: require_sleep.t("Turn off", "Spegni"),
|
|
95458
|
+
phrase: require_sleep.t("Turn off {device}", "Spegni {device}"),
|
|
95459
|
+
icon: "power-off",
|
|
95460
|
+
effect: {
|
|
95461
|
+
field: "on",
|
|
95462
|
+
value: false
|
|
95463
|
+
},
|
|
95464
|
+
args: { on: false }
|
|
95465
|
+
}]
|
|
95466
|
+
}),
|
|
95467
|
+
toggle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
|
|
95468
|
+
kind: "mutation",
|
|
95469
|
+
auth: "protected",
|
|
95470
|
+
actions: [{
|
|
95471
|
+
id: "switch.toggle",
|
|
95472
|
+
label: require_sleep.t("Toggle", "Commuta"),
|
|
95473
|
+
phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
|
|
95474
|
+
icon: "toggle-right"
|
|
95475
|
+
}]
|
|
95476
|
+
})
|
|
95477
|
+
},
|
|
94782
95478
|
events: { onStateChanged: {
|
|
94783
95479
|
data: zod.z.object({
|
|
94784
95480
|
deviceId: zod.z.number(),
|
|
@@ -95842,19 +96538,534 @@ var temperatureSensorCapability = {
|
|
|
95842
96538
|
}
|
|
95843
96539
|
};
|
|
95844
96540
|
//#endregion
|
|
96541
|
+
//#region src/template/automation-template.ts
|
|
96542
|
+
/**
|
|
96543
|
+
* Automation templates (#527): the `automation` kind of the template store
|
|
96544
|
+
* (D963). A template is an automation BODY plus declared, typed INPUTS and the
|
|
96545
|
+
* BINDINGS that say where each input's value lands in the body. Creating an
|
|
96546
|
+
* automation from a template asks only for the inputs; the instance stores the
|
|
96547
|
+
* template id and the values (`AutomationRecipe.template`) and is EXPANDED into
|
|
96548
|
+
* an ordinary recipe — same codegen, same engine, same traces.
|
|
96549
|
+
*
|
|
96550
|
+
* The body is not a recipe until it is expanded (a choose with no branch yet,
|
|
96551
|
+
* a leaf with no device), so it is stored as JSON and judged only after the
|
|
96552
|
+
* expansion, by `AutomationRecipeSchema`.
|
|
96553
|
+
*
|
|
96554
|
+
* Bindings are paths into the body:
|
|
96555
|
+
* - `value` writes one input's value at a path. Device, number, duration,
|
|
96556
|
+
* text, select and boolean values REPLACE what is there (a device with
|
|
96557
|
+
* `as: 'target'` becomes `{ kind: 'devices', ids }`); event and action values
|
|
96558
|
+
* MERGE into the object at the path (a `device-fired` row, a command step).
|
|
96559
|
+
* - `rows` appends one copy of `item` per row of a repeatable group to the list
|
|
96560
|
+
* at the path, each copy filled by its own row-relative bindings; `row-id`
|
|
96561
|
+
* writes `<group>-<index>`, so a row's event leaf and the branch that reads it
|
|
96562
|
+
* (`triggered-by`) agree on one name.
|
|
96563
|
+
*
|
|
96564
|
+
* Everything here is pure: the admin UI expands on save and the hub re-expands
|
|
96565
|
+
* every instance when a template changes, with the same function.
|
|
96566
|
+
*/
|
|
96567
|
+
var TEMPLATE_INPUT_KEY_RE = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
96568
|
+
var inputKey = zod.z.string().regex(TEMPLATE_INPUT_KEY_RE);
|
|
96569
|
+
var inputBase = {
|
|
96570
|
+
key: inputKey,
|
|
96571
|
+
label: zod.z.string().min(1).max(80),
|
|
96572
|
+
description: zod.z.string().max(300).optional(),
|
|
96573
|
+
/** Absent means required. */
|
|
96574
|
+
optional: zod.z.literal(true).optional()
|
|
96575
|
+
};
|
|
96576
|
+
var TemplateDeviceFilterSchema = zod.z.object({
|
|
96577
|
+
/** Only devices that offer this capability. */
|
|
96578
|
+
capability: zod.z.string().min(1).optional(),
|
|
96579
|
+
/** Only devices of this role / device type (`light`, `switch`, `button`). */
|
|
96580
|
+
role: zod.z.string().min(1).optional()
|
|
96581
|
+
});
|
|
96582
|
+
var DeviceInputSchema = zod.z.object({
|
|
96583
|
+
kind: zod.z.literal("device"),
|
|
96584
|
+
...inputBase,
|
|
96585
|
+
multiple: zod.z.literal(true).optional(),
|
|
96586
|
+
filter: TemplateDeviceFilterSchema.optional()
|
|
96587
|
+
});
|
|
96588
|
+
var EventInputSchema = zod.z.object({
|
|
96589
|
+
kind: zod.z.literal("event"),
|
|
96590
|
+
...inputBase,
|
|
96591
|
+
/** The device input (same level) whose event vocabulary is offered (D1044). */
|
|
96592
|
+
deviceInput: inputKey
|
|
96593
|
+
});
|
|
96594
|
+
var ActionInputSchema$1 = zod.z.object({
|
|
96595
|
+
kind: zod.z.literal("action"),
|
|
96596
|
+
...inputBase,
|
|
96597
|
+
/** The device input (same level) whose actions are offered; absent offers all (D1050). */
|
|
96598
|
+
deviceInput: inputKey.optional()
|
|
96599
|
+
});
|
|
96600
|
+
var NumberInputSchema = zod.z.object({
|
|
96601
|
+
kind: zod.z.literal("number"),
|
|
96602
|
+
...inputBase,
|
|
96603
|
+
min: zod.z.number().optional(),
|
|
96604
|
+
max: zod.z.number().optional(),
|
|
96605
|
+
default: zod.z.number().optional()
|
|
96606
|
+
});
|
|
96607
|
+
var DurationInputSchema = zod.z.object({
|
|
96608
|
+
kind: zod.z.literal("duration"),
|
|
96609
|
+
...inputBase,
|
|
96610
|
+
/** Seconds. */
|
|
96611
|
+
min: zod.z.number().nonnegative().optional(),
|
|
96612
|
+
max: zod.z.number().nonnegative().optional(),
|
|
96613
|
+
default: zod.z.number().nonnegative().optional()
|
|
96614
|
+
});
|
|
96615
|
+
var TextInputSchema = zod.z.object({
|
|
96616
|
+
kind: zod.z.literal("text"),
|
|
96617
|
+
...inputBase,
|
|
96618
|
+
maxLength: zod.z.number().int().min(1).max(2e3).optional(),
|
|
96619
|
+
default: zod.z.string().optional()
|
|
96620
|
+
});
|
|
96621
|
+
var TemplateSelectOptionSchema = zod.z.object({
|
|
96622
|
+
value: zod.z.string().min(1),
|
|
96623
|
+
label: zod.z.string().min(1).max(80)
|
|
96624
|
+
});
|
|
96625
|
+
var SelectInputSchema = zod.z.object({
|
|
96626
|
+
kind: zod.z.literal("select"),
|
|
96627
|
+
...inputBase,
|
|
96628
|
+
options: zod.z.array(TemplateSelectOptionSchema).min(1).max(50),
|
|
96629
|
+
default: zod.z.string().optional()
|
|
96630
|
+
});
|
|
96631
|
+
var BooleanInputSchema = zod.z.object({
|
|
96632
|
+
kind: zod.z.literal("boolean"),
|
|
96633
|
+
...inputBase,
|
|
96634
|
+
default: zod.z.boolean().optional()
|
|
96635
|
+
});
|
|
96636
|
+
var TemplateScalarInputSchema = zod.z.discriminatedUnion("kind", [
|
|
96637
|
+
DeviceInputSchema,
|
|
96638
|
+
EventInputSchema,
|
|
96639
|
+
ActionInputSchema$1,
|
|
96640
|
+
NumberInputSchema,
|
|
96641
|
+
DurationInputSchema,
|
|
96642
|
+
TextInputSchema,
|
|
96643
|
+
SelectInputSchema,
|
|
96644
|
+
BooleanInputSchema
|
|
96645
|
+
]);
|
|
96646
|
+
var TEMPLATE_GROUP_ROWS_MAX = 20;
|
|
96647
|
+
var GroupInputSchema = zod.z.object({
|
|
96648
|
+
kind: zod.z.literal("group"),
|
|
96649
|
+
...inputBase,
|
|
96650
|
+
inputs: zod.z.array(TemplateScalarInputSchema).min(1).max(10),
|
|
96651
|
+
minRows: zod.z.number().int().min(0).max(20).optional(),
|
|
96652
|
+
maxRows: zod.z.number().int().min(1).max(20).optional()
|
|
96653
|
+
});
|
|
96654
|
+
var TemplateInputSchema = zod.z.discriminatedUnion("kind", [...TemplateScalarInputSchema.options, GroupInputSchema]);
|
|
96655
|
+
var TemplatePathSchema = zod.z.array(zod.z.union([zod.z.string().min(1), zod.z.number().int().nonnegative()])).max(24);
|
|
96656
|
+
var TemplateValueBindingSchema = zod.z.object({
|
|
96657
|
+
kind: zod.z.literal("value"),
|
|
96658
|
+
input: inputKey,
|
|
96659
|
+
path: TemplatePathSchema,
|
|
96660
|
+
/** A device value written as a step target (`{ kind: 'devices', ids }`). */
|
|
96661
|
+
as: zod.z.literal("target").optional()
|
|
96662
|
+
});
|
|
96663
|
+
var TemplateRowIdBindingSchema = zod.z.object({
|
|
96664
|
+
kind: zod.z.literal("row-id"),
|
|
96665
|
+
path: TemplatePathSchema
|
|
96666
|
+
});
|
|
96667
|
+
var TemplateRowItemBindingSchema = zod.z.discriminatedUnion("kind", [TemplateValueBindingSchema, TemplateRowIdBindingSchema]);
|
|
96668
|
+
var TemplateRowsBindingSchema = zod.z.object({
|
|
96669
|
+
kind: zod.z.literal("rows"),
|
|
96670
|
+
input: inputKey,
|
|
96671
|
+
/** The list in the body the rows are appended to. */
|
|
96672
|
+
path: TemplatePathSchema,
|
|
96673
|
+
/** The JSON copied once per row. */
|
|
96674
|
+
item: zod.z.unknown(),
|
|
96675
|
+
bindings: zod.z.array(TemplateRowItemBindingSchema).max(40)
|
|
96676
|
+
});
|
|
96677
|
+
var TemplateBindingSchema = zod.z.discriminatedUnion("kind", [TemplateValueBindingSchema, TemplateRowsBindingSchema]);
|
|
96678
|
+
var AUTOMATION_TEMPLATE_VERSION = 1;
|
|
96679
|
+
function bindingProblems(payload, ctx) {
|
|
96680
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
96681
|
+
payload.inputs.forEach((input, index) => {
|
|
96682
|
+
if (byKey.has(input.key)) ctx.addIssue({
|
|
96683
|
+
code: "custom",
|
|
96684
|
+
message: `input "${input.key}" is declared twice`,
|
|
96685
|
+
path: ["inputs", index]
|
|
96686
|
+
});
|
|
96687
|
+
byKey.set(input.key, input);
|
|
96688
|
+
const siblings = input.kind === "group" ? input.inputs : payload.inputs;
|
|
96689
|
+
for (const scalar of input.kind === "group" ? input.inputs : [input]) {
|
|
96690
|
+
if (scalar.kind !== "event" && scalar.kind !== "action") continue;
|
|
96691
|
+
if (scalar.deviceInput === void 0) continue;
|
|
96692
|
+
const device = siblings.find((s) => s.key === scalar.deviceInput);
|
|
96693
|
+
if (device === void 0 || device.kind !== "device") ctx.addIssue({
|
|
96694
|
+
code: "custom",
|
|
96695
|
+
message: `"${scalar.key}" reads the device input "${scalar.deviceInput}", which is not a device input beside it`,
|
|
96696
|
+
path: ["inputs", index]
|
|
96697
|
+
});
|
|
96698
|
+
}
|
|
96699
|
+
});
|
|
96700
|
+
payload.bindings.forEach((binding, index) => {
|
|
96701
|
+
const input = byKey.get(binding.input);
|
|
96702
|
+
if (input === void 0) {
|
|
96703
|
+
ctx.addIssue({
|
|
96704
|
+
code: "custom",
|
|
96705
|
+
message: `binding names the undeclared input "${binding.input}"`,
|
|
96706
|
+
path: ["bindings", index]
|
|
96707
|
+
});
|
|
96708
|
+
return;
|
|
96709
|
+
}
|
|
96710
|
+
if (binding.kind === "value" && input.kind === "group") ctx.addIssue({
|
|
96711
|
+
code: "custom",
|
|
96712
|
+
message: `group "${input.key}" is bound with rows, not a value`,
|
|
96713
|
+
path: ["bindings", index]
|
|
96714
|
+
});
|
|
96715
|
+
if (binding.kind === "rows") {
|
|
96716
|
+
if (input.kind !== "group") {
|
|
96717
|
+
ctx.addIssue({
|
|
96718
|
+
code: "custom",
|
|
96719
|
+
message: `rows need a group input, "${input.key}" is ${input.kind}`,
|
|
96720
|
+
path: ["bindings", index]
|
|
96721
|
+
});
|
|
96722
|
+
return;
|
|
96723
|
+
}
|
|
96724
|
+
for (const row of binding.bindings) if (row.kind === "value" && !input.inputs.some((i) => i.key === row.input)) ctx.addIssue({
|
|
96725
|
+
code: "custom",
|
|
96726
|
+
message: `row binding names "${row.input}", which group "${input.key}" does not declare`,
|
|
96727
|
+
path: ["bindings", index]
|
|
96728
|
+
});
|
|
96729
|
+
}
|
|
96730
|
+
});
|
|
96731
|
+
}
|
|
96732
|
+
var AutomationTemplatePayloadSchema = zod.z.object({
|
|
96733
|
+
version: zod.z.literal(1),
|
|
96734
|
+
description: zod.z.string().max(500).optional(),
|
|
96735
|
+
/** The automation body; a recipe once the inputs are written into it. */
|
|
96736
|
+
body: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
96737
|
+
inputs: zod.z.array(TemplateInputSchema).max(30),
|
|
96738
|
+
bindings: zod.z.array(TemplateBindingSchema).max(100)
|
|
96739
|
+
}).superRefine(bindingProblems);
|
|
96740
|
+
function valueProblem(input, value) {
|
|
96741
|
+
switch (input.kind) {
|
|
96742
|
+
case "device":
|
|
96743
|
+
if (input.multiple === true) return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === "number" && Number.isInteger(v) && v >= 0) ? null : "pick at least one device";
|
|
96744
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? null : "pick one device";
|
|
96745
|
+
case "event": return TemplateEventValueSchema.safeParse(value).success ? null : "pick an event";
|
|
96746
|
+
case "action": {
|
|
96747
|
+
const parsed = TemplateActionValueSchema.safeParse(value);
|
|
96748
|
+
if (!parsed.success) return "pick an action";
|
|
96749
|
+
return require_sleep.findVocabAction(parsed.data.actionId) === void 0 ? `"${parsed.data.actionId}" is not a vocabulary action` : null;
|
|
96750
|
+
}
|
|
96751
|
+
case "number":
|
|
96752
|
+
case "duration":
|
|
96753
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return "a number is required";
|
|
96754
|
+
if (input.min !== void 0 && value < input.min) return `at least ${input.min}`;
|
|
96755
|
+
if (input.max !== void 0 && value > input.max) return `at most ${input.max}`;
|
|
96756
|
+
return null;
|
|
96757
|
+
case "text":
|
|
96758
|
+
if (typeof value !== "string") return "text is required";
|
|
96759
|
+
return input.maxLength !== void 0 && value.length > input.maxLength ? `at most ${input.maxLength} characters` : null;
|
|
96760
|
+
case "select": return typeof value === "string" && input.options.some((o) => o.value === value) ? null : "pick one of the options";
|
|
96761
|
+
case "boolean": return typeof value === "boolean" ? null : "on or off";
|
|
96762
|
+
}
|
|
96763
|
+
}
|
|
96764
|
+
function defaultOf(input) {
|
|
96765
|
+
switch (input.kind) {
|
|
96766
|
+
case "number":
|
|
96767
|
+
case "duration":
|
|
96768
|
+
case "text":
|
|
96769
|
+
case "select":
|
|
96770
|
+
case "boolean": return input.default;
|
|
96771
|
+
default: return;
|
|
96772
|
+
}
|
|
96773
|
+
}
|
|
96774
|
+
function isScalar(value) {
|
|
96775
|
+
return !(Array.isArray(value) && value.some((v) => typeof v === "object" && v !== null));
|
|
96776
|
+
}
|
|
96777
|
+
function isRowList(value) {
|
|
96778
|
+
return Array.isArray(value) && value.every((v) => typeof v === "object" && v !== null && !Array.isArray(v));
|
|
96779
|
+
}
|
|
96780
|
+
function resolveScalars(inputs, values, prefix, problems) {
|
|
96781
|
+
const out = /* @__PURE__ */ new Map();
|
|
96782
|
+
for (const input of inputs) {
|
|
96783
|
+
const address = `${prefix}${input.key}`;
|
|
96784
|
+
const raw = values[input.key] ?? defaultOf(input);
|
|
96785
|
+
if (raw === void 0) {
|
|
96786
|
+
if (input.optional !== true) problems.push({
|
|
96787
|
+
code: "missing-input",
|
|
96788
|
+
input: address,
|
|
96789
|
+
detail: `"${input.label}" is required`
|
|
96790
|
+
});
|
|
96791
|
+
continue;
|
|
96792
|
+
}
|
|
96793
|
+
const problem = isScalar(raw) ? valueProblem(input, raw) : "a single value is required";
|
|
96794
|
+
if (problem !== null || !isScalar(raw)) {
|
|
96795
|
+
problems.push({
|
|
96796
|
+
code: "invalid-input",
|
|
96797
|
+
input: address,
|
|
96798
|
+
detail: problem ?? "invalid value"
|
|
96799
|
+
});
|
|
96800
|
+
continue;
|
|
96801
|
+
}
|
|
96802
|
+
out.set(input.key, raw);
|
|
96803
|
+
}
|
|
96804
|
+
return out;
|
|
96805
|
+
}
|
|
96806
|
+
function resolveValues(payload, values, problems) {
|
|
96807
|
+
const scalars = resolveScalars(payload.inputs.filter((i) => i.kind !== "group"), values, "", problems);
|
|
96808
|
+
const groups = /* @__PURE__ */ new Map();
|
|
96809
|
+
for (const input of payload.inputs) {
|
|
96810
|
+
if (input.kind !== "group") continue;
|
|
96811
|
+
const raw = values[input.key] ?? [];
|
|
96812
|
+
if (!isRowList(raw)) {
|
|
96813
|
+
problems.push({
|
|
96814
|
+
code: "invalid-input",
|
|
96815
|
+
input: input.key,
|
|
96816
|
+
detail: "a list of rows is required"
|
|
96817
|
+
});
|
|
96818
|
+
continue;
|
|
96819
|
+
}
|
|
96820
|
+
const min = input.minRows ?? (input.optional === true ? 0 : 1);
|
|
96821
|
+
const max = input.maxRows ?? 20;
|
|
96822
|
+
if (raw.length < min) {
|
|
96823
|
+
problems.push({
|
|
96824
|
+
code: raw.length === 0 ? "missing-input" : "invalid-input",
|
|
96825
|
+
input: input.key,
|
|
96826
|
+
detail: `"${input.label}" needs at least ${min} row(s)`
|
|
96827
|
+
});
|
|
96828
|
+
continue;
|
|
96829
|
+
}
|
|
96830
|
+
if (raw.length > max) {
|
|
96831
|
+
problems.push({
|
|
96832
|
+
code: "invalid-input",
|
|
96833
|
+
input: input.key,
|
|
96834
|
+
detail: `"${input.label}" takes at most ${max} row(s)`
|
|
96835
|
+
});
|
|
96836
|
+
continue;
|
|
96837
|
+
}
|
|
96838
|
+
groups.set(input.key, raw.map((row, index) => resolveScalars(input.inputs, row, `${input.key}.${index}.`, problems)));
|
|
96839
|
+
}
|
|
96840
|
+
return {
|
|
96841
|
+
scalars,
|
|
96842
|
+
groups
|
|
96843
|
+
};
|
|
96844
|
+
}
|
|
96845
|
+
function isRecord$3(value) {
|
|
96846
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
96847
|
+
}
|
|
96848
|
+
var PathError = class extends Error {};
|
|
96849
|
+
function getAt(root, path) {
|
|
96850
|
+
let node = root;
|
|
96851
|
+
for (const segment of path) if (typeof segment === "number") node = Array.isArray(node) ? node[segment] : void 0;
|
|
96852
|
+
else node = isRecord$3(node) ? node[segment] : void 0;
|
|
96853
|
+
return node;
|
|
96854
|
+
}
|
|
96855
|
+
/** `root` with `value` at `path`; missing containers are created, a wrong one throws. */
|
|
96856
|
+
function setAt(root, path, value) {
|
|
96857
|
+
const [head, ...rest] = path;
|
|
96858
|
+
if (head === void 0) return value;
|
|
96859
|
+
if (typeof head === "number") {
|
|
96860
|
+
const list = root === void 0 ? [] : root;
|
|
96861
|
+
if (!Array.isArray(list)) throw new PathError(`expected a list at index ${head}`);
|
|
96862
|
+
const next = [...list];
|
|
96863
|
+
next[head] = setAt(list[head], rest, value);
|
|
96864
|
+
return next;
|
|
96865
|
+
}
|
|
96866
|
+
const object = root === void 0 ? {} : root;
|
|
96867
|
+
if (!isRecord$3(object)) throw new PathError(`expected an object at "${head}"`);
|
|
96868
|
+
return {
|
|
96869
|
+
...object,
|
|
96870
|
+
[head]: setAt(object[head], rest, value)
|
|
96871
|
+
};
|
|
96872
|
+
}
|
|
96873
|
+
var EVENT_FIELDS = [
|
|
96874
|
+
"eventIds",
|
|
96875
|
+
"sourceIds",
|
|
96876
|
+
"kinds"
|
|
96877
|
+
];
|
|
96878
|
+
var ACTION_FIELDS = [
|
|
96879
|
+
"actionId",
|
|
96880
|
+
"args",
|
|
96881
|
+
"argUnits"
|
|
96882
|
+
];
|
|
96883
|
+
function mergeInto(current, drop, patch) {
|
|
96884
|
+
const base = isRecord$3(current) ? current : {};
|
|
96885
|
+
return {
|
|
96886
|
+
...Object.fromEntries(Object.entries(base).filter(([k]) => !drop.includes(k))),
|
|
96887
|
+
...patch
|
|
96888
|
+
};
|
|
96889
|
+
}
|
|
96890
|
+
function writeValue(root, binding, input, value) {
|
|
96891
|
+
switch (input.kind) {
|
|
96892
|
+
case "event": return setAt(root, binding.path, mergeInto(getAt(root, binding.path), EVENT_FIELDS, TemplateEventValueSchema.parse(value)));
|
|
96893
|
+
case "action": return setAt(root, binding.path, mergeInto(getAt(root, binding.path), ACTION_FIELDS, TemplateActionValueSchema.parse(value)));
|
|
96894
|
+
case "device":
|
|
96895
|
+
if (binding.as === "target") {
|
|
96896
|
+
const ids = Array.isArray(value) ? value : [value];
|
|
96897
|
+
return setAt(root, binding.path, {
|
|
96898
|
+
kind: "devices",
|
|
96899
|
+
ids
|
|
96900
|
+
});
|
|
96901
|
+
}
|
|
96902
|
+
return setAt(root, binding.path, value);
|
|
96903
|
+
default: return setAt(root, binding.path, value);
|
|
96904
|
+
}
|
|
96905
|
+
}
|
|
96906
|
+
function applyRows(root, binding, group, rows) {
|
|
96907
|
+
const existing = getAt(root, binding.path);
|
|
96908
|
+
const list = existing === void 0 ? [] : existing;
|
|
96909
|
+
if (!Array.isArray(list)) throw new PathError(`rows of "${group.key}" need a list`);
|
|
96910
|
+
const items = rows.map((row, index) => {
|
|
96911
|
+
let item = binding.item;
|
|
96912
|
+
for (const rowBinding of binding.bindings) {
|
|
96913
|
+
if (rowBinding.kind === "row-id") {
|
|
96914
|
+
item = setAt(item, rowBinding.path, `${group.key}-${index}`);
|
|
96915
|
+
continue;
|
|
96916
|
+
}
|
|
96917
|
+
const input = group.inputs.find((i) => i.key === rowBinding.input);
|
|
96918
|
+
const value = row.get(rowBinding.input);
|
|
96919
|
+
if (input === void 0 || value === void 0) continue;
|
|
96920
|
+
item = writeValue(item, rowBinding, input, value);
|
|
96921
|
+
}
|
|
96922
|
+
return item;
|
|
96923
|
+
});
|
|
96924
|
+
return setAt(root, binding.path, [...list, ...items]);
|
|
96925
|
+
}
|
|
96926
|
+
/** The body with the values written in, as a recipe — or every reason it is not one. */
|
|
96927
|
+
function expandAutomationTemplate(payload, values) {
|
|
96928
|
+
const problems = [];
|
|
96929
|
+
const resolved = resolveValues(payload, values, problems);
|
|
96930
|
+
if (problems.length > 0) return {
|
|
96931
|
+
ok: false,
|
|
96932
|
+
problems
|
|
96933
|
+
};
|
|
96934
|
+
let body = payload.body;
|
|
96935
|
+
try {
|
|
96936
|
+
for (const binding of payload.bindings) {
|
|
96937
|
+
const input = payload.inputs.find((i) => i.key === binding.input);
|
|
96938
|
+
if (input === void 0) continue;
|
|
96939
|
+
if (binding.kind === "rows") {
|
|
96940
|
+
if (input.kind !== "group") continue;
|
|
96941
|
+
body = applyRows(body, binding, input, resolved.groups.get(input.key) ?? []);
|
|
96942
|
+
continue;
|
|
96943
|
+
}
|
|
96944
|
+
if (input.kind === "group") continue;
|
|
96945
|
+
const value = resolved.scalars.get(input.key);
|
|
96946
|
+
if (value === void 0) continue;
|
|
96947
|
+
body = writeValue(body, binding, input, value);
|
|
96948
|
+
}
|
|
96949
|
+
} catch (error) {
|
|
96950
|
+
if (!(error instanceof PathError)) throw error;
|
|
96951
|
+
return {
|
|
96952
|
+
ok: false,
|
|
96953
|
+
problems: [{
|
|
96954
|
+
code: "invalid-recipe",
|
|
96955
|
+
detail: error.message
|
|
96956
|
+
}]
|
|
96957
|
+
};
|
|
96958
|
+
}
|
|
96959
|
+
const parsed = AutomationRecipeSchema.safeParse(body);
|
|
96960
|
+
if (!parsed.success) return {
|
|
96961
|
+
ok: false,
|
|
96962
|
+
problems: parsed.error.issues.slice(0, 5).map((issue) => ({
|
|
96963
|
+
code: "invalid-recipe",
|
|
96964
|
+
detail: `${issue.path.join(".")}: ${issue.message}`
|
|
96965
|
+
}))
|
|
96966
|
+
};
|
|
96967
|
+
const { template: _ignored, ...recipe } = parsed.data;
|
|
96968
|
+
return {
|
|
96969
|
+
ok: true,
|
|
96970
|
+
recipe
|
|
96971
|
+
};
|
|
96972
|
+
}
|
|
96973
|
+
/** A new instance: the expansion, linked to its template. */
|
|
96974
|
+
function instantiateAutomationTemplate(templateId, payload, values) {
|
|
96975
|
+
const expanded = expandAutomationTemplate(payload, values);
|
|
96976
|
+
if (!expanded.ok) return expanded;
|
|
96977
|
+
return {
|
|
96978
|
+
ok: true,
|
|
96979
|
+
recipe: {
|
|
96980
|
+
...expanded.recipe,
|
|
96981
|
+
template: {
|
|
96982
|
+
templateId,
|
|
96983
|
+
values
|
|
96984
|
+
}
|
|
96985
|
+
}
|
|
96986
|
+
};
|
|
96987
|
+
}
|
|
96988
|
+
/**
|
|
96989
|
+
* An instance after its template changed (or vanished, `payload === null`):
|
|
96990
|
+
* re-expanded when its values still fit, otherwise its previous body kept and
|
|
96991
|
+
* the link flagged with the problems. Never dropped.
|
|
96992
|
+
*/
|
|
96993
|
+
function reexpandAutomationInstance(payload, current) {
|
|
96994
|
+
const link = current.template;
|
|
96995
|
+
if (link === void 0) return {
|
|
96996
|
+
recipe: current,
|
|
96997
|
+
flagged: false
|
|
96998
|
+
};
|
|
96999
|
+
const expanded = payload === null ? {
|
|
97000
|
+
ok: false,
|
|
97001
|
+
problems: [{
|
|
97002
|
+
code: "missing-template",
|
|
97003
|
+
detail: `template "${link.templateId}" is gone`
|
|
97004
|
+
}]
|
|
97005
|
+
} : expandAutomationTemplate(payload, link.values);
|
|
97006
|
+
if (expanded.ok) return {
|
|
97007
|
+
recipe: {
|
|
97008
|
+
...expanded.recipe,
|
|
97009
|
+
template: {
|
|
97010
|
+
templateId: link.templateId,
|
|
97011
|
+
values: link.values
|
|
97012
|
+
}
|
|
97013
|
+
},
|
|
97014
|
+
flagged: false
|
|
97015
|
+
};
|
|
97016
|
+
const [first, ...rest] = expanded.problems;
|
|
97017
|
+
if (first === void 0) return {
|
|
97018
|
+
recipe: current,
|
|
97019
|
+
flagged: false
|
|
97020
|
+
};
|
|
97021
|
+
return {
|
|
97022
|
+
recipe: {
|
|
97023
|
+
...current,
|
|
97024
|
+
template: {
|
|
97025
|
+
...link,
|
|
97026
|
+
problems: [first, ...rest]
|
|
97027
|
+
}
|
|
97028
|
+
},
|
|
97029
|
+
flagged: true
|
|
97030
|
+
};
|
|
97031
|
+
}
|
|
97032
|
+
/** "Convert to a free automation": the expansion as it is, without the link. */
|
|
97033
|
+
function detachAutomationInstance(recipe) {
|
|
97034
|
+
const { template: _link, ...free } = recipe;
|
|
97035
|
+
return free;
|
|
97036
|
+
}
|
|
97037
|
+
var AUTOMATION_TEMPLATE_EXPORT_FORMAT = "camstack.automation-template";
|
|
97038
|
+
var AutomationTemplateExportSchema = zod.z.object({
|
|
97039
|
+
format: zod.z.literal(AUTOMATION_TEMPLATE_EXPORT_FORMAT),
|
|
97040
|
+
version: zod.z.literal(1),
|
|
97041
|
+
name: zod.z.string().min(1).max(120),
|
|
97042
|
+
payload: AutomationTemplatePayloadSchema
|
|
97043
|
+
});
|
|
97044
|
+
function exportAutomationTemplate(name, payload) {
|
|
97045
|
+
return {
|
|
97046
|
+
format: AUTOMATION_TEMPLATE_EXPORT_FORMAT,
|
|
97047
|
+
version: 1,
|
|
97048
|
+
name,
|
|
97049
|
+
payload
|
|
97050
|
+
};
|
|
97051
|
+
}
|
|
97052
|
+
//#endregion
|
|
95845
97053
|
//#region src/template/template-kinds.ts
|
|
95846
97054
|
/**
|
|
95847
97055
|
* Template kinds (D963). A template is a named, reusable piece of operator
|
|
95848
|
-
* data that more than one device points at —
|
|
95849
|
-
*
|
|
97056
|
+
* data that more than one device points at — the button grid of a remote,
|
|
97057
|
+
* and an automation body with declared inputs (#527). The store is generic: it keeps `{ id, kind, name, payload }` and
|
|
95850
97058
|
* knows nothing of a remote. Only the SYSTEM declares kinds, here: each kind
|
|
95851
97059
|
* names the schema its payload must satisfy. Adding a kind is adding a member
|
|
95852
97060
|
* to `TEMPLATE_KINDS` and a payload schema; the compiler refuses one without
|
|
95853
97061
|
* the other.
|
|
95854
97062
|
*/
|
|
95855
|
-
var TEMPLATE_KINDS = ["remote"];
|
|
97063
|
+
var TEMPLATE_KINDS = ["remote", "automation"];
|
|
95856
97064
|
var TemplateKindSchema = zod.z.enum(TEMPLATE_KINDS);
|
|
95857
|
-
var TEMPLATE_PAYLOAD_SCHEMAS = {
|
|
97065
|
+
var TEMPLATE_PAYLOAD_SCHEMAS = {
|
|
97066
|
+
remote: RemoteLayoutPayloadSchema,
|
|
97067
|
+
automation: AutomationTemplatePayloadSchema
|
|
97068
|
+
};
|
|
95858
97069
|
function isTemplateKind(value) {
|
|
95859
97070
|
return TemplateKindSchema.safeParse(value).success;
|
|
95860
97071
|
}
|
|
@@ -95878,7 +97089,9 @@ function checkTemplatePayload(kind, payload) {
|
|
|
95878
97089
|
* button grid of a remote) and the schema each payload must satisfy are
|
|
95879
97090
|
* declared by the system in `template-kinds.ts`. Nothing here is specific to a
|
|
95880
97091
|
* kind: the engine validates a payload against its kind's schema and, on a
|
|
95881
|
-
* delete, asks the kind's owner whether anything still points at the record
|
|
97092
|
+
* delete, asks the kind's owner whether anything still points at the record
|
|
97093
|
+
* (a device's remote, an automation made from the template). Saving an
|
|
97094
|
+
* `automation` template re-expands every automation made from it (#527).
|
|
95882
97095
|
*
|
|
95883
97096
|
* Every refusal is a typed result — a UI says "unknown kind" or names the
|
|
95884
97097
|
* devices that still use a template, without parsing text.
|
|
@@ -95890,9 +97103,15 @@ var TemplateRecordSchema = zod.z.object({
|
|
|
95890
97103
|
/** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
|
|
95891
97104
|
payload: zod.z.unknown(),
|
|
95892
97105
|
createdAt: zod.z.number(),
|
|
95893
|
-
updatedAt: zod.z.number()
|
|
97106
|
+
updatedAt: zod.z.number(),
|
|
97107
|
+
/** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
|
|
97108
|
+
builtIn: zod.z.literal(true).optional()
|
|
95894
97109
|
});
|
|
95895
|
-
var TEMPLATE_WRITE_REFUSALS = [
|
|
97110
|
+
var TEMPLATE_WRITE_REFUSALS = [
|
|
97111
|
+
"invalid-payload",
|
|
97112
|
+
"not-found",
|
|
97113
|
+
"read-only"
|
|
97114
|
+
];
|
|
95896
97115
|
var TemplateWriteResultSchema = zod.z.discriminatedUnion("status", [zod.z.object({
|
|
95897
97116
|
status: zod.z.literal("saved"),
|
|
95898
97117
|
template: TemplateRecordSchema
|
|
@@ -95906,12 +97125,19 @@ var TemplateUserSchema = zod.z.object({
|
|
|
95906
97125
|
deviceId: zod.z.number().int().nonnegative(),
|
|
95907
97126
|
name: zod.z.string()
|
|
95908
97127
|
});
|
|
97128
|
+
/** An automation made from a template (#527): a core block whose recipe links to it. */
|
|
97129
|
+
var TemplateAutomationUserSchema = zod.z.object({
|
|
97130
|
+
blockId: zod.z.string().min(1),
|
|
97131
|
+
name: zod.z.string()
|
|
97132
|
+
});
|
|
95909
97133
|
var TemplateDeleteResultSchema = zod.z.discriminatedUnion("status", [
|
|
95910
97134
|
zod.z.object({ status: zod.z.literal("deleted") }),
|
|
95911
97135
|
zod.z.object({ status: zod.z.literal("not-found") }),
|
|
97136
|
+
zod.z.object({ status: zod.z.literal("read-only") }),
|
|
95912
97137
|
zod.z.object({
|
|
95913
97138
|
status: zod.z.literal("in-use"),
|
|
95914
|
-
devices: zod.z.array(TemplateUserSchema)
|
|
97139
|
+
devices: zod.z.array(TemplateUserSchema),
|
|
97140
|
+
automations: zod.z.array(TemplateAutomationUserSchema)
|
|
95915
97141
|
})
|
|
95916
97142
|
]);
|
|
95917
97143
|
var templateCapability = {
|
|
@@ -99513,6 +100739,7 @@ var CAPABILITY_NAMES = {
|
|
|
99513
100739
|
doNotDisturb: "do-not-disturb",
|
|
99514
100740
|
doorbell: "doorbell",
|
|
99515
100741
|
embeddingEncoder: "embedding-encoder",
|
|
100742
|
+
energySystem: "energy-system",
|
|
99516
100743
|
enumSensor: "enum-sensor",
|
|
99517
100744
|
eventEmitter: "event-emitter",
|
|
99518
100745
|
faceGallery: "face-gallery",
|
|
@@ -99931,6 +101158,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
99931
101158
|
key: "embeddingEncoder",
|
|
99932
101159
|
name: "embedding-encoder"
|
|
99933
101160
|
},
|
|
101161
|
+
{
|
|
101162
|
+
key: "energySystem",
|
|
101163
|
+
name: "energy-system"
|
|
101164
|
+
},
|
|
99934
101165
|
{
|
|
99935
101166
|
key: "enumSensor",
|
|
99936
101167
|
name: "enum-sensor"
|
|
@@ -100552,6 +101783,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
100552
101783
|
doNotDisturbCapability,
|
|
100553
101784
|
doorbellCapability,
|
|
100554
101785
|
embeddingEncoderCapability,
|
|
101786
|
+
energySystemCapability,
|
|
100555
101787
|
enumSensorCapability,
|
|
100556
101788
|
eventEmitterCapability,
|
|
100557
101789
|
faceGalleryCapability,
|
|
@@ -104010,6 +105242,227 @@ function flipperIrDraft(file, target) {
|
|
|
104010
105242
|
};
|
|
104011
105243
|
}
|
|
104012
105244
|
//#endregion
|
|
105245
|
+
//#region src/template/builtin-automation-templates.ts
|
|
105246
|
+
/**
|
|
105247
|
+
* Automation templates shipped with CamStack (#527). They are read-only records
|
|
105248
|
+
* of the template store: `template.list` returns them beside the operator's
|
|
105249
|
+
* own, under `builtin:` ids, and an update or delete of one is refused. They
|
|
105250
|
+
* are code, not seeded rows, so a new release changes them without a
|
|
105251
|
+
* migration and nothing an operator saved is ever overwritten.
|
|
105252
|
+
*/
|
|
105253
|
+
var BUILTIN_TEMPLATE_ID_PREFIX = "builtin:";
|
|
105254
|
+
var BUILTIN_AUTOMATION_TEMPLATES = [{
|
|
105255
|
+
id: `${BUILTIN_TEMPLATE_ID_PREFIX}buttons-to-devices`,
|
|
105256
|
+
name: "Buttons → devices",
|
|
105257
|
+
payload: {
|
|
105258
|
+
version: 1,
|
|
105259
|
+
description: "Each row: when a button sends an event, run an action on a set of devices.",
|
|
105260
|
+
body: {
|
|
105261
|
+
when: {
|
|
105262
|
+
kind: "any",
|
|
105263
|
+
children: []
|
|
105264
|
+
},
|
|
105265
|
+
actions: [{
|
|
105266
|
+
kind: "choose",
|
|
105267
|
+
branches: []
|
|
105268
|
+
}],
|
|
105269
|
+
runMode: {
|
|
105270
|
+
mode: "queued",
|
|
105271
|
+
max: 5
|
|
105272
|
+
}
|
|
105273
|
+
},
|
|
105274
|
+
inputs: [{
|
|
105275
|
+
kind: "group",
|
|
105276
|
+
key: "buttons",
|
|
105277
|
+
label: "Buttons",
|
|
105278
|
+
maxRows: 6,
|
|
105279
|
+
inputs: [
|
|
105280
|
+
{
|
|
105281
|
+
kind: "device",
|
|
105282
|
+
key: "button",
|
|
105283
|
+
label: "Button",
|
|
105284
|
+
filter: { capability: "event-emitter" }
|
|
105285
|
+
},
|
|
105286
|
+
{
|
|
105287
|
+
kind: "event",
|
|
105288
|
+
key: "event",
|
|
105289
|
+
label: "Event",
|
|
105290
|
+
deviceInput: "button"
|
|
105291
|
+
},
|
|
105292
|
+
{
|
|
105293
|
+
kind: "device",
|
|
105294
|
+
key: "targets",
|
|
105295
|
+
label: "Devices",
|
|
105296
|
+
multiple: true
|
|
105297
|
+
},
|
|
105298
|
+
{
|
|
105299
|
+
kind: "action",
|
|
105300
|
+
key: "action",
|
|
105301
|
+
label: "Action",
|
|
105302
|
+
deviceInput: "targets"
|
|
105303
|
+
}
|
|
105304
|
+
]
|
|
105305
|
+
}],
|
|
105306
|
+
bindings: [{
|
|
105307
|
+
kind: "rows",
|
|
105308
|
+
input: "buttons",
|
|
105309
|
+
path: ["when", "children"],
|
|
105310
|
+
item: { kind: "device-fired" },
|
|
105311
|
+
bindings: [
|
|
105312
|
+
{
|
|
105313
|
+
kind: "row-id",
|
|
105314
|
+
path: ["id"]
|
|
105315
|
+
},
|
|
105316
|
+
{
|
|
105317
|
+
kind: "value",
|
|
105318
|
+
input: "button",
|
|
105319
|
+
path: ["deviceId"]
|
|
105320
|
+
},
|
|
105321
|
+
{
|
|
105322
|
+
kind: "value",
|
|
105323
|
+
input: "event",
|
|
105324
|
+
path: []
|
|
105325
|
+
}
|
|
105326
|
+
]
|
|
105327
|
+
}, {
|
|
105328
|
+
kind: "rows",
|
|
105329
|
+
input: "buttons",
|
|
105330
|
+
path: [
|
|
105331
|
+
"actions",
|
|
105332
|
+
0,
|
|
105333
|
+
"branches"
|
|
105334
|
+
],
|
|
105335
|
+
item: {
|
|
105336
|
+
if: {
|
|
105337
|
+
kind: "triggered-by",
|
|
105338
|
+
leafIds: []
|
|
105339
|
+
},
|
|
105340
|
+
steps: [{ kind: "command" }]
|
|
105341
|
+
},
|
|
105342
|
+
bindings: [
|
|
105343
|
+
{
|
|
105344
|
+
kind: "row-id",
|
|
105345
|
+
path: [
|
|
105346
|
+
"if",
|
|
105347
|
+
"leafIds",
|
|
105348
|
+
0
|
|
105349
|
+
]
|
|
105350
|
+
},
|
|
105351
|
+
{
|
|
105352
|
+
kind: "value",
|
|
105353
|
+
input: "targets",
|
|
105354
|
+
path: [
|
|
105355
|
+
"steps",
|
|
105356
|
+
0,
|
|
105357
|
+
"target"
|
|
105358
|
+
],
|
|
105359
|
+
as: "target"
|
|
105360
|
+
},
|
|
105361
|
+
{
|
|
105362
|
+
kind: "value",
|
|
105363
|
+
input: "action",
|
|
105364
|
+
path: ["steps", 0]
|
|
105365
|
+
}
|
|
105366
|
+
]
|
|
105367
|
+
}]
|
|
105368
|
+
}
|
|
105369
|
+
}, {
|
|
105370
|
+
id: `${BUILTIN_TEMPLATE_ID_PREFIX}motion-light`,
|
|
105371
|
+
name: "Motion → light, off after a delay",
|
|
105372
|
+
payload: {
|
|
105373
|
+
version: 1,
|
|
105374
|
+
description: "Turns lights on when a motion sensor detects motion and off once it has been quiet for the delay. New motion restarts the delay.",
|
|
105375
|
+
body: {
|
|
105376
|
+
when: {
|
|
105377
|
+
kind: "device-becomes",
|
|
105378
|
+
cap: "motion",
|
|
105379
|
+
fieldPath: "detected",
|
|
105380
|
+
becomes: true
|
|
105381
|
+
},
|
|
105382
|
+
actions: [
|
|
105383
|
+
{
|
|
105384
|
+
kind: "command",
|
|
105385
|
+
actionId: "switch.on"
|
|
105386
|
+
},
|
|
105387
|
+
{
|
|
105388
|
+
kind: "wait",
|
|
105389
|
+
seconds: 300
|
|
105390
|
+
},
|
|
105391
|
+
{
|
|
105392
|
+
kind: "command",
|
|
105393
|
+
actionId: "switch.off"
|
|
105394
|
+
}
|
|
105395
|
+
],
|
|
105396
|
+
runMode: { mode: "restart" }
|
|
105397
|
+
},
|
|
105398
|
+
inputs: [
|
|
105399
|
+
{
|
|
105400
|
+
kind: "device",
|
|
105401
|
+
key: "sensor",
|
|
105402
|
+
label: "Motion sensor",
|
|
105403
|
+
filter: { capability: "motion" }
|
|
105404
|
+
},
|
|
105405
|
+
{
|
|
105406
|
+
kind: "device",
|
|
105407
|
+
key: "lights",
|
|
105408
|
+
label: "Lights",
|
|
105409
|
+
multiple: true,
|
|
105410
|
+
filter: { capability: "switch" }
|
|
105411
|
+
},
|
|
105412
|
+
{
|
|
105413
|
+
kind: "duration",
|
|
105414
|
+
key: "delay",
|
|
105415
|
+
label: "Off after (seconds)",
|
|
105416
|
+
min: 10,
|
|
105417
|
+
max: 3600,
|
|
105418
|
+
default: 300
|
|
105419
|
+
}
|
|
105420
|
+
],
|
|
105421
|
+
bindings: [
|
|
105422
|
+
{
|
|
105423
|
+
kind: "value",
|
|
105424
|
+
input: "sensor",
|
|
105425
|
+
path: ["when", "deviceId"]
|
|
105426
|
+
},
|
|
105427
|
+
{
|
|
105428
|
+
kind: "value",
|
|
105429
|
+
input: "lights",
|
|
105430
|
+
path: [
|
|
105431
|
+
"actions",
|
|
105432
|
+
0,
|
|
105433
|
+
"target"
|
|
105434
|
+
],
|
|
105435
|
+
as: "target"
|
|
105436
|
+
},
|
|
105437
|
+
{
|
|
105438
|
+
kind: "value",
|
|
105439
|
+
input: "delay",
|
|
105440
|
+
path: [
|
|
105441
|
+
"actions",
|
|
105442
|
+
1,
|
|
105443
|
+
"seconds"
|
|
105444
|
+
]
|
|
105445
|
+
},
|
|
105446
|
+
{
|
|
105447
|
+
kind: "value",
|
|
105448
|
+
input: "lights",
|
|
105449
|
+
path: [
|
|
105450
|
+
"actions",
|
|
105451
|
+
2,
|
|
105452
|
+
"target"
|
|
105453
|
+
],
|
|
105454
|
+
as: "target"
|
|
105455
|
+
}
|
|
105456
|
+
]
|
|
105457
|
+
}
|
|
105458
|
+
}];
|
|
105459
|
+
function isBuiltinTemplateId(id) {
|
|
105460
|
+
return id.startsWith(BUILTIN_TEMPLATE_ID_PREFIX);
|
|
105461
|
+
}
|
|
105462
|
+
function builtinAutomationTemplate(id) {
|
|
105463
|
+
return BUILTIN_AUTOMATION_TEMPLATES.find((t) => t.id === id);
|
|
105464
|
+
}
|
|
105465
|
+
//#endregion
|
|
104013
105466
|
//#region src/running-state/from-operation.ts
|
|
104014
105467
|
function programStartFromRemaining(running, remainingSeconds, fetchedAt) {
|
|
104015
105468
|
if (!running || remainingSeconds === null || remainingSeconds === void 0) return null;
|
|
@@ -107956,6 +109409,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
107956
109409
|
dishwasher: dishwasherCapability,
|
|
107957
109410
|
doNotDisturb: doNotDisturbCapability,
|
|
107958
109411
|
doorbell: doorbellCapability,
|
|
109412
|
+
energySystem: energySystemCapability,
|
|
107959
109413
|
enumSensor: enumSensorCapability,
|
|
107960
109414
|
eventEmitter: eventEmitterCapability,
|
|
107961
109415
|
fanControl: fanControlCapability,
|
|
@@ -110089,6 +111543,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
|
|
|
110089
111543
|
[require_composed_stable_id.DeviceType.Humidifier]: "humidifier",
|
|
110090
111544
|
[require_composed_stable_id.DeviceType.WaterHeater]: "water-heater",
|
|
110091
111545
|
[require_composed_stable_id.DeviceType.HeatPump]: "dummy",
|
|
111546
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "energy-system",
|
|
110092
111547
|
[require_composed_stable_id.DeviceType.Camera]: "dummy",
|
|
110093
111548
|
[require_composed_stable_id.DeviceType.Hub]: "dummy",
|
|
110094
111549
|
[require_composed_stable_id.DeviceType.Switch]: "switch",
|
|
@@ -113125,6 +114580,7 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
113125
114580
|
[require_composed_stable_id.DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
|
|
113126
114581
|
[require_composed_stable_id.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
113127
114582
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
|
|
114583
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LAYOUT_DEFAULT,
|
|
113128
114584
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LAYOUT,
|
|
113129
114585
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
113130
114586
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
@@ -113850,6 +115306,7 @@ var HERO_LOOK_BY_TYPE = {
|
|
|
113850
115306
|
[require_composed_stable_id.DeviceType.Humidifier]: HUMIDIFIER_LOOK,
|
|
113851
115307
|
[require_composed_stable_id.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
113852
115308
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
|
|
115309
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LOOK_DEFAULT,
|
|
113853
115310
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LOOK,
|
|
113854
115311
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
113855
115312
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
@@ -114299,6 +115756,7 @@ var HERO_CAP_COVERAGE = {
|
|
|
114299
115756
|
"group-commands": "contributes",
|
|
114300
115757
|
"group-status": "contributes",
|
|
114301
115758
|
"heat-pump-status": "contributes",
|
|
115759
|
+
"energy-system": { none: "drawn by the energy-system device card (the energy-flow scene), which replaces the hero on the device page" },
|
|
114302
115760
|
"heating-valve": "contributes",
|
|
114303
115761
|
humidifier: "contributes",
|
|
114304
115762
|
"humidity-sensor": "contributes",
|
|
@@ -117626,6 +119084,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
117626
119084
|
access: "delete",
|
|
117627
119085
|
role: "admin"
|
|
117628
119086
|
},
|
|
119087
|
+
"energySystem.getStatus": {
|
|
119088
|
+
capName: "energy-system",
|
|
119089
|
+
capScope: "device",
|
|
119090
|
+
addonId: null,
|
|
119091
|
+
access: "view",
|
|
119092
|
+
role: "viewer"
|
|
119093
|
+
},
|
|
117629
119094
|
"enumSensor.getStatus": {
|
|
117630
119095
|
capName: "enum-sensor",
|
|
117631
119096
|
capScope: "device",
|
|
@@ -123667,6 +125132,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
123667
125132
|
access: "create",
|
|
123668
125133
|
role: "viewer"
|
|
123669
125134
|
},
|
|
125135
|
+
"switch.toggle": {
|
|
125136
|
+
capName: "switch",
|
|
125137
|
+
capScope: "device",
|
|
125138
|
+
addonId: null,
|
|
125139
|
+
access: "create",
|
|
125140
|
+
role: "viewer"
|
|
125141
|
+
},
|
|
123670
125142
|
"system.debugWatch": {
|
|
123671
125143
|
capName: "system",
|
|
123672
125144
|
capScope: "system",
|
|
@@ -124846,6 +126318,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
124846
126318
|
"do-not-disturb",
|
|
124847
126319
|
"doorbell",
|
|
124848
126320
|
"embedding-encoder",
|
|
126321
|
+
"energy-system",
|
|
124849
126322
|
"enum-sensor",
|
|
124850
126323
|
"event-emitter",
|
|
124851
126324
|
"face-gallery",
|
|
@@ -125018,6 +126491,7 @@ var DEVICE_CAP_NAMES = [
|
|
|
125018
126491
|
"dishwasher",
|
|
125019
126492
|
"do-not-disturb",
|
|
125020
126493
|
"doorbell",
|
|
126494
|
+
"energy-system",
|
|
125021
126495
|
"enum-sensor",
|
|
125022
126496
|
"event-emitter",
|
|
125023
126497
|
"fan-control",
|
|
@@ -125316,6 +126790,16 @@ function actionsForDevice(bindings, deviceType, role) {
|
|
|
125316
126790
|
}
|
|
125317
126791
|
return out;
|
|
125318
126792
|
}
|
|
126793
|
+
/**
|
|
126794
|
+
* Whether a device offers the vocabulary actions, with the same `any` / `all`
|
|
126795
|
+
* rule a cap require uses. An empty list passes. This is the one check the
|
|
126796
|
+
* device search and the command picker share.
|
|
126797
|
+
*/
|
|
126798
|
+
function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
|
|
126799
|
+
if (actionIds.length === 0) return true;
|
|
126800
|
+
const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
|
|
126801
|
+
return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
|
|
126802
|
+
}
|
|
125319
126803
|
function resolveEnumValue(v) {
|
|
125320
126804
|
const phrase = v.phrase ?? fill(BECOMES, {
|
|
125321
126805
|
en: { value: v.label.en },
|
|
@@ -125748,6 +127232,7 @@ var DEVICE_TYPE_ICON = {
|
|
|
125748
127232
|
[require_composed_stable_id.DeviceType.Sensor]: "activity",
|
|
125749
127233
|
[require_composed_stable_id.DeviceType.Climate]: "thermometer",
|
|
125750
127234
|
[require_composed_stable_id.DeviceType.HeatPump]: "flame",
|
|
127235
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "solar-panel",
|
|
125751
127236
|
[require_composed_stable_id.DeviceType.Button]: "circle-dot",
|
|
125752
127237
|
[require_composed_stable_id.DeviceType.EventEmitter]: "zap",
|
|
125753
127238
|
[require_composed_stable_id.DeviceType.Update]: "refresh-cw",
|
|
@@ -127134,6 +128619,7 @@ var CAP_NAMES_WITH_STATUS = [
|
|
|
127134
128619
|
"dishwasher",
|
|
127135
128620
|
"do-not-disturb",
|
|
127136
128621
|
"doorbell",
|
|
128622
|
+
"energy-system",
|
|
127137
128623
|
"enum-sensor",
|
|
127138
128624
|
"event-emitter",
|
|
127139
128625
|
"fan-control",
|
|
@@ -128149,6 +129635,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
128149
129635
|
form: "single",
|
|
128150
129636
|
optional: false
|
|
128151
129637
|
}],
|
|
129638
|
+
"energySystem.getStatus": [{
|
|
129639
|
+
name: "deviceId",
|
|
129640
|
+
form: "single",
|
|
129641
|
+
optional: false
|
|
129642
|
+
}],
|
|
128152
129643
|
"enumSensor.getStatus": [{
|
|
128153
129644
|
name: "deviceId",
|
|
128154
129645
|
form: "single",
|
|
@@ -129848,6 +131339,12 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
129848
131339
|
form: "single",
|
|
129849
131340
|
optional: false
|
|
129850
131341
|
}],
|
|
131342
|
+
"smtpProvider.sendEmail": [{
|
|
131343
|
+
name: "images",
|
|
131344
|
+
form: "object-array",
|
|
131345
|
+
optional: true,
|
|
131346
|
+
itemField: "deviceId"
|
|
131347
|
+
}],
|
|
129851
131348
|
"snapshot.applyDeviceSettingsPatch": [{
|
|
129852
131349
|
name: "deviceId",
|
|
129853
131350
|
form: "single",
|
|
@@ -130014,6 +131511,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
130014
131511
|
form: "single",
|
|
130015
131512
|
optional: false
|
|
130016
131513
|
}],
|
|
131514
|
+
"switch.toggle": [{
|
|
131515
|
+
name: "deviceId",
|
|
131516
|
+
form: "single",
|
|
131517
|
+
optional: false
|
|
131518
|
+
}],
|
|
130017
131519
|
"system.debugWatch": [{
|
|
130018
131520
|
name: "deviceIds",
|
|
130019
131521
|
form: "array",
|
|
@@ -130475,6 +131977,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
|
|
|
130475
131977
|
"remote.sendCommand",
|
|
130476
131978
|
"remote.sendMediaCommand",
|
|
130477
131979
|
"remote.setConfig",
|
|
131980
|
+
"smtpProvider.sendEmail",
|
|
130478
131981
|
"storageAdmin.readRecords",
|
|
130479
131982
|
"streamBroker.acquireEgressTranscode",
|
|
130480
131983
|
"streamBroker.applyDeviceSettingsPatch",
|
|
@@ -130530,7 +132033,7 @@ function getCapsByProviderKind(kind) {
|
|
|
130530
132033
|
//#region src/generated/runtime-state-durability.ts
|
|
130531
132034
|
/**
|
|
130532
132035
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
130533
|
-
* `runtimeState`.
|
|
132036
|
+
* `runtimeState`. 83 caps: 42 `restored`, 41 `session`.
|
|
130534
132037
|
*
|
|
130535
132038
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
130536
132039
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -130625,6 +132128,10 @@ var RUNTIME_STATE_POLICY = {
|
|
|
130625
132128
|
durability: "restored",
|
|
130626
132129
|
volatileFields: []
|
|
130627
132130
|
},
|
|
132131
|
+
"energy-system": {
|
|
132132
|
+
durability: "session",
|
|
132133
|
+
volatileFields: ["lastFetchedAt"]
|
|
132134
|
+
},
|
|
130628
132135
|
"enum-sensor": {
|
|
130629
132136
|
durability: "restored",
|
|
130630
132137
|
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
@@ -133090,12 +134597,92 @@ function prepareNotification(caps, n) {
|
|
|
133090
134597
|
sound,
|
|
133091
134598
|
ttl,
|
|
133092
134599
|
tag,
|
|
134600
|
+
...n.deviceId !== void 0 ? { deviceId: n.deviceId } : {},
|
|
133093
134601
|
...n.delivery !== void 0 ? { delivery: n.delivery } : {},
|
|
133094
134602
|
bodyParts,
|
|
133095
134603
|
renderedAs
|
|
133096
134604
|
};
|
|
133097
134605
|
}
|
|
133098
134606
|
//#endregion
|
|
134607
|
+
//#region src/notification/email-image-bytes.ts
|
|
134608
|
+
function asBytes(chunk) {
|
|
134609
|
+
if (chunk instanceof Uint8Array) return chunk;
|
|
134610
|
+
if (typeof chunk === "string") return Buffer.from(chunk);
|
|
134611
|
+
throw new Error("email image: unexpected stream chunk");
|
|
134612
|
+
}
|
|
134613
|
+
async function readBody(opened, maxBytes) {
|
|
134614
|
+
if (opened.declaredBytes !== null && opened.declaredBytes > maxBytes) {
|
|
134615
|
+
opened.cancel("email image over cap");
|
|
134616
|
+
throw new Error(`attachment exceeds maxBytes (${opened.declaredBytes} > ${maxBytes})`);
|
|
134617
|
+
}
|
|
134618
|
+
const chunks = [];
|
|
134619
|
+
let total = 0;
|
|
134620
|
+
for await (const chunk of opened.stream) {
|
|
134621
|
+
const bytes = asBytes(chunk);
|
|
134622
|
+
total += bytes.byteLength;
|
|
134623
|
+
if (total > maxBytes) {
|
|
134624
|
+
opened.cancel("email image over cap");
|
|
134625
|
+
throw new Error(`attachment exceeds maxBytes (>${maxBytes})`);
|
|
134626
|
+
}
|
|
134627
|
+
chunks.push(bytes);
|
|
134628
|
+
}
|
|
134629
|
+
if (total === 0) throw new Error("email image was empty");
|
|
134630
|
+
const out = new Uint8Array(total);
|
|
134631
|
+
let offset = 0;
|
|
134632
|
+
for (const chunk of chunks) {
|
|
134633
|
+
out.set(chunk, offset);
|
|
134634
|
+
offset += chunk.byteLength;
|
|
134635
|
+
}
|
|
134636
|
+
return out;
|
|
134637
|
+
}
|
|
134638
|
+
async function readTicket(open, ticket, maxBytes) {
|
|
134639
|
+
const opened = await open(ticket);
|
|
134640
|
+
if (opened.kind === "refused") throw new Error(`email image unavailable: ${opened.code}`);
|
|
134641
|
+
return readBody(opened.body, maxBytes);
|
|
134642
|
+
}
|
|
134643
|
+
/** The images that fit. Each failure is handed to `onDropped` and skipped. */
|
|
134644
|
+
async function materializeEmailImages(images, open, onDropped) {
|
|
134645
|
+
if (images === void 0 || images.length === 0) return [];
|
|
134646
|
+
const out = [];
|
|
134647
|
+
let used = 0;
|
|
134648
|
+
for (const image of images) {
|
|
134649
|
+
const room = EMAIL_IMAGE_MAX_TOTAL_BYTES - used;
|
|
134650
|
+
if (room <= 0) {
|
|
134651
|
+
onDropped("attachment exceeds maxBytes (total cap)", image.deviceId);
|
|
134652
|
+
continue;
|
|
134653
|
+
}
|
|
134654
|
+
try {
|
|
134655
|
+
const bytes = await readTicket(open, image.ticket, room);
|
|
134656
|
+
used += bytes.byteLength;
|
|
134657
|
+
out.push({
|
|
134658
|
+
bytes,
|
|
134659
|
+
mime: image.mime,
|
|
134660
|
+
name: image.name,
|
|
134661
|
+
contentId: image.contentId,
|
|
134662
|
+
placement: image.placement
|
|
134663
|
+
});
|
|
134664
|
+
} catch (err) {
|
|
134665
|
+
onDropped(err instanceof Error ? err.message : String(err), image.deviceId);
|
|
134666
|
+
}
|
|
134667
|
+
}
|
|
134668
|
+
return out;
|
|
134669
|
+
}
|
|
134670
|
+
/** Tickets in, one MIME body out. The same call for Gmail and SMTP. */
|
|
134671
|
+
async function assembleEmailMime(input, open, onDropped) {
|
|
134672
|
+
const images = await materializeEmailImages(input.images, open, onDropped);
|
|
134673
|
+
return buildRawMime({
|
|
134674
|
+
from: input.from,
|
|
134675
|
+
to: input.to,
|
|
134676
|
+
subject: input.subject,
|
|
134677
|
+
text: input.text,
|
|
134678
|
+
...input.cc !== void 0 ? { cc: input.cc } : {},
|
|
134679
|
+
...input.bcc !== void 0 ? { bcc: input.bcc } : {},
|
|
134680
|
+
...input.replyTo !== void 0 ? { replyTo: input.replyTo } : {},
|
|
134681
|
+
...input.html !== void 0 ? { html: input.html } : {},
|
|
134682
|
+
...images.length > 0 ? { images } : {}
|
|
134683
|
+
});
|
|
134684
|
+
}
|
|
134685
|
+
//#endregion
|
|
133099
134686
|
//#region src/notification/attachment-url.ts
|
|
133100
134687
|
/** Build a {@link PublicEndpointReader} over `local-network.getAddresses`. */
|
|
133101
134688
|
function publicEndpointReaderFrom(source) {
|
|
@@ -135742,6 +137329,28 @@ var STATE_SUMMARY_VARS = [
|
|
|
135742
137329
|
systemEventKinds: [...SUMMARISABLE],
|
|
135743
137330
|
systemEventDeliveries: ["summary"]
|
|
135744
137331
|
},
|
|
137332
|
+
{
|
|
137333
|
+
name: "offlineCount",
|
|
137334
|
+
label: "Summary: how many went offline",
|
|
137335
|
+
example: "2",
|
|
137336
|
+
group: "system",
|
|
137337
|
+
families: ["rule"],
|
|
137338
|
+
fields: [...RULE_TEXT],
|
|
137339
|
+
kinds: ["system"],
|
|
137340
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
137341
|
+
systemEventDeliveries: ["summary"]
|
|
137342
|
+
},
|
|
137343
|
+
{
|
|
137344
|
+
name: "onlineCount",
|
|
137345
|
+
label: "Summary: how many came back",
|
|
137346
|
+
example: "5",
|
|
137347
|
+
group: "system",
|
|
137348
|
+
families: ["rule"],
|
|
137349
|
+
fields: [...RULE_TEXT],
|
|
137350
|
+
kinds: ["system"],
|
|
137351
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
137352
|
+
systemEventDeliveries: ["summary"]
|
|
137353
|
+
},
|
|
135745
137354
|
{
|
|
135746
137355
|
name: "summaryCount",
|
|
135747
137356
|
label: "Summary: items reported",
|
|
@@ -135832,6 +137441,21 @@ var NC_TEMPLATE_VARS = [
|
|
|
135832
137441
|
kinds: ["detection", "system"],
|
|
135833
137442
|
systemEventKinds: [...COMBINED_ALARM]
|
|
135834
137443
|
},
|
|
137444
|
+
{
|
|
137445
|
+
name: "headline",
|
|
137446
|
+
label: "Subject and place",
|
|
137447
|
+
description: "The default detection title: the label when one is set, otherwise the translated class, then the zone or the device. The subject alone when neither place is known.",
|
|
137448
|
+
example: "Persona — Uscio",
|
|
137449
|
+
group: "subject",
|
|
137450
|
+
families: ["rule"],
|
|
137451
|
+
fields: [...RULE_TEXT],
|
|
137452
|
+
kinds: [
|
|
137453
|
+
"detection",
|
|
137454
|
+
"occupancy",
|
|
137455
|
+
"sound",
|
|
137456
|
+
"sensor"
|
|
137457
|
+
]
|
|
137458
|
+
},
|
|
135835
137459
|
{
|
|
135836
137460
|
name: "subject",
|
|
135837
137461
|
label: "Subject sentence",
|
|
@@ -136126,7 +137750,7 @@ var NC_TEMPLATE_VARS = [
|
|
|
136126
137750
|
families: ["rule"],
|
|
136127
137751
|
fields: [...RULE_TEXT],
|
|
136128
137752
|
kinds: ["system"],
|
|
136129
|
-
systemEventKinds: ["device-command"]
|
|
137753
|
+
systemEventKinds: ["device-command", "alarm-disarmed"]
|
|
136130
137754
|
},
|
|
136131
137755
|
{
|
|
136132
137756
|
name: "deviceLabel",
|
|
@@ -144305,6 +145929,9 @@ exports.AUTOMATIC_HUB_ADDRESS_FLAGS = AUTOMATIC_HUB_ADDRESS_FLAGS;
|
|
|
144305
145929
|
exports.AUTOMATION_LEAF_CATALOG = AUTOMATION_LEAF_CATALOG;
|
|
144306
145930
|
exports.AUTOMATION_LEAF_CATEGORIES = AUTOMATION_LEAF_CATEGORIES;
|
|
144307
145931
|
exports.AUTOMATION_LEAF_KINDS = AUTOMATION_LEAF_KINDS;
|
|
145932
|
+
exports.AUTOMATION_RECIPE_DECLARATION = AUTOMATION_RECIPE_DECLARATION;
|
|
145933
|
+
exports.AUTOMATION_TEMPLATE_EXPORT_FORMAT = AUTOMATION_TEMPLATE_EXPORT_FORMAT;
|
|
145934
|
+
exports.AUTOMATION_TEMPLATE_VERSION = AUTOMATION_TEMPLATE_VERSION;
|
|
144308
145935
|
exports.AUTO_SHARE_HEADROOM = AUTO_SHARE_HEADROOM;
|
|
144309
145936
|
exports.AUTO_TUNE_FAMILY = AUTO_TUNE_FAMILY;
|
|
144310
145937
|
exports.AcceleratorComputeSchema = AcceleratorComputeSchema;
|
|
@@ -144429,6 +146056,9 @@ exports.AutomationSetStepSchema = AutomationSetStepSchema;
|
|
|
144429
146056
|
exports.AutomationStateDocSchema = AutomationStateDocSchema;
|
|
144430
146057
|
exports.AutomationStepTraceSchema = AutomationStepTraceSchema;
|
|
144431
146058
|
exports.AutomationStopStepSchema = AutomationStopStepSchema;
|
|
146059
|
+
exports.AutomationTemplateExportSchema = AutomationTemplateExportSchema;
|
|
146060
|
+
exports.AutomationTemplateLinkSchema = AutomationTemplateLinkSchema;
|
|
146061
|
+
exports.AutomationTemplatePayloadSchema = AutomationTemplatePayloadSchema;
|
|
144432
146062
|
exports.AutomationTriggerTraceSchema = AutomationTriggerTraceSchema;
|
|
144433
146063
|
exports.AutomationWaitStepSchema = AutomationWaitStepSchema;
|
|
144434
146064
|
exports.AutomationWaitUntilStepSchema = AutomationWaitUntilStepSchema;
|
|
@@ -144442,8 +146072,10 @@ exports.BENCH_ROOT_STEP_ID = BENCH_ROOT_STEP_ID;
|
|
|
144442
146072
|
exports.BINARY_AGGREGATES = require_implemented_methods.BINARY_AGGREGATES;
|
|
144443
146073
|
exports.BIRTH_DECISION_DEFAULT_LIMIT = BIRTH_DECISION_DEFAULT_LIMIT;
|
|
144444
146074
|
exports.BOOT_RECOVERY_BACKOFF_MS = require_sleep.BOOT_RECOVERY_BACKOFF_MS;
|
|
146075
|
+
exports.BUILTIN_AUTOMATION_TEMPLATES = BUILTIN_AUTOMATION_TEMPLATES;
|
|
144445
146076
|
exports.BUILTIN_REMOTE_COMPONENTS = BUILTIN_REMOTE_COMPONENTS;
|
|
144446
146077
|
exports.BUILTIN_RESULT_KINDS = BUILTIN_RESULT_KINDS;
|
|
146078
|
+
exports.BUILTIN_TEMPLATE_ID_PREFIX = BUILTIN_TEMPLATE_ID_PREFIX;
|
|
144447
146079
|
exports.BackgroundRunRegistry = BackgroundRunRegistry;
|
|
144448
146080
|
exports.BacklightModeSchema = BacklightModeSchema;
|
|
144449
146081
|
exports.BackupArchiveEncryptionSchema = BackupArchiveEncryptionSchema;
|
|
@@ -144999,6 +146631,9 @@ exports.DoorbellStatusSchema = DoorbellStatusSchema;
|
|
|
144999
146631
|
exports.DraftKindSchema = DraftKindSchema;
|
|
145000
146632
|
exports.DraftSiteDeviceSchema = DraftSiteDeviceSchema;
|
|
145001
146633
|
exports.DraftSiteSchema = DraftSiteSchema;
|
|
146634
|
+
exports.EMAIL_IMAGE_MAX_COUNT = EMAIL_IMAGE_MAX_COUNT;
|
|
146635
|
+
exports.EMAIL_IMAGE_MAX_TOTAL_BYTES = EMAIL_IMAGE_MAX_TOTAL_BYTES;
|
|
146636
|
+
exports.EMAIL_IMAGE_SLOT = EMAIL_IMAGE_SLOT;
|
|
145002
146637
|
exports.EMBEDDING_MODEL_FAILED = EMBEDDING_MODEL_FAILED;
|
|
145003
146638
|
exports.EMBEDDING_REQUIREMENTS_FAILED = EMBEDDING_REQUIREMENTS_FAILED;
|
|
145004
146639
|
exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
|
|
@@ -145041,6 +146676,7 @@ exports.EgressRateControlSchema = EgressRateControlSchema;
|
|
|
145041
146676
|
exports.EgressTranscodeRequestSchema = EgressTranscodeRequestSchema;
|
|
145042
146677
|
exports.EgressTranscodeSchema = EgressTranscodeSchema;
|
|
145043
146678
|
exports.ElementConfigStore = ElementConfigStore;
|
|
146679
|
+
exports.EmailImagePartSchema = EmailImagePartSchema;
|
|
145044
146680
|
exports.EmbeddingFailedModelSchema = EmbeddingFailedModelSchema;
|
|
145045
146681
|
exports.EmbeddingFailedRequirementSchema = EmbeddingFailedRequirementSchema;
|
|
145046
146682
|
exports.EmbeddingInfoSchema = EmbeddingInfoSchema;
|
|
@@ -145048,6 +146684,11 @@ exports.EmbeddingRefusalCodeSchema = EmbeddingRefusalCodeSchema;
|
|
|
145048
146684
|
exports.EmbeddingResultSchema = EmbeddingResultSchema;
|
|
145049
146685
|
exports.EmbeddingTowerSchema = EmbeddingTowerSchema;
|
|
145050
146686
|
exports.EncodeProfileSchema = EncodeProfileSchema;
|
|
146687
|
+
exports.EnergyConsumerSchema = EnergyConsumerSchema;
|
|
146688
|
+
exports.EnergyGridSchema = EnergyGridSchema;
|
|
146689
|
+
exports.EnergySolarSchema = EnergySolarSchema;
|
|
146690
|
+
exports.EnergyStorageSchema = EnergyStorageSchema;
|
|
146691
|
+
exports.EnergySystemStatusSchema = EnergySystemStatusSchema;
|
|
145051
146692
|
exports.EnrichedWidgetMetadataSchema = EnrichedWidgetMetadataSchema;
|
|
145052
146693
|
exports.EnrollSelfInputSchema = EnrollSelfInputSchema;
|
|
145053
146694
|
exports.EntryDescriptorSchema = require_sleep.EntryDescriptorSchema;
|
|
@@ -146607,6 +148248,9 @@ exports.SystemHeldSecretNameSchema = SystemHeldSecretNameSchema;
|
|
|
146607
148248
|
exports.SystemMetricsSchema = SystemMetricsSchema;
|
|
146608
148249
|
exports.SystemMirror = SystemMirror;
|
|
146609
148250
|
exports.TARGET_OWNER_KEY = TARGET_OWNER_KEY;
|
|
148251
|
+
exports.TEMPLATE_GROUP_ROWS_MAX = TEMPLATE_GROUP_ROWS_MAX;
|
|
148252
|
+
exports.TEMPLATE_INPUT_KEY_RE = TEMPLATE_INPUT_KEY_RE;
|
|
148253
|
+
exports.TEMPLATE_INSTANCE_PROBLEM_CODES = TEMPLATE_INSTANCE_PROBLEM_CODES;
|
|
146610
148254
|
exports.TEMPLATE_KINDS = TEMPLATE_KINDS;
|
|
146611
148255
|
exports.TEMPLATE_PAYLOAD_SCHEMAS = TEMPLATE_PAYLOAD_SCHEMAS;
|
|
146612
148256
|
exports.TEMPLATE_WRITE_REFUSALS = TEMPLATE_WRITE_REFUSALS;
|
|
@@ -146630,10 +148274,28 @@ exports.TargetKindSchema = TargetKindSchema;
|
|
|
146630
148274
|
exports.TargetKindTextCapsSchema = TargetKindTextCapsSchema;
|
|
146631
148275
|
exports.TargetSchema = TargetSchema;
|
|
146632
148276
|
exports.TemperatureSensorStatusSchema = TemperatureSensorStatusSchema;
|
|
148277
|
+
exports.TemplateActionValueSchema = TemplateActionValueSchema;
|
|
148278
|
+
exports.TemplateAutomationUserSchema = TemplateAutomationUserSchema;
|
|
148279
|
+
exports.TemplateBindingSchema = TemplateBindingSchema;
|
|
146633
148280
|
exports.TemplateDeleteResultSchema = TemplateDeleteResultSchema;
|
|
148281
|
+
exports.TemplateDeviceFilterSchema = TemplateDeviceFilterSchema;
|
|
148282
|
+
exports.TemplateEventValueSchema = TemplateEventValueSchema;
|
|
148283
|
+
exports.TemplateGroupRowSchema = TemplateGroupRowSchema;
|
|
148284
|
+
exports.TemplateInputSchema = TemplateInputSchema;
|
|
148285
|
+
exports.TemplateInputValueSchema = TemplateInputValueSchema;
|
|
148286
|
+
exports.TemplateInputValuesSchema = TemplateInputValuesSchema;
|
|
148287
|
+
exports.TemplateInstanceProblemSchema = TemplateInstanceProblemSchema;
|
|
146634
148288
|
exports.TemplateKindSchema = TemplateKindSchema;
|
|
148289
|
+
exports.TemplatePathSchema = TemplatePathSchema;
|
|
146635
148290
|
exports.TemplateRecordSchema = TemplateRecordSchema;
|
|
148291
|
+
exports.TemplateRowIdBindingSchema = TemplateRowIdBindingSchema;
|
|
148292
|
+
exports.TemplateRowItemBindingSchema = TemplateRowItemBindingSchema;
|
|
148293
|
+
exports.TemplateRowsBindingSchema = TemplateRowsBindingSchema;
|
|
148294
|
+
exports.TemplateScalarInputSchema = TemplateScalarInputSchema;
|
|
148295
|
+
exports.TemplateScalarValueSchema = TemplateScalarValueSchema;
|
|
148296
|
+
exports.TemplateSelectOptionSchema = TemplateSelectOptionSchema;
|
|
146636
148297
|
exports.TemplateUserSchema = TemplateUserSchema;
|
|
148298
|
+
exports.TemplateValueBindingSchema = TemplateValueBindingSchema;
|
|
146637
148299
|
exports.TemplateWriteResultSchema = TemplateWriteResultSchema;
|
|
146638
148300
|
exports.TerminalInstanceInfoSchema = TerminalInstanceInfoSchema;
|
|
146639
148301
|
exports.TerminalLegacyCameraSchema = TerminalLegacyCameraSchema;
|
|
@@ -146896,6 +148558,7 @@ exports.asJsonObject = require_sleep.asJsonObject;
|
|
|
146896
148558
|
exports.asNumber = require_sleep.asNumber;
|
|
146897
148559
|
exports.asRecordsError = require_sleep.asRecordsError;
|
|
146898
148560
|
exports.asString = require_sleep.asString;
|
|
148561
|
+
exports.assembleEmailMime = assembleEmailMime;
|
|
146899
148562
|
exports.assertDeviceOffers = require_sleep.assertDeviceOffers;
|
|
146900
148563
|
exports.assertInstanceUnused = assertInstanceUnused;
|
|
146901
148564
|
exports.assertOwnExportInstance = assertOwnExportInstance;
|
|
@@ -146954,6 +148617,7 @@ exports.buildNcTaxonomy = buildNcTaxonomy;
|
|
|
146954
148617
|
exports.buildNotificationTargetInstances = buildNotificationTargetInstances;
|
|
146955
148618
|
exports.buildPlusCatalogClassMap = buildPlusCatalogClassMap;
|
|
146956
148619
|
exports.buildPowerSwitch = buildPowerSwitch;
|
|
148620
|
+
exports.buildRawMime = buildRawMime;
|
|
146957
148621
|
exports.buildRepairPrompt = buildRepairPrompt;
|
|
146958
148622
|
exports.buildRoleScopes = buildRoleScopes;
|
|
146959
148623
|
exports.buildSecretRef = require_sleep.buildSecretRef;
|
|
@@ -146967,6 +148631,7 @@ exports.buildVideoArgs = require_implemented_methods.buildVideoArgs;
|
|
|
146967
148631
|
exports.buildViewerLink = buildViewerLink;
|
|
146968
148632
|
exports.buildVocabularySlice = buildVocabularySlice;
|
|
146969
148633
|
exports.builtCapabilityBlockers = builtCapabilityBlockers;
|
|
148634
|
+
exports.builtinAutomationTemplate = builtinAutomationTemplate;
|
|
146970
148635
|
exports.builtinRemoteComponent = builtinRemoteComponent;
|
|
146971
148636
|
exports.bundledCamstack = bundledCamstack;
|
|
146972
148637
|
exports.buttonCapability = buttonCapability;
|
|
@@ -147197,6 +148862,7 @@ exports.describeSystemEventDeliveryProblem = describeSystemEventDeliveryProblem;
|
|
|
147197
148862
|
exports.describeSystemEventFamilyProblem = describeSystemEventFamilyProblem;
|
|
147198
148863
|
exports.describeTopLevelStateFields = describeTopLevelStateFields;
|
|
147199
148864
|
exports.describeUnmet = describeUnmet;
|
|
148865
|
+
exports.detachAutomationInstance = detachAutomationInstance;
|
|
147200
148866
|
exports.detectAccessRole = detectAccessRole;
|
|
147201
148867
|
exports.detectionClassMatches = detectionClassMatches;
|
|
147202
148868
|
exports.detectionPipelineCapability = detectionPipelineCapability;
|
|
@@ -147213,6 +148879,7 @@ exports.deviceHistoryCapability = deviceHistoryCapability;
|
|
|
147213
148879
|
exports.deviceIconKey = deviceIconKey;
|
|
147214
148880
|
exports.deviceManagerCapability = deviceManagerCapability;
|
|
147215
148881
|
exports.deviceMatchesProfile = deviceMatchesProfile;
|
|
148882
|
+
exports.deviceOffersActions = deviceOffersActions;
|
|
147216
148883
|
exports.deviceOpsCapability = require_sleep.deviceOpsCapability;
|
|
147217
148884
|
exports.deviceProviderCapability = deviceProviderCapability;
|
|
147218
148885
|
exports.deviceRefusalFromMessage = deviceRefusalFromMessage;
|
|
@@ -147256,6 +148923,8 @@ exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
|
147256
148923
|
exports.encodeSamsung = encodeSamsung;
|
|
147257
148924
|
exports.encodeTuya = encodeTuya;
|
|
147258
148925
|
exports.encodeVectorBase64 = encodeVectorBase64;
|
|
148926
|
+
exports.energySystemCapability = energySystemCapability;
|
|
148927
|
+
exports.energySystemSelfConsumptionPct = energySystemSelfConsumptionPct;
|
|
147259
148928
|
exports.ensureAlarmProfiles = ensureAlarmProfiles;
|
|
147260
148929
|
exports.entryBody = require_sleep.entryBody;
|
|
147261
148930
|
exports.enumSensorCapability = enumSensorCapability;
|
|
@@ -147290,9 +148959,11 @@ exports.eventTypesOfVocabulary = eventTypesOfVocabulary;
|
|
|
147290
148959
|
exports.evictionPolicyForMode = evictionPolicyForMode;
|
|
147291
148960
|
exports.evictionPolicyOfLocation = evictionPolicyOfLocation;
|
|
147292
148961
|
exports.expandAudioChunkToF32le = require_sleep.expandAudioChunkToF32le;
|
|
148962
|
+
exports.expandAutomationTemplate = expandAutomationTemplate;
|
|
147293
148963
|
exports.expandCapMethods = require_sleep.expandCapMethods;
|
|
147294
148964
|
exports.expandContainer = expandContainer;
|
|
147295
148965
|
exports.expandSystemEventClasses = expandSystemEventClasses;
|
|
148966
|
+
exports.exportAutomationTemplate = exportAutomationTemplate;
|
|
147296
148967
|
exports.exportSubjectOf = exportSubjectOf;
|
|
147297
148968
|
exports.exposeBlockDevices = exposeBlockDevices;
|
|
147298
148969
|
exports.exposedNamePatch = exposedNamePatch;
|
|
@@ -147330,6 +149001,7 @@ exports.findCandidateCycles = findCandidateCycles;
|
|
|
147330
149001
|
exports.findChannelSource = findChannelSource;
|
|
147331
149002
|
exports.findCompositionCycles = findCompositionCycles;
|
|
147332
149003
|
exports.findMigrationsBlocked = require_sleep.findMigrationsBlocked;
|
|
149004
|
+
exports.findRecipeLiteralJson = findRecipeLiteralJson;
|
|
147333
149005
|
exports.findTimezone = findTimezone;
|
|
147334
149006
|
exports.findVocabAction = require_sleep.findVocabAction;
|
|
147335
149007
|
exports.findVocabularyEntry = findVocabularyEntry;
|
|
@@ -147430,9 +149102,11 @@ exports.ingestReading = ingestReading;
|
|
|
147430
149102
|
exports.initialPoolMemoryState = initialPoolMemoryState;
|
|
147431
149103
|
exports.insertComponent = insertComponent;
|
|
147432
149104
|
exports.instanceApiOverTargets = instanceApiOverTargets;
|
|
149105
|
+
exports.instanceCodeHash = instanceCodeHash;
|
|
147433
149106
|
exports.instanceSourceOverApi = instanceSourceOverApi;
|
|
147434
149107
|
exports.instancesOfCap = instancesOfCap;
|
|
147435
149108
|
exports.instantKindsOf = instantKindsOf;
|
|
149109
|
+
exports.instantiateAutomationTemplate = instantiateAutomationTemplate;
|
|
147436
149110
|
exports.integralCadenceMs = require_implemented_methods.integralCadenceMs;
|
|
147437
149111
|
exports.integralDraft = integralDraft;
|
|
147438
149112
|
exports.integrateReading = require_implemented_methods.integrateReading;
|
|
@@ -147472,6 +149146,7 @@ exports.isAudioRule = isAudioRule;
|
|
|
147472
149146
|
exports.isAutomaticShareSource = isAutomaticShareSource;
|
|
147473
149147
|
exports.isBaseConditionKey = isBaseConditionKey;
|
|
147474
149148
|
exports.isBatteryPresenceFault = isBatteryPresenceFault;
|
|
149149
|
+
exports.isBuiltinTemplateId = isBuiltinTemplateId;
|
|
147475
149150
|
exports.isClusterScopedStep = isClusterScopedStep;
|
|
147476
149151
|
exports.isCollectionArrayMethod = isCollectionArrayMethod;
|
|
147477
149152
|
exports.isCommand = require_sleep.isCommand;
|
|
@@ -147569,6 +149244,7 @@ exports.kebabToCamel = kebabToCamel;
|
|
|
147569
149244
|
exports.keychainAdminCapability = keychainAdminCapability;
|
|
147570
149245
|
exports.keychainCapability = keychainCapability;
|
|
147571
149246
|
exports.kindOfValue = kindOfValue;
|
|
149247
|
+
exports.kindServesCap = kindServesCap;
|
|
147572
149248
|
exports.kindsForDiscriminator = kindsForDiscriminator;
|
|
147573
149249
|
exports.knownSecretCount = require_sleep.knownSecretCount;
|
|
147574
149250
|
exports.knownValues = knownValues;
|
|
@@ -147619,6 +149295,7 @@ exports.markFieldEdited = markFieldEdited;
|
|
|
147619
149295
|
exports.markdownToHtmlLite = markdownToHtmlLite;
|
|
147620
149296
|
exports.markdownToText = markdownToText;
|
|
147621
149297
|
exports.maskUrlCredentials = require_sleep.maskUrlCredentials;
|
|
149298
|
+
exports.materializeEmailImages = materializeEmailImages;
|
|
147622
149299
|
exports.maxDurationMs = require_implemented_methods.maxDurationMs;
|
|
147623
149300
|
exports.mayReadLocation = mayReadLocation;
|
|
147624
149301
|
exports.mayWriteToLocation = mayWriteToLocation;
|
|
@@ -147867,6 +149544,7 @@ exports.readKeyedArrayItems = readKeyedArrayItems;
|
|
|
147867
149544
|
exports.readMotionTriggeredBy = readMotionTriggeredBy;
|
|
147868
149545
|
exports.readNativeLeaseOverride = readNativeLeaseOverride;
|
|
147869
149546
|
exports.readNodePin = require_sleep.readNodePin;
|
|
149547
|
+
exports.readRecipeLiteral = readRecipeLiteral;
|
|
147870
149548
|
exports.readRecoveryRecipe = readRecoveryRecipe;
|
|
147871
149549
|
exports.readRecoveryRecipeForSteps = readRecoveryRecipeForSteps;
|
|
147872
149550
|
exports.readStoredRemoteConfig = readStoredRemoteConfig;
|
|
@@ -147897,6 +149575,7 @@ exports.rectsOverlap = rectsOverlap;
|
|
|
147897
149575
|
exports.rectsToCells = rectsToCells;
|
|
147898
149576
|
exports.reducePoints = reducePoints;
|
|
147899
149577
|
exports.reducerForActive = reducerForActive;
|
|
149578
|
+
exports.reexpandAutomationInstance = reexpandAutomationInstance;
|
|
147900
149579
|
exports.registerKnownSecret = require_sleep.registerKnownSecret;
|
|
147901
149580
|
exports.registerPowerSwitch = registerPowerSwitch;
|
|
147902
149581
|
exports.registrySwitchPortsOver = require_sleep.registrySwitchPortsOver;
|
|
@@ -147914,6 +149593,7 @@ exports.removeScalarTarget = removeScalarTarget;
|
|
|
147914
149593
|
exports.renameAlarmProfile = renameAlarmProfile;
|
|
147915
149594
|
exports.renderVocabPhrase = renderVocabPhrase;
|
|
147916
149595
|
exports.repeatCheck = repeatCheck;
|
|
149596
|
+
exports.replaceRecipeLiteral = replaceRecipeLiteral;
|
|
147917
149597
|
exports.replacedFieldKeys = replacedFieldKeys;
|
|
147918
149598
|
exports.replayDwellIntervals = replayDwellIntervals;
|
|
147919
149599
|
exports.reportIsScalable = reportIsScalable;
|