@camstack/types 1.2.416 → 1.2.418

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 (79) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/capabilities/air-quality-sensor.cap.d.ts +2 -8
  4. package/dist/capabilities/ambient-light-sensor.cap.d.ts +3 -14
  5. package/dist/capabilities/battery.cap.d.ts +9 -2
  6. package/dist/capabilities/binary.cap.d.ts +0 -5
  7. package/dist/capabilities/capability-definition.d.ts +11 -6
  8. package/dist/capabilities/composer.cap.d.ts +198 -0
  9. package/dist/capabilities/consumables.cap.d.ts +30 -41
  10. package/dist/capabilities/control.cap.d.ts +3 -25
  11. package/dist/capabilities/core-blocks.cap.d.ts +1421 -0
  12. package/dist/capabilities/customize-catalog.d.ts +0 -8
  13. package/dist/capabilities/customize-spec.d.ts +2 -3
  14. package/dist/capabilities/device-manager.cap.d.ts +79 -0
  15. package/dist/capabilities/device-provider.cap.d.ts +36 -0
  16. package/dist/capabilities/enum-sensor.cap.d.ts +5 -17
  17. package/dist/capabilities/group-status.cap.d.ts +46 -0
  18. package/dist/capabilities/humidity-sensor.cap.d.ts +3 -14
  19. package/dist/capabilities/index.d.ts +4 -2
  20. package/dist/capabilities/motion.cap.d.ts +13 -5
  21. package/dist/capabilities/numeric-sensor.cap.d.ts +8 -16
  22. package/dist/capabilities/pet-feeder.cap.d.ts +1 -1
  23. package/dist/capabilities/power-meter.cap.d.ts +0 -11
  24. package/dist/capabilities/pressure-sensor.cap.d.ts +3 -9
  25. package/dist/capabilities/running-state.cap.d.ts +1 -2
  26. package/dist/capabilities/runtime-field-unit.d.ts +1 -0
  27. package/dist/capabilities/runtime-field-units.d.ts +8 -0
  28. package/dist/capabilities/switch.cap.d.ts +0 -5
  29. package/dist/capabilities/temperature-sensor.cap.d.ts +5 -20
  30. package/dist/capabilities/weather.cap.d.ts +4 -13
  31. package/dist/client.d.ts +2 -1
  32. package/dist/client.js +57 -5
  33. package/dist/client.mjs +55 -6
  34. package/dist/composition/composition-report.d.ts +80 -3
  35. package/dist/composition/composition.d.ts +285 -5
  36. package/dist/composition/helpers/aggregate.d.ts +41 -0
  37. package/dist/composition/helpers/catalog.d.ts +42 -0
  38. package/dist/composition/helpers/compile.d.ts +22 -0
  39. package/dist/composition/helpers/index.d.ts +6 -0
  40. package/dist/composition/helpers/save.d.ts +18 -0
  41. package/dist/composition/helpers/source-pick.d.ts +40 -0
  42. package/dist/composition/helpers/spec.d.ts +38 -0
  43. package/dist/composition/index.d.ts +1 -0
  44. package/dist/composition/source-ref.d.ts +11 -0
  45. package/dist/composition/state-fields.d.ts +1 -1
  46. package/dist/composition/validate-composition.d.ts +8 -2
  47. package/dist/{composition-kEl9mevu.mjs → composition-B85l9j1M.mjs} +114 -8
  48. package/dist/{composition-DsmkwP9-.js → composition-OJKOJJD-.js} +179 -7
  49. package/dist/device/cap-vocabulary/entries/sensors.d.ts +1 -1
  50. package/dist/device/cap-vocabulary/types.d.ts +2 -2
  51. package/dist/device/schema-fields.d.ts +3 -0
  52. package/dist/device/source-info.d.ts +12 -6
  53. package/dist/generated/addon-api.d.ts +14 -0
  54. package/dist/generated/addon-cap-facts.d.ts +1 -1
  55. package/dist/generated/cap-status-types.d.ts +3 -1
  56. package/dist/generated/capability-router-map.d.ts +5 -2
  57. package/dist/generated/customize-catalog.d.ts +11 -87
  58. package/dist/generated/device-local-state.d.ts +3 -0
  59. package/dist/generated/device-proxy.d.ts +3 -0
  60. package/dist/generated/history-catalog.d.ts +1 -1
  61. package/dist/generated/method-access-map.d.ts +1 -1
  62. package/dist/generated/method-device-selectors.d.ts +1 -1
  63. package/dist/generated/runtime-state-durability.d.ts +1 -1
  64. package/dist/index.d.ts +3 -1
  65. package/dist/index.js +1458 -499
  66. package/dist/index.mjs +1420 -499
  67. package/dist/node.js +1 -1
  68. package/dist/node.mjs +1 -1
  69. package/dist/{sleep-BPQ2ZyaI.js → sleep-7Gw3GJ4n.js} +232 -127
  70. package/dist/{sleep-BErAxhul.mjs → sleep-B81gwQuR.mjs} +179 -128
  71. package/dist/units/convert.d.ts +5 -0
  72. package/dist/units/format-reading.d.ts +15 -0
  73. package/dist/units/index.d.ts +8 -1
  74. package/dist/units/ingest-reading.d.ts +21 -0
  75. package/dist/units/quantity.d.ts +47 -0
  76. package/dist/units/threshold.d.ts +6 -0
  77. package/dist/units/unit-table.d.ts +2 -228
  78. package/package.json +1 -1
  79. package/dist/capabilities/advanced-parameters.d.ts +0 -17
@@ -5112,6 +5112,134 @@ function makeInMemoryRecords(owner = "spec", options = {}) {
5112
5112
  }
5113
5113
  };
5114
5114
  }
5115
+ var READING_QUANTITIES = [
5116
+ "temperature",
5117
+ "pressure",
5118
+ "speed",
5119
+ "precipitation",
5120
+ "precipitation-rate",
5121
+ "length",
5122
+ "area",
5123
+ "illuminance",
5124
+ "irradiance",
5125
+ "power",
5126
+ "energy",
5127
+ "voltage",
5128
+ "current",
5129
+ "apparent-power",
5130
+ "humidity",
5131
+ "percentage",
5132
+ "concentration-volume",
5133
+ "concentration-mass",
5134
+ "concentration-ppb",
5135
+ "volume",
5136
+ "duration",
5137
+ "duration-ms",
5138
+ "information",
5139
+ "sound-level",
5140
+ "signal-level",
5141
+ "colour-temperature",
5142
+ "angle",
5143
+ "bitrate",
5144
+ "rate",
5145
+ "mass",
5146
+ "index",
5147
+ "ratio",
5148
+ "count",
5149
+ "none",
5150
+ "device"
5151
+ ];
5152
+ var ReadingQuantitySchema = z.enum(READING_QUANTITIES);
5153
+ var QUANTITY_SET = new Set(READING_QUANTITIES);
5154
+ function isReadingQuantity(value) {
5155
+ return typeof value === "string" && QUANTITY_SET.has(value);
5156
+ }
5157
+ /**
5158
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
5159
+ * (or an index / ratio / count). `device` means the cap has no single unit.
5160
+ */
5161
+ var QUANTITY_BASE = {
5162
+ temperature: "°C",
5163
+ pressure: "hPa",
5164
+ speed: "m/s",
5165
+ precipitation: "mm",
5166
+ "precipitation-rate": "mm/h",
5167
+ length: "m",
5168
+ area: "m²",
5169
+ illuminance: "lx",
5170
+ irradiance: "W/m²",
5171
+ power: "W",
5172
+ energy: "kWh",
5173
+ voltage: "V",
5174
+ current: "A",
5175
+ "apparent-power": "VA",
5176
+ humidity: "%",
5177
+ percentage: "%",
5178
+ "concentration-volume": "ppm",
5179
+ "concentration-mass": "µg/m³",
5180
+ "concentration-ppb": "ppb",
5181
+ volume: "L",
5182
+ duration: "s",
5183
+ "duration-ms": "ms",
5184
+ information: "B",
5185
+ "sound-level": "dBFS",
5186
+ "signal-level": "dBm",
5187
+ "colour-temperature": "mired",
5188
+ angle: "°",
5189
+ bitrate: "kbps",
5190
+ rate: "fps",
5191
+ mass: "kg",
5192
+ index: "none",
5193
+ ratio: "none",
5194
+ count: "none",
5195
+ none: "none",
5196
+ device: "device"
5197
+ };
5198
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
5199
+ function baseUnitOf(quantity) {
5200
+ const symbol = QUANTITY_BASE[quantity];
5201
+ if (symbol === "none" || symbol === "device") return void 0;
5202
+ return symbol;
5203
+ }
5204
+ /**
5205
+ * History catalog label for a quantity. Index and ratio keep the labels the
5206
+ * series already used (`count`, `ratio`). A polymorphic reading has no
5207
+ * single label.
5208
+ */
5209
+ function historyUnitFor(quantity) {
5210
+ if (quantity === "index" || quantity === "count") return "count";
5211
+ if (quantity === "ratio") return "ratio";
5212
+ return baseUnitOf(quantity);
5213
+ }
5214
+ function readingMeta(quantity, extras) {
5215
+ return {
5216
+ quantity,
5217
+ ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
5218
+ ...extras?.label !== void 0 ? { label: extras.label } : {}
5219
+ };
5220
+ }
5221
+ /** Imperial display symbol when it differs from the stored base. */
5222
+ var IMPERIAL_DISPLAY = {
5223
+ temperature: "°F",
5224
+ pressure: "inHg",
5225
+ speed: "mph",
5226
+ precipitation: "in",
5227
+ "precipitation-rate": "in/h",
5228
+ length: "ft",
5229
+ volume: "gal"
5230
+ };
5231
+ var DISPLAY_PREFERENCES = ["metric", "imperial"];
5232
+ var DEFAULT_DISPLAY_PREFERENCE = "metric";
5233
+ /** Display symbol for a preference. Duration and information are scaled by the formatter. */
5234
+ function displayUnitFor(quantity, preference) {
5235
+ const base = baseUnitOf(quantity);
5236
+ if (base === void 0) return void 0;
5237
+ if (preference === "imperial") {
5238
+ const imperial = IMPERIAL_DISPLAY[quantity];
5239
+ if (imperial !== void 0) return imperial;
5240
+ }
5241
+ return base;
5242
+ }
5115
5243
  //#endregion
5116
5244
  //#region src/capabilities/schemas/streaming-shared.ts
5117
5245
  /** Shared Zod schemas used across streaming capabilities. */
@@ -5147,8 +5275,8 @@ var CamStreamKindSchema = z.enum([
5147
5275
  "derived"
5148
5276
  ]);
5149
5277
  var CamStreamResolutionSchema = z.object({
5150
- width: z.number().int().positive(),
5151
- height: z.number().int().positive()
5278
+ width: z.number().int().positive().meta(readingMeta("none")),
5279
+ height: z.number().int().positive().meta(readingMeta("none"))
5152
5280
  });
5153
5281
  var CameraStreamSchema = z.object({
5154
5282
  /** Stable, provider-assigned id unique within the (deviceId) scope. */
@@ -6003,7 +6131,7 @@ z.object({
6003
6131
  });
6004
6132
  /** The default applied to a `runtimeState` cap that declares no `durability`. */
6005
6133
  var DEFAULT_RUNTIME_STATE_DURABILITY = "session";
6006
- /** Display label per {@link HistoryUnit} (only `'ug/m3'` differs from its id). */
6134
+ /** Display label per {@link HistoryUnit}. */
6007
6135
  var HISTORY_UNIT_LABELS = {
6008
6136
  "%": "%",
6009
6137
  dBFS: "dBFS",
@@ -6017,7 +6145,7 @@ var HISTORY_UNIT_LABELS = {
6017
6145
  lx: "lx",
6018
6146
  ppm: "ppm",
6019
6147
  ppb: "ppb",
6020
- "ug/m3": "µg/m³",
6148
+ "µg/m³": "µg/m³",
6021
6149
  hPa: "hPa",
6022
6150
  count: "count",
6023
6151
  ratio: "ratio",
@@ -6026,7 +6154,8 @@ var HISTORY_UNIT_LABELS = {
6026
6154
  days: "days",
6027
6155
  bytes: "bytes",
6028
6156
  kbps: "kbps",
6029
- fps: "fps"
6157
+ fps: "fps",
6158
+ "m/s": "m/s"
6030
6159
  };
6031
6160
  /** The catalog field path of an item field: `<itemsPath>[].<field>` (`items[].level`). */
6032
6161
  function historyItemFieldPath(itemsPath, field) {
@@ -6584,6 +6713,7 @@ var CAP_NAMES = Object.freeze([
6584
6713
  "filesystem-browse",
6585
6714
  "flood",
6586
6715
  "gas",
6716
+ "group-status",
6587
6717
  "heating-valve",
6588
6718
  "humidifier",
6589
6719
  "humidity-sensor",
@@ -6714,14 +6844,6 @@ var CAP_STATE_LEAVES = Object.freeze({
6714
6844
  {
6715
6845
  "path": "aqi",
6716
6846
  "valueType": "number"
6717
- },
6718
- {
6719
- "path": "unit",
6720
- "valueType": "string"
6721
- },
6722
- {
6723
- "path": "precision",
6724
- "valueType": "number"
6725
6847
  }
6726
6848
  ],
6727
6849
  "alarm-panel": [
@@ -6757,20 +6879,10 @@ var CAP_STATE_LEAVES = Object.freeze({
6757
6879
  "valueType": "boolean"
6758
6880
  }
6759
6881
  ],
6760
- "ambient-light-sensor": [
6761
- {
6762
- "path": "lux",
6763
- "valueType": "number"
6764
- },
6765
- {
6766
- "path": "unit",
6767
- "valueType": "string"
6768
- },
6769
- {
6770
- "path": "precision",
6771
- "valueType": "number"
6772
- }
6773
- ],
6882
+ "ambient-light-sensor": [{
6883
+ "path": "lux",
6884
+ "valueType": "number"
6885
+ }],
6774
6886
  "audio-metrics": [
6775
6887
  {
6776
6888
  "path": "ts",
@@ -6850,6 +6962,10 @@ var CAP_STATE_LEAVES = Object.freeze({
6850
6962
  "path": "lastUpdated",
6851
6963
  "valueType": "number"
6852
6964
  },
6965
+ {
6966
+ "path": "volts",
6967
+ "valueType": "number"
6968
+ },
6853
6969
  {
6854
6970
  "path": "lastContactAt",
6855
6971
  "valueType": "number"
@@ -7092,10 +7208,6 @@ var CAP_STATE_LEAVES = Object.freeze({
7092
7208
  "datetime"
7093
7209
  ]
7094
7210
  },
7095
- {
7096
- "path": "unit",
7097
- "valueType": "string"
7098
- },
7099
7211
  {
7100
7212
  "path": "min",
7101
7213
  "valueType": "number"
@@ -7107,19 +7219,6 @@ var CAP_STATE_LEAVES = Object.freeze({
7107
7219
  {
7108
7220
  "path": "step",
7109
7221
  "valueType": "number"
7110
- },
7111
- {
7112
- "path": "precision",
7113
- "valueType": "number"
7114
- },
7115
- {
7116
- "path": "format",
7117
- "valueType": "enum",
7118
- "enumValues": [
7119
- "date",
7120
- "time",
7121
- "datetime"
7122
- ]
7123
7222
  }
7124
7223
  ],
7125
7224
  "cover": [
@@ -7360,13 +7459,8 @@ var CAP_STATE_LEAVES = Object.freeze({
7360
7459
  "path": "value",
7361
7460
  "valueType": "string"
7362
7461
  }, {
7363
- "path": "format",
7364
- "valueType": "enum",
7365
- "enumValues": [
7366
- "date",
7367
- "time",
7368
- "datetime"
7369
- ]
7462
+ "path": "timestamp",
7463
+ "valueType": "boolean"
7370
7464
  }],
7371
7465
  "event-emitter": [
7372
7466
  {
@@ -7439,6 +7533,20 @@ var CAP_STATE_LEAVES = Object.freeze({
7439
7533
  "path": "detected",
7440
7534
  "valueType": "boolean"
7441
7535
  }],
7536
+ "group-status": [
7537
+ {
7538
+ "path": "included",
7539
+ "valueType": "number"
7540
+ },
7541
+ {
7542
+ "path": "excluded",
7543
+ "valueType": "number"
7544
+ },
7545
+ {
7546
+ "path": "total",
7547
+ "valueType": "number"
7548
+ }
7549
+ ],
7442
7550
  "heating-valve": [{
7443
7551
  "path": "position",
7444
7552
  "valueType": "number"
@@ -7473,20 +7581,10 @@ var CAP_STATE_LEAVES = Object.freeze({
7473
7581
  "valueType": "number"
7474
7582
  }
7475
7583
  ],
7476
- "humidity-sensor": [
7477
- {
7478
- "path": "percent",
7479
- "valueType": "number"
7480
- },
7481
- {
7482
- "path": "unit",
7483
- "valueType": "string"
7484
- },
7485
- {
7486
- "path": "precision",
7487
- "valueType": "number"
7488
- }
7489
- ],
7584
+ "humidity-sensor": [{
7585
+ "path": "percent",
7586
+ "valueType": "number"
7587
+ }],
7490
7588
  "image": [{
7491
7589
  "path": "url",
7492
7590
  "valueType": "string"
@@ -7825,20 +7923,10 @@ var CAP_STATE_LEAVES = Object.freeze({
7825
7923
  "valueType": "boolean"
7826
7924
  }
7827
7925
  ],
7828
- "numeric-sensor": [
7829
- {
7830
- "path": "value",
7831
- "valueType": "number"
7832
- },
7833
- {
7834
- "path": "unit",
7835
- "valueType": "string"
7836
- },
7837
- {
7838
- "path": "precision",
7839
- "valueType": "number"
7840
- }
7841
- ],
7926
+ "numeric-sensor": [{
7927
+ "path": "value",
7928
+ "valueType": "number"
7929
+ }],
7842
7930
  "pet-feeder": [
7843
7931
  {
7844
7932
  "path": "foodLevel",
@@ -7930,14 +8018,6 @@ var CAP_STATE_LEAVES = Object.freeze({
7930
8018
  {
7931
8019
  "path": "powerFactor",
7932
8020
  "valueType": "number"
7933
- },
7934
- {
7935
- "path": "unit",
7936
- "valueType": "string"
7937
- },
7938
- {
7939
- "path": "precision",
7940
- "valueType": "number"
7941
8021
  }
7942
8022
  ],
7943
8023
  "presence": [
@@ -7966,20 +8046,10 @@ var CAP_STATE_LEAVES = Object.freeze({
7966
8046
  "valueType": "number"
7967
8047
  }
7968
8048
  ],
7969
- "pressure-sensor": [
7970
- {
7971
- "path": "hpa",
7972
- "valueType": "number"
7973
- },
7974
- {
7975
- "path": "unit",
7976
- "valueType": "string"
7977
- },
7978
- {
7979
- "path": "precision",
7980
- "valueType": "number"
7981
- }
7982
- ],
8049
+ "pressure-sensor": [{
8050
+ "path": "hpa",
8051
+ "valueType": "number"
8052
+ }],
7983
8053
  "privacy-mask": [{
7984
8054
  "path": "enabled",
7985
8055
  "valueType": "boolean"
@@ -8290,20 +8360,10 @@ var CAP_STATE_LEAVES = Object.freeze({
8290
8360
  "path": "tampered",
8291
8361
  "valueType": "boolean"
8292
8362
  }],
8293
- "temperature-sensor": [
8294
- {
8295
- "path": "celsius",
8296
- "valueType": "number"
8297
- },
8298
- {
8299
- "path": "unit",
8300
- "valueType": "string"
8301
- },
8302
- {
8303
- "path": "precision",
8304
- "valueType": "number"
8305
- }
8306
- ],
8363
+ "temperature-sensor": [{
8364
+ "path": "celsius",
8365
+ "valueType": "number"
8366
+ }],
8307
8367
  "update": [
8308
8368
  {
8309
8369
  "path": "currentVersion",
@@ -8414,10 +8474,6 @@ var CAP_STATE_LEAVES = Object.freeze({
8414
8474
  "path": "temperature",
8415
8475
  "valueType": "number"
8416
8476
  },
8417
- {
8418
- "path": "temperatureUnit",
8419
- "valueType": "string"
8420
- },
8421
8477
  {
8422
8478
  "path": "humidity",
8423
8479
  "valueType": "number"
@@ -8426,18 +8482,10 @@ var CAP_STATE_LEAVES = Object.freeze({
8426
8482
  "path": "pressure",
8427
8483
  "valueType": "number"
8428
8484
  },
8429
- {
8430
- "path": "pressureUnit",
8431
- "valueType": "string"
8432
- },
8433
8485
  {
8434
8486
  "path": "windSpeed",
8435
8487
  "valueType": "number"
8436
8488
  },
8437
- {
8438
- "path": "windSpeedUnit",
8439
- "valueType": "string"
8440
- },
8441
8489
  {
8442
8490
  "path": "windBearing",
8443
8491
  "valueType": "number"
@@ -9053,6 +9101,7 @@ function createDeviceProxy(api, binding, opts) {
9053
9101
  const featureProbeInterface = { getStatus: (input) => dispatch("feature-probe", "featureProbe", "getStatus", "query", input) };
9054
9102
  const floodInterface = { getStatus: (input) => dispatch("flood", "flood", "getStatus", "query", input) };
9055
9103
  const gasInterface = { getStatus: (input) => dispatch("gas", "gas", "getStatus", "query", input) };
9104
+ const groupStatusInterface = { getStatus: (input) => dispatch("group-status", "groupStatus", "getStatus", "query", input) };
9056
9105
  const heatingValveInterface = { getStatus: (input) => dispatch("heating-valve", "heatingValve", "getStatus", "query", input) };
9057
9106
  const humidifierInterface = {
9058
9107
  setOn: (input) => dispatch("humidifier", "humidifier", "setOn", "mutation", input),
@@ -9607,6 +9656,7 @@ function createDeviceProxy(api, binding, opts) {
9607
9656
  featureProbe: createSliceHandle(stateSource, binding.deviceId, "feature-probe"),
9608
9657
  flood: createSliceHandle(stateSource, binding.deviceId, "flood"),
9609
9658
  gas: createSliceHandle(stateSource, binding.deviceId, "gas"),
9659
+ groupStatus: createSliceHandle(stateSource, binding.deviceId, "group-status"),
9610
9660
  heatingValve: createSliceHandle(stateSource, binding.deviceId, "heating-valve"),
9611
9661
  humidifier: createSliceHandle(stateSource, binding.deviceId, "humidifier"),
9612
9662
  humiditySensor: createSliceHandle(stateSource, binding.deviceId, "humidity-sensor"),
@@ -9690,6 +9740,7 @@ function createDeviceProxy(api, binding, opts) {
9690
9740
  ...bound("feature-probe") ? { featureProbe: featureProbeInterface } : {},
9691
9741
  ...bound("flood") ? { flood: floodInterface } : {},
9692
9742
  ...bound("gas") ? { gas: gasInterface } : {},
9743
+ ...bound("group-status") ? { groupStatus: groupStatusInterface } : {},
9693
9744
  ...bound("heating-valve") ? { heatingValve: heatingValveInterface } : {},
9694
9745
  ...bound("humidifier") ? { humidifier: humidifierInterface } : {},
9695
9746
  ...bound("humidity-sensor") ? { humiditySensor: humiditySensorInterface } : {},
@@ -10165,4 +10216,4 @@ function sleepCancellable(ms, signal) {
10165
10216
  });
10166
10217
  }
10167
10218
  //#endregion
10168
- export { expandCapMethods as $, PEER_BYTES_CHUNK_BYTES as $n, omitTransientConfig as $r, REMOVE_LEAF as $t, HF_REPO as A, RECORD_BATCH_MAX_BYTES as An, emitReadiness as Ar, StreamSourceEntrySchema$1 as At, withoutCallerStamp as B, RECORD_SECRET_COLLECTION_PREFIX as Bn, SECRET_CLEAR as Br, entryBody as Bt, addonSliceHandleApi as C, RevConflictError as Cn, globalSecretScope as Cr, CamStreamResolutionSchema as Ct, createSliceHandle as D, asRecordsError as Dn, normalizeNodeId as Dr, ProfileRtspEntrySchema as Dt, createMirrorSource as E, UnknownRecordKindError as En, parseSecretRef as Er, FrameHandleSchema as Et, RawStateResultSchema as F, RECORD_ID_MAX_LENGTH as Fn, collectHydratedFieldValues as Fr, makeSourceBrokerId as Ft, adminUiCapability as G, createSecretsAccess as Gn, isSecretMarkerLike as Gr, RecordIndexSchema as Gt, defineCustomActions as H, RECORD_SWEEP_INTERVAL_MS as Hn, isSecretClear as Hr, assertTransactScope as Ht, deviceOpsCapability as I, RECORD_MAX_DATA_BYTES as In, dehydrateConfigField as Ir, parseProfileBrokerId as It, DEVICE_STATUS_METHOD as J, forgetKnownSecret as Jn, REDACTED_SECRET as Jr, RecordRetentionSchema as Jt, DEFAULT_RUNTIME_STATE_DURABILITY as K, MIN_SCRUBBED_LENGTH as Kn, makeSecretMarker as Kr, RecordKindDeclarationSchema as Kt, viewerUiCapability as L, RECORD_MAX_INDEXES as Ln, dehydrateSchema as Lr, selectAssignedProfileSlots as Lt, CAP_ADVANCE_FIELDS as M, RECORD_DATABASES as Mn, WELL_KNOWN_TABS as Mr, SubscribeAudioChunksInputSchema as Mt, CAP_NAMES as N, RECORD_DEFAULT_MAX_DATA_BYTES as Nn, WELL_KNOWN_TAB_MAP as Nr, SubscribeAudioChunksResultSchema as Nt, DEFAULT_TOKEN_EXPIRY as O, recordsErrorFromMessage as On, createDurableState as Or, ProfileSlotSchema as Ot, CAP_STATE_LEAVES as P, RECORD_DELETE_BATCH as Pn, collectHydratedFieldEntries as Pr, makeProfileBrokerId as Pt, event as Q, shortSecretRefHash as Qn, isSecretConfigField as Qr, defineRecordKinds as Qt, DEVICE_CHILDREN_BATCH_MAX as R, RECORD_MAX_INDEX_FIELDS as Rn, hydrateSchema as Rr, makeInMemoryRecords as Rt, invokeTrpcLeaf as S, RecordsError as Sn, formatSecretScope as Sr, CamStreamKindSchema as St, createLazyTrpcSource as T, UnindexedFilterError as Tn, normalizeSecretOwner as Tr, DecodedAudioChunkSchema as Tt, describeCustomActions as U, resolveSecretViewsIn as Un, isSecretFieldView as Ur, EntryDescriptorSchema as Ut, customAction as V, RECORD_SETTINGS_MAX_ROWS as Vn, classifySecretWrite as Vr, createRecordsAccess as Vt, deviceCustomAction as W, REVALIDATE_AFTER_MS as Wn, isSecretMarker as Wr, RecordFieldPathSchema as Wt, HISTORY_UNIT_LABELS as X, registerKnownSecret as Xn, collectSecretConfigKeys as Xr, assertValidDeclaration as Xt, HISTORY_DEFAULT_MIN_INTERVAL_MS as Y, knownSecretCount as Yn, collectKeychainStoredKeys as Yr, StoredRecordKindDeclarationSchema as Yt, PROVIDER_PIN_FIELD as Z, scrubKnownSecrets as Zn, isKeychainStoredField as Zr, declarationsOf as Zt, readErrorI18n as _, RECORDS_ERROR_CODES as _n, resolveSecretMarkers as _r, AudioStreamPickSchema as _t, asJsonArray as a, recordSecretRef as an, SHARE_VIEW_KINDS as ar, systemMethod as at, isDeviceScopedCap as b, RecordTooLargeError as bn, arrayItemFieldPath as br, CAM_PROFILE_ORDER as bt, asString as c, collectZodSecretPaths as cn, classifyStoreError as cr, readNodePin as ct, parseJsonUnknown as d, DeclarationRefusedError as dn, parseSecretStatePath as dr, ReadinessRegistry as dt, schemaDeclaresAnyField as ei, collectSecretLeaves as en, PEER_BYTES_MAX_OUTSTANDING as er, historyItemFieldPath as et, hfModelUrl as f, FilterRequiredError as fn, secretTreeFromPaths as fr, ReadinessTimeoutError as ft, ErrorI18nPayloadSchema as g, PlaintextSecretError as gn, isSecretRefOwnedBy as gr, AudioChunkFormatSchema as gt, ErrorCodeSchema as h, NoCallerError as hn, collectSecretMarkerRefs as hr, scopeKey as ht, asBoolean as i, isAudioChunkFormat as ii, recordSecretCollection as in, DATAPLANE_SECRET_HEADER as ir, resolveCapMount as it, RUNTIME_DEFAULTS as j, RECORD_CLASSES as jn, isEvent as jr, StreamSourceSchema as jt, HF_BASE_URL as k, RECORD_BATCH_MAX as kn, createEvent as kr, ProfileSlotStatusSchema as kt, parseJsonArray as l, isZodSecret as ln, normalizeAddonInitResult as lr, toNodeId as lt, CamstackError as m, InvalidRecordError as mn, KeychainWriteRefusedError as mr, readinessKey as mt, sleepCancellable as n, audioChunkBytesPerSample as ni, parseSecretPath as nn, PEER_BYTES_TICKET_TTL_MS as nr, method as nt, asJsonObject as o, secretArrayPrefixes as on, DisposerChain as or, CAP_NODE_PIN_CONTEXT_KEY as ot, BOOT_RECOVERY_BACKOFF_MS as p, ForeignSecretMarkerError as pn, secretTreeFromSchema as pr, emitDownForOwnedCaps as pt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as q, clearKnownSecrets as qn, toSecretFieldView as qr, RecordKindNameSchema as qt, maskUrlCredentials as r, expandAudioChunkToF32le as ri, recordArrayItemPath as rn, PeerBytesTicketSchema as rr, optionalMethod as rt, asNumber as s, SECRET_META as sn, BaseAddon as sr, nodePin as st, sleep as t, AUDIO_CHUNK_FORMATS as ti, mapSecretLeaves as tn, PEER_BYTES_STALL_MS as tr, isDeviceConfigCap as tt, parseJsonObject as u, BatchTooLargeError as un, mergeSecretStatePaths as ur, MODEL_FORMATS as ut, userError as v, RecordNotFoundError as vn, transformSecretWrite as vr, BrokerStatsSchema as vt, createEventBusSliceSource as w, TransactRefusedError as wn, isSecretRef as wr, CameraStreamSchema as wt, createDeviceProxy as x, RecordUniqueViolationError as xn, buildSecretRef as xr, CamProfileSchema as xt, DEVICE_SCOPED_CAPS as y, RecordSecretUnavailableError as yn, SECRET_REF_SCHEME as yr, BrokerStatusSchema as yt, CALLER_STAMPED_CAPABILITIES as z, RECORD_QUERY_MAX as zn, resolveHydratedFieldValue as zr, defineEntryKind as zt };
10219
+ export { expandCapMethods as $, REVALIDATE_AFTER_MS as $n, isSecretMarker as $r, RecordFieldPathSchema as $t, HF_REPO as A, RecordUniqueViolationError as An, buildSecretRef as Ar, StreamSourceEntrySchema$1 as At, withoutCallerStamp as B, RECORD_CLASSES as Bn, isEvent as Br, QUANTITY_BASE as Bt, addonSliceHandleApi as C, InvalidRecordError as Cn, KeychainWriteRefusedError as Cr, CamStreamResolutionSchema as Ct, createSliceHandle as D, RecordNotFoundError as Dn, transformSecretWrite as Dr, ProfileRtspEntrySchema as Dt, createMirrorSource as E, RECORDS_ERROR_CODES as En, resolveSecretMarkers as Er, FrameHandleSchema as Et, RawStateResultSchema as F, UnknownRecordKindError as Fn, parseSecretRef as Fr, makeSourceBrokerId as Ft, adminUiCapability as G, RECORD_MAX_DATA_BYTES as Gn, dehydrateConfigField as Gr, isReadingQuantity as Gt, defineCustomActions as H, RECORD_DEFAULT_MAX_DATA_BYTES as Hn, WELL_KNOWN_TAB_MAP as Hr, baseUnitOf as Ht, deviceOpsCapability as I, asRecordsError as In, normalizeNodeId as Ir, parseProfileBrokerId as It, DEVICE_STATUS_METHOD as J, RECORD_QUERY_MAX as Jn, resolveHydratedFieldValue as Jr, defineEntryKind as Jt, DEFAULT_RUNTIME_STATE_DURABILITY as K, RECORD_MAX_INDEXES as Kn, dehydrateSchema as Kr, readingMeta as Kt, viewerUiCapability as L, recordsErrorFromMessage as Ln, createDurableState as Lr, selectAssignedProfileSlots as Lt, CAP_ADVANCE_FIELDS as M, RevConflictError as Mn, globalSecretScope as Mr, SubscribeAudioChunksInputSchema as Mt, CAP_NAMES as N, TransactRefusedError as Nn, isSecretRef as Nr, SubscribeAudioChunksResultSchema as Nt, DEFAULT_TOKEN_EXPIRY as O, RecordSecretUnavailableError as On, SECRET_REF_SCHEME as Or, ProfileSlotSchema as Ot, CAP_STATE_LEAVES as P, UnindexedFilterError as Pn, normalizeSecretOwner as Pr, makeProfileBrokerId as Pt, event as Q, resolveSecretViewsIn as Qn, isSecretFieldView as Qr, EntryDescriptorSchema as Qt, DEVICE_CHILDREN_BATCH_MAX as R, RECORD_BATCH_MAX as Rn, createEvent as Rr, DEFAULT_DISPLAY_PREFERENCE as Rt, invokeTrpcLeaf as S, ForeignSecretMarkerError as Sn, secretTreeFromSchema as Sr, CamStreamKindSchema as St, createLazyTrpcSource as T, PlaintextSecretError as Tn, isSecretRefOwnedBy as Tr, DecodedAudioChunkSchema as Tt, describeCustomActions as U, RECORD_DELETE_BATCH as Un, collectHydratedFieldEntries as Ur, displayUnitFor as Ut, customAction as V, RECORD_DATABASES as Vn, WELL_KNOWN_TABS as Vr, ReadingQuantitySchema as Vt, deviceCustomAction as W, RECORD_ID_MAX_LENGTH as Wn, collectHydratedFieldValues as Wr, historyUnitFor as Wt, HISTORY_UNIT_LABELS as X, RECORD_SETTINGS_MAX_ROWS as Xn, classifySecretWrite as Xr, createRecordsAccess as Xt, HISTORY_DEFAULT_MIN_INTERVAL_MS as Y, RECORD_SECRET_COLLECTION_PREFIX as Yn, SECRET_CLEAR as Yr, entryBody as Yt, PROVIDER_PIN_FIELD as Z, RECORD_SWEEP_INTERVAL_MS as Zn, isSecretClear as Zr, assertTransactScope as Zt, readErrorI18n as _, collectZodSecretPaths as _n, classifyStoreError as _r, AudioStreamPickSchema as _t, asJsonArray as a, collectSecretConfigKeys as ai, assertValidDeclaration as an, registerKnownSecret as ar, systemMethod as at, isDeviceScopedCap as b, DeclarationRefusedError as bn, parseSecretStatePath as br, CAM_PROFILE_ORDER as bt, asString as c, omitTransientConfig as ci, REMOVE_LEAF as cn, PEER_BYTES_CHUNK_BYTES as cr, readNodePin as ct, parseJsonUnknown as d, audioChunkBytesPerSample as di, parseSecretPath as dn, PEER_BYTES_TICKET_TTL_MS as dr, ReadinessRegistry as dt, isSecretMarkerLike as ei, RecordIndexSchema as en, createSecretsAccess as er, historyItemFieldPath as et, hfModelUrl as f, expandAudioChunkToF32le as fi, recordArrayItemPath as fn, PeerBytesTicketSchema as fr, ReadinessTimeoutError as ft, ErrorI18nPayloadSchema as g, SECRET_META as gn, BaseAddon as gr, AudioChunkFormatSchema as gt, ErrorCodeSchema as h, secretArrayPrefixes as hn, DisposerChain as hr, scopeKey as ht, asBoolean as i, collectKeychainStoredKeys as ii, StoredRecordKindDeclarationSchema as in, knownSecretCount as ir, resolveCapMount as it, RUNTIME_DEFAULTS as j, RecordsError as jn, formatSecretScope as jr, StreamSourceSchema as jt, HF_BASE_URL as k, RecordTooLargeError as kn, arrayItemFieldPath as kr, ProfileSlotStatusSchema as kt, parseJsonArray as l, schemaDeclaresAnyField as li, collectSecretLeaves as ln, PEER_BYTES_MAX_OUTSTANDING as lr, toNodeId as lt, CamstackError as m, recordSecretRef as mn, SHARE_VIEW_KINDS as mr, readinessKey as mt, sleepCancellable as n, toSecretFieldView as ni, RecordKindNameSchema as nn, clearKnownSecrets as nr, method as nt, asJsonObject as o, isKeychainStoredField as oi, declarationsOf as on, scrubKnownSecrets as or, CAP_NODE_PIN_CONTEXT_KEY as ot, BOOT_RECOVERY_BACKOFF_MS as p, isAudioChunkFormat as pi, recordSecretCollection as pn, DATAPLANE_SECRET_HEADER as pr, emitDownForOwnedCaps as pt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as q, RECORD_MAX_INDEX_FIELDS as qn, hydrateSchema as qr, makeInMemoryRecords as qt, maskUrlCredentials as r, REDACTED_SECRET as ri, RecordRetentionSchema as rn, forgetKnownSecret as rr, optionalMethod as rt, asNumber as s, isSecretConfigField as si, defineRecordKinds as sn, shortSecretRefHash as sr, nodePin as st, sleep as t, makeSecretMarker as ti, RecordKindDeclarationSchema as tn, MIN_SCRUBBED_LENGTH as tr, isDeviceConfigCap as tt, parseJsonObject as u, AUDIO_CHUNK_FORMATS as ui, mapSecretLeaves as un, PEER_BYTES_STALL_MS as ur, MODEL_FORMATS as ut, userError as v, isZodSecret as vn, normalizeAddonInitResult as vr, BrokerStatsSchema as vt, createEventBusSliceSource as w, NoCallerError as wn, collectSecretMarkerRefs as wr, CameraStreamSchema as wt, createDeviceProxy as x, FilterRequiredError as xn, secretTreeFromPaths as xr, CamProfileSchema as xt, DEVICE_SCOPED_CAPS as y, BatchTooLargeError as yn, mergeSecretStatePaths as yr, BrokerStatusSchema as yt, CALLER_STAMPED_CAPABILITIES as z, RECORD_BATCH_MAX_BYTES as zn, emitReadiness as zr, DISPLAY_PREFERENCES as zt };
@@ -46,4 +46,9 @@ export declare function canConvertUnit(from: string, to: string): boolean;
46
46
  * Every known unit spelling in a dimension (table insertion order — canonical
47
47
  * unit first). Powers the UI's same-dimension unit picker.
48
48
  */
49
+ /**
50
+ * Convert a difference, not a reading. Affine units (°F) shift an absolute
51
+ * value by their offset; a step of 1°F is 5/9°C, so the offset is cancelled.
52
+ */
53
+ export declare function tryConvertDelta(value: number, from: string, to: string): number | undefined;
49
54
  export declare function unitsForDimension(dimension: UnitDimension): readonly string[];
@@ -0,0 +1,15 @@
1
+ import { type DisplayPreference, type ReadingQuantity } from './quantity.js';
2
+ export interface FormatReadingInput {
3
+ readonly value: number;
4
+ readonly quantity: ReadingQuantity;
5
+ readonly preference?: DisplayPreference;
6
+ readonly precision?: number;
7
+ /** Concrete quantity when `quantity` is `device`. */
8
+ readonly deviceQuantity?: ReadingQuantity;
9
+ }
10
+ export interface FormattedReading {
11
+ readonly text: string;
12
+ readonly unit: string;
13
+ readonly value: number;
14
+ }
15
+ export declare function formatReading(input: FormatReadingInput): FormattedReading;
@@ -4,5 +4,12 @@
4
4
  */
5
5
  export { UNIT_TABLE } from './unit-table.js';
6
6
  export type { UnitDimension, UnitSpec, KnownUnit } from './unit-table.js';
7
- export { UnitConversionError, unitDimension, convertUnit, tryConvertUnit, canConvertUnit, unitsForDimension, } from './convert.js';
7
+ export { UnitConversionError, unitDimension, convertUnit, tryConvertUnit, tryConvertDelta, canConvertUnit, unitsForDimension, } from './convert.js';
8
8
  export type { UnitConversionReason } from './convert.js';
9
+ export { DEFAULT_DISPLAY_PREFERENCE, DISPLAY_PREFERENCES, QUANTITY_BASE, ReadingQuantitySchema, baseUnitOf, displayUnitFor, historyUnitFor, isReadingQuantity, readingMeta, } from './quantity.js';
10
+ export type { DisplayPreference, ReadingMeta, ReadingQuantity } from './quantity.js';
11
+ export { thresholdToBase, thresholdToDisplay } from './threshold.js';
12
+ export { formatReading } from './format-reading.js';
13
+ export type { FormatReadingInput, FormattedReading } from './format-reading.js';
14
+ export { ingestReading, quantityFromUnit } from './ingest-reading.js';
15
+ export type { IngestReadingInput, IngestReadingResult, IngestRefusal } from './ingest-reading.js';
@@ -0,0 +1,21 @@
1
+ import { type ReadingQuantity } from './quantity.js';
2
+ export type IngestRefusal = 'non-finite' | 'unknown-unit' | 'cross-dimension';
3
+ export interface IngestReadingInput {
4
+ readonly value: number;
5
+ readonly rawUnit: string | undefined;
6
+ readonly quantity: ReadingQuantity;
7
+ }
8
+ export type IngestReadingResult = {
9
+ readonly ok: true;
10
+ readonly value: number;
11
+ } | {
12
+ readonly ok: false;
13
+ readonly reason: IngestRefusal;
14
+ };
15
+ /**
16
+ * Quantity implied by a unit symbol. `ppb` and `ms` are the two symbols
17
+ * whose stored base is not the dimension's canonical unit. `mm` is length;
18
+ * precipitation is chosen by the caller (a device class), not by the symbol.
19
+ */
20
+ export declare function quantityFromUnit(rawUnit: string | undefined): ReadingQuantity | undefined;
21
+ export declare function ingestReading(input: IngestReadingInput): IngestReadingResult;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A numeric reading is stored in the base unit of its quantity (D944 §4).
3
+ * The base symbol lives here — never as a sibling field on the device slice.
4
+ *
5
+ * `energy` is stored in kWh even though `UNIT_TABLE`'s linear origin is Wh:
6
+ * history, Matter and the field name already count kilowatt-hours.
7
+ * `concentration-ppb` is separate so VOC parts-per-billion are not divided
8
+ * by 1000 into ppm. `device` is a polymorphic reading (numeric-sensor,
9
+ * numeric control): the quantity is chosen once, on the device, at adopt.
10
+ */
11
+ import { z } from 'zod';
12
+ declare const READING_QUANTITY_VALUES: readonly ['temperature', 'pressure', 'speed', 'precipitation', 'precipitation-rate', 'length', 'area', 'illuminance', 'irradiance', 'power', 'energy', 'voltage', 'current', 'apparent-power', 'humidity', 'percentage', 'concentration-volume', 'concentration-mass', 'concentration-ppb', 'volume', 'duration', 'duration-ms', 'information', 'sound-level', 'signal-level', 'colour-temperature', 'angle', 'bitrate', 'rate', 'mass', 'index', 'ratio', 'count', 'none', 'device'];
13
+ export declare const READING_QUANTITIES: typeof READING_QUANTITY_VALUES;
14
+ export type ReadingQuantity = (typeof READING_QUANTITIES)[number];
15
+ export declare const ReadingQuantitySchema: z.ZodType<ReadingQuantity>;
16
+ export declare function isReadingQuantity(value: unknown): value is ReadingQuantity;
17
+ /**
18
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
19
+ * (or an index / ratio / count). `device` means the cap has no single unit.
20
+ */
21
+ export declare const QUANTITY_BASE: Readonly<Record<ReadingQuantity, string>>;
22
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
23
+ export declare function baseUnitOf(quantity: ReadingQuantity): string | undefined;
24
+ /**
25
+ * History catalog label for a quantity. Index and ratio keep the labels the
26
+ * series already used (`count`, `ratio`). A polymorphic reading has no
27
+ * single label.
28
+ */
29
+ export declare function historyUnitFor(quantity: ReadingQuantity): string | undefined;
30
+ /** Zod `.meta()` bag for a numeric reading. Precision is a display hint. */
31
+ export type ReadingMeta = {
32
+ readonly [key: string]: unknown;
33
+ readonly quantity: ReadingQuantity;
34
+ readonly precision?: number;
35
+ readonly label?: string;
36
+ };
37
+ export declare function readingMeta(quantity: ReadingQuantity, extras?: {
38
+ readonly precision?: number;
39
+ readonly label?: string;
40
+ }): ReadingMeta;
41
+ declare const DISPLAY_PREFERENCE_VALUES: readonly ['metric', 'imperial'];
42
+ export declare const DISPLAY_PREFERENCES: typeof DISPLAY_PREFERENCE_VALUES;
43
+ export type DisplayPreference = (typeof DISPLAY_PREFERENCES)[number];
44
+ export declare const DEFAULT_DISPLAY_PREFERENCE: DisplayPreference;
45
+ /** Display symbol for a preference. Duration and information are scaled by the formatter. */
46
+ export declare function displayUnitFor(quantity: ReadingQuantity, preference: DisplayPreference): string | undefined;
47
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Move a threshold between the unit the operator sees and the stored base.
3
+ * A failed conversion leaves the number unchanged — the recipe stays serialisable.
4
+ */
5
+ export declare function thresholdToBase(value: number, displayUnit: string, baseUnit: string): number;
6
+ export declare function thresholdToDisplay(value: number, baseUnit: string, displayUnit: string): number;