@camstack/types 1.2.24 → 1.2.25

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-CI7DYokZ.js");
2
+ const require_sleep = require("./sleep-BvSjpsfC.js");
3
3
  const require_event_category = require("./event-category-BE4PDZ_3.js");
4
4
  const require_enums = require("./enums.js");
5
5
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -4985,6 +4985,14 @@ var NcMediaPolicySchema = zod.z.object({
4985
4985
  clipPreRollSec: zod.z.number().int().min(0).max(30).optional(),
4986
4986
  clipPostRollSec: zod.z.number().int().min(0).max(30).optional(),
4987
4987
  /**
4988
+ * Playback rate of the attached gif / clip. Absent = 2x.
4989
+ *
4990
+ * A notification clip is GLANCED at on a lock screen, not watched: at real
4991
+ * time an eight-second passage is eight seconds of the recipient's attention
4992
+ * and twice the bytes. 1 is real time for the operator who wants it.
4993
+ */
4994
+ clipSpeed: zod.z.number().min(1).max(8).optional(),
4995
+ /**
4988
4996
  * Which stream profile the footage is cut from. Absent = the CHEAPEST
4989
4997
  * assigned profile: a notification is watched on a phone, so the 4K
4990
4998
  * rendition would burn CPU to produce a file the client downscales anyway.
@@ -5056,7 +5064,21 @@ var NcRuleInputSchema = zod.z.object({
5056
5064
  * behaviour, visible to all, read-only in the viewer). Present = personal
5057
5065
  * rule owned by this userId. Server-stamped; never trusted from a client.
5058
5066
  */
5059
- ownerUserId: zod.z.string().optional()
5067
+ ownerUserId: zod.z.string().optional(),
5068
+ /**
5069
+ * May a non-admin snooze this rule for EVERYONE, not just themselves?
5070
+ *
5071
+ * A snooze is personal by default — it silences the person who set it. This
5072
+ * opts THIS rule into the "the gardener is here all afternoon" case, where
5073
+ * silencing the camera for the whole household is legitimate. It silences
5074
+ * other people, so it is off unless a rule deliberately allows it.
5075
+ *
5076
+ * `.optional()`, deliberately NOT `.default()`: a Zod default does not run on
5077
+ * the addon cap path (three production failures in one day), so absent is
5078
+ * read as `false` by {@link canSetGlobal} in the engine. Admins are not bound
5079
+ * by this flag — see the scope rules on that function.
5080
+ */
5081
+ snoozeAllowGlobal: zod.z.boolean().optional()
5060
5082
  });
5061
5083
  /**
5062
5084
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -5141,7 +5163,28 @@ var NcConditionDescriptorSchema = zod.z.object({
5141
5163
  /** Which delivery kinds the condition applies to. */
5142
5164
  appliesTo: zod.z.array(NcDeliverySchema),
5143
5165
  phase: zod.z.string(),
5144
- description: zod.z.string().optional()
5166
+ description: zod.z.string().optional(),
5167
+ /**
5168
+ * The CHOICES for a single-choice widget (`sourceSelect`, `crossingSelect`,
5169
+ * `packagePhase`, …), served with the descriptor.
5170
+ *
5171
+ * Before this the descriptor said which widget to render and not what to put
5172
+ * in it, so every option list lived in three places: this file's enums, the
5173
+ * admin's `NC_*_OPTIONS` and the viewer's `NC_*_VALUES`. That triple mirror
5174
+ * is the drift that emptied the viewer's rule editor on 2026-08-04 — the app
5175
+ * mirrors the cap by hand, so it is only ever as current as its last build.
5176
+ *
5177
+ * With the options on the wire, a condition of an EXISTING `valueType` costs
5178
+ * zero client changes. Clients keep a local fallback for an older hub that
5179
+ * does not send them; absent here is "use your own list", not "no choices".
5180
+ */
5181
+ options: zod.z.array(zod.z.object({
5182
+ /** Written to the rule verbatim. `''` means the ABSENT state. */
5183
+ value: zod.z.string(),
5184
+ label: zod.z.string(),
5185
+ /** What THIS choice matches — shown one at a time, under the control. */
5186
+ hint: zod.z.string().optional()
5187
+ })).readonly().optional()
5145
5188
  });
5146
5189
  /**
5147
5190
  * The P1 condition surface as data — served by `getConditionCatalog` so
@@ -5235,6 +5278,28 @@ var NC_CONDITION_CATALOG = [
5235
5278
  group: "zones",
5236
5279
  label: "Zone crossing",
5237
5280
  valueType: "crossingSelect",
5281
+ options: [
5282
+ {
5283
+ value: "",
5284
+ label: "Not set — entering",
5285
+ hint: "Entries, and every detection that is not a crossing at all. Exits are excluded. This is what a rule without a crossing condition already does, and choosing it writes nothing to the rule."
5286
+ },
5287
+ {
5288
+ value: "enter",
5289
+ label: "Entered a zone",
5290
+ hint: "The same matches as \"not set\", stated explicitly: entries and non-crossing detections pass, exits do not."
5291
+ },
5292
+ {
5293
+ value: "exit",
5294
+ label: "Left a zone",
5295
+ hint: "ONLY an exit crossing. A detection that is not a crossing fails, so this rule cannot fire on ordinary movement — pair it with the zones the subject must have left. Also matches a tripwire crossed against its drawn direction."
5296
+ },
5297
+ {
5298
+ value: "any",
5299
+ label: "Entered or left",
5300
+ hint: "No direction filter: entries, exits and non-crossing detections alike. This is the only choice that adds exits to what the rule already matched."
5301
+ }
5302
+ ],
5238
5303
  operator: "in",
5239
5304
  appliesTo: ["immediate"],
5240
5305
  phase: "P1",
@@ -5315,6 +5380,24 @@ var NC_CONDITION_CATALOG = [
5315
5380
  group: "scope",
5316
5381
  label: "Detection source",
5317
5382
  valueType: "sourceSelect",
5383
+ options: [
5384
+ {
5385
+ value: "any",
5386
+ label: "Any source"
5387
+ },
5388
+ {
5389
+ value: "pipeline",
5390
+ label: "Pipeline"
5391
+ },
5392
+ {
5393
+ value: "onboard",
5394
+ label: "Onboard (camera)"
5395
+ },
5396
+ {
5397
+ value: "sensor",
5398
+ label: "Sensor"
5399
+ }
5400
+ ],
5318
5401
  operator: "in",
5319
5402
  appliesTo: [
5320
5403
  "immediate",
@@ -5350,6 +5433,20 @@ var NC_CONDITION_CATALOG = [
5350
5433
  group: "package",
5351
5434
  label: "Package phase",
5352
5435
  valueType: "packagePhase",
5436
+ options: [
5437
+ {
5438
+ value: "delivered",
5439
+ label: "Delivered"
5440
+ },
5441
+ {
5442
+ value: "picked-up",
5443
+ label: "Picked up"
5444
+ },
5445
+ {
5446
+ value: "both",
5447
+ label: "Both"
5448
+ }
5449
+ ],
5353
5450
  operator: "in",
5354
5451
  appliesTo: ["package-event"],
5355
5452
  phase: "P1",
@@ -5481,6 +5578,78 @@ var NcHistoryFilterSchema = zod.z.object({
5481
5578
  until: zod.z.number().optional(),
5482
5579
  limit: zod.z.number().int().min(1).max(500).default(100)
5483
5580
  });
5581
+ /**
5582
+ * What a snooze covers. Broader scopes win when several overlap, so one window
5583
+ * leaves ONE digest rather than a rule snooze and a whole-feed snooze both
5584
+ * summarising the same silence.
5585
+ */
5586
+ var NcSnoozeScopeSchema = zod.z.enum([
5587
+ "rule",
5588
+ "device",
5589
+ "all"
5590
+ ]);
5591
+ /** Hard ceiling on a window (24h). A snooze that could not expire would be an
5592
+ * outage the operator asked for once and forgot. */
5593
+ var NC_SNOOZE_MAX_MINUTES = 1440;
5594
+ /**
5595
+ * Client-authored snooze. The server stamps `userId`, `startedAt` and
5596
+ * `expiresAt` — a DURATION is sent rather than an instant so a client with a
5597
+ * skewed clock cannot author a window that is already over, or never ends.
5598
+ */
5599
+ var NcSnoozeInputSchema = zod.z.object({
5600
+ scope: NcSnoozeScopeSchema,
5601
+ /** Required when `scope: 'rule'` — a scoped snooze with no id matches
5602
+ * NOTHING rather than degrading to "everything". */
5603
+ ruleId: zod.z.string().optional(),
5604
+ /** Required when `scope: 'device'`. */
5605
+ deviceId: zod.z.number().int().optional(),
5606
+ durationMinutes: zod.z.number().int().min(1).max(NC_SNOOZE_MAX_MINUTES),
5607
+ /**
5608
+ * Silence this for EVERY recipient, not just the caller. Permission is
5609
+ * checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
5610
+ * broader scopes). Absent = personal.
5611
+ */
5612
+ global: zod.z.boolean().optional(),
5613
+ /**
5614
+ * Deliver a summary of what was suppressed when the window ends. Absent =
5615
+ * ON: someone silencing a nuisance camera wants it off, someone silencing a
5616
+ * SECURITY camera wants to know what they missed, and choosing "off" for
5617
+ * everybody is how a snooze becomes an outage. Resolved to a concrete
5618
+ * boolean by the server at create time — never left to a Zod default, which
5619
+ * does not run on the addon cap path.
5620
+ */
5621
+ summary: zod.z.boolean().optional()
5622
+ });
5623
+ /** A persisted snooze window. */
5624
+ var NcSnoozeSchema = zod.z.object({
5625
+ id: zod.z.string(),
5626
+ /** Who set it. Also who it silences, unless `global`. */
5627
+ userId: zod.z.string(),
5628
+ scope: NcSnoozeScopeSchema,
5629
+ ruleId: zod.z.string().optional(),
5630
+ deviceId: zod.z.number().int().optional(),
5631
+ startedAt: zod.z.number(),
5632
+ /** Exclusive: at exactly this instant the snooze is over. Expiry is a
5633
+ * COMPARISON, not a job — no sweeper can leave the operator silenced. */
5634
+ expiresAt: zod.z.number(),
5635
+ global: zod.z.boolean(),
5636
+ summary: zod.z.boolean(),
5637
+ /** When the end-of-window digest went out. Absent = not sent (yet, or the
5638
+ * window has not closed, or `summary` is false). */
5639
+ digestSentAt: zod.z.number().optional()
5640
+ });
5641
+ /** One line of an end-of-window digest: what one rule hid on one camera. */
5642
+ var NcSnoozeSuppressedSchema = zod.z.object({
5643
+ snoozeId: zod.z.string(),
5644
+ targetId: zod.z.string(),
5645
+ ruleId: zod.z.string(),
5646
+ ruleName: zod.z.string(),
5647
+ deviceId: zod.z.number().int(),
5648
+ /** How many notifications this snooze hid for that pair. */
5649
+ count: zod.z.number().int(),
5650
+ firstAt: zod.z.number(),
5651
+ lastAt: zod.z.number()
5652
+ });
5484
5653
  var notificationRulesCapability = {
5485
5654
  name: "notification-rules",
5486
5655
  scope: "system",
@@ -5547,7 +5716,36 @@ var notificationRulesCapability = {
5547
5716
  * P1 (no user dimension); the P2 viewer History screen adds per-caller
5548
5717
  * scoping on the same method.
5549
5718
  */
5550
- getHistory: require_sleep.method(zod.z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), zod.z.object({ entries: zod.z.array(NcHistoryEntrySchema) }), { auth: "admin" })
5719
+ getHistory: require_sleep.method(zod.z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), zod.z.object({ entries: zod.z.array(NcHistoryEntrySchema) }), { auth: "admin" }),
5720
+ /**
5721
+ * Snooze windows currently in effect, plus any whose digest has not yet
5722
+ * gone out. `caller: 'required'`: a user sees their OWN windows and the
5723
+ * global ones that silence them, never another person's private silence.
5724
+ * An admin sees every window — a household-wide silence is exactly the
5725
+ * thing an operator has to be able to find and cancel.
5726
+ */
5727
+ listSnoozes: require_sleep.method(zod.z.object({}), zod.z.object({ snoozes: zod.z.array(NcSnoozeSchema) }), { caller: "required" }),
5728
+ /**
5729
+ * Open a window. `userId` is stamped from the caller; a GLOBAL window is
5730
+ * permission-checked server-side (the rule's `snoozeAllowGlobal` for a
5731
+ * rule-scoped one, admin for a camera or the whole feed) — a client asking
5732
+ * for one it may not have is rejected, never silently downgraded, because
5733
+ * a snooze the operator believes is in effect and is not is the same
5734
+ * failure as one they cannot end.
5735
+ */
5736
+ createSnooze: require_sleep.method(zod.z.object({ snooze: NcSnoozeInputSchema }), zod.z.object({ snooze: NcSnoozeSchema }), {
5737
+ kind: "mutation",
5738
+ caller: "required"
5739
+ }),
5740
+ /**
5741
+ * End a window NOW. The digest still goes out (what was hidden while it
5742
+ * was open is still what the operator missed); only the silence stops.
5743
+ * A user may cancel their own; an admin may cancel any.
5744
+ */
5745
+ cancelSnooze: require_sleep.method(zod.z.object({ snoozeId: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
5746
+ kind: "mutation",
5747
+ caller: "required"
5748
+ })
5551
5749
  }
5552
5750
  };
5553
5751
  //#endregion
@@ -6656,7 +6854,15 @@ var streamBrokerCapability = {
6656
6854
  format: zod.z.enum(["gif", "mp4"]).default("gif"),
6657
6855
  maxWidth: zod.z.number().int().min(120).max(1920).default(480),
6658
6856
  /** GIF only — MP4 keeps the source cadence. */
6659
- fps: zod.z.number().int().min(1).max(15).default(5)
6857
+ fps: zod.z.number().int().min(1).max(15).default(5),
6858
+ /**
6859
+ * Playback rate. A notification clip is GLANCED at on a lock screen,
6860
+ * not watched, so 2x is the default: the recipient sees the whole
6861
+ * passage in half the time and the GIF is half the bytes. `1` is real
6862
+ * time. Applies to MP4 as well — the operator set a speed, not a GIF
6863
+ * speed.
6864
+ */
6865
+ speed: zod.z.number().min(1).max(8).default(2)
6660
6866
  }), zod.z.object({
6661
6867
  base64: zod.z.string(),
6662
6868
  mime: zod.z.string(),
@@ -14796,17 +15002,6 @@ function createSystemProxy(api) {
14796
15002
  deleteTarget: (input) => dispatch("notificationOutput", "deleteTarget", "mutation", input),
14797
15003
  setTargetEnabled: (input) => dispatch("notificationOutput", "setTargetEnabled", "mutation", input)
14798
15004
  },
14799
- notificationRules: {
14800
- listRules: (input) => dispatch("notificationRules", "listRules", "query", input),
14801
- getRule: (input) => dispatch("notificationRules", "getRule", "query", input),
14802
- createRule: (input) => dispatch("notificationRules", "createRule", "mutation", input),
14803
- updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
14804
- deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
14805
- setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
14806
- testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
14807
- getConditionCatalog: (input) => dispatch("notificationRules", "getConditionCatalog", "query", input),
14808
- getHistory: (input) => dispatch("notificationRules", "getHistory", "query", input)
14809
- },
14810
15005
  pipelineExecutor: {
14811
15006
  getAvailableEngines: (input) => dispatch("pipelineExecutor", "getAvailableEngines", "query", input),
14812
15007
  getSelectedEngine: (input) => dispatch("pipelineExecutor", "getSelectedEngine", "query", input),
@@ -30706,12 +30901,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
30706
30901
  addonId: null,
30707
30902
  access: "create"
30708
30903
  },
30904
+ "notificationRules.cancelSnooze": {
30905
+ capName: "notification-rules",
30906
+ capScope: "system",
30907
+ addonId: null,
30908
+ access: "create"
30909
+ },
30709
30910
  "notificationRules.createRule": {
30710
30911
  capName: "notification-rules",
30711
30912
  capScope: "system",
30712
30913
  addonId: null,
30713
30914
  access: "create"
30714
30915
  },
30916
+ "notificationRules.createSnooze": {
30917
+ capName: "notification-rules",
30918
+ capScope: "system",
30919
+ addonId: null,
30920
+ access: "create"
30921
+ },
30715
30922
  "notificationRules.deleteRule": {
30716
30923
  capName: "notification-rules",
30717
30924
  capScope: "system",
@@ -30742,6 +30949,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
30742
30949
  addonId: null,
30743
30950
  access: "view"
30744
30951
  },
30952
+ "notificationRules.listSnoozes": {
30953
+ capName: "notification-rules",
30954
+ capScope: "system",
30955
+ addonId: null,
30956
+ access: "view"
30957
+ },
30745
30958
  "notificationRules.setRuleEnabled": {
30746
30959
  capName: "notification-rules",
30747
30960
  capScope: "system",
@@ -34270,6 +34483,7 @@ exports.NC_CONDITION_CATALOG = NC_CONDITION_CATALOG;
34270
34483
  exports.NC_HISTORY_LIMIT_DEFAULT = NC_HISTORY_LIMIT_DEFAULT;
34271
34484
  exports.NC_HISTORY_LIMIT_MAX = NC_HISTORY_LIMIT_MAX;
34272
34485
  exports.NC_MAX_PER_TRACK_IMMEDIATE = NC_MAX_PER_TRACK_IMMEDIATE;
34486
+ exports.NC_SNOOZE_MAX_MINUTES = NC_SNOOZE_MAX_MINUTES;
34273
34487
  exports.NC_TAXONOMY = NC_TAXONOMY;
34274
34488
  exports.NativeCropBboxSchema = NativeCropBboxSchema;
34275
34489
  exports.NativeCropRefSchema = NativeCropRefSchema;
@@ -34297,6 +34511,10 @@ exports.NcRuleSchema = NcRuleSchema;
34297
34511
  exports.NcRuleTargetSchema = NcRuleTargetSchema;
34298
34512
  exports.NcScheduleSchema = NcScheduleSchema;
34299
34513
  exports.NcScheduleWindowSchema = NcScheduleWindowSchema;
34514
+ exports.NcSnoozeInputSchema = NcSnoozeInputSchema;
34515
+ exports.NcSnoozeSchema = NcSnoozeSchema;
34516
+ exports.NcSnoozeScopeSchema = NcSnoozeScopeSchema;
34517
+ exports.NcSnoozeSuppressedSchema = NcSnoozeSuppressedSchema;
34300
34518
  exports.NcTaxonomyEntrySchema = NcTaxonomyEntrySchema;
34301
34519
  exports.NcTaxonomySchema = NcTaxonomySchema;
34302
34520
  exports.NcTestResultSchema = NcTestResultSchema;