@camstack/types 1.2.555 → 1.2.556

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-4qch9WKa.js");
3
- const require_event_category = require("./event-category-BC4RRerT.js");
2
+ const require_sleep = require("./sleep-BRGFFgr9.js");
3
+ const require_event_category = require("./event-category-Ps2LC8dN.js");
4
4
  const require_composed_stable_id = require("./composed-stable-id-CDNLq7Y8.js");
5
5
  const require_implemented_methods = require("./implemented-methods-Cj65uy2F.js");
6
6
  const require_node_color = require("./node-color.js");
@@ -60472,18 +60472,32 @@ var HeroRowModelSchema = zod.z.object({
60472
60472
  extras: zod.z.array(HeroControlSchema).max(2).optional(),
60473
60473
  trailing: HeroFactSchema.nullable()
60474
60474
  });
60475
- /** The trailing fact, in order of preference. */
60475
+ /**
60476
+ * A measurement that IS the headline. The row trails it so a client that paints only
60477
+ * `trailing` still shows the reading. Power, battery and consumables stay ahead of these.
60478
+ */
60479
+ var ROW_READING_FACT_IDS = [
60480
+ "temperature",
60481
+ "humidity",
60482
+ "pressure",
60483
+ "illuminance",
60484
+ "reading",
60485
+ "air-quality",
60486
+ "valve"
60487
+ ];
60488
+ /** The trailing fact, in order of preference. A reading joins only when it repeats the headline. */
60476
60489
  var TRAILING_ORDER = [
60477
60490
  "power",
60478
60491
  "battery",
60479
60492
  "consumables"
60480
60493
  ];
60481
- function trailingOf(facts) {
60494
+ var READING_FACT_IDS = new Set(ROW_READING_FACT_IDS);
60495
+ function trailingOf(model) {
60482
60496
  for (const id of TRAILING_ORDER) {
60483
- const found = facts.find((f) => f.id === id);
60497
+ const found = model.facts.find((f) => f.id === id);
60484
60498
  if (found !== void 0) return found;
60485
60499
  }
60486
- return null;
60500
+ return model.facts.find((f) => READING_FACT_IDS.has(f.id) && f.text.en === model.title.en) ?? null;
60487
60501
  }
60488
60502
  /**
60489
60503
  * A type whose primary is a named control, not its power: a climate row is the mode
@@ -60578,7 +60592,7 @@ function timedRunOf(model) {
60578
60592
  };
60579
60593
  }
60580
60594
  function projectDeviceRow(model) {
60581
- const trailing = trailingOf(model.facts);
60595
+ const trailing = trailingOf(model);
60582
60596
  const primary = primaryOf(model);
60583
60597
  return {
60584
60598
  deviceId: model.deviceId,
@@ -75205,6 +75219,7 @@ var NcSystemEventKindSchema = zod.z.enum([
75205
75219
  "recording-degraded",
75206
75220
  "device-attention-required",
75207
75221
  "device-attention-resolved",
75222
+ "device-command",
75208
75223
  "storage-location-low",
75209
75224
  "storage-location-critical",
75210
75225
  "storage-location-ok",
@@ -75311,6 +75326,22 @@ var NC_CONSUMABLE_LOW_PERCENT_MAX = 95;
75311
75326
  * gate; the remaining lists are optional narrowing filters relevant to the
75312
75327
  * selected kinds.
75313
75328
  */
75329
+ /** How a settled command can be filtered (D1022): a device's own change is not a command. */
75330
+ var NC_COMMAND_OUTCOMES = [
75331
+ "confirmed",
75332
+ "already",
75333
+ "unconfirmed",
75334
+ "failed"
75335
+ ];
75336
+ /** Who gave a command, as the transition audit names the actor (D1022). */
75337
+ var NC_COMMAND_ACTOR_KINDS = [
75338
+ "user",
75339
+ "addon",
75340
+ "action",
75341
+ "scheduler",
75342
+ "composition",
75343
+ "node"
75344
+ ];
75314
75345
  var NcSystemEventConditionSchema = zod.z.object({
75315
75346
  kinds: zod.z.array(NcSystemEventKindSchema).min(1),
75316
75347
  deviceIds: zod.z.array(zod.z.number().int()).min(1).optional(),
@@ -75342,6 +75373,16 @@ var NcSystemEventConditionSchema = zod.z.object({
75342
75373
  nodeIds: zod.z.array(zod.z.string().min(1)).min(1).optional(),
75343
75374
  packageNames: zod.z.array(zod.z.string().min(1)).min(1).optional(),
75344
75375
  /**
75376
+ * `device-command` only: the vocabulary ACTION IDS (D983, `powerSource.forceRestart`)
75377
+ * this rule speaks about - the same dictionary the automation action blocks
75378
+ * pick from. The hub refuses an id the action index does not know.
75379
+ */
75380
+ commandActions: zod.z.array(zod.z.string().min(1)).min(1).optional(),
75381
+ /** `device-command` only: how the command settled. A device's own change is not a command. */
75382
+ commandOutcomes: zod.z.array(zod.z.enum(NC_COMMAND_OUTCOMES)).min(1).optional(),
75383
+ /** `device-command` only: who asked (`user`, `addon`, `action`, `scheduler`, `composition`, `node`). */
75384
+ commandActorKinds: zod.z.array(zod.z.enum(NC_COMMAND_ACTOR_KINDS)).min(1).optional(),
75385
+ /**
75345
75386
  * At or below this remaining-life %, a consumable is LOW for THIS rule
75346
75387
  * (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
75347
75388
  * {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
@@ -76927,6 +76968,10 @@ var NC_CONDITION_CATALOG = [
76927
76968
  value: "device-attention-resolved",
76928
76969
  label: "Device attention resolved"
76929
76970
  },
76971
+ {
76972
+ value: "device-command",
76973
+ label: "Command given to a device"
76974
+ },
76930
76975
  {
76931
76976
  value: "storage-location-low",
76932
76977
  label: "Storage location low"
@@ -109079,7 +109124,8 @@ function buildHeroModel(input) {
109079
109124
  label: require_sleep.t(integration, integration)
109080
109125
  }], ...fragments.flatMap((f) => f.badges ?? [])];
109081
109126
  const headline = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.title !== void 0)?.title;
109082
- const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en);
109127
+ const readingIds = new Set(ROW_READING_FACT_IDS);
109128
+ const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en || readingIds.has(f.id));
109083
109129
  const sideTiles = {
109084
109130
  left: tilesOf(fragments, "left"),
109085
109131
  right: tilesOf(fragments, "right")
@@ -128329,7 +128375,10 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
128329
128375
  "deviceTypes",
128330
128376
  "nodeIds",
128331
128377
  "packageNames",
128332
- "consumableLowPercent"
128378
+ "consumableLowPercent",
128379
+ "commandActions",
128380
+ "commandOutcomes",
128381
+ "commandActorKinds"
128333
128382
  ];
128334
128383
  /**
128335
128384
  * Does `filter` say anything about `kind`?
@@ -128345,6 +128394,9 @@ function systemEventFilterApplies(kind, filter) {
128345
128394
  case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "wrapper-update-available" || kind === "server-updated" || kind.startsWith("storage-location-") || kind.startsWith("alert-");
128346
128395
  case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "node-updating" || kind === "server-updated";
128347
128396
  case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
128397
+ case "commandActions":
128398
+ case "commandOutcomes":
128399
+ case "commandActorKinds": return kind === "device-command";
128348
128400
  }
128349
128401
  }
128350
128402
  /**
@@ -128405,6 +128457,7 @@ var NC_SYSTEM_EVENT_FAMILY = {
128405
128457
  "recording-degraded": "device-events",
128406
128458
  "device-attention-required": "device-events",
128407
128459
  "device-attention-resolved": "device-events",
128460
+ "device-command": "device-events",
128408
128461
  "node-online": "system",
128409
128462
  "node-offline": "system",
128410
128463
  "node-restarting": "system",
@@ -128454,7 +128507,10 @@ var NC_SYSTEM_EVENT_FAMILY_FILTERS = {
128454
128507
  "deviceIds",
128455
128508
  "excludeDeviceIds",
128456
128509
  "deviceTypes",
128457
- "consumableLowPercent"
128510
+ "consumableLowPercent",
128511
+ "commandActions",
128512
+ "commandOutcomes",
128513
+ "commandActorKinds"
128458
128514
  ],
128459
128515
  system: ["nodeIds", "packageNames"],
128460
128516
  alarm: ["deviceIds"]
@@ -128523,6 +128579,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
128523
128579
  label: "Needs attention",
128524
128580
  kinds: ["device-attention-required", "device-attention-resolved"]
128525
128581
  },
128582
+ {
128583
+ id: "device-command",
128584
+ family: "device-events",
128585
+ label: "Commands given to devices",
128586
+ kinds: ["device-command"]
128587
+ },
128526
128588
  {
128527
128589
  id: "nodes",
128528
128590
  family: "system",
@@ -128647,6 +128709,10 @@ function systemEventFamilyProblems(condition) {
128647
128709
  code: "mixed-families",
128648
128710
  families
128649
128711
  });
128712
+ for (const action of condition.commandActions ?? []) if (require_sleep.findVocabAction(action) === void 0) problems.push({
128713
+ code: "unknown-command-action",
128714
+ action
128715
+ });
128650
128716
  const [family] = families;
128651
128717
  if (families.length !== 1 || family === void 0) return problems;
128652
128718
  const allowed = NC_SYSTEM_EVENT_FAMILY_FILTERS[family];
@@ -128663,6 +128729,7 @@ function describeSystemEventFamilyProblem(problem) {
128663
128729
  case "legacy-kind": return `'${problem.kind}' is a legacy kind and cannot be authored`;
128664
128730
  case "mixed-families": return `event kinds span ${problem.families.join(" + ")} — one rule per family`;
128665
128731
  case "filter-outside-family": return `filter '${problem.filter}' is not allowed on a ${problem.family} rule`;
128732
+ case "unknown-command-action": return `'${problem.action}' is not a vocabulary action id`;
128666
128733
  }
128667
128734
  }
128668
128735
  //#endregion
@@ -130575,6 +130642,7 @@ var DEVICE_EVENTS = [
130575
130642
  "recording-healthy",
130576
130643
  "recording-degraded",
130577
130644
  ...DEVICE_ATTENTION,
130645
+ "device-command",
130578
130646
  ...ALARM
130579
130647
  ];
130580
130648
  /** Every kind a summary may speak about — the two summarisable families. */
@@ -131031,6 +131099,37 @@ var NC_TEMPLATE_VARS = [
131031
131099
  kinds: ["system"],
131032
131100
  systemEventKinds: [...DEVICE_EVENTS]
131033
131101
  },
131102
+ {
131103
+ name: "actionLabel",
131104
+ label: "Command",
131105
+ example: "Force restart",
131106
+ group: "system",
131107
+ families: ["rule"],
131108
+ fields: [...RULE_TEXT],
131109
+ kinds: ["system"],
131110
+ systemEventKinds: ["device-command"]
131111
+ },
131112
+ {
131113
+ name: "actorLabel",
131114
+ label: "Who asked",
131115
+ example: "velux",
131116
+ group: "system",
131117
+ families: ["rule"],
131118
+ fields: [...RULE_TEXT],
131119
+ kinds: ["system"],
131120
+ systemEventKinds: ["device-command"]
131121
+ },
131122
+ {
131123
+ name: "deviceLabel",
131124
+ label: "Device with type",
131125
+ description: "The device name with its type in parentheses. {{deviceName}} stays the bare name.",
131126
+ example: "Front door (Camera)",
131127
+ group: "system",
131128
+ families: ["rule"],
131129
+ fields: [...RULE_TEXT],
131130
+ kinds: ["system"],
131131
+ systemEventKinds: [...DEVICE_EVENTS]
131132
+ },
131034
131133
  {
131035
131134
  name: "locations",
131036
131135
  label: "Intrusion locations",
@@ -131751,7 +131850,8 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
131751
131850
  "rule-broken",
131752
131851
  "rule-repaired",
131753
131852
  "package-llm-silent",
131754
- "package-llm-answered"
131853
+ "package-llm-answered",
131854
+ "device-command"
131755
131855
  ];
131756
131856
  /**
131757
131857
  * The catalog as `getTemplateCatalog` SERVES it: every descriptor, with the
@@ -139791,6 +139891,7 @@ exports.DeviceCertificateSettingsSchema = DeviceCertificateSettingsSchema;
139791
139891
  exports.DeviceChallengeResultSchema = DeviceChallengeResultSchema;
139792
139892
  exports.DeviceChallengeSchema = DeviceChallengeSchema;
139793
139893
  exports.DeviceCodeSeveritySchema = DeviceCodeSeveritySchema;
139894
+ exports.DeviceCommandSettledEventSchema = require_sleep.DeviceCommandSettledEventSchema;
139794
139895
  exports.DeviceConfig = DeviceConfig;
139795
139896
  exports.DeviceCredentialSchema = DeviceCredentialSchema;
139796
139897
  exports.DeviceCredentialStatusSchema = DeviceCredentialStatusSchema;
@@ -140545,6 +140646,8 @@ exports.NC_CAMERA_SCOPE_CAP_NAME = NC_CAMERA_SCOPE_CAP_NAME;
140545
140646
  exports.NC_CLIP_POST_ROLL_DEFAULT_SEC = NC_CLIP_POST_ROLL_DEFAULT_SEC;
140546
140647
  exports.NC_CLIP_PRE_ROLL_DEFAULT_SEC = NC_CLIP_PRE_ROLL_DEFAULT_SEC;
140547
140648
  exports.NC_CLIP_RETENTION_MAX_SEC = NC_CLIP_RETENTION_MAX_SEC;
140649
+ exports.NC_COMMAND_ACTOR_KINDS = NC_COMMAND_ACTOR_KINDS;
140650
+ exports.NC_COMMAND_OUTCOMES = NC_COMMAND_OUTCOMES;
140548
140651
  exports.NC_CONDITION_CATALOG = NC_CONDITION_CATALOG;
140549
140652
  exports.NC_CONFIRM_DEFAULT_MAX_IMAGE_PX = NC_CONFIRM_DEFAULT_MAX_IMAGE_PX;
140550
140653
  exports.NC_CONFIRM_DEFAULT_TIMEOUT_MS = NC_CONFIRM_DEFAULT_TIMEOUT_MS;