@camstack/types 1.2.151 → 1.2.153

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_event_category = require("./event-category-BaEgqJNv.js");
3
- const require_sleep = require("./sleep-BCUreN6s.js");
2
+ const require_event_category = require("./event-category-b8kBSOTT.js");
3
+ const require_sleep = require("./sleep-TVipGseU.js");
4
4
  const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -19016,6 +19016,35 @@ var RecentTracksQueryInput = zod.z.object({
19016
19016
  */
19017
19017
  classes: zod.z.array(zod.z.string()).optional()
19018
19018
  });
19019
+ /**
19020
+ * A Summary (D359): the per-camera session envelope that references tracks.
19021
+ * `groupShotKey` is the media key of its group shot (`ownerKind: 'summary'`,
19022
+ * served by the event-media plane by key), null until the first frame with a
19023
+ * member visible has been materialised.
19024
+ */
19025
+ var SummarySchema = zod.z.object({
19026
+ id: zod.z.string(),
19027
+ deviceId: zod.z.number(),
19028
+ openedAt: zod.z.number(),
19029
+ lastActiveAt: zod.z.number(),
19030
+ sealedAt: zod.z.number().nullable(),
19031
+ memberCount: zod.z.number().int().nonnegative(),
19032
+ groupShotKey: zod.z.string().nullable()
19033
+ });
19034
+ var SUMMARIES_MAX_LIMIT = 200;
19035
+ var SUMMARIES_DEFAULT_LIMIT = 50;
19036
+ var SummariesQueryInput = zod.z.object({
19037
+ deviceIds: zod.z.array(zod.z.number()).min(1),
19038
+ since: zod.z.number().optional(),
19039
+ until: zod.z.number().optional(),
19040
+ limit: zod.z.number().int().min(1).max(200).default(50)
19041
+ });
19042
+ var SummariesPageSchema = zod.z.object({ summaries: zod.z.array(SummarySchema).readonly() });
19043
+ var SummaryDetailSchema = zod.z.object({
19044
+ summary: SummarySchema,
19045
+ /** Member track ids, in absorption order. */
19046
+ trackIds: zod.z.array(zod.z.string()).readonly()
19047
+ });
19019
19048
  var RecentTracksPageSchema = zod.z.object({
19020
19049
  /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19021
19050
  tracks: zod.z.array(TrackSchema).readonly(),
@@ -19458,6 +19487,10 @@ var pipelineAnalyticsCapability = {
19458
19487
  * are not included (same contract as `listTracks`).
19459
19488
  */
19460
19489
  listRecentTracks: require_sleep.method(RecentTracksQueryInput, RecentTracksPageSchema),
19490
+ /** Newest first by `openedAt`, for a camera set, inside an optional window. */
19491
+ listSummaries: require_sleep.method(SummariesQueryInput, SummariesPageSchema),
19492
+ /** One summary with its member track ids; `null` for an id nobody wrote. */
19493
+ getSummary: require_sleep.method(zod.z.object({ id: zod.z.string() }), SummaryDetailSchema.nullable()),
19461
19494
  clearTracks: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
19462
19495
  kind: "mutation",
19463
19496
  auth: "admin"
@@ -25535,6 +25568,125 @@ onStatusChanged: { data: zod.z.object({
25535
25568
  volatileStateFields: ["lastUpdated"]
25536
25569
  };
25537
25570
  //#endregion
25571
+ //#region src/capabilities/network-link.cap.ts
25572
+ /**
25573
+ * How a device reaches the network, and how well.
25574
+ *
25575
+ * NOT `connectivity`: that cap is an UPSTREAM system's binary view of whether
25576
+ * an entity is reachable (a Home Assistant `binary_sensor` with
25577
+ * `device_class: connectivity`). This one is the device's OWN link — the
25578
+ * medium it is on and the signal it sees — the way `battery` is the device's
25579
+ * own charge.
25580
+ *
25581
+ * `'wifi'`, `'ethernet'` and `'cellular'` are links the firmware actually
25582
+ * reported. `'unknown'` is the ABSENCE of an answer — the provider has
25583
+ * registered the capability but has not read the link yet (D315: unknown is
25584
+ * not empty). Consumers skip it rather than draw a wire or a bar.
25585
+ */
25586
+ var NETWORK_LINK_TYPES = [
25587
+ "wifi",
25588
+ "ethernet",
25589
+ "cellular",
25590
+ "unknown"
25591
+ ];
25592
+ /**
25593
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
25594
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
25595
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
25596
+ * one Home Assistant projection.
25597
+ */
25598
+ var NetworkLinkStatusSchema = zod.z.object({
25599
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
25600
+ type: zod.z.enum(NETWORK_LINK_TYPES),
25601
+ /**
25602
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
25603
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
25604
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
25605
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
25606
+ * SKIP a null rather than coerce it.
25607
+ */
25608
+ signalPercent: zod.z.number().min(0).max(100).nullable(),
25609
+ /** Raw received signal strength in dBm, when the firmware reports one. */
25610
+ rssiDbm: zod.z.number().optional(),
25611
+ /** Network name of a wireless link, when the firmware reports it. */
25612
+ ssid: zod.z.string().optional(),
25613
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
25614
+ lastUpdated: zod.z.number()
25615
+ });
25616
+ /** The slice a provider seeds before its first read: nothing is known yet. */
25617
+ var NETWORK_LINK_UNKNOWN = {
25618
+ type: "unknown",
25619
+ signalPercent: null,
25620
+ lastUpdated: 0
25621
+ };
25622
+ /**
25623
+ * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
25624
+ * Out-of-range or non-finite input is not a reading: `null`.
25625
+ */
25626
+ function signalPercentFromBars(bars, maxBars) {
25627
+ if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
25628
+ if (bars < 0 || bars > maxBars) return null;
25629
+ return Math.round(bars / maxBars * 100);
25630
+ }
25631
+ /**
25632
+ * Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
25633
+ * below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
25634
+ * positive input is not an RSSI: `null`.
25635
+ */
25636
+ function signalPercentFromRssi(rssiDbm) {
25637
+ if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
25638
+ return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
25639
+ }
25640
+ var networkLinkCapability = {
25641
+ name: "network-link",
25642
+ scope: "device",
25643
+ deviceNative: true,
25644
+ mode: "singleton",
25645
+ deviceTypes: [
25646
+ require_sleep.DeviceType.Camera,
25647
+ require_sleep.DeviceType.Sensor,
25648
+ require_sleep.DeviceType.Button,
25649
+ require_sleep.DeviceType.Switch,
25650
+ require_sleep.DeviceType.Light,
25651
+ require_sleep.DeviceType.Lock,
25652
+ require_sleep.DeviceType.Siren
25653
+ ],
25654
+ methods: {},
25655
+ events: {
25656
+ /**
25657
+ * Emitted whenever the cached status changes (a link switch, a signal
25658
+ * reading that moved). Mirrored on the parent chain by the
25659
+ * DeviceEventPropagator like `battery.onStatusChanged`.
25660
+ */
25661
+ onStatusChanged: { data: zod.z.object({
25662
+ deviceId: zod.z.number(),
25663
+ status: NetworkLinkStatusSchema
25664
+ }) } },
25665
+ status: {
25666
+ schema: NetworkLinkStatusSchema,
25667
+ kind: "push",
25668
+ empty: NETWORK_LINK_UNKNOWN
25669
+ },
25670
+ /**
25671
+ * Runtime-state slice — every provider stores the same shape under
25672
+ * `device.runtimeState['network-link']`, read once by the badge and the
25673
+ * Home Assistant projector regardless of the driver.
25674
+ */
25675
+ runtimeState: NetworkLinkStatusSchema,
25676
+ /**
25677
+ * Runtime-state durability: **restored** — a link reading is slow to
25678
+ * change and a sleeping battery camera may not report for hours; the
25679
+ * restored slice is what the badge shows until the next read.
25680
+ *
25681
+ * See `RuntimeStateDurability`. Enforced by
25682
+ * `scripts/check-runtime-state-durability.ts`.
25683
+ */
25684
+ durability: "restored",
25685
+ /** Clock fields: written, but excluded from the compare that decides
25686
+ * whether persisting is worth a SQLite commit. */
25687
+ volatileStateFields: ["lastUpdated"]
25688
+ };
25689
+ //#endregion
25538
25690
  //#region src/capabilities/binary.cap.ts
25539
25691
  /**
25540
25692
  * Generic boolean sensor — last-resort fallback when no domain-
@@ -36035,6 +36187,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
36035
36187
  motionTrigger: motionTriggerCapability,
36036
36188
  motionZones: motionZonesCapability,
36037
36189
  nativeObjectDetection: nativeObjectDetectionCapability,
36190
+ networkLink: networkLinkCapability,
36038
36191
  notifier: notifierCapability,
36039
36192
  numericSensor: numericSensorCapability,
36040
36193
  petFeeder: petFeederCapability,
@@ -38847,6 +39000,7 @@ var CAP_NAMES_WITH_STATUS = [
38847
39000
  "motion-zones",
38848
39001
  "mqtt-broker",
38849
39002
  "native-object-detection",
39003
+ "network-link",
38850
39004
  "notifier",
38851
39005
  "numeric-sensor",
38852
39006
  "osd",
@@ -38966,6 +39120,7 @@ var CAPABILITY_NAMES = {
38966
39120
  mqttBroker: "mqtt-broker",
38967
39121
  nativeObjectDetection: "native-object-detection",
38968
39122
  networkAccess: "network-access",
39123
+ networkLink: "network-link",
38969
39124
  networkQuality: "network-quality",
38970
39125
  nodes: "nodes",
38971
39126
  notificationOutput: "notification-output",
@@ -39391,6 +39546,10 @@ var CAPABILITY_ROUTER_KEYS = [
39391
39546
  key: "networkAccess",
39392
39547
  name: "network-access"
39393
39548
  },
39549
+ {
39550
+ key: "networkLink",
39551
+ name: "network-link"
39552
+ },
39394
39553
  {
39395
39554
  key: "networkQuality",
39396
39555
  name: "network-quality"
@@ -39740,6 +39899,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
39740
39899
  mqttBrokerCapability,
39741
39900
  nativeObjectDetectionCapability,
39742
39901
  networkAccessCapability,
39902
+ networkLinkCapability,
39743
39903
  networkQualityCapability,
39744
39904
  nodesCapability,
39745
39905
  notificationOutputCapability,
@@ -43106,6 +43266,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
43106
43266
  addonId: null,
43107
43267
  access: "view"
43108
43268
  },
43269
+ "pipelineAnalytics.getSummary": {
43270
+ capName: "pipeline-analytics",
43271
+ capScope: "device",
43272
+ addonId: null,
43273
+ access: "view"
43274
+ },
43109
43275
  "pipelineAnalytics.getTrack": {
43110
43276
  capName: "pipeline-analytics",
43111
43277
  capScope: "device",
@@ -43184,6 +43350,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
43184
43350
  addonId: null,
43185
43351
  access: "view"
43186
43352
  },
43353
+ "pipelineAnalytics.listSummaries": {
43354
+ capName: "pipeline-analytics",
43355
+ capScope: "device",
43356
+ addonId: null,
43357
+ access: "view"
43358
+ },
43187
43359
  "pipelineAnalytics.listTrackMedia": {
43188
43360
  capName: "pipeline-analytics",
43189
43361
  capScope: "device",
@@ -47142,6 +47314,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
47142
47314
  form: "array",
47143
47315
  optional: true
47144
47316
  }],
47317
+ "pipelineAnalytics.listSummaries": [{
47318
+ name: "deviceIds",
47319
+ form: "array",
47320
+ optional: false
47321
+ }],
47145
47322
  "pipelineAnalytics.listTrackMedia": [{
47146
47323
  name: "deviceId",
47147
47324
  form: "single",
@@ -48086,7 +48263,7 @@ function getCapsByProviderKind(kind) {
48086
48263
  //#region src/generated/runtime-state-durability.ts
48087
48264
  /**
48088
48265
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
48089
- * `runtimeState`. 64 caps: 34 `restored`, 30 `session`.
48266
+ * `runtimeState`. 65 caps: 35 `restored`, 30 `session`.
48090
48267
  *
48091
48268
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
48092
48269
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -48248,6 +48425,10 @@ var RUNTIME_STATE_POLICY = {
48248
48425
  durability: "restored",
48249
48426
  volatileFields: ["lastFetchedAt"]
48250
48427
  },
48428
+ "network-link": {
48429
+ durability: "restored",
48430
+ volatileFields: ["lastUpdated"]
48431
+ },
48251
48432
  "notifier": {
48252
48433
  durability: "session",
48253
48434
  volatileFields: []
@@ -48390,6 +48571,7 @@ var RESTORED_CAP_NAMES = [
48390
48571
  "lock-control",
48391
48572
  "motion-zones",
48392
48573
  "native-object-detection",
48574
+ "network-link",
48393
48575
  "numeric-sensor",
48394
48576
  "power-meter",
48395
48577
  "presence",
@@ -53660,6 +53842,8 @@ exports.NC_SNOOZE_MAX_MINUTES = NC_SNOOZE_MAX_MINUTES;
53660
53842
  exports.NC_SYSTEM_DELIVERY = NC_SYSTEM_DELIVERY;
53661
53843
  exports.NC_SYSTEM_EVENT_FILTER_KEYS = NC_SYSTEM_EVENT_FILTER_KEYS;
53662
53844
  exports.NC_TAXONOMY = NC_TAXONOMY;
53845
+ exports.NETWORK_LINK_TYPES = NETWORK_LINK_TYPES;
53846
+ exports.NETWORK_LINK_UNKNOWN = NETWORK_LINK_UNKNOWN;
53663
53847
  exports.NativeCropBboxSchema = NativeCropBboxSchema;
53664
53848
  exports.NativeCropRefSchema = NativeCropRefSchema;
53665
53849
  exports.NativeCropResultSchema = NativeCropResultSchema;
@@ -53718,6 +53902,7 @@ exports.NcZoneConditionSchema = NcZoneConditionSchema;
53718
53902
  exports.NetworkAccessStatusSchema = NetworkAccessStatusSchema;
53719
53903
  exports.NetworkAddressSchema = NetworkAddressSchema;
53720
53904
  exports.NetworkEndpointSchema = NetworkEndpointSchema;
53905
+ exports.NetworkLinkStatusSchema = NetworkLinkStatusSchema;
53721
53906
  exports.NotificationActionIconSchema = NotificationActionIconSchema;
53722
53907
  exports.NotificationActionSchema = NotificationActionSchema;
53723
53908
  exports.NotificationFormatSchema = NotificationFormatSchema;
@@ -53910,6 +54095,8 @@ exports.STORAGE_ACCESS_FALLBACK = STORAGE_ACCESS_FALLBACK;
53910
54095
  exports.STREAM_PROFILE_META = STREAM_PROFILE_META;
53911
54096
  exports.STREAM_QUALITY_LABELS = STREAM_QUALITY_LABELS;
53912
54097
  exports.SUB_DETECTION_TYPES = SUB_DETECTION_TYPES;
54098
+ exports.SUMMARIES_DEFAULT_LIMIT = SUMMARIES_DEFAULT_LIMIT;
54099
+ exports.SUMMARIES_MAX_LIMIT = SUMMARIES_MAX_LIMIT;
53913
54100
  exports.SYSTEM_CAP_NAMES = SYSTEM_CAP_NAMES;
53914
54101
  exports.SYSTEM_SCOPE_DEVICE_METHODS = SYSTEM_SCOPE_DEVICE_METHODS;
53915
54102
  exports.SceneCheckSchema = SceneCheckSchema;
@@ -54011,6 +54198,7 @@ exports.SubscribeAudioChunksInputSchema = require_sleep.SubscribeAudioChunksInpu
54011
54198
  exports.SubscribeAudioChunksResultSchema = require_sleep.SubscribeAudioChunksResultSchema;
54012
54199
  exports.SubscribeFramesInputSchema = require_sleep.SubscribeFramesInputSchema;
54013
54200
  exports.SubscribeFramesResultSchema = require_sleep.SubscribeFramesResultSchema;
54201
+ exports.SummarySchema = SummarySchema;
54014
54202
  exports.SwitchStatusSchema = SwitchStatusSchema;
54015
54203
  exports.SystemMetricsSchema = SystemMetricsSchema;
54016
54204
  exports.SystemMirror = SystemMirror;
@@ -54374,6 +54562,7 @@ exports.motionZonesCapability = motionZonesCapability;
54374
54562
  exports.mqttBrokerCapability = mqttBrokerCapability;
54375
54563
  exports.nativeObjectDetectionCapability = nativeObjectDetectionCapability;
54376
54564
  exports.networkAccessCapability = networkAccessCapability;
54565
+ exports.networkLinkCapability = networkLinkCapability;
54377
54566
  exports.networkQualityCapability = networkQualityCapability;
54378
54567
  exports.nodePin = require_sleep.nodePin;
54379
54568
  exports.nodesCapability = nodesCapability;
@@ -54487,6 +54676,8 @@ exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
54487
54676
  exports.serverManagementCapability = serverManagementCapability;
54488
54677
  exports.setByPath = setByPath;
54489
54678
  exports.settingsStoreCapability = settingsStoreCapability;
54679
+ exports.signalPercentFromBars = signalPercentFromBars;
54680
+ exports.signalPercentFromRssi = signalPercentFromRssi;
54490
54681
  exports.sleep = require_sleep.sleep;
54491
54682
  exports.sleepCancellable = require_sleep.sleepCancellable;
54492
54683
  exports.sliceActiveValue = sliceActiveValue;