een-api-toolkit 0.3.51 → 0.3.55
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/.claude/agents/docs-accuracy-reviewer.md +27 -1
- package/.claude/agents/een-events-agent.md +43 -3
- package/CHANGELOG.md +4 -7
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +214 -0
- package/dist/index.js +793 -421
- package/dist/index.js.map +1 -1
- package/docs/AI-CONTEXT.md +1 -1
- package/docs/ai-reference/AI-AUTH.md +1 -1
- package/docs/ai-reference/AI-AUTOMATIONS.md +1 -1
- package/docs/ai-reference/AI-DEVICES.md +1 -1
- package/docs/ai-reference/AI-EVENT-DATA-SCHEMAS.md +328 -0
- package/docs/ai-reference/AI-EVENTS.md +13 -2
- package/docs/ai-reference/AI-GROUPING.md +1 -1
- package/docs/ai-reference/AI-JOBS.md +1 -1
- package/docs/ai-reference/AI-MEDIA.md +1 -1
- package/docs/ai-reference/AI-SETUP.md +1 -1
- package/docs/ai-reference/AI-USERS.md +1 -1
- package/examples/vue-events/src/components/EventsModal.vue +54 -1
- package/package.json +1 -1
package/docs/AI-CONTEXT.md
CHANGED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Event Type to Data Schemas Mapping - EEN API Toolkit
|
|
2
|
+
|
|
3
|
+
> **Version:** 0.3.55
|
|
4
|
+
>
|
|
5
|
+
> Complete reference for event type to data schema mappings.
|
|
6
|
+
> Load this document when building dynamic event queries with the `include` parameter.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
When fetching events using the `listEvents` API, you can request additional event-specific data by using the `include` parameter. Each event type supports a specific set of data schemas. The toolkit provides a static mapping and utility functions to help you build the correct `include` parameter dynamically.
|
|
13
|
+
|
|
14
|
+
### Key Concept
|
|
15
|
+
|
|
16
|
+
- **Schema names** appear in the event's `dataSchemas` array (e.g., `een.objectDetection.v1`)
|
|
17
|
+
- **Include values** require the `data.` prefix (e.g., `data.een.objectDetection.v1`)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Exported Functions
|
|
22
|
+
|
|
23
|
+
### getIncludeParameterForEventTypes(eventTypes)
|
|
24
|
+
|
|
25
|
+
Get the include parameter values for multiple event types. Combines all schemas, removes duplicates, and adds the `data.` prefix.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { getIncludeParameterForEventTypes, listEvents } from 'een-api-toolkit'
|
|
29
|
+
|
|
30
|
+
const selectedTypes = ['een.personDetectionEvent.v1', 'een.vehicleDetectionEvent.v1']
|
|
31
|
+
const includeValues = getIncludeParameterForEventTypes(selectedTypes)
|
|
32
|
+
// ['data.een.objectDetection.v1', 'data.een.personAttributes.v1', ...]
|
|
33
|
+
|
|
34
|
+
const result = await listEvents({
|
|
35
|
+
actor: `camera:${cameraId}`,
|
|
36
|
+
type__in: selectedTypes,
|
|
37
|
+
startTimestamp__gte: startTime,
|
|
38
|
+
include: includeValues
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### getDataSchemasForEventType(eventType)
|
|
43
|
+
|
|
44
|
+
Get the data schemas for a specific event type (without `data.` prefix).
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { getDataSchemasForEventType } from 'een-api-toolkit'
|
|
48
|
+
|
|
49
|
+
const schemas = getDataSchemasForEventType('een.personDetectionEvent.v1')
|
|
50
|
+
// ['een.objectDetection.v1', 'een.personAttributes.v1', ...]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### eventTypeHasDataSchemas(eventType)
|
|
54
|
+
|
|
55
|
+
Check if an event type has any associated data schemas.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { eventTypeHasDataSchemas } from 'een-api-toolkit'
|
|
59
|
+
|
|
60
|
+
if (eventTypeHasDataSchemas('een.personDetectionEvent.v1')) {
|
|
61
|
+
// Include data schemas in the API call
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### getEventTypesForDataSchema(schema)
|
|
66
|
+
|
|
67
|
+
Find which event types support a specific data schema.
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { getEventTypesForDataSchema } from 'een-api-toolkit'
|
|
71
|
+
|
|
72
|
+
const eventTypes = getEventTypesForDataSchema('een.objectDetection.v1')
|
|
73
|
+
// ['een.motionDetectionEvent.v1', 'een.personDetectionEvent.v1', ...]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### getAllDataSchemas()
|
|
77
|
+
|
|
78
|
+
Get all unique data schemas across all event types.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { getAllDataSchemas } from 'een-api-toolkit'
|
|
82
|
+
|
|
83
|
+
const allSchemas = getAllDataSchemas()
|
|
84
|
+
// ['een.objectDetection.v1', 'een.fullFrameImageUrl.v1', ...]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### getAllKnownEventTypes()
|
|
88
|
+
|
|
89
|
+
Get all known event types defined in the mapping.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { getAllKnownEventTypes } from 'een-api-toolkit'
|
|
93
|
+
|
|
94
|
+
const allTypes = getAllKnownEventTypes()
|
|
95
|
+
// ['een.motionDetectionEvent.v1', 'een.personDetectionEvent.v1', ...]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Static Mapping
|
|
101
|
+
|
|
102
|
+
The `EVENT_TYPE_DATA_SCHEMAS` constant provides the complete mapping:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { EVENT_TYPE_DATA_SCHEMAS } from 'een-api-toolkit'
|
|
106
|
+
|
|
107
|
+
const schemas = EVENT_TYPE_DATA_SCHEMAS['een.personDetectionEvent.v1']
|
|
108
|
+
// ['een.objectDetection.v1', 'een.personAttributes.v1', ...]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Event Type to Data Schemas Reference
|
|
114
|
+
|
|
115
|
+
### Detection Events
|
|
116
|
+
|
|
117
|
+
| Event Type | Data Schemas |
|
|
118
|
+
|------------|--------------|
|
|
119
|
+
| `een.motionDetectionEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
120
|
+
| `een.motionInRegionDetectionEvent.v1` | `motionRegion`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
121
|
+
| `een.personDetectionEvent.v1` | `objectDetection`, `personAttributes`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `objectRegionMapping`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay`, `geoLocation` |
|
|
122
|
+
| `een.personMotionDetectionEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification` |
|
|
123
|
+
| `een.animalDetectionEvent.v1` | `objectDetection`, `animalAttributes`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `objectRegionMapping`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
124
|
+
| `een.faceDetectionEvent.v1` | `objectDetection`, `personAttributes`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `objectRegionMapping`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
125
|
+
| `een.vehicleDetectionEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `vehicleAttributes`, `objectRegionMapping`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
126
|
+
| `een.vehicleMotionDetectionEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `vehicleAttributes` |
|
|
127
|
+
| `een.gunDetectionEvent.v1` | `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectDetection`, `motionRegion`, `objectClassification`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay`, `weaponAttributes`, `personAttributes`, `humanValidationDetails` |
|
|
128
|
+
| `een.weaponDetectionEvent.v1` | `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectDetection`, `motionRegion`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
129
|
+
| `een.fallDetectionEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
130
|
+
| `een.fireDetectionEvent.v1` | `objectDetection`, `objectClassification`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
131
|
+
| `een.spillDetectionEvent.v1` | `objectDetection`, `objectClassification`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
132
|
+
| `een.crowdFormationDetectionEvent.v1` | `objectDetection`, `objectClassification`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
133
|
+
|
|
134
|
+
### Camera Analytics Events
|
|
135
|
+
|
|
136
|
+
| Event Type | Data Schemas |
|
|
137
|
+
|------------|--------------|
|
|
138
|
+
| `een.tamperDetectionEvent.v1` | `fullFrameImageUrl` |
|
|
139
|
+
| `een.loiterDetectionEvent.v1` | `loiterArea`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
140
|
+
| `een.objectLineCrossEvent.v1` | `lineCrossLine`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `entryDirection`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
141
|
+
| `een.objectLineCrossCountEvent.v1` | `lineCrossLine`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `entryDirection`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
142
|
+
| `een.countedObjectLineCrossEvent.v1` | `countedLineCross` |
|
|
143
|
+
| `een.objectIntrusionEvent.v1` | `intrusionArea`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `entryDirection`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
144
|
+
| `een.objectRemovalEvent.v1` | `monitoredArea`, `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
145
|
+
| `een.personTailgateEvent.v1` | `objectDetection`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
146
|
+
| `een.ppeViolationEvent.v1` | `objectDetection`, `personAttributes`, `fullFrameImageUrl`, `croppedFrameImageUrl`, `objectClassification`, `objectRegionMapping`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay` |
|
|
147
|
+
|
|
148
|
+
### AI/Scene Events
|
|
149
|
+
|
|
150
|
+
| Event Type | Data Schemas |
|
|
151
|
+
|------------|--------------|
|
|
152
|
+
| `een.sceneLabelEvent.v1` | `objectDetection`, `objectClassification`, `vehicleAttributes`, `personAttributes`, `animalAttributes`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `objectRegionMapping`, `displayOverlay.boundingBox`, `customLabels`, `eevaAttributes`, `fullFrameImageUrlWithOverlay` |
|
|
153
|
+
| `een.eevaQueryEvent.v1` | `customLabels`, `eevaAttributes`, `objectDetection`, `fullFrameImageUrl`, `fullFrameImageUrlWithOverlay`, `displayOverlay.boundingBox` |
|
|
154
|
+
|
|
155
|
+
### License Plate & Fleet Recognition Events
|
|
156
|
+
|
|
157
|
+
| Event Type | Data Schemas |
|
|
158
|
+
|------------|--------------|
|
|
159
|
+
| `een.lprPlateReadEvent.v1` | `objectDetection`, `lprDetection`, `vehicleAttributes`, `lprAccessType`, `userData`, `userTags`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `displayOverlay.boundingBox`, `fullFrameImageUrlWithOverlay`, `vehicleListInfo`, `resourceDetails`, `vspInsightsSummary` |
|
|
160
|
+
| `een.fleetCodeRecognitionEvent.v1` | `objectDetection`, `dotNumberRecognition`, `truckNumberRecognition`, `trailerNumberRecognition`, `croppedFrameImageUrl`, `fullFrameImageUrl`, `recognizedText`, `resourceDetails` |
|
|
161
|
+
|
|
162
|
+
### Audio Detection Events
|
|
163
|
+
|
|
164
|
+
| Event Type | Data Schemas |
|
|
165
|
+
|------------|--------------|
|
|
166
|
+
| `een.gunShotAudioDetectionEvent.v1` | `audioDetection`, `geoLocation` |
|
|
167
|
+
| `een.t3AlarmAudioDetectionEvent.v1` | `audioDetection` |
|
|
168
|
+
| `een.t4AlarmAudioDetectionEvent.v1` | `audioDetection` |
|
|
169
|
+
|
|
170
|
+
### POS (Point of Sale) Events
|
|
171
|
+
|
|
172
|
+
| Event Type | Data Schemas |
|
|
173
|
+
|------------|--------------|
|
|
174
|
+
| `een.posTransactionEvent.v1` | `posTransactionStart`, `posTransactionEnd`, `posTransactionItem`, `posTransactionPayment`, `posTransactionCartChangeTrail`, `posTransactionCardLoadSummary`, `posTransactionFlag`, `posTransactionLabel`, `rawData`, `displayLocationSummary`, `fullFrameImageUrl` |
|
|
175
|
+
|
|
176
|
+
### Device & System Events
|
|
177
|
+
|
|
178
|
+
| Event Type | Data Schemas |
|
|
179
|
+
|------------|--------------|
|
|
180
|
+
| `een.deviceCloudStatusUpdateEvent.v1` | `deviceCloudStatusUpdate`, `deviceCloudPreviousStatus` |
|
|
181
|
+
| `een.deviceCloudConnectionStatusUpdateEvent.v1` | `deviceCloudConnectionStatusUpdate`, `deviceCloudConnectionPreviousStatus` |
|
|
182
|
+
| `een.edgeReportedDeviceStatusEvent.v1` | `deviceCommonStatusUpdate`, `deviceErrorStatusUpdate` |
|
|
183
|
+
| `een.deviceIOEvent.v1` | `deviceIO` |
|
|
184
|
+
| `een.deviceOperationEvent.v1` | `resourceDetails`, `deviceOperationDetails`, `deviceOperationSubStep`, `deviceOperationUpdate` |
|
|
185
|
+
| `een.ptzPositionUpdateEvent.v1` | `ptzPositionUpdate` |
|
|
186
|
+
|
|
187
|
+
### Sensor Events
|
|
188
|
+
|
|
189
|
+
| Event Type | Data Schemas |
|
|
190
|
+
|------------|--------------|
|
|
191
|
+
| `een.doorStatusEvent.v1` | `measurementStringValueUpdate` |
|
|
192
|
+
| `een.batteryLevelUpdateEvent.v1` | `batteryLevelUpdate` |
|
|
193
|
+
| `een.measurementThresholdStatusEvent.v1` | `measurementThresholdStatus`, `measurementValueUpdate`, `measurementStringValueUpdate` |
|
|
194
|
+
| `een.thermalCameraThresholdStatusEvent.v1` | `thermalCameraValueUpdate`, `thermalMonitoredArea` |
|
|
195
|
+
|
|
196
|
+
### Resource Management Events
|
|
197
|
+
|
|
198
|
+
All resource management events use `resourceDetails.v1`:
|
|
199
|
+
|
|
200
|
+
- `een.layoutCreationEvent.v1`, `een.layoutUpdateEvent.v1`, `een.layoutDeletionEvent.v1`
|
|
201
|
+
- `een.deviceCreationEvent.v1`, `een.deviceUpdateEvent.v1`, `een.deviceDeletionEvent.v1`
|
|
202
|
+
- `een.userCreationEvent.v1`, `een.userUpdateEvent.v1`, `een.userDeletionEvent.v1`
|
|
203
|
+
- `een.accountCreationEvent.v1`, `een.accountUpdateEvent.v1`, `een.accountDeletionEvent.v1`
|
|
204
|
+
|
|
205
|
+
### Job Events
|
|
206
|
+
|
|
207
|
+
| Event Type | Data Schemas |
|
|
208
|
+
|------------|--------------|
|
|
209
|
+
| `een.jobCreationEvent.v1` | `jobDetails`, `ownerDetails` |
|
|
210
|
+
| `een.jobUpdateEvent.v1` | `jobDetails`, `ownerDetails` |
|
|
211
|
+
| `een.jobDeletionEvent.v1` | `ownerDetails` |
|
|
212
|
+
|
|
213
|
+
### Safety & Protocol Events
|
|
214
|
+
|
|
215
|
+
| Event Type | Data Schemas |
|
|
216
|
+
|------------|--------------|
|
|
217
|
+
| `een.panicButtonEvent.v1` | `geoLocation` |
|
|
218
|
+
| `een.evacuateProtocolEvent.v1` | *(none)* |
|
|
219
|
+
| `een.holdProtocolEvent.v1` | *(none)* |
|
|
220
|
+
| `een.lockdownProtocolEvent.v1` | *(none)* |
|
|
221
|
+
| `een.secureProtocolEvent.v1` | *(none)* |
|
|
222
|
+
| `een.shelterProtocolEvent.v1` | *(none)* |
|
|
223
|
+
|
|
224
|
+
### Behavioral Events
|
|
225
|
+
|
|
226
|
+
These events have no associated data schemas:
|
|
227
|
+
|
|
228
|
+
- `een.violenceDetectionEvent.v1`
|
|
229
|
+
- `een.fightDetectionEvent.v1`
|
|
230
|
+
- `een.handsUpDetectionEvent.v1`
|
|
231
|
+
- `een.vapeDetectionEvent.v1`
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Common Data Schemas
|
|
236
|
+
|
|
237
|
+
These are the most commonly used data schemas across multiple event types:
|
|
238
|
+
|
|
239
|
+
| Schema | Description | Common Uses |
|
|
240
|
+
|--------|-------------|-------------|
|
|
241
|
+
| `een.objectDetection.v1` | Bounding box coordinates `[x1, y1, x2, y2]` (normalized 0-1) | Most detection events |
|
|
242
|
+
| `een.objectClassification.v1` | Object class label and confidence | Detection with classification |
|
|
243
|
+
| `een.fullFrameImageUrl.v1` | URL to full-frame event image | Most camera events |
|
|
244
|
+
| `een.croppedFrameImageUrl.v1` | URL to cropped image of detected object | Detection events |
|
|
245
|
+
| `een.fullFrameImageUrlWithOverlay.v1` | URL to full-frame image with visual overlays | Detection events with overlays |
|
|
246
|
+
| `een.displayOverlay.boundingBox.v1` | Bounding box overlay data for visual display | Detection events |
|
|
247
|
+
| `een.personAttributes.v1` | Person-specific attributes (clothing, gender) | Person detection |
|
|
248
|
+
| `een.vehicleAttributes.v1` | Vehicle-specific attributes (make, model, color) | Vehicle detection |
|
|
249
|
+
| `een.animalAttributes.v1` | Animal-specific attributes | Animal detection |
|
|
250
|
+
| `een.eevaAttributes.v1` | EEVA AI query and response attributes | Scene label, EEVA query |
|
|
251
|
+
| `een.customLabels.v1` | Custom labels from AI analysis | Scene label, EEVA query |
|
|
252
|
+
| `een.countedLineCross.v1` | Aggregated count of objects crossing a line | Counting analytics |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Vue Component Example
|
|
257
|
+
|
|
258
|
+
```vue
|
|
259
|
+
<script setup lang="ts">
|
|
260
|
+
import { ref, watch, computed } from 'vue'
|
|
261
|
+
import {
|
|
262
|
+
listEvents,
|
|
263
|
+
listEventFieldValues,
|
|
264
|
+
getIncludeParameterForEventTypes,
|
|
265
|
+
getDataSchemasForEventType,
|
|
266
|
+
type Camera,
|
|
267
|
+
type Event
|
|
268
|
+
} from 'een-api-toolkit'
|
|
269
|
+
|
|
270
|
+
const props = defineProps<{ camera: Camera }>()
|
|
271
|
+
|
|
272
|
+
const availableEventTypes = ref<string[]>([])
|
|
273
|
+
const selectedEventTypes = ref<string[]>([])
|
|
274
|
+
const events = ref<Event[]>([])
|
|
275
|
+
|
|
276
|
+
// Dynamically compute include parameter based on selected event types
|
|
277
|
+
const includeParameter = computed(() => {
|
|
278
|
+
return getIncludeParameterForEventTypes(selectedEventTypes.value)
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
async function fetchAvailableEventTypes() {
|
|
282
|
+
const result = await listEventFieldValues({
|
|
283
|
+
actor: `camera:${props.camera.id}`
|
|
284
|
+
})
|
|
285
|
+
if (!result.error) {
|
|
286
|
+
availableEventTypes.value = result.data.type || []
|
|
287
|
+
selectedEventTypes.value = [...availableEventTypes.value]
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async function fetchEvents() {
|
|
292
|
+
if (selectedEventTypes.value.length === 0) return
|
|
293
|
+
|
|
294
|
+
const result = await listEvents({
|
|
295
|
+
actor: `camera:${props.camera.id}`,
|
|
296
|
+
type__in: selectedEventTypes.value,
|
|
297
|
+
startTimestamp__gte: new Date(Date.now() - 3600000).toISOString(),
|
|
298
|
+
include: includeParameter.value
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
if (!result.error) {
|
|
302
|
+
events.value = result.data.results
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Get schemas for a specific event (useful for JSON viewer)
|
|
307
|
+
function getEventSchemas(event: Event): string[] {
|
|
308
|
+
return getDataSchemasForEventType(event.type)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Refetch when selection changes
|
|
312
|
+
watch(selectedEventTypes, fetchEvents, { deep: true })
|
|
313
|
+
</script>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Source
|
|
319
|
+
|
|
320
|
+
This mapping is derived from the Eagle Eye Networks API v3.0 specification (`events.yaml`).
|
|
321
|
+
|
|
322
|
+
## Maintenance
|
|
323
|
+
|
|
324
|
+
When new event types are added to the EEN API:
|
|
325
|
+
1. Check the API specification for the new event type
|
|
326
|
+
2. Find the `dataSchemas` array in the event schema
|
|
327
|
+
3. Add the mapping to `src/events/dataSchemas.ts`
|
|
328
|
+
4. Update the `KnownEventType` and `DataSchema` types as needed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Events, Alerts & Real-Time Streaming - EEN API Toolkit
|
|
2
2
|
|
|
3
|
-
> **Version:** 0.3.
|
|
3
|
+
> **Version:** 0.3.55
|
|
4
4
|
>
|
|
5
5
|
> Complete reference for events, alerts, metrics, and SSE subscriptions.
|
|
6
6
|
> Load this document when implementing event-driven features.
|
|
@@ -293,6 +293,8 @@ import {
|
|
|
293
293
|
listEventTypes,
|
|
294
294
|
getRecordedImage,
|
|
295
295
|
getEvent,
|
|
296
|
+
getIncludeParameterForEventTypes,
|
|
297
|
+
getDataSchemasForEventType,
|
|
296
298
|
type Camera,
|
|
297
299
|
type Event,
|
|
298
300
|
type EventType,
|
|
@@ -420,6 +422,12 @@ const jsonViewerContent = computed(() => {
|
|
|
420
422
|
}
|
|
421
423
|
})
|
|
422
424
|
|
|
425
|
+
// Data schemas for the current event type
|
|
426
|
+
const jsonViewerDataSchemas = computed(() => {
|
|
427
|
+
if (!jsonViewerEvent.value) return []
|
|
428
|
+
return getDataSchemasForEventType(jsonViewerEvent.value.type)
|
|
429
|
+
})
|
|
430
|
+
|
|
423
431
|
// Get start timestamp based on time range
|
|
424
432
|
function getStartTimestamp(range: TimeRange): string {
|
|
425
433
|
const now = Date.now()
|
|
@@ -571,6 +579,9 @@ async function fetchEvents(append = false) {
|
|
|
571
579
|
error.value = null
|
|
572
580
|
}
|
|
573
581
|
|
|
582
|
+
// Build include parameter dynamically based on selected event types
|
|
583
|
+
const includeValues = getIncludeParameterForEventTypes(selectedEventTypes.value)
|
|
584
|
+
|
|
574
585
|
const result = await listEvents({
|
|
575
586
|
actor: `camera:${props.camera.id}`,
|
|
576
587
|
type__in: selectedEventTypes.value,
|
|
@@ -579,7 +590,7 @@ async function fetchEvents(append = false) {
|
|
|
579
590
|
pageSize: 20,
|
|
580
591
|
pageToken: append ? nextPageToken.value : undefined,
|
|
581
592
|
sort: '-startTimestamp',
|
|
582
|
-
include:
|
|
593
|
+
include: includeValues
|
|
583
594
|
})
|
|
584
595
|
|
|
585
596
|
if (result.error) {
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
listEventTypes,
|
|
7
7
|
getRecordedImage,
|
|
8
8
|
getEvent,
|
|
9
|
+
getIncludeParameterForEventTypes,
|
|
10
|
+
getDataSchemasForEventType,
|
|
9
11
|
type Camera,
|
|
10
12
|
type Event,
|
|
11
13
|
type EventType,
|
|
@@ -133,6 +135,12 @@ const jsonViewerContent = computed(() => {
|
|
|
133
135
|
}
|
|
134
136
|
})
|
|
135
137
|
|
|
138
|
+
// Data schemas for the current event type
|
|
139
|
+
const jsonViewerDataSchemas = computed(() => {
|
|
140
|
+
if (!jsonViewerEvent.value) return []
|
|
141
|
+
return getDataSchemasForEventType(jsonViewerEvent.value.type)
|
|
142
|
+
})
|
|
143
|
+
|
|
136
144
|
// Get start timestamp based on time range
|
|
137
145
|
function getStartTimestamp(range: TimeRange): string {
|
|
138
146
|
const now = Date.now()
|
|
@@ -284,6 +292,9 @@ async function fetchEvents(append = false) {
|
|
|
284
292
|
error.value = null
|
|
285
293
|
}
|
|
286
294
|
|
|
295
|
+
// Build include parameter dynamically based on selected event types
|
|
296
|
+
const includeValues = getIncludeParameterForEventTypes(selectedEventTypes.value)
|
|
297
|
+
|
|
287
298
|
const result = await listEvents({
|
|
288
299
|
actor: `camera:${props.camera.id}`,
|
|
289
300
|
type__in: selectedEventTypes.value,
|
|
@@ -292,7 +303,7 @@ async function fetchEvents(append = false) {
|
|
|
292
303
|
pageSize: 20,
|
|
293
304
|
pageToken: append ? nextPageToken.value : undefined,
|
|
294
305
|
sort: '-startTimestamp',
|
|
295
|
-
include:
|
|
306
|
+
include: includeValues
|
|
296
307
|
})
|
|
297
308
|
|
|
298
309
|
if (result.error) {
|
|
@@ -907,6 +918,16 @@ watch([timeRange, selectedEventTypes], () => {
|
|
|
907
918
|
>×</button>
|
|
908
919
|
</div>
|
|
909
920
|
</div>
|
|
921
|
+
<div v-if="jsonViewerDataSchemas.length > 0" class="json-viewer-schemas" data-testid="json-viewer-schemas">
|
|
922
|
+
<span class="schemas-label">Data Schemas:</span>
|
|
923
|
+
<div class="schemas-list">
|
|
924
|
+
<span
|
|
925
|
+
v-for="schema in jsonViewerDataSchemas"
|
|
926
|
+
:key="schema"
|
|
927
|
+
class="schema-tag"
|
|
928
|
+
>{{ schema }}</span>
|
|
929
|
+
</div>
|
|
930
|
+
</div>
|
|
910
931
|
<div class="json-viewer-body">
|
|
911
932
|
<div v-if="jsonViewerLoading" class="json-viewer-loading">
|
|
912
933
|
Loading full event details...
|
|
@@ -1496,6 +1517,38 @@ watch([timeRange, selectedEventTypes], () => {
|
|
|
1496
1517
|
color: #fff;
|
|
1497
1518
|
}
|
|
1498
1519
|
|
|
1520
|
+
.json-viewer-schemas {
|
|
1521
|
+
padding: 12px 20px;
|
|
1522
|
+
border-bottom: 1px solid #333;
|
|
1523
|
+
background: #252525;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
.schemas-label {
|
|
1527
|
+
color: #888;
|
|
1528
|
+
font-size: 0.75rem;
|
|
1529
|
+
font-weight: 500;
|
|
1530
|
+
text-transform: uppercase;
|
|
1531
|
+
letter-spacing: 0.5px;
|
|
1532
|
+
display: block;
|
|
1533
|
+
margin-bottom: 8px;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
.schemas-list {
|
|
1537
|
+
display: flex;
|
|
1538
|
+
flex-wrap: wrap;
|
|
1539
|
+
gap: 6px;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
.schema-tag {
|
|
1543
|
+
background: #333;
|
|
1544
|
+
color: #42b883;
|
|
1545
|
+
font-size: 0.7rem;
|
|
1546
|
+
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
|
|
1547
|
+
padding: 3px 8px;
|
|
1548
|
+
border-radius: 3px;
|
|
1549
|
+
border: 1px solid #444;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1499
1552
|
.json-viewer-body {
|
|
1500
1553
|
flex: 1;
|
|
1501
1554
|
overflow: auto;
|