@camstack/types 1.2.396 → 1.2.398

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.
Files changed (37) hide show
  1. package/dist/addon.js +17 -2
  2. package/dist/addon.mjs +15 -3
  3. package/dist/capabilities/dishwasher.cap.d.ts +9 -0
  4. package/dist/capabilities/index.d.ts +2 -2
  5. package/dist/capabilities/notification-rules.cap.d.ts +138 -0
  6. package/dist/capabilities/osd-manager.cap.d.ts +36 -0
  7. package/dist/capabilities/records.cap.d.ts +67 -3
  8. package/dist/capabilities/storage-admin.cap.d.ts +0 -2
  9. package/dist/capabilities/user-management.cap.d.ts +2 -28
  10. package/dist/client.d.ts +1 -1
  11. package/dist/client.js +324 -13
  12. package/dist/client.mjs +320 -14
  13. package/dist/enums/event-category.d.ts +17 -0
  14. package/dist/enums.js +1 -1
  15. package/dist/enums.mjs +1 -1
  16. package/dist/{event-category-eSqkye-K.js → event-category-7AwNbPjm.js} +17 -0
  17. package/dist/{event-category-DOl51-Ij.mjs → event-category-BfJwUd2S.mjs} +17 -0
  18. package/dist/generated/addon-api.d.ts +7 -14
  19. package/dist/generated/addon-cap-facts.d.ts +1 -1
  20. package/dist/generated/method-access-map.d.ts +1 -1
  21. package/dist/generated/system-proxy.d.ts +1 -1
  22. package/dist/index.d.ts +3 -2
  23. package/dist/index.js +426 -62
  24. package/dist/index.mjs +415 -61
  25. package/dist/interfaces/auth.d.ts +1 -1
  26. package/dist/interfaces/event-bus.d.ts +43 -5
  27. package/dist/notification/alert-episode.d.ts +7 -0
  28. package/dist/notification/system-event-classes.d.ts +73 -0
  29. package/dist/records/errors.d.ts +9 -1
  30. package/dist/records/index.d.ts +1 -0
  31. package/dist/records/record-kind.d.ts +62 -2
  32. package/dist/records/records-access.d.ts +36 -1
  33. package/dist/records/transact-rules.d.ts +7 -0
  34. package/dist/schemas/auth-records.d.ts +0 -12
  35. package/dist/{sleep-Re8daN0Y.js → sleep-CD18m9HF.js} +478 -311
  36. package/dist/{sleep-_sV1BE2f.mjs → sleep-DJFUfKvA.mjs} +461 -312
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-Re8daN0Y.js");
3
- const require_event_category = require("./event-category-eSqkye-K.js");
2
+ const require_sleep = require("./sleep-CD18m9HF.js");
3
+ const require_event_category = require("./event-category-7AwNbPjm.js");
4
4
  const require_composition = require("./composition-eoYYVfOp.js");
5
5
  const require_node_color = require("./node-color.js");
6
6
  const require_err_msg = require("./err-msg-BhVbr0NX.js");
@@ -6812,17 +6812,6 @@ var UserRecordSchema = zod.z.object({
6812
6812
  createdAt: zod.z.number(),
6813
6813
  updatedAt: zod.z.number()
6814
6814
  });
6815
- var ApiKeyRecordSchema = zod.z.object({
6816
- id: zod.z.string(),
6817
- label: zod.z.string(),
6818
- isAdmin: zod.z.boolean().default(false),
6819
- allowedProviders: AllowedProviderSchema,
6820
- allowedDevices: AllowedDevicesSchema,
6821
- tokenHash: zod.z.string(),
6822
- tokenPrefix: zod.z.string(),
6823
- createdAt: zod.z.number(),
6824
- lastUsedAt: zod.z.number().optional()
6825
- });
6826
6815
  var ScopedTokenSchema = zod.z.object({
6827
6816
  id: zod.z.string(),
6828
6817
  userId: zod.z.string(),
@@ -14502,16 +14491,36 @@ var RecordKindStateSchema = zod.z.enum([
14502
14491
  var DeclareKindResultSchema = zod.z.object({
14503
14492
  kindId: zod.z.number().int(),
14504
14493
  state: RecordKindStateSchema,
14505
- createdIndexes: zod.z.array(zod.z.string()),
14506
- /**
14507
- * RETIRED (D900): always `null`. It carried the records-migration boot guard;
14508
- * it stays on the wire, null, because an addon built before the removal reads
14509
- * an ABSENT field as "adoption pending" and refuses to start.
14510
- */
14511
- adoptionPending: zod.z.null()
14494
+ createdIndexes: zod.z.array(zod.z.string())
14512
14495
  });
14513
14496
  /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
14514
14497
  var SecretRefsList = zod.z.array(zod.z.string());
14498
+ /**
14499
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
14500
+ * All ops of one call share ONE database file and ONE `transactFamily`.
14501
+ */
14502
+ var RecordTransactOpSchema = zod.z.discriminatedUnion("op", [
14503
+ zod.z.object({
14504
+ op: zod.z.literal("put"),
14505
+ kind: require_sleep.RecordKindNameSchema,
14506
+ record: RecordInputSchema,
14507
+ ifRev: zod.z.number().int().min(0).optional()
14508
+ }),
14509
+ zod.z.object({
14510
+ op: zod.z.literal("patch"),
14511
+ kind: require_sleep.RecordKindNameSchema,
14512
+ id: RecordIdSchema,
14513
+ data: RecordBodySchema,
14514
+ at: zod.z.number().int().nullable().optional(),
14515
+ expiresAt: zod.z.number().int().nullable().optional(),
14516
+ ifRev: zod.z.number().int().min(1).optional()
14517
+ }),
14518
+ zod.z.object({
14519
+ op: zod.z.literal("delete"),
14520
+ kind: require_sleep.RecordKindNameSchema,
14521
+ id: RecordIdSchema
14522
+ })
14523
+ ]);
14515
14524
  var RecordSecretRefsSchema = zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.string()));
14516
14525
  var recordsCapability = {
14517
14526
  name: "records",
@@ -14643,6 +14652,22 @@ var recordsCapability = {
14643
14652
  kind: "mutation",
14644
14653
  auth: "admin"
14645
14654
  }),
14655
+ /**
14656
+ * Several single-row writes (put / patch / delete) in ONE SQLite transaction:
14657
+ * all land or none does. Every op's kind must sit in one file and share one
14658
+ * `transactFamily` (`records/transact-refused` otherwise). Results are in op order.
14659
+ */
14660
+ transact: require_sleep.method(zod.z.object({ ops: zod.z.array(RecordTransactOpSchema).min(1).max(require_sleep.RECORD_BATCH_MAX) }), zod.z.object({
14661
+ results: zod.z.array(zod.z.object({
14662
+ rev: zod.z.number().int().nullable(),
14663
+ deleted: zod.z.boolean()
14664
+ })),
14665
+ releasedRefs: SecretRefsList,
14666
+ secretRefs: SecretRefsList
14667
+ }), {
14668
+ kind: "mutation",
14669
+ auth: "admin"
14670
+ }),
14646
14671
  /** The D865 hook body: every kind of this addon declared `deviceRemoval: 'delete'`. */
14647
14672
  deleteDevice: require_sleep.method(zod.z.object({
14648
14673
  deviceId: zod.z.number().int(),
@@ -43434,9 +43459,13 @@ var NcSystemEventKindSchema = zod.z.enum([
43434
43459
  "node-updating",
43435
43460
  "node-inference-unavailable",
43436
43461
  "detection-blind",
43462
+ "motion-noisy",
43463
+ "motion-calm",
43437
43464
  "recording-stalled",
43438
43465
  "recording-healthy",
43439
43466
  "recording-degraded",
43467
+ "device-attention-required",
43468
+ "device-attention-resolved",
43440
43469
  "storage-location-low",
43441
43470
  "storage-location-critical",
43442
43471
  "storage-location-ok",
@@ -43460,6 +43489,8 @@ var NcSystemEventKindSchema = zod.z.enum([
43460
43489
  "alert-critical",
43461
43490
  "alert-error",
43462
43491
  "alert-critical-resolved",
43492
+ "rule-broken",
43493
+ "rule-repaired",
43463
43494
  "camera-online",
43464
43495
  "camera-offline",
43465
43496
  "camera-disabled",
@@ -45071,6 +45102,14 @@ var NC_CONDITION_CATALOG = [
45071
45102
  value: "detection-blind",
45072
45103
  label: "Camera detecting nothing"
45073
45104
  },
45105
+ {
45106
+ value: "motion-noisy",
45107
+ label: "Camera motion constant, no subject"
45108
+ },
45109
+ {
45110
+ value: "motion-calm",
45111
+ label: "Camera motion calm again"
45112
+ },
45074
45113
  {
45075
45114
  value: "recording-stalled",
45076
45115
  label: "Recording stalled"
@@ -45083,6 +45122,14 @@ var NC_CONDITION_CATALOG = [
45083
45122
  value: "recording-degraded",
45084
45123
  label: "Recording degraded (restart storm)"
45085
45124
  },
45125
+ {
45126
+ value: "device-attention-required",
45127
+ label: "Device needs attention"
45128
+ },
45129
+ {
45130
+ value: "device-attention-resolved",
45131
+ label: "Device attention resolved"
45132
+ },
45086
45133
  {
45087
45134
  value: "storage-location-low",
45088
45135
  label: "Storage location low"
@@ -45167,6 +45214,14 @@ var NC_CONDITION_CATALOG = [
45167
45214
  value: "alert-critical-resolved",
45168
45215
  label: "Critical alert resolved"
45169
45216
  },
45217
+ {
45218
+ value: "rule-broken",
45219
+ label: "Notification rule broken"
45220
+ },
45221
+ {
45222
+ value: "rule-repaired",
45223
+ label: "Notification rule repaired"
45224
+ },
45170
45225
  {
45171
45226
  value: "alarm-arm-refused",
45172
45227
  label: "Alarm arm refused"
@@ -61843,6 +61898,16 @@ var DishwasherStatusSchema = zod.z.object({
61843
61898
  powerState: zod.z.string().nullable(),
61844
61899
  saltLevel: DishwasherConsumableLevelSchema.nullable(),
61845
61900
  rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
61901
+ /**
61902
+ * True while the appliance asks for its filter to be cleaned (smart-filter, filter-system or
61903
+ * combined care-and-filter reminder raised); false when every such reminder reads clear; null
61904
+ * when none is reported. A cleared reminder is not an unknown one.
61905
+ */
61906
+ filterCleaningDue: zod.z.boolean().nullable(),
61907
+ /** True while the machine-care (descaling / cleaning-program) reminder is raised; false when clear; null when not reported. */
61908
+ machineCareDue: zod.z.boolean().nullable(),
61909
+ /** Program runs left before the machine-care reminder is due; null when the appliance does not say. */
61910
+ machineCareRemainingRuns: zod.z.number().int().nonnegative().nullable(),
61846
61911
  /** Option states: null when the appliance does not expose the option or has not said. */
61847
61912
  halfLoad: zod.z.boolean().nullable(),
61848
61913
  hygienePlus: zod.z.boolean().nullable(),
@@ -72877,16 +72942,6 @@ var UpdateUserInputSchema = zod.z.object({
72877
72942
  allowedDevices: zod.z.record(zod.z.string(), zod.z.union([zod.z.array(zod.z.string()), zod.z.literal("*")])).optional(),
72878
72943
  scopes: zod.z.array(TokenScopeSchema).optional()
72879
72944
  });
72880
- var ApiKeySummarySchema = zod.z.object({
72881
- id: zod.z.string(),
72882
- label: zod.z.string(),
72883
- isAdmin: zod.z.boolean().default(false),
72884
- allowedProviders: zod.z.union([zod.z.array(zod.z.string()), zod.z.literal("*")]).optional(),
72885
- allowedDevices: zod.z.record(zod.z.string(), zod.z.union([zod.z.array(zod.z.string()), zod.z.literal("*")])).optional(),
72886
- tokenPrefix: zod.z.string(),
72887
- createdAt: zod.z.number(),
72888
- lastUsedAt: zod.z.number().optional()
72889
- });
72890
72945
  var OauthSessionSummarySchema = zod.z.object({
72891
72946
  id: zod.z.string(),
72892
72947
  userId: zod.z.string(),
@@ -72908,8 +72963,7 @@ var TotpStatusSchema = zod.z.object({
72908
72963
  confirmedAt: zod.z.number().nullable()
72909
72964
  });
72910
72965
  /**
72911
- * user-management — singleton capability for user accounts and the
72912
- * legacy API-key rows.
72966
+ * user-management — singleton capability for user accounts.
72913
72967
  *
72914
72968
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
72915
72969
  * — the subset check on `setUserScopes` is moot
@@ -72977,12 +73031,6 @@ var userManagementCapability = {
72977
73031
  kind: "mutation",
72978
73032
  access: "view"
72979
73033
  }),
72980
- listApiKeys: require_sleep.method(zod.z.void(), zod.z.array(ApiKeySummarySchema), { auth: "admin" }),
72981
- revokeApiKey: require_sleep.method(zod.z.object({ id: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
72982
- kind: "mutation",
72983
- auth: "admin",
72984
- access: "delete"
72985
- }),
72986
73034
  setupTotp: require_sleep.method(zod.z.object({ userId: zod.z.string() }), TotpSetupResultSchema, {
72987
73035
  kind: "mutation",
72988
73036
  auth: "admin",
@@ -84587,6 +84635,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
84587
84635
  addonId: null,
84588
84636
  access: "view"
84589
84637
  },
84638
+ "records.transact": {
84639
+ capName: "records",
84640
+ capScope: "system",
84641
+ addonId: null,
84642
+ access: "create"
84643
+ },
84590
84644
  "sceneMonitor.captureReference": {
84591
84645
  capName: "scene-monitor",
84592
84646
  capScope: "device",
@@ -85919,12 +85973,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85919
85973
  addonId: null,
85920
85974
  access: "view"
85921
85975
  },
85922
- "userManagement.listApiKeys": {
85923
- capName: "user-management",
85924
- capScope: "system",
85925
- addonId: null,
85926
- access: "view"
85927
- },
85928
85976
  "userManagement.listExternalIdentities": {
85929
85977
  capName: "user-management",
85930
85978
  capScope: "system",
@@ -85979,12 +86027,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85979
86027
  addonId: null,
85980
86028
  access: "create"
85981
86029
  },
85982
- "userManagement.revokeApiKey": {
85983
- capName: "user-management",
85984
- capScope: "system",
85985
- addonId: null,
85986
- access: "delete"
85987
- },
85988
86030
  "userManagement.revokeOauthSession": {
85989
86031
  capName: "user-management",
85990
86032
  capScope: "system",
@@ -94554,8 +94596,6 @@ function createSystemProxy(api) {
94554
94596
  resetPassword: (input) => dispatch("userManagement", "resetPassword", "mutation", input),
94555
94597
  setUserScopes: (input) => dispatch("userManagement", "setUserScopes", "mutation", input),
94556
94598
  validateCredentials: (input) => dispatch("userManagement", "validateCredentials", "mutation", input),
94557
- listApiKeys: (input) => dispatch("userManagement", "listApiKeys", "query", input),
94558
- revokeApiKey: (input) => dispatch("userManagement", "revokeApiKey", "mutation", input),
94559
94599
  setupTotp: (input) => dispatch("userManagement", "setupTotp", "mutation", input),
94560
94600
  confirmTotp: (input) => dispatch("userManagement", "confirmTotp", "mutation", input),
94561
94601
  disableTotp: (input) => dispatch("userManagement", "disableTotp", "mutation", input),
@@ -95401,8 +95441,8 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
95401
95441
  */
95402
95442
  function systemEventFilterApplies(kind, filter) {
95403
95443
  switch (filter) {
95404
- case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind.startsWith("recording-") || kind === "alarm-triggered";
95405
- case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
95444
+ case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind.startsWith("motion-") || kind.startsWith("recording-") || kind === "alarm-triggered";
95445
+ case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind" || kind.startsWith("motion-");
95406
95446
  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-");
95407
95447
  case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "node-updating" || kind === "server-updated";
95408
95448
  case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
@@ -95460,9 +95500,13 @@ var NC_SYSTEM_EVENT_FAMILY = {
95460
95500
  "stream-online": "device-events",
95461
95501
  "stream-offline": "device-events",
95462
95502
  "detection-blind": "device-events",
95503
+ "motion-noisy": "device-events",
95504
+ "motion-calm": "device-events",
95463
95505
  "recording-stalled": "device-events",
95464
95506
  "recording-healthy": "device-events",
95465
95507
  "recording-degraded": "device-events",
95508
+ "device-attention-required": "device-events",
95509
+ "device-attention-resolved": "device-events",
95466
95510
  "node-online": "system",
95467
95511
  "node-offline": "system",
95468
95512
  "node-restarting": "system",
@@ -95479,6 +95523,8 @@ var NC_SYSTEM_EVENT_FAMILY = {
95479
95523
  "alert-critical": "system",
95480
95524
  "alert-error": "system",
95481
95525
  "alert-critical-resolved": "system",
95526
+ "rule-broken": "system",
95527
+ "rule-repaired": "system",
95482
95528
  "storage-location-low": "system",
95483
95529
  "storage-location-critical": "system",
95484
95530
  "storage-location-ok": "system",
@@ -95561,6 +95607,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
95561
95607
  label: "Detecting nothing",
95562
95608
  kinds: ["detection-blind"]
95563
95609
  },
95610
+ {
95611
+ id: "motion-noise",
95612
+ family: "device-events",
95613
+ label: "Motion without a subject",
95614
+ kinds: ["motion-noisy", "motion-calm"]
95615
+ },
95564
95616
  {
95565
95617
  id: "recording",
95566
95618
  family: "device-events",
@@ -95571,6 +95623,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
95571
95623
  "recording-degraded"
95572
95624
  ]
95573
95625
  },
95626
+ {
95627
+ id: "device-attention",
95628
+ family: "device-events",
95629
+ label: "Needs attention",
95630
+ kinds: ["device-attention-required", "device-attention-resolved"]
95631
+ },
95574
95632
  {
95575
95633
  id: "nodes",
95576
95634
  family: "system",
@@ -95631,6 +95689,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
95631
95689
  "alert-critical-resolved"
95632
95690
  ]
95633
95691
  },
95692
+ {
95693
+ id: "rule-health",
95694
+ family: "system",
95695
+ label: "Notification rules",
95696
+ kinds: ["rule-broken", "rule-repaired"]
95697
+ },
95634
95698
  {
95635
95699
  id: "alarm",
95636
95700
  family: "alarm",
@@ -97398,6 +97462,16 @@ function alertEpisodeKind(severity, phase) {
97398
97462
  if (severity === "error" && phase === "raised") return "alert-error";
97399
97463
  return null;
97400
97464
  }
97465
+ /**
97466
+ * The kind of a CRITICAL episode edge about a DEVICE (D911): the alert's source
97467
+ * is `device`, so it is announced in the devices family as
97468
+ * `device-attention-required` / `-resolved` INSTEAD of `alert-critical`. One
97469
+ * alert notifies once, through one family. `null` for any other severity.
97470
+ */
97471
+ function deviceAttentionKind(severity, phase) {
97472
+ if (severity !== "critical") return null;
97473
+ return phase === "raised" ? "device-attention-required" : "device-attention-resolved";
97474
+ }
97401
97475
  function alertEpisodePayload(alert, phase, at) {
97402
97476
  const nodeId = alertNodeId(alert);
97403
97477
  return {
@@ -97433,6 +97507,7 @@ var ALERT_EPISODE = [
97433
97507
  "alert-error",
97434
97508
  "alert-critical-resolved"
97435
97509
  ];
97510
+ var DEVICE_ATTENTION = ["device-attention-required", "device-attention-resolved"];
97436
97511
  var UPDATES = [
97437
97512
  "addon-update-available",
97438
97513
  "server-update-available",
@@ -97462,9 +97537,12 @@ var DEVICE_EVENTS = [
97462
97537
  "stream-online",
97463
97538
  "stream-offline",
97464
97539
  "detection-blind",
97540
+ "motion-noisy",
97541
+ "motion-calm",
97465
97542
  "recording-stalled",
97466
97543
  "recording-healthy",
97467
97544
  "recording-degraded",
97545
+ ...DEVICE_ATTENTION,
97468
97546
  ...ALARM
97469
97547
  ];
97470
97548
  /** Every kind a summary may speak about — the two summarisable families. */
@@ -98038,7 +98116,36 @@ var NC_TEMPLATE_VARS = [
98038
98116
  families: ["rule"],
98039
98117
  fields: [...RULE_TEXT],
98040
98118
  kinds: ["system"],
98041
- systemEventKinds: ["detection-blind", "recording-stalled"]
98119
+ systemEventKinds: [
98120
+ "detection-blind",
98121
+ "motion-noisy",
98122
+ "motion-calm",
98123
+ "recording-stalled"
98124
+ ]
98125
+ },
98126
+ {
98127
+ name: "duty",
98128
+ label: "Motion share (%)",
98129
+ example: "55",
98130
+ group: "system",
98131
+ families: ["rule"],
98132
+ fields: [...RULE_TEXT],
98133
+ kinds: ["system"],
98134
+ systemEventKinds: ["motion-noisy", "motion-calm"]
98135
+ },
98136
+ {
98137
+ name: "sessions",
98138
+ label: "Detection sessions",
98139
+ example: "96",
98140
+ group: "system",
98141
+ families: ["rule"],
98142
+ fields: [...RULE_TEXT],
98143
+ kinds: ["system"],
98144
+ systemEventKinds: [
98145
+ "detection-blind",
98146
+ "motion-noisy",
98147
+ "motion-calm"
98148
+ ]
98042
98149
  },
98043
98150
  {
98044
98151
  name: "message",
@@ -98048,7 +98155,52 @@ var NC_TEMPLATE_VARS = [
98048
98155
  families: ["rule"],
98049
98156
  fields: [...RULE_TEXT],
98050
98157
  kinds: ["system"],
98051
- systemEventKinds: ["recording-degraded", ...ALERT_EPISODE]
98158
+ systemEventKinds: [
98159
+ "recording-degraded",
98160
+ ...DEVICE_ATTENTION,
98161
+ ...ALERT_EPISODE
98162
+ ]
98163
+ },
98164
+ {
98165
+ name: "ruleName",
98166
+ label: "Rule name",
98167
+ example: "Robot",
98168
+ group: "system",
98169
+ families: ["rule"],
98170
+ fields: [...RULE_TEXT],
98171
+ kinds: ["system"],
98172
+ systemEventKinds: ["rule-broken", "rule-repaired"]
98173
+ },
98174
+ {
98175
+ name: "ruleId",
98176
+ label: "Rule id",
98177
+ example: "3db3e226-9b82-4681-a200-de13b260aa48",
98178
+ group: "system",
98179
+ families: ["rule"],
98180
+ fields: [...RULE_TEXT],
98181
+ kinds: ["system"],
98182
+ systemEventKinds: ["rule-broken", "rule-repaired"]
98183
+ },
98184
+ {
98185
+ name: "brokenReason",
98186
+ label: "Why the rule is broken",
98187
+ description: "unparseable, device-deleted or target-deleted",
98188
+ example: "device-deleted",
98189
+ group: "system",
98190
+ families: ["rule"],
98191
+ fields: [...RULE_TEXT],
98192
+ kinds: ["system"],
98193
+ systemEventKinds: ["rule-broken"]
98194
+ },
98195
+ {
98196
+ name: "offendingIds",
98197
+ label: "Deleted devices or destinations",
98198
+ example: "4483",
98199
+ group: "system",
98200
+ families: ["rule"],
98201
+ fields: [...RULE_TEXT],
98202
+ kinds: ["system"],
98203
+ systemEventKinds: ["rule-broken"]
98052
98204
  },
98053
98205
  {
98054
98206
  name: "locationName",
@@ -98251,7 +98403,11 @@ var NC_TEMPLATE_VARS = [
98251
98403
  families: ["rule"],
98252
98404
  fields: [...RULE_TEXT],
98253
98405
  kinds: ["system"],
98254
- systemEventKinds: ["export-completed", ...ALERT_EPISODE]
98406
+ systemEventKinds: [
98407
+ "export-completed",
98408
+ ...DEVICE_ATTENTION,
98409
+ ...ALERT_EPISODE
98410
+ ]
98255
98411
  },
98256
98412
  {
98257
98413
  name: "severity",
@@ -98271,7 +98427,7 @@ var NC_TEMPLATE_VARS = [
98271
98427
  families: ["rule"],
98272
98428
  fields: [...RULE_TEXT],
98273
98429
  kinds: ["system"],
98274
- systemEventKinds: [...ALERT_EPISODE]
98430
+ systemEventKinds: [...DEVICE_ATTENTION, ...ALERT_EPISODE]
98275
98431
  },
98276
98432
  {
98277
98433
  name: "source",
@@ -98291,7 +98447,7 @@ var NC_TEMPLATE_VARS = [
98291
98447
  families: ["rule"],
98292
98448
  fields: [...RULE_TEXT],
98293
98449
  kinds: ["system"],
98294
- systemEventKinds: [...ALERT_EPISODE]
98450
+ systemEventKinds: [...DEVICE_ATTENTION, ...ALERT_EPISODE]
98295
98451
  },
98296
98452
  {
98297
98453
  name: "exportId",
@@ -98505,7 +98661,11 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
98505
98661
  "node-updating",
98506
98662
  "alert-critical",
98507
98663
  "alert-error",
98508
- "alert-critical-resolved"
98664
+ "alert-critical-resolved",
98665
+ "device-attention-required",
98666
+ "device-attention-resolved",
98667
+ "rule-broken",
98668
+ "rule-repaired"
98509
98669
  ];
98510
98670
  /**
98511
98671
  * The catalog as `getTemplateCatalog` SERVES it: every descriptor, with the
@@ -98611,6 +98771,200 @@ function isKnownTemplateVar(name, ctx) {
98611
98771
  return templateVarsFor(ctx).some((d) => d.dynamic !== void 0 ? name.startsWith(d.dynamic.prefix) && name.length > d.dynamic.prefix.length : d.name === name);
98612
98772
  }
98613
98773
  //#endregion
98774
+ //#region src/notification/system-event-classes.ts
98775
+ var NC_SYSTEM_EVENT_CLASS_SPECS = [
98776
+ {
98777
+ id: "device-connectivity",
98778
+ family: "device-events",
98779
+ label: "Device connectivity (offline / back online)",
98780
+ bad: ["device-offline"],
98781
+ recovery: ["device-online"],
98782
+ snapshotLabel: "Devices offline now",
98783
+ snapshotSection: "device-state"
98784
+ },
98785
+ {
98786
+ id: "device-switch",
98787
+ family: "device-events",
98788
+ label: "Device switched off / back on",
98789
+ bad: ["device-disabled"],
98790
+ recovery: ["device-enabled"],
98791
+ snapshotLabel: "Devices switched off now",
98792
+ snapshotSection: "device-state"
98793
+ },
98794
+ {
98795
+ id: "stream-connectivity",
98796
+ family: "device-events",
98797
+ label: "Stream connectivity (offline / back online)",
98798
+ bad: ["stream-offline"],
98799
+ recovery: ["stream-online"],
98800
+ snapshotLabel: "Streams offline now",
98801
+ snapshotSection: "streams"
98802
+ },
98803
+ {
98804
+ id: "battery",
98805
+ family: "device-events",
98806
+ label: "Battery (low / back to normal)",
98807
+ bad: ["device-battery-low"],
98808
+ recovery: ["device-battery-normal"],
98809
+ snapshotLabel: "Batteries low now",
98810
+ snapshotSection: "battery"
98811
+ },
98812
+ {
98813
+ id: "consumables",
98814
+ family: "device-events",
98815
+ label: "Consumables (low / replaced)",
98816
+ bad: ["device-consumable-low"],
98817
+ recovery: ["device-consumable-normal"],
98818
+ snapshotLabel: "Consumables low now",
98819
+ snapshotSection: "consumables"
98820
+ },
98821
+ {
98822
+ id: "tanks",
98823
+ family: "device-events",
98824
+ label: "Tanks (low or full / back to normal)",
98825
+ bad: ["device-tank-low", "device-tank-full"],
98826
+ recovery: ["device-tank-normal"],
98827
+ snapshotLabel: "Tanks low or full now",
98828
+ snapshotSection: "tanks"
98829
+ },
98830
+ {
98831
+ id: "motion-noise",
98832
+ family: "device-events",
98833
+ label: "Motion without a subject (constant / calm again)",
98834
+ bad: ["motion-noisy"],
98835
+ recovery: ["motion-calm"],
98836
+ snapshotLabel: "Cameras with constant motion now",
98837
+ snapshotSection: null
98838
+ },
98839
+ {
98840
+ id: "recording-health",
98841
+ family: "device-events",
98842
+ label: "Recording health (stalled or degraded / recording again)",
98843
+ bad: ["recording-stalled", "recording-degraded"],
98844
+ recovery: ["recording-healthy"],
98845
+ snapshotLabel: "Recordings stalled now",
98846
+ snapshotSection: null
98847
+ },
98848
+ {
98849
+ id: "device-attention",
98850
+ family: "device-events",
98851
+ label: "Device needs attention (raised / resolved)",
98852
+ bad: ["device-attention-required"],
98853
+ recovery: ["device-attention-resolved"],
98854
+ snapshotLabel: "Devices needing attention now",
98855
+ snapshotSection: null
98856
+ },
98857
+ {
98858
+ id: "node-connectivity",
98859
+ family: "system",
98860
+ label: "Node connectivity (offline / back online)",
98861
+ bad: ["node-offline"],
98862
+ recovery: ["node-online"],
98863
+ snapshotLabel: "Nodes offline now",
98864
+ snapshotSection: "nodes"
98865
+ },
98866
+ {
98867
+ id: "storage-space",
98868
+ family: "system",
98869
+ label: "Storage space (low or critical / ok again)",
98870
+ bad: ["storage-location-low", "storage-location-critical"],
98871
+ recovery: ["storage-location-ok"],
98872
+ snapshotLabel: "Storage locations low now",
98873
+ snapshotSection: null
98874
+ },
98875
+ {
98876
+ id: "critical-alerts",
98877
+ family: "system",
98878
+ label: "Critical alerts (raised / resolved)",
98879
+ bad: ["alert-critical"],
98880
+ recovery: ["alert-critical-resolved"],
98881
+ snapshotLabel: "Critical alerts open now",
98882
+ snapshotSection: null
98883
+ },
98884
+ {
98885
+ id: "rule-health",
98886
+ family: "system",
98887
+ label: "Rule health (broken / repaired)",
98888
+ bad: ["rule-broken"],
98889
+ recovery: ["rule-repaired"],
98890
+ snapshotLabel: "Notification rules broken now",
98891
+ snapshotSection: null
98892
+ }
98893
+ ];
98894
+ var CLASS_BY_KIND = new Map(NC_SYSTEM_EVENT_CLASS_SPECS.flatMap((spec) => [...spec.bad, ...spec.recovery].map((kind) => [kind, spec])));
98895
+ /** Every edge of a class: what an instant rule selecting it listens to. */
98896
+ function systemEventClassKinds(spec) {
98897
+ return [...spec.bad, ...spec.recovery];
98898
+ }
98899
+ /** The class a kind belongs to, or `undefined` for a one-edge kind. */
98900
+ function systemEventClassOf(kind) {
98901
+ return CLASS_BY_KIND.get(kind);
98902
+ }
98903
+ /** Is this kind a RECOVERY edge of some class? */
98904
+ function isSystemEventRecoveryKind(kind) {
98905
+ return systemEventClassOf(kind)?.recovery.some((k) => k === kind) ?? false;
98906
+ }
98907
+ /** The classes of ONE family, for that family's editor. */
98908
+ function systemEventClassesFor(family) {
98909
+ return NC_SYSTEM_EVENT_CLASS_SPECS.filter((spec) => spec.family === family);
98910
+ }
98911
+ /**
98912
+ * A kind list with the OTHER front of every class it touches: a bad edge
98913
+ * brings the class's recovery, a recovery brings the class's bad edges. A
98914
+ * sibling bad edge is never added by a bad edge — a rule on
98915
+ * `storage-location-critical` does not start hearing `storage-location-low`.
98916
+ * Input order is kept, each added edge right after the kind that brought it.
98917
+ * Kinds of no class (and legacy names) pass through.
98918
+ */
98919
+ function expandSystemEventClasses(kinds) {
98920
+ const out = [];
98921
+ const seen = /* @__PURE__ */ new Set();
98922
+ const push = (kind) => {
98923
+ if (seen.has(kind)) return;
98924
+ seen.add(kind);
98925
+ out.push(kind);
98926
+ };
98927
+ const listed = new Set(kinds);
98928
+ for (const kind of kinds) {
98929
+ push(kind);
98930
+ const spec = systemEventClassOf(kind);
98931
+ if (spec === void 0) continue;
98932
+ const hasBad = spec.bad.some((k) => listed.has(k));
98933
+ if (spec.bad.some((k) => k === kind)) for (const edge of spec.recovery) push(edge);
98934
+ else if (!hasBad) for (const edge of spec.bad) push(edge);
98935
+ }
98936
+ return out;
98937
+ }
98938
+ /** Does this rule speak per EVENT (not a scheduled summary)? */
98939
+ function isInstantSystemRule(rule) {
98940
+ if (rule.delivery !== "system-event") return false;
98941
+ return rule.systemEventDelivery?.mode !== "summary";
98942
+ }
98943
+ /**
98944
+ * An INSTANT system rule with each class it touches completed with both edges;
98945
+ * the rule itself (same object) when there is nothing to add, a summary rule,
98946
+ * or a rule spanning families (`mixed` stays read-only, D637). A copy, never a
98947
+ * mutation.
98948
+ */
98949
+ function withSystemEventClasses(rule) {
98950
+ const condition = rule.conditions.systemEvent;
98951
+ if (condition === void 0 || !isInstantSystemRule(rule)) return rule;
98952
+ const families = new Set(condition.kinds.map((kind) => NC_SYSTEM_EVENT_FAMILY[kind]));
98953
+ if (families.size !== 1 || families.has(null)) return rule;
98954
+ const kinds = expandSystemEventClasses(condition.kinds);
98955
+ if (kinds.length === condition.kinds.length) return rule;
98956
+ return {
98957
+ ...rule,
98958
+ conditions: {
98959
+ ...rule.conditions,
98960
+ systemEvent: {
98961
+ ...condition,
98962
+ kinds
98963
+ }
98964
+ }
98965
+ };
98966
+ }
98967
+ //#endregion
98614
98968
  //#region src/notification/system-event-summary.ts
98615
98969
  /** The families a rule may summarise. The alarm is not one of them. */
98616
98970
  var NC_SYSTEM_EVENT_SUMMARY_FAMILIES = ["device-events", "system"];
@@ -103857,8 +104211,6 @@ exports.AlertSourceSchema = AlertSourceSchema;
103857
104211
  exports.AlertStatusSchema = AlertStatusSchema;
103858
104212
  exports.AmbientLightSensorStatusSchema = AmbientLightSensorStatusSchema;
103859
104213
  exports.AnalyticsLtsSeriesSchema = AnalyticsLtsSeriesSchema;
103860
- exports.ApiKeyRecordSchema = ApiKeyRecordSchema;
103861
- exports.ApiKeySummarySchema = ApiKeySummarySchema;
103862
104214
  exports.AppFlowPurposeSchema = AppFlowPurposeSchema;
103863
104215
  exports.AppLoginPathSchema = AppLoginPathSchema;
103864
104216
  exports.AppPageLangSchema = AppPageLangSchema;
@@ -104846,6 +105198,7 @@ exports.NC_SENSOR_TRANSITION_UNSUPPORTED_REASON = NC_SENSOR_TRANSITION_UNSUPPORT
104846
105198
  exports.NC_SERVER_PACKAGE_NAME = NC_SERVER_PACKAGE_NAME;
104847
105199
  exports.NC_SNOOZE_MAX_MINUTES = NC_SNOOZE_MAX_MINUTES;
104848
105200
  exports.NC_SYSTEM_DELIVERY = NC_SYSTEM_DELIVERY;
105201
+ exports.NC_SYSTEM_EVENT_CLASS_SPECS = NC_SYSTEM_EVENT_CLASS_SPECS;
104849
105202
  exports.NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS = NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS;
104850
105203
  exports.NC_SYSTEM_EVENT_FAMILIES = NC_SYSTEM_EVENT_FAMILIES;
104851
105204
  exports.NC_SYSTEM_EVENT_FAMILY = NC_SYSTEM_EVENT_FAMILY;
@@ -105244,6 +105597,7 @@ exports.RecordRetentionSchema = require_sleep.RecordRetentionSchema;
105244
105597
  exports.RecordSecretRefsSchema = RecordSecretRefsSchema;
105245
105598
  exports.RecordSecretUnavailableError = require_sleep.RecordSecretUnavailableError;
105246
105599
  exports.RecordTooLargeError = require_sleep.RecordTooLargeError;
105600
+ exports.RecordTransactOpSchema = RecordTransactOpSchema;
105247
105601
  exports.RecordTriggerSchema = RecordTriggerSchema;
105248
105602
  exports.RecordUniqueViolationError = require_sleep.RecordUniqueViolationError;
105249
105603
  exports.RecordViewSchema = RecordViewSchema;
@@ -105513,6 +105867,7 @@ exports.StorageReadChunkInputSchema = ReadChunkInputSchema;
105513
105867
  exports.StorageTableSchema = StorageTableSchema;
105514
105868
  exports.StorageTestLocationResultSchema = TestLocationResultSchema;
105515
105869
  exports.StorageWriteChunkInputSchema = WriteChunkInputSchema;
105870
+ exports.StoredRecordKindDeclarationSchema = require_sleep.StoredRecordKindDeclarationSchema;
105516
105871
  exports.StreamCodecSchema = StreamCodecSchema;
105517
105872
  exports.StreamFormatSchema = StreamFormatSchema;
105518
105873
  exports.StreamNetworkStatsSchema = StreamNetworkStatsSchema;
@@ -105619,6 +105974,7 @@ exports.TrainingResultFileSchema = TrainingResultFileSchema;
105619
105974
  exports.TrainingResultSchema = TrainingResultSchema;
105620
105975
  exports.TrainingSplitPlanSchema = TrainingSplitPlanSchema;
105621
105976
  exports.TrainingStageSchema = TrainingStageSchema;
105977
+ exports.TransactRefusedError = require_sleep.TransactRefusedError;
105622
105978
  exports.TransportPlaneCountsSchema = TransportPlaneCountsSchema;
105623
105979
  exports.TransportPlaneSchema = TransportPlaneSchema;
105624
105980
  exports.TurnServerSchema = TurnServerSchema;
@@ -105753,6 +106109,7 @@ exports.asNumber = require_sleep.asNumber;
105753
106109
  exports.asRecordsError = require_sleep.asRecordsError;
105754
106110
  exports.asString = require_sleep.asString;
105755
106111
  exports.assertTimelapseCadences = assertTimelapseCadences;
106112
+ exports.assertTransactScope = require_sleep.assertTransactScope;
105756
106113
  exports.assertValidDeclaration = require_sleep.assertValidDeclaration;
105757
106114
  exports.assignNodeColorId = require_node_color.assignNodeColorId;
105758
106115
  exports.audioAnalysisCapability = audioAnalysisCapability;
@@ -105950,6 +106307,7 @@ exports.detectAccessRole = detectAccessRole;
105950
106307
  exports.detectionPipelineCapability = detectionPipelineCapability;
105951
106308
  exports.deviceAdminLinkCapability = deviceAdminLinkCapability;
105952
106309
  exports.deviceAdoptionCapability = deviceAdoptionCapability;
106310
+ exports.deviceAttentionKind = deviceAttentionKind;
105953
106311
  exports.deviceBackendToFormat = deviceBackendToFormat;
105954
106312
  exports.deviceCredentialsCapability = deviceCredentialsCapability;
105955
106313
  exports.deviceCustomAction = require_sleep.deviceCustomAction;
@@ -106017,6 +106375,7 @@ exports.evictionPolicyOfLocation = evictionPolicyOfLocation;
106017
106375
  exports.expandAudioChunkToF32le = require_sleep.expandAudioChunkToF32le;
106018
106376
  exports.expandCapMethods = require_sleep.expandCapMethods;
106019
106377
  exports.expandContainer = expandContainer;
106378
+ exports.expandSystemEventClasses = expandSystemEventClasses;
106020
106379
  exports.exportSubjectOf = exportSubjectOf;
106021
106380
  exports.exposeBlockDevices = exposeBlockDevices;
106022
106381
  exports.expressionContainsBuiltinCall = expressionContainsBuiltinCall;
@@ -106158,6 +106517,7 @@ exports.isStatefulBuiltin = require_composition.isStatefulBuiltin;
106158
106517
  exports.isStorageLocationMode = isStorageLocationMode;
106159
106518
  exports.isSystemDelivery = isSystemDelivery;
106160
106519
  exports.isSystemEventFamily = isSystemEventFamily;
106520
+ exports.isSystemEventRecoveryKind = isSystemEventRecoveryKind;
106161
106521
  exports.isSystemEventSummaryRule = isSystemEventSummaryRule;
106162
106522
  exports.isSystemRuleKind = isSystemRuleKind;
106163
106523
  exports.isVectorIndexDimConflict = isVectorIndexDimConflict;
@@ -106525,6 +106885,9 @@ exports.switchedOffIds = switchedOffIds;
106525
106885
  exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
106526
106886
  exports.synthesizeSourceInfo = synthesizeSourceInfo;
106527
106887
  exports.systemCapability = systemCapability;
106888
+ exports.systemEventClassKinds = systemEventClassKinds;
106889
+ exports.systemEventClassOf = systemEventClassOf;
106890
+ exports.systemEventClassesFor = systemEventClassesFor;
106528
106891
  exports.systemEventDeliveryProblems = systemEventDeliveryProblems;
106529
106892
  exports.systemEventFamilyOf = systemEventFamilyOf;
106530
106893
  exports.systemEventFamilyProblems = systemEventFamilyProblems;
@@ -106602,6 +106965,7 @@ exports.wiringProbeKindSchema = wiringProbeKindSchema;
106602
106965
  exports.wiringProbeResultSchema = wiringProbeResultSchema;
106603
106966
  exports.withFieldFrom = withFieldFrom;
106604
106967
  exports.withLocationMode = withLocationMode;
106968
+ exports.withSystemEventClasses = withSystemEventClasses;
106605
106969
  exports.withoutCallerStamp = require_sleep.withoutCallerStamp;
106606
106970
  exports.withoutField = withoutField;
106607
106971
  exports.writeModelBoundSetting = writeModelBoundSetting;