clarion-shared-types 1.0.118 → 1.0.120
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/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/dispatch/index.js +1 -0
- package/dist/cjs/modules/dispatch/index.js.map +1 -1
- package/dist/cjs/modules/dispatch/interfaces/dispatch-analytics.js +3 -0
- package/dist/cjs/modules/dispatch/interfaces/dispatch-analytics.js.map +1 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +10 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js +1 -0
- package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
- package/dist/cjs/modules/responder/enums/responder-enums.js +83 -0
- package/dist/cjs/modules/responder/enums/responder-enums.js.map +1 -0
- package/dist/cjs/modules/responder/index.js +23 -0
- package/dist/cjs/modules/responder/index.js.map +1 -0
- package/dist/cjs/modules/responder/interfaces/responder.dto.js +3 -0
- package/dist/cjs/modules/responder/interfaces/responder.dto.js.map +1 -0
- package/dist/cjs/modules/responder/utils/responder-display.util.js +102 -0
- package/dist/cjs/modules/responder/utils/responder-display.util.js.map +1 -0
- package/dist/cjs/modules/tracking/index.js +1 -0
- package/dist/cjs/modules/tracking/index.js.map +1 -1
- package/dist/cjs/modules/tracking/interfaces/tracking-analytics.js +14 -0
- package/dist/cjs/modules/tracking/interfaces/tracking-analytics.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/dispatch/index.js +1 -0
- package/dist/esm/modules/dispatch/index.js.map +1 -1
- package/dist/esm/modules/dispatch/interfaces/dispatch-analytics.js +2 -0
- package/dist/esm/modules/dispatch/interfaces/dispatch-analytics.js.map +1 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +10 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-moudule.enum.js +1 -0
- package/dist/esm/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
- package/dist/esm/modules/responder/enums/responder-enums.js +80 -0
- package/dist/esm/modules/responder/enums/responder-enums.js.map +1 -0
- package/dist/esm/modules/responder/index.js +7 -0
- package/dist/esm/modules/responder/index.js.map +1 -0
- package/dist/esm/modules/responder/interfaces/responder.dto.js +2 -0
- package/dist/esm/modules/responder/interfaces/responder.dto.js.map +1 -0
- package/dist/esm/modules/responder/utils/responder-display.util.js +92 -0
- package/dist/esm/modules/responder/utils/responder-display.util.js.map +1 -0
- package/dist/esm/modules/tracking/index.js +1 -0
- package/dist/esm/modules/tracking/index.js.map +1 -1
- package/dist/esm/modules/tracking/interfaces/tracking-analytics.js +13 -0
- package/dist/esm/modules/tracking/interfaces/tracking-analytics.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modules/dispatch/index.d.ts +1 -0
- package/dist/types/modules/dispatch/interfaces/dispatch-analytics.d.ts +158 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +4 -0
- package/dist/types/modules/permission/enums/permissions-moudule.enum.d.ts +2 -1
- package/dist/types/modules/responder/enums/responder-enums.d.ts +75 -0
- package/dist/types/modules/responder/index.d.ts +3 -0
- package/dist/types/modules/responder/interfaces/responder.dto.d.ts +87 -0
- package/dist/types/modules/responder/utils/responder-display.util.d.ts +26 -0
- package/dist/types/modules/tracking/index.d.ts +1 -0
- package/dist/types/modules/tracking/interfaces/tracking-analytics.d.ts +205 -0
- package/package.json +1 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Units & Tracking analytics, the tracking half (the admin's Units & Tracking
|
|
3
|
+
* Analytics): the response units in scope and how they are tracked - computed by
|
|
4
|
+
* clarion-response-tracking. The other half, what was dispatched and how it went, is
|
|
5
|
+
* DispatchAnalytics (clarion-incident); both answer the same query.
|
|
6
|
+
*
|
|
7
|
+
* The fleet and its live status are as they stand NOW. Everything else is the period's,
|
|
8
|
+
* counted by the hour a position was recorded (`eventTime`): the service keeps an hourly
|
|
9
|
+
* rollup of the position history, so a year costs no more to read than a day. Counts,
|
|
10
|
+
* rates and durations only - never a position, a route or a device identifier.
|
|
11
|
+
*/
|
|
12
|
+
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
13
|
+
export type UnitsAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
14
|
+
export interface UnitsAnalyticsRange {
|
|
15
|
+
/** Inclusive, ISO 8601. For "forever", the start of the data in scope. */
|
|
16
|
+
from: string;
|
|
17
|
+
/** Exclusive, ISO 8601. */
|
|
18
|
+
to: string;
|
|
19
|
+
bucket: UnitsAnalyticsBucket;
|
|
20
|
+
/** IANA time zone the buckets (and the dispatch hour-of-week grid) are cut in. */
|
|
21
|
+
timeZone: string;
|
|
22
|
+
}
|
|
23
|
+
/** Whose figures these are, as the service decided from the caller. */
|
|
24
|
+
export interface UnitsAnalyticsScope {
|
|
25
|
+
/** Null: every organization (a Super-Admin's platform view). */
|
|
26
|
+
organizationId: number | null;
|
|
27
|
+
/** Null: every control centre of the organization. */
|
|
28
|
+
controlCentreId: number | null;
|
|
29
|
+
platform: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** A count by a key (a type, a status, a provider), largest first unless the section says otherwise. */
|
|
32
|
+
export interface UnitsAnalyticsCount<K extends string = string> {
|
|
33
|
+
key: K;
|
|
34
|
+
count: number;
|
|
35
|
+
}
|
|
36
|
+
/** Median and 90th percentile of one duration, in seconds; null when nothing was measured. */
|
|
37
|
+
export interface UnitsAnalyticsDuration {
|
|
38
|
+
samples: number;
|
|
39
|
+
medianSeconds: number | null;
|
|
40
|
+
p90Seconds: number | null;
|
|
41
|
+
}
|
|
42
|
+
/** The response units in scope, as they stand now (deleted units are left out). */
|
|
43
|
+
export interface TrackingAnalyticsFleet {
|
|
44
|
+
total: number;
|
|
45
|
+
enabled: number;
|
|
46
|
+
disabled: number;
|
|
47
|
+
byType: UnitsAnalyticsCount[];
|
|
48
|
+
byOperationalStatus: UnitsAnalyticsCount[];
|
|
49
|
+
/** Enabled units with an enabled device binding: the service is told where they are. */
|
|
50
|
+
tracked: number;
|
|
51
|
+
/** Enabled units with no enabled binding. */
|
|
52
|
+
untracked: number;
|
|
53
|
+
/** Tracked units by the provider of their binding's connection (a unit bound twice counts under each). */
|
|
54
|
+
trackedByProvider: UnitsAnalyticsCount[];
|
|
55
|
+
}
|
|
56
|
+
/** The tracked units' state now - the same states as the live map. */
|
|
57
|
+
export interface TrackingAnalyticsLive {
|
|
58
|
+
online: number;
|
|
59
|
+
stale: number;
|
|
60
|
+
offline: number;
|
|
61
|
+
/** Tracked units with no position in the live store (never reported, or not for a long while). */
|
|
62
|
+
noPosition: number;
|
|
63
|
+
}
|
|
64
|
+
/** Which units reported in the period. */
|
|
65
|
+
export interface TrackingAnalyticsReporting {
|
|
66
|
+
/** Units that reported at least one position. */
|
|
67
|
+
reportingUnits: number;
|
|
68
|
+
/** The same for the previous period of the same length; null for "forever". */
|
|
69
|
+
previousReportingUnits: number | null;
|
|
70
|
+
/** Tracked units (now) that reported nothing in the period. */
|
|
71
|
+
silentTrackedUnits: number;
|
|
72
|
+
/** Tracked units that reported, as a percentage of the tracked units; null without tracked units. */
|
|
73
|
+
reportingRate: number | null;
|
|
74
|
+
}
|
|
75
|
+
/** The positions recorded in the period. */
|
|
76
|
+
export interface TrackingAnalyticsPositions {
|
|
77
|
+
total: number;
|
|
78
|
+
/** Null for "forever". */
|
|
79
|
+
previousTotal: number | null;
|
|
80
|
+
/** Positions per reporting unit per hour it reported in. */
|
|
81
|
+
perUnitHour: number | null;
|
|
82
|
+
/** Percentages of the positions that say: reported while moving, with the ignition on. */
|
|
83
|
+
movingRate: number | null;
|
|
84
|
+
ignitionOnRate: number | null;
|
|
85
|
+
byProvider: UnitsAnalyticsCount[];
|
|
86
|
+
}
|
|
87
|
+
/** How long a position took to reach Clarion once the device recorded it, in bands. */
|
|
88
|
+
export type TrackingDelayBand = 'WITHIN_5S' | 'WITHIN_10S' | 'WITHIN_30S' | 'WITHIN_1M' | 'WITHIN_2M' | 'WITHIN_5M' | 'WITHIN_15M' | 'LATER';
|
|
89
|
+
/** Delivery delay: `receivedAt - eventTime` of every position in the period. */
|
|
90
|
+
export interface TrackingAnalyticsDelivery {
|
|
91
|
+
/** Estimated from the bands (interpolated within the band the percentile falls in). */
|
|
92
|
+
medianSeconds: number | null;
|
|
93
|
+
p90Seconds: number | null;
|
|
94
|
+
meanSeconds: number | null;
|
|
95
|
+
/** Every band, fastest first, zero counts included. */
|
|
96
|
+
bands: UnitsAnalyticsCount<TrackingDelayBand>[];
|
|
97
|
+
/** Positions that took longer than 5 minutes, as a percentage. */
|
|
98
|
+
lateRate: number | null;
|
|
99
|
+
}
|
|
100
|
+
/** What the ingestion flagged about the period's positions, and the provider units nobody has bound. */
|
|
101
|
+
export interface TrackingAnalyticsQuality {
|
|
102
|
+
outOfOrder: number;
|
|
103
|
+
duplicates: number;
|
|
104
|
+
invalidCoordinates: number;
|
|
105
|
+
/** Positions that jumped implausibly far from the previous one. */
|
|
106
|
+
jumpSuspected: number;
|
|
107
|
+
/** Positions with an accuracy worse than 100 m. */
|
|
108
|
+
poorAccuracy: number;
|
|
109
|
+
/** Provider units reporting without a binding: open now, resolved, and how often they were seen. */
|
|
110
|
+
unmappedOpen: number;
|
|
111
|
+
unmappedResolved: number;
|
|
112
|
+
unmappedOccurrences: number;
|
|
113
|
+
}
|
|
114
|
+
export interface TrackingAnalyticsTimelinePoint {
|
|
115
|
+
/** Start of the bucket, ISO 8601. */
|
|
116
|
+
at: string;
|
|
117
|
+
positions: number;
|
|
118
|
+
reportingUnits: number;
|
|
119
|
+
/** Positions that took longer than 5 minutes to arrive. */
|
|
120
|
+
late: number;
|
|
121
|
+
}
|
|
122
|
+
/** A provider connection in scope: its configuration and health now, and its positions in the period. */
|
|
123
|
+
export interface TrackingAnalyticsConnectionRow {
|
|
124
|
+
id: number;
|
|
125
|
+
organizationId: number;
|
|
126
|
+
controlCentreId: number | null;
|
|
127
|
+
name: string;
|
|
128
|
+
providerCode: string;
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
connectionStatus: string;
|
|
131
|
+
lastEventAt: string | null;
|
|
132
|
+
lastErrorAt: string | null;
|
|
133
|
+
lastErrorCode: string | null;
|
|
134
|
+
/** Enabled bindings through it now. */
|
|
135
|
+
boundUnits: number;
|
|
136
|
+
positions: number;
|
|
137
|
+
reportingUnits: number;
|
|
138
|
+
medianDelaySeconds: number | null;
|
|
139
|
+
lateRate: number | null;
|
|
140
|
+
}
|
|
141
|
+
/** A response unit in scope: what it is and how it is tracked now, and what it reported in the period. */
|
|
142
|
+
export interface TrackingAnalyticsUnitRow {
|
|
143
|
+
responseUnitId: number;
|
|
144
|
+
organizationId: number;
|
|
145
|
+
controlCentreId: number | null;
|
|
146
|
+
name: string | null;
|
|
147
|
+
responseUnitType: string | null;
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
tracked: boolean;
|
|
150
|
+
/** The providers its enabled bindings use. */
|
|
151
|
+
providers: string[];
|
|
152
|
+
/** ONLINE, STALE or OFFLINE now; null when not tracked or without a position. */
|
|
153
|
+
liveStatus: string | null;
|
|
154
|
+
/** Its newest position in the period. */
|
|
155
|
+
lastPositionAt: string | null;
|
|
156
|
+
positions: number;
|
|
157
|
+
/** Hours in which it reported at least once. */
|
|
158
|
+
hoursReporting: number;
|
|
159
|
+
medianDelaySeconds: number | null;
|
|
160
|
+
}
|
|
161
|
+
/** Platform view only: one row per organization. */
|
|
162
|
+
export interface TrackingAnalyticsOrganizationRow {
|
|
163
|
+
organizationId: number;
|
|
164
|
+
units: number;
|
|
165
|
+
tracked: number;
|
|
166
|
+
reportingUnits: number;
|
|
167
|
+
positions: number;
|
|
168
|
+
connections: number;
|
|
169
|
+
lateRate: number | null;
|
|
170
|
+
}
|
|
171
|
+
export interface TrackingAnalytics {
|
|
172
|
+
generatedAt: string;
|
|
173
|
+
range: UnitsAnalyticsRange;
|
|
174
|
+
scope: UnitsAnalyticsScope;
|
|
175
|
+
fleet: TrackingAnalyticsFleet;
|
|
176
|
+
live: TrackingAnalyticsLive;
|
|
177
|
+
reporting: TrackingAnalyticsReporting;
|
|
178
|
+
positions: TrackingAnalyticsPositions;
|
|
179
|
+
delivery: TrackingAnalyticsDelivery;
|
|
180
|
+
quality: TrackingAnalyticsQuality;
|
|
181
|
+
timeline: TrackingAnalyticsTimelinePoint[];
|
|
182
|
+
connections: TrackingAnalyticsConnectionRow[];
|
|
183
|
+
/** The units in scope, most positions first; capped (see `unitsTruncated`). */
|
|
184
|
+
units: TrackingAnalyticsUnitRow[];
|
|
185
|
+
unitsTruncated: boolean;
|
|
186
|
+
/** Platform view only; null otherwise. */
|
|
187
|
+
byOrganization: TrackingAnalyticsOrganizationRow[] | null;
|
|
188
|
+
/** The rollup is complete up to this instant: positions recorded later are not counted yet. */
|
|
189
|
+
rollupThrough: string | null;
|
|
190
|
+
/** History older than this is still being rolled up (the first hours after release); null once complete. */
|
|
191
|
+
backfillingBefore: string | null;
|
|
192
|
+
}
|
|
193
|
+
/** The query both halves answer (UnitsAnalyticsQueryDto in grm-shared-library). All optional. */
|
|
194
|
+
export interface UnitsAnalyticsQuery {
|
|
195
|
+
/** Inclusive, ISO 8601. Omit for "forever". */
|
|
196
|
+
from?: string;
|
|
197
|
+
/** Exclusive, ISO 8601. Omit for "now". */
|
|
198
|
+
to?: string;
|
|
199
|
+
/** IANA time zone for the buckets and the hour-of-week grid. */
|
|
200
|
+
timeZone?: string;
|
|
201
|
+
/** Super-Admin only. */
|
|
202
|
+
organizationId?: number;
|
|
203
|
+
/** One control centre of the organization. */
|
|
204
|
+
controlCentreId?: number;
|
|
205
|
+
}
|