@camstack/types 1.2.209 → 1.2.211

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,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-WeJUxTv-.js");
2
+ const require_sleep = require("./sleep-OPlow2a9.js");
3
3
  const require_event_category = require("./event-category-BVfsrBYA.js");
4
4
  const require_canonical_hash = require("./canonical-hash-CZ2JqJc3.js");
5
5
  const require_enums = require("./enums.js");
@@ -8748,6 +8748,24 @@ var GetStreamWithCodecInputSchema = zod.z.object({
8748
8748
  });
8749
8749
  var RtpSourceSchema = zod.z.object({
8750
8750
  url: zod.z.string(),
8751
+ /**
8752
+ * The SENTRY counterpart of {@link url} — the dial that asks for the stream
8753
+ * WITHOUT asking for the camera — or `null` when this camera offers none.
8754
+ *
8755
+ * The broker answers it because the broker is the only thing that can:
8756
+ * eligibility is `sentryEligible` (a BATTERY camera that DECLARES the signals
8757
+ * cap), asked of facts only the broker holds. A consumer re-deriving it from
8758
+ * cap bindings would be a second authority, and two authorities on the same
8759
+ * question is how a composite camera ends up dialling a sleeping camera
8760
+ * because its own copy of the rule was a release behind.
8761
+ *
8762
+ * `null` is a real answer and is never a live url in disguise: a consumer
8763
+ * that silently fell back to {@link url} would perform exactly the wake this
8764
+ * field exists to prevent. Only a PASSTHROUGH acquisition can offer one — a
8765
+ * transcode hands back an egress the broker is feeding itself, which has no
8766
+ * sentry counterpart.
8767
+ */
8768
+ sentryUrl: zod.z.string().nullable().optional(),
8751
8769
  videoCodec: zod.z.enum(["H264", "H265"]),
8752
8770
  audioCodec: zod.z.string(),
8753
8771
  resolution: zod.z.object({
@@ -32420,6 +32438,141 @@ var motionTriggerCapability = {
32420
32438
  durability: "session"
32421
32439
  };
32422
32440
  //#endregion
32441
+ //#region src/capabilities/camera-grid-layout.cap.ts
32442
+ /**
32443
+ * camera-grid-layout — the geometry of a COMPOSITE camera, on the camera's own
32444
+ * page.
32445
+ *
32446
+ * ## Why this is a capability and not an addon settings schema
32447
+ *
32448
+ * It was one, and it did not render. The addon declared the editor as a
32449
+ * `type: 'widget'` field inside its own `deviceSettingsSchema()`; the hub
32450
+ * returned that section correctly and `ConfigFormField` renders `type:'widget'`
32451
+ * perfectly well — and nothing ever asked camera-grid for it. The Cluster →
32452
+ * Pipeline → Device Overrides page interrogates a HAND-WRITTEN list of four
32453
+ * addons (`PIPELINE_CLUSTER_DEVICE_ADDONS`), whose own comment says an addon
32454
+ * not on it "falls off silently".
32455
+ *
32456
+ * Adding a fifth name to that list would have been the wrong fix twice over:
32457
+ * that page is per-camera DETECTION tuning, and a grid's geometry belongs
32458
+ * beside PTZ and motion zones on the camera itself — which is exactly where the
32459
+ * framework already puts a widget, when the widget is declared on a CAPABILITY.
32460
+ * `deviceConfig.ui` is the mechanism (`motion-zones`, `ptz`, `ptz-autotrack`
32461
+ * all use it): the framework emits the structural section and the widget
32462
+ * self-persists through the cap's own mutations.
32463
+ *
32464
+ * ## Why one addon may implement it
32465
+ *
32466
+ * It is a device-scoped NATIVE cap, registered by the grid camera device
32467
+ * itself. Nothing else declares a composite camera, so nothing else has a
32468
+ * layout — and the device-scoped route means the widget asks THE camera, not
32469
+ * "the camera-grid addon", which is what let the old custom-action pair be
32470
+ * reached only by a caller that already knew the addon id.
32471
+ *
32472
+ * ## The tab
32473
+ *
32474
+ * `streaming`, not a top-tab of its own. A grid's geometry IS what its stream
32475
+ * is, so the Streaming tab is where it belongs; a `grid` top-tab would need an
32476
+ * entry in `WELL_KNOWN_TAB_MAP` or the device page renders the raw id as the
32477
+ * label (measured on the robot camera, 2026-09-06 — a tab called "navigation"
32478
+ * next to "PTZ").
32479
+ */
32480
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
32481
+ var GridNormalizedRectSchema = zod.z.object({
32482
+ x: zod.z.number().min(0).max(1),
32483
+ y: zod.z.number().min(0).max(1),
32484
+ width: zod.z.number().gt(0).max(1),
32485
+ height: zod.z.number().gt(0).max(1)
32486
+ });
32487
+ /**
32488
+ * One source camera, the part of its picture taken, and where that part lands.
32489
+ *
32490
+ * Both rectangles are NORMALIZED (D519): a source camera can change resolution
32491
+ * — a profile switch, a firmware update, a substream that comes back different
32492
+ * — and a stored PIXEL rectangle would quietly start cutting the wrong region,
32493
+ * which is the class of bug nobody files.
32494
+ */
32495
+ var GridLayoutCellSchema = zod.z.object({
32496
+ deviceId: zod.z.number().int().positive(),
32497
+ /** The part of the SOURCE taken, normalized against the source. */
32498
+ source: GridNormalizedRectSchema,
32499
+ /** Where it lands, normalized against the CANVAS. */
32500
+ cell: GridNormalizedRectSchema
32501
+ });
32502
+ /**
32503
+ * Which profiles this grid can actually compose, and why not.
32504
+ *
32505
+ * A grid's `high` composes its sources' `high` and its `low` their `low`, so a
32506
+ * profile is on offer only when EVERY source can serve it. The refusal NAMES
32507
+ * the sources, because "this grid has no low" is not a finding — "615 has no
32508
+ * low" is, and it is the one an operator can act on.
32509
+ */
32510
+ var GridProfileOfferSchema = zod.z.object({
32511
+ profile: zod.z.enum([
32512
+ "high",
32513
+ "mid",
32514
+ "low"
32515
+ ]),
32516
+ offered: zod.z.boolean(),
32517
+ /** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
32518
+ missingSources: zod.z.array(zod.z.number().int().positive())
32519
+ });
32520
+ var GridLayoutViewSchema = zod.z.object({
32521
+ /** The persisted grid row this camera was declared from. */
32522
+ instanceId: zod.z.string(),
32523
+ deviceId: zod.z.number().int().nonnegative(),
32524
+ name: zod.z.string(),
32525
+ /** The canvas the operator laid out — this grid's `high`. mid/low are scaled from it. */
32526
+ width: zod.z.number().int(),
32527
+ height: zod.z.number().int(),
32528
+ fps: zod.z.number().int(),
32529
+ cells: zod.z.array(GridLayoutCellSchema),
32530
+ /** What the catalog will publish, and what it refuses to. Read-only. */
32531
+ profiles: zod.z.array(GridProfileOfferSchema)
32532
+ });
32533
+ var GridLayoutPatchSchema = zod.z.object({
32534
+ deviceId: zod.z.number().int().nonnegative(),
32535
+ name: zod.z.string().min(1).max(160).optional(),
32536
+ width: zod.z.number().int().min(160).max(7680).optional(),
32537
+ height: zod.z.number().int().min(120).max(4320).optional(),
32538
+ fps: zod.z.number().int().min(1).max(60).optional(),
32539
+ /**
32540
+ * The whole cell list at once. A per-cell patch would need an ordering the
32541
+ * editor does not have, and a half-applied layout is a picture nobody asked
32542
+ * for.
32543
+ */
32544
+ cells: zod.z.array(GridLayoutCellSchema).max(16)
32545
+ });
32546
+ var cameraGridLayoutCapability = {
32547
+ name: "camera-grid-layout",
32548
+ scope: "device",
32549
+ deviceNative: true,
32550
+ mode: "singleton",
32551
+ deviceTypes: [require_sleep.DeviceType.Camera],
32552
+ deviceConfig: { ui: {
32553
+ kind: "widget",
32554
+ widgetId: "host/camera-grid-layout",
32555
+ tab: "streaming",
32556
+ label: "Grid layout",
32557
+ order: 20
32558
+ } },
32559
+ methods: {
32560
+ /**
32561
+ * The grid behind this device.
32562
+ *
32563
+ * `null` means ANSWERED and this camera is not a grid — not "not yet
32564
+ * known". The widget renders its "this is not a grid camera" state only
32565
+ * from this answer, never from an unresolved query (D315).
32566
+ */
32567
+ getLayout: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), GridLayoutViewSchema.nullable(), { auth: "admin" }),
32568
+ /** Write the geometry back. Returns the grid as it now stands, profiles included. */
32569
+ saveLayout: require_sleep.method(GridLayoutPatchSchema, GridLayoutViewSchema, {
32570
+ kind: "mutation",
32571
+ auth: "admin"
32572
+ })
32573
+ }
32574
+ };
32575
+ //#endregion
32423
32576
  //#region src/capabilities/motion-zones.cap.ts
32424
32577
  /**
32425
32578
  * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
@@ -35038,6 +35191,26 @@ var PtzHomePresetSchema = zod.z.object({
35038
35191
  "none"
35039
35192
  ])
35040
35193
  });
35194
+ /**
35195
+ * The camera's own idle-return behaviour: whether it goes home by itself, and
35196
+ * after how long.
35197
+ *
35198
+ * ONE shape, not two scalars, because on the camera they are ONE fact —
35199
+ * Reolink's guard point carries `benable` and `timeout` in the same element,
35200
+ * written by the same command. Reading them apart means two round-trips that
35201
+ * can disagree.
35202
+ *
35203
+ * `enabled` and `seconds` are INDEPENDENT: a camera can hold a 68 s delay with
35204
+ * the behaviour switched off, which is exactly what the vendor app leaves when
35205
+ * you turn the guard point off without clearing it. The first version of this
35206
+ * cap reported only the delay, so that state was invisible — a camera could be
35207
+ * configured to return after 68 seconds with no way to say whether it should
35208
+ * return at all.
35209
+ */
35210
+ var PtzHomeReturnSchema = zod.z.object({
35211
+ enabled: zod.z.boolean(),
35212
+ seconds: zod.z.number().int()
35213
+ });
35041
35214
  var ptzCapability = {
35042
35215
  name: "ptz",
35043
35216
  scope: "device",
@@ -35120,18 +35293,25 @@ var ptzCapability = {
35120
35293
  auth: "admin"
35121
35294
  }),
35122
35295
  /**
35123
- * How long the camera waits, idle, before returning home on its own --
35124
- * `null` when it has no such behaviour.
35296
+ * Whether the camera returns home on its own when left idle, and after how
35297
+ * long. `null` when it has no such behaviour at all.
35125
35298
  *
35126
35299
  * Reolink's guard point carries one (`timeout`, freely settable in
35127
35300
  * seconds). It is a real function of the camera that we did not expose at
35128
35301
  * all, and it belongs next to the home it governs rather than in a vendor
35129
35302
  * settings page nobody associates with Home.
35130
35303
  */
35131
- getHomeReturnSeconds: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.number().int().nullable()),
35132
- /** Set the idle-return delay. Refused by a camera that has no such timer. */
35133
- setHomeReturnSeconds: require_sleep.method(zod.z.object({
35304
+ getHomeReturn: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), PtzHomeReturnSchema.nullable()),
35305
+ /**
35306
+ * Set both together. Refused by a camera with no idle-return behaviour.
35307
+ *
35308
+ * They travel together for the same reason they are read together: the
35309
+ * underlying write carries both, so setting one alone means reading the
35310
+ * other back first and racing whoever else is writing.
35311
+ */
35312
+ setHomeReturn: require_sleep.method(zod.z.object({
35134
35313
  deviceId: zod.z.number(),
35314
+ enabled: zod.z.boolean(),
35135
35315
  seconds: zod.z.number().int().min(0).max(3600)
35136
35316
  }), zod.z.void(), {
35137
35317
  kind: "mutation",
@@ -43025,6 +43205,7 @@ var CAPABILITY_NAMES = {
43025
43205
  broker: "broker",
43026
43206
  button: "button",
43027
43207
  cameraCredentials: "camera-credentials",
43208
+ cameraGridLayout: "camera-grid-layout",
43028
43209
  cameraPipelineConfig: "camera-pipeline-config",
43029
43210
  cameraStreams: "camera-streams",
43030
43211
  carbonMonoxide: "carbon-monoxide",
@@ -43263,6 +43444,10 @@ var CAPABILITY_ROUTER_KEYS = [
43263
43444
  key: "cameraCredentials",
43264
43445
  name: "camera-credentials"
43265
43446
  },
43447
+ {
43448
+ key: "cameraGridLayout",
43449
+ name: "camera-grid-layout"
43450
+ },
43266
43451
  {
43267
43452
  key: "cameraPipelineConfig",
43268
43453
  name: "camera-pipeline-config"
@@ -43824,6 +44009,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
43824
44009
  brokerCapability,
43825
44010
  buttonCapability,
43826
44011
  cameraCredentialsCapability,
44012
+ cameraGridLayoutCapability,
43827
44013
  cameraPipelineConfigCapability,
43828
44014
  cameraStreamsCapability,
43829
44015
  carbonMonoxideCapability,
@@ -44679,6 +44865,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
44679
44865
  addonId: null,
44680
44866
  access: "view"
44681
44867
  },
44868
+ "cameraGridLayout.getLayout": {
44869
+ capName: "camera-grid-layout",
44870
+ capScope: "device",
44871
+ addonId: null,
44872
+ access: "view"
44873
+ },
44874
+ "cameraGridLayout.saveLayout": {
44875
+ capName: "camera-grid-layout",
44876
+ capScope: "device",
44877
+ addonId: null,
44878
+ access: "create"
44879
+ },
44682
44880
  "cameraStreams.getBrokerStreams": {
44683
44881
  capName: "camera-streams",
44684
44882
  capScope: "device",
@@ -48429,7 +48627,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
48429
48627
  addonId: null,
48430
48628
  access: "view"
48431
48629
  },
48432
- "ptz.getHomeReturnSeconds": {
48630
+ "ptz.getHomeReturn": {
48433
48631
  capName: "ptz",
48434
48632
  capScope: "device",
48435
48633
  addonId: null,
@@ -48489,7 +48687,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
48489
48687
  addonId: null,
48490
48688
  access: "create"
48491
48689
  },
48492
- "ptz.setHomeReturnSeconds": {
48690
+ "ptz.setHomeReturn": {
48493
48691
  capName: "ptz",
48494
48692
  capScope: "device",
48495
48693
  addonId: null,
@@ -50303,6 +50501,7 @@ var KNOWN_CAP_NAMES = [
50303
50501
  "broker",
50304
50502
  "button",
50305
50503
  "camera-credentials",
50504
+ "camera-grid-layout",
50306
50505
  "camera-streams",
50307
50506
  "climate-control",
50308
50507
  "color",
@@ -50422,6 +50621,7 @@ var DEVICE_CAP_NAMES = [
50422
50621
  "brightness",
50423
50622
  "button",
50424
50623
  "camera-credentials",
50624
+ "camera-grid-layout",
50425
50625
  "camera-streams",
50426
50626
  "climate-control",
50427
50627
  "color",
@@ -50649,6 +50849,21 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
50649
50849
  form: "single",
50650
50850
  optional: false
50651
50851
  }],
50852
+ "cameraGridLayout.getLayout": [{
50853
+ name: "deviceId",
50854
+ form: "single",
50855
+ optional: false
50856
+ }],
50857
+ "cameraGridLayout.saveLayout": [{
50858
+ name: "cells",
50859
+ form: "object-array",
50860
+ optional: false,
50861
+ itemField: "deviceId"
50862
+ }, {
50863
+ name: "deviceId",
50864
+ form: "single",
50865
+ optional: false
50866
+ }],
50652
50867
  "cameraStreams.getBrokerStreams": [{
50653
50868
  name: "deviceId",
50654
50869
  form: "single",
@@ -51949,7 +52164,7 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
51949
52164
  form: "single",
51950
52165
  optional: false
51951
52166
  }],
51952
- "ptz.getHomeReturnSeconds": [{
52167
+ "ptz.getHomeReturn": [{
51953
52168
  name: "deviceId",
51954
52169
  form: "single",
51955
52170
  optional: false
@@ -51999,7 +52214,7 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
51999
52214
  form: "single",
52000
52215
  optional: false
52001
52216
  }],
52002
- "ptz.setHomeReturnSeconds": [{
52217
+ "ptz.setHomeReturn": [{
52003
52218
  name: "deviceId",
52004
52219
  form: "single",
52005
52220
  optional: false
@@ -58240,6 +58455,8 @@ exports.GasStatusSchema = GasStatusSchema;
58240
58455
  exports.GetLoggingSettingsInputSchema = GetLoggingSettingsInputSchema;
58241
58456
  exports.GetStreamWithCodecInputSchema = GetStreamWithCodecInputSchema;
58242
58457
  exports.GlobalMetricsSchema = GlobalMetricsSchema;
58458
+ exports.GridLayoutPatchSchema = GridLayoutPatchSchema;
58459
+ exports.GridLayoutViewSchema = GridLayoutViewSchema;
58243
58460
  exports.HAP_AUDIO_BASE = HAP_AUDIO_BASE;
58244
58461
  exports.HAP_AUDIO_BITRATE_KBPS = HAP_AUDIO_BITRATE_KBPS;
58245
58462
  exports.HAP_AUDIO_VBV_KBITS = HAP_AUDIO_VBV_KBITS;
@@ -58631,6 +58848,7 @@ exports.PtzAutotrackSettingsSchema = PtzAutotrackSettingsSchema;
58631
58848
  exports.PtzAutotrackStatusSchema = PtzAutotrackStatusSchema;
58632
58849
  exports.PtzAutotrackTargetOptionSchema = PtzAutotrackTargetOptionSchema;
58633
58850
  exports.PtzHomePresetSchema = PtzHomePresetSchema;
58851
+ exports.PtzHomeReturnSchema = PtzHomeReturnSchema;
58634
58852
  exports.PtzMoveCommandSchema = PtzMoveCommandSchema;
58635
58853
  exports.PtzOptionsSchema = PtzOptionsSchema;
58636
58854
  exports.PtzPositionSchema = PtzPositionSchema;
@@ -59033,6 +59251,7 @@ exports.buildStreamParamsConfigSchema = buildStreamParamsConfigSchema;
59033
59251
  exports.buildVideoArgs = require_canonical_hash.buildVideoArgs;
59034
59252
  exports.buttonCapability = buttonCapability;
59035
59253
  exports.cameraCredentialsCapability = cameraCredentialsCapability;
59254
+ exports.cameraGridLayoutCapability = cameraGridLayoutCapability;
59036
59255
  exports.cameraPipelineConfigCapability = cameraPipelineConfigCapability;
59037
59256
  exports.cameraStreamsCapability = cameraStreamsCapability;
59038
59257
  exports.canConvertUnit = canConvertUnit;