@camstack/types 1.1.49 → 1.1.50

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-BfvNtyu8.js");
2
+ const require_sleep = require("./sleep-CF-UWPp0.js");
3
3
  const require_event_category = require("./event-category-CGj9fI4L.js");
4
4
  const require_enums = require("./enums.js");
5
5
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -1048,6 +1048,71 @@ function migrateConfigToBands(config) {
1048
1048
  return schedules.map((schedule) => bandFromSchedule(schedule, bandMode, config));
1049
1049
  }
1050
1050
  //#endregion
1051
+ //#region src/interfaces/ops-log.ts
1052
+ /**
1053
+ * Ops-log — the durable, append-only operations audit shared by the
1054
+ * recordings and events management surfaces.
1055
+ *
1056
+ * ONE row shape is reused for both domains so a single "Activity" view can
1057
+ * merge the recorder's DurableState ring (recordings ops-log) and the
1058
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
1059
+ * management operation, WHY it ran (reason), and its measurable effect
1060
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
1061
+ * never fail the operation it records.
1062
+ */
1063
+ /** Which management domain the operation belongs to. */
1064
+ var OpsLogDomainSchema = zod.z.enum(["recording", "events"]);
1065
+ /** The kind of management operation performed. */
1066
+ var OpsLogOpSchema = zod.z.enum([
1067
+ "prune",
1068
+ "manual-delete",
1069
+ "rescan",
1070
+ "retention-run"
1071
+ ]);
1072
+ /** Why the operation ran. */
1073
+ var OpsLogReasonSchema = zod.z.enum([
1074
+ "retention",
1075
+ "quota",
1076
+ "manual",
1077
+ "operator"
1078
+ ]);
1079
+ /** One audit row, shared verbatim by both domains. */
1080
+ var OpsLogEntrySchema = zod.z.object({
1081
+ /** Unique row id. */
1082
+ id: zod.z.string(),
1083
+ /** Epoch ms the operation completed. */
1084
+ at: zod.z.number(),
1085
+ domain: OpsLogDomainSchema,
1086
+ op: OpsLogOpSchema,
1087
+ reason: OpsLogReasonSchema,
1088
+ /** The camera the op targeted; null for a cluster/global op. */
1089
+ deviceId: zod.z.number().nullable(),
1090
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
1091
+ nodeId: zod.z.string(),
1092
+ /** Buckets / rows deleted (op-specific unit). */
1093
+ itemsAffected: zod.z.number(),
1094
+ /** Bytes reclaimed by the op (0 when not measurable). */
1095
+ bytesReclaimed: zod.z.number(),
1096
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
1097
+ detail: zod.z.string().nullable(),
1098
+ /** Who/what triggered the op. */
1099
+ actor: zod.z.string()
1100
+ });
1101
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
1102
+ var OpsLogQueryInputSchema = zod.z.object({
1103
+ /** Restrict to a single camera; omit for every row. */
1104
+ deviceId: zod.z.number().optional(),
1105
+ /** Max rows returned, newest-first. */
1106
+ limit: zod.z.number().int().min(1).max(1e3).optional()
1107
+ });
1108
+ /**
1109
+ * Default cap on the recorder's DurableState ops-log ring — the newest N rows
1110
+ * survive; older ones are evicted on append.
1111
+ */
1112
+ var OPS_LOG_RING_DEFAULT_MAX = 500;
1113
+ /** Default page size for a `listOpsLog` query when the caller omits `limit`. */
1114
+ var OPS_LOG_DEFAULT_LIMIT = 200;
1115
+ //#endregion
1051
1116
  //#region src/interfaces/storage-location.ts
1052
1117
  /**
1053
1118
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -11066,9 +11131,10 @@ var zoneRulesCapability = {
11066
11131
  * `package` backs the package-drop detector — a package zone is a
11067
11132
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
11068
11133
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
11069
- * The orchestrator provider that writes this stage lands in a later
11070
- * slice; until then the mirror carries only `{motion, detection}` and
11071
- * consumers read `package` as absent (treat as `[]`).
11134
+ * The orchestrator provider writes this stage as a first-class slice
11135
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
11136
+ * package}` shape, so consumers read the current package rules directly
11137
+ * off `device.state.zoneRules.value.package`.
11072
11138
  */
11073
11139
  runtimeState: zod.z.object({
11074
11140
  motion: zod.z.array(ZoneRuleSchema).readonly(),
@@ -13073,7 +13139,10 @@ function createSystemProxy(api) {
13073
13139
  assignPlates: (input) => dispatch("plateGallery", "assignPlates", "mutation", input),
13074
13140
  unassignPlates: (input) => dispatch("plateGallery", "unassignPlates", "mutation", input)
13075
13141
  },
13076
- recording: { getStorageUsage: (input) => dispatch("recording", "getStorageUsage", "query", input) },
13142
+ recording: {
13143
+ getStorageUsage: (input) => dispatch("recording", "getStorageUsage", "query", input),
13144
+ listOpsLog: (input) => dispatch("recording", "listOpsLog", "query", input)
13145
+ },
13077
13146
  recordingExport: {
13078
13147
  getExport: (input) => dispatch("recordingExport", "getExport", "query", input),
13079
13148
  cancelExport: (input) => dispatch("recordingExport", "cancelExport", "mutation", input),
@@ -18694,6 +18763,26 @@ var TrackCascadeCountsSchema = zod.z.object({
18694
18763
  /** Per-track CLIP search vectors removed (best-effort). */
18695
18764
  embeddings: zod.z.number().int()
18696
18765
  });
18766
+ /** Event-store footprint for one camera. */
18767
+ var EventStoreDeviceFootprintSchema = zod.z.object({
18768
+ deviceId: zod.z.number(),
18769
+ /** Persisted event rows (motion + object + audio) for the camera. */
18770
+ rows: zod.z.number().int(),
18771
+ /** Event-owned media bytes on disk for the camera. */
18772
+ bytes: zod.z.number().int()
18773
+ });
18774
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
18775
+ var EventStoreFootprintSchema = zod.z.object({
18776
+ totalRows: zod.z.number().int(),
18777
+ totalBytes: zod.z.number().int(),
18778
+ devices: zod.z.array(EventStoreDeviceFootprintSchema).readonly()
18779
+ });
18780
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
18781
+ var EventPruneCountsSchema = zod.z.object({
18782
+ motion: zod.z.number().int(),
18783
+ object: zod.z.number().int(),
18784
+ audio: zod.z.number().int()
18785
+ });
18697
18786
  var pipelineAnalyticsCapability = {
18698
18787
  name: "pipeline-analytics",
18699
18788
  scope: "device",
@@ -18855,6 +18944,45 @@ var pipelineAnalyticsCapability = {
18855
18944
  kind: "mutation",
18856
18945
  auth: "admin"
18857
18946
  }),
18947
+ /**
18948
+ * Durable event-store footprint for the management UI: event rows
18949
+ * (motion + object + audio) counted per camera + total, plus the
18950
+ * event-owned media bytes on disk per camera + total. Stat/count-based,
18951
+ * computed on demand.
18952
+ */
18953
+ getEventStoreFootprint: require_sleep.method(zod.z.object({}), EventStoreFootprintSchema, {
18954
+ kind: "query",
18955
+ auth: "admin"
18956
+ }),
18957
+ /**
18958
+ * Cluster-wide prune of events older than `olderThanMs` (exclusive) across
18959
+ * every camera, deleting each event's media in lockstep. Logged to the
18960
+ * events ops-log with `reason` (default `'retention'`). Returns the summed
18961
+ * per-kind deleted counts.
18962
+ */
18963
+ pruneEvents: require_sleep.method(zod.z.object({
18964
+ olderThanMs: zod.z.number(),
18965
+ reason: OpsLogReasonSchema.optional()
18966
+ }), EventPruneCountsSchema, {
18967
+ kind: "mutation",
18968
+ auth: "admin"
18969
+ }),
18970
+ /**
18971
+ * Manually delete EVERY event (motion + object + audio) for one camera and
18972
+ * its event-owned media in lockstep. Logged to the events ops-log as
18973
+ * `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
18974
+ * it behind a confirm.
18975
+ */
18976
+ deleteDeviceEvents: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), EventPruneCountsSchema, {
18977
+ kind: "mutation",
18978
+ auth: "admin"
18979
+ }),
18980
+ /** The events ops-log rows (newest-first), optionally scoped to one camera.
18981
+ * Backed by a declared pipeline-analytics SQLite collection. */
18982
+ listOpsLog: require_sleep.method(OpsLogQueryInputSchema, zod.z.array(OpsLogEntrySchema).readonly(), {
18983
+ kind: "query",
18984
+ auth: "admin"
18985
+ }),
18858
18986
  getEventMedia: require_sleep.method(zod.z.object({
18859
18987
  eventId: zod.z.string(),
18860
18988
  kind: MediaFileKindEnum.optional()
@@ -23592,14 +23720,43 @@ var recordingCapability = {
23592
23720
  auth: "admin"
23593
23721
  }),
23594
23722
  /** Apply this device's retention policy to footage now; returns the oldest
23595
- * surviving footage start (the retention floor) or null if no footage. */
23596
- pruneFootage: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.object({
23723
+ * surviving footage start (the retention floor) or null if no footage. The
23724
+ * prune is logged to the recordings ops-log with `reason` (default
23725
+ * `'retention'` — the policy-driven prune; `'quota'` when disk-pressure
23726
+ * triggered). */
23727
+ pruneFootage: require_sleep.method(zod.z.object({
23728
+ deviceId: zod.z.number(),
23729
+ reason: OpsLogReasonSchema.optional()
23730
+ }), zod.z.object({
23597
23731
  floorMs: zod.z.number().nullable(),
23598
23732
  deletedBuckets: zod.z.number().int(),
23599
23733
  reclaimedBytes: zod.z.number().int()
23600
23734
  }), {
23601
23735
  kind: "mutation",
23602
23736
  auth: "admin"
23737
+ }),
23738
+ /**
23739
+ * Manually delete a camera's footage — the whole footprint, or a
23740
+ * `[fromMs, toMs)` window when either bound is given. Logged to the
23741
+ * recordings ops-log as `op:'manual-delete', reason:'manual'`. Destructive:
23742
+ * the admin UI guards it behind a confirm.
23743
+ */
23744
+ deleteFootprint: require_sleep.method(zod.z.object({
23745
+ deviceId: zod.z.number(),
23746
+ fromMs: zod.z.number().optional(),
23747
+ toMs: zod.z.number().optional()
23748
+ }), zod.z.object({
23749
+ deletedBuckets: zod.z.number().int(),
23750
+ reclaimedBytes: zod.z.number().int()
23751
+ }), {
23752
+ kind: "mutation",
23753
+ auth: "admin"
23754
+ }),
23755
+ /** The recordings ops-log rows (newest-first), optionally scoped to one
23756
+ * camera. Backed by the recorder's bounded DurableState ring. */
23757
+ listOpsLog: require_sleep.method(OpsLogQueryInputSchema, zod.z.array(OpsLogEntrySchema).readonly(), {
23758
+ kind: "query",
23759
+ auth: "admin"
23603
23760
  })
23604
23761
  }
23605
23762
  };
@@ -28062,6 +28219,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28062
28219
  addonId: null,
28063
28220
  access: "delete"
28064
28221
  },
28222
+ "pipelineAnalytics.deleteDeviceEvents": {
28223
+ capName: "pipeline-analytics",
28224
+ capScope: "device",
28225
+ addonId: null,
28226
+ access: "delete"
28227
+ },
28065
28228
  "pipelineAnalytics.deleteTracks": {
28066
28229
  capName: "pipeline-analytics",
28067
28230
  capScope: "device",
@@ -28092,6 +28255,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28092
28255
  addonId: null,
28093
28256
  access: "view"
28094
28257
  },
28258
+ "pipelineAnalytics.getEventStoreFootprint": {
28259
+ capName: "pipeline-analytics",
28260
+ capScope: "device",
28261
+ addonId: null,
28262
+ access: "view"
28263
+ },
28095
28264
  "pipelineAnalytics.getKeyEvents": {
28096
28265
  capName: "pipeline-analytics",
28097
28266
  capScope: "device",
@@ -28134,6 +28303,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28134
28303
  addonId: null,
28135
28304
  access: "view"
28136
28305
  },
28306
+ "pipelineAnalytics.listOpsLog": {
28307
+ capName: "pipeline-analytics",
28308
+ capScope: "device",
28309
+ addonId: null,
28310
+ access: "view"
28311
+ },
28137
28312
  "pipelineAnalytics.listRecentTracks": {
28138
28313
  capName: "pipeline-analytics",
28139
28314
  capScope: "device",
@@ -28146,6 +28321,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28146
28321
  addonId: null,
28147
28322
  access: "view"
28148
28323
  },
28324
+ "pipelineAnalytics.pruneEvents": {
28325
+ capName: "pipeline-analytics",
28326
+ capScope: "device",
28327
+ addonId: null,
28328
+ access: "create"
28329
+ },
28149
28330
  "pipelineAnalytics.pruneEventsBefore": {
28150
28331
  capName: "pipeline-analytics",
28151
28332
  capScope: "device",
@@ -28908,6 +29089,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28908
29089
  addonId: null,
28909
29090
  access: "create"
28910
29091
  },
29092
+ "recording.deleteFootprint": {
29093
+ capName: "recording",
29094
+ capScope: "system",
29095
+ addonId: null,
29096
+ access: "delete"
29097
+ },
28911
29098
  "recording.getAvailability": {
28912
29099
  capName: "recording",
28913
29100
  capScope: "system",
@@ -28938,6 +29125,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28938
29125
  addonId: null,
28939
29126
  access: "view"
28940
29127
  },
29128
+ "recording.listOpsLog": {
29129
+ capName: "recording",
29130
+ capScope: "system",
29131
+ addonId: null,
29132
+ access: "view"
29133
+ },
28941
29134
  "recording.locateSegment": {
28942
29135
  capName: "recording",
28943
29136
  capScope: "system",
@@ -31303,8 +31496,15 @@ exports.NotificationRuleSchema = NotificationRuleSchema;
31303
31496
  exports.NotificationSchema = NotificationSchema;
31304
31497
  exports.NotifierStatusSchema = NotifierStatusSchema;
31305
31498
  exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
31499
+ exports.OPS_LOG_DEFAULT_LIMIT = OPS_LOG_DEFAULT_LIMIT;
31500
+ exports.OPS_LOG_RING_DEFAULT_MAX = OPS_LOG_RING_DEFAULT_MAX;
31306
31501
  exports.OauthIntegrationDescriptorSchema = OauthIntegrationDescriptorSchema;
31307
31502
  exports.ObjectEventSchema = ObjectEventSchema;
31503
+ exports.OpsLogDomainSchema = OpsLogDomainSchema;
31504
+ exports.OpsLogEntrySchema = OpsLogEntrySchema;
31505
+ exports.OpsLogOpSchema = OpsLogOpSchema;
31506
+ exports.OpsLogQueryInputSchema = OpsLogQueryInputSchema;
31507
+ exports.OpsLogReasonSchema = OpsLogReasonSchema;
31308
31508
  exports.OrchestratorMetricsSchema = OrchestratorMetricsSchema;
31309
31509
  exports.OsdOverlayKindEnum = OsdOverlayKindEnum;
31310
31510
  exports.OsdOverlayPatchSchema = OsdOverlayPatchSchema;