grm-shared-library 1.1.222 → 1.1.224
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/kafka/topics.js +7 -0
- package/dist/cjs/kafka/topics.js.map +1 -1
- package/dist/cjs/modules/gis/dtos/private-trip.dto.js +34 -0
- package/dist/cjs/modules/gis/dtos/private-trip.dto.js.map +1 -1
- package/dist/cjs/modules/gis/dtos/routing.dto.js +251 -0
- package/dist/cjs/modules/gis/dtos/routing.dto.js.map +1 -0
- package/dist/cjs/modules/gis/dtos/trip-points.dto.js +35 -0
- package/dist/cjs/modules/gis/dtos/trip-points.dto.js.map +1 -0
- package/dist/cjs/modules/gis/enums/routing.enum.js +29 -0
- package/dist/cjs/modules/gis/enums/routing.enum.js.map +1 -0
- package/dist/cjs/modules/gis/enums/trip-privacy.enum.js +6 -0
- package/dist/cjs/modules/gis/enums/trip-privacy.enum.js.map +1 -1
- package/dist/cjs/modules/gis/index.js +5 -0
- package/dist/cjs/modules/gis/index.js.map +1 -1
- package/dist/cjs/modules/gis/interfaces/routing.js +3 -0
- package/dist/cjs/modules/gis/interfaces/routing.js.map +1 -0
- package/dist/cjs/modules/gis/interfaces/trip-point.js +3 -0
- package/dist/cjs/modules/gis/interfaces/trip-point.js.map +1 -0
- package/dist/cjs/modules/incident/dtos/incident/incident.dto.js +9 -1
- package/dist/cjs/modules/incident/dtos/incident/incident.dto.js.map +1 -1
- package/dist/cjs/modules/incident/enums/incident-origin-type.enum.js +2 -0
- package/dist/cjs/modules/incident/enums/incident-origin-type.enum.js.map +1 -1
- package/dist/cjs/modules/permission/data/permissions.data.js +10 -1
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +12 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/cjs/modules/role/constants/safety-roles.js +22 -1
- package/dist/cjs/modules/role/constants/safety-roles.js.map +1 -1
- package/dist/cjs/modules/role/data/roles.data.js +24 -7
- package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
- package/dist/cjs/modules/safety/constants/follow-me.const.js +137 -0
- package/dist/cjs/modules/safety/constants/follow-me.const.js.map +1 -0
- package/dist/cjs/modules/safety/constants/safety-integration.const.js +88 -1
- package/dist/cjs/modules/safety/constants/safety-integration.const.js.map +1 -1
- package/dist/cjs/modules/safety/dtos/follow-me.dto.js +501 -0
- package/dist/cjs/modules/safety/dtos/follow-me.dto.js.map +1 -0
- package/dist/cjs/modules/safety/dtos/safety-admin.dto.js +13 -0
- package/dist/cjs/modules/safety/dtos/safety-admin.dto.js.map +1 -1
- package/dist/cjs/modules/safety/dtos/safety-alert-context.dto.js +60 -0
- package/dist/cjs/modules/safety/dtos/safety-alert-context.dto.js.map +1 -0
- package/dist/cjs/modules/safety/dtos/safety-internal.dto.js +17 -0
- package/dist/cjs/modules/safety/dtos/safety-internal.dto.js.map +1 -1
- package/dist/cjs/modules/safety/enums/follow-me.enums.js +237 -0
- package/dist/cjs/modules/safety/enums/follow-me.enums.js.map +1 -0
- package/dist/cjs/modules/safety/enums/safety-enums.js +8 -3
- package/dist/cjs/modules/safety/enums/safety-enums.js.map +1 -1
- package/dist/cjs/modules/safety/index.js +7 -0
- package/dist/cjs/modules/safety/index.js.map +1 -1
- package/dist/cjs/modules/safety/interfaces/follow-me.js +3 -0
- package/dist/cjs/modules/safety/interfaces/follow-me.js.map +1 -0
- package/dist/cjs/modules/safety/interfaces/safety-alert-context.js +3 -0
- package/dist/cjs/modules/safety/interfaces/safety-alert-context.js.map +1 -0
- package/dist/cjs/modules/safety/utils/follow-me-state-machine.js +131 -0
- package/dist/cjs/modules/safety/utils/follow-me-state-machine.js.map +1 -0
- package/dist/cjs/modules/sms/constants/sms-templates.config.js +12 -0
- package/dist/cjs/modules/sms/constants/sms-templates.config.js.map +1 -1
- package/dist/cjs/modules/sms/enums/sms-template.enum.js +2 -0
- package/dist/cjs/modules/sms/enums/sms-template.enum.js.map +1 -1
- package/dist/esm/kafka/topics.js +7 -0
- package/dist/esm/kafka/topics.js.map +1 -1
- package/dist/esm/modules/gis/dtos/private-trip.dto.js +34 -0
- package/dist/esm/modules/gis/dtos/private-trip.dto.js.map +1 -1
- package/dist/esm/modules/gis/dtos/routing.dto.js +241 -0
- package/dist/esm/modules/gis/dtos/routing.dto.js.map +1 -0
- package/dist/esm/modules/gis/dtos/trip-points.dto.js +31 -0
- package/dist/esm/modules/gis/dtos/trip-points.dto.js.map +1 -0
- package/dist/esm/modules/gis/enums/routing.enum.js +26 -0
- package/dist/esm/modules/gis/enums/routing.enum.js.map +1 -0
- package/dist/esm/modules/gis/enums/trip-privacy.enum.js +6 -0
- package/dist/esm/modules/gis/enums/trip-privacy.enum.js.map +1 -1
- package/dist/esm/modules/gis/index.js +5 -0
- package/dist/esm/modules/gis/index.js.map +1 -1
- package/dist/esm/modules/gis/interfaces/routing.js +2 -0
- package/dist/esm/modules/gis/interfaces/routing.js.map +1 -0
- package/dist/esm/modules/gis/interfaces/trip-point.js +2 -0
- package/dist/esm/modules/gis/interfaces/trip-point.js.map +1 -0
- package/dist/esm/modules/incident/dtos/incident/incident.dto.js +9 -1
- package/dist/esm/modules/incident/dtos/incident/incident.dto.js.map +1 -1
- package/dist/esm/modules/incident/enums/incident-origin-type.enum.js +2 -0
- package/dist/esm/modules/incident/enums/incident-origin-type.enum.js.map +1 -1
- package/dist/esm/modules/permission/data/permissions.data.js +10 -1
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +12 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/esm/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/esm/modules/role/constants/safety-roles.js +21 -0
- package/dist/esm/modules/role/constants/safety-roles.js.map +1 -1
- package/dist/esm/modules/role/data/roles.data.js +24 -7
- package/dist/esm/modules/role/data/roles.data.js.map +1 -1
- package/dist/esm/modules/safety/constants/follow-me.const.js +134 -0
- package/dist/esm/modules/safety/constants/follow-me.const.js.map +1 -0
- package/dist/esm/modules/safety/constants/safety-integration.const.js +86 -0
- package/dist/esm/modules/safety/constants/safety-integration.const.js.map +1 -1
- package/dist/esm/modules/safety/dtos/follow-me.dto.js +488 -0
- package/dist/esm/modules/safety/dtos/follow-me.dto.js.map +1 -0
- package/dist/esm/modules/safety/dtos/safety-admin.dto.js +13 -0
- package/dist/esm/modules/safety/dtos/safety-admin.dto.js.map +1 -1
- package/dist/esm/modules/safety/dtos/safety-alert-context.dto.js +55 -0
- package/dist/esm/modules/safety/dtos/safety-alert-context.dto.js.map +1 -0
- package/dist/esm/modules/safety/dtos/safety-internal.dto.js +17 -0
- package/dist/esm/modules/safety/dtos/safety-internal.dto.js.map +1 -1
- package/dist/esm/modules/safety/enums/follow-me.enums.js +234 -0
- package/dist/esm/modules/safety/enums/follow-me.enums.js.map +1 -0
- package/dist/esm/modules/safety/enums/safety-enums.js +8 -3
- package/dist/esm/modules/safety/enums/safety-enums.js.map +1 -1
- package/dist/esm/modules/safety/index.js +7 -0
- package/dist/esm/modules/safety/index.js.map +1 -1
- package/dist/esm/modules/safety/interfaces/follow-me.js +2 -0
- package/dist/esm/modules/safety/interfaces/follow-me.js.map +1 -0
- package/dist/esm/modules/safety/interfaces/safety-alert-context.js +2 -0
- package/dist/esm/modules/safety/interfaces/safety-alert-context.js.map +1 -0
- package/dist/esm/modules/safety/utils/follow-me-state-machine.js +116 -0
- package/dist/esm/modules/safety/utils/follow-me-state-machine.js.map +1 -0
- package/dist/esm/modules/sms/constants/sms-templates.config.js +12 -0
- package/dist/esm/modules/sms/constants/sms-templates.config.js.map +1 -1
- package/dist/esm/modules/sms/enums/sms-template.enum.js +2 -0
- package/dist/esm/modules/sms/enums/sms-template.enum.js.map +1 -1
- package/dist/types/kafka/topics.d.ts +5 -0
- package/dist/types/modules/gis/dtos/private-trip.dto.d.ts +4 -0
- package/dist/types/modules/gis/dtos/routing.dto.d.ts +48 -0
- package/dist/types/modules/gis/dtos/trip-points.dto.d.ts +5 -0
- package/dist/types/modules/gis/enums/routing.enum.d.ts +22 -0
- package/dist/types/modules/gis/enums/trip-privacy.enum.d.ts +7 -1
- package/dist/types/modules/gis/index.d.ts +5 -0
- package/dist/types/modules/gis/interfaces/routing.d.ts +43 -0
- package/dist/types/modules/gis/interfaces/trip-point.d.ts +16 -0
- package/dist/types/modules/gis/interfaces/trip-summary.d.ts +2 -6
- package/dist/types/modules/incident/dtos/incident/incident.dto.d.ts +2 -0
- package/dist/types/modules/incident/enums/incident-origin-type.enum.d.ts +3 -1
- package/dist/types/modules/incident/intefaces/incident.d.ts +3 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +4 -0
- package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +2 -1
- package/dist/types/modules/role/constants/safety-roles.d.ts +10 -0
- package/dist/types/modules/safety/constants/follow-me.const.d.ts +120 -0
- package/dist/types/modules/safety/constants/safety-integration.const.d.ts +79 -0
- package/dist/types/modules/safety/dtos/follow-me.dto.d.ts +106 -0
- package/dist/types/modules/safety/dtos/safety-admin.dto.d.ts +3 -0
- package/dist/types/modules/safety/dtos/safety-alert-context.dto.d.ts +14 -0
- package/dist/types/modules/safety/dtos/safety-internal.dto.d.ts +3 -0
- package/dist/types/modules/safety/enums/follow-me.enums.d.ts +218 -0
- package/dist/types/modules/safety/enums/safety-enums.d.ts +9 -4
- package/dist/types/modules/safety/index.d.ts +7 -0
- package/dist/types/modules/safety/interfaces/follow-me.d.ts +377 -0
- package/dist/types/modules/safety/interfaces/safety-alert-context.d.ts +8 -0
- package/dist/types/modules/safety/interfaces/safety-check.d.ts +3 -1
- package/dist/types/modules/safety/utils/follow-me-state-machine.d.ts +51 -0
- package/dist/types/modules/sms/enums/sms-template.enum.d.ts +2 -0
- package/package.json +1 -1
|
@@ -3,7 +3,13 @@ export declare enum TripPurpose {
|
|
|
3
3
|
/** The trip of an SOS incident - every trip before safety features existed. */
|
|
4
4
|
SOS = "SOS",
|
|
5
5
|
/** Recorded during a Safety Check. */
|
|
6
|
-
SAFETY_CHECK = "SAFETY_CHECK"
|
|
6
|
+
SAFETY_CHECK = "SAFETY_CHECK",
|
|
7
|
+
/**
|
|
8
|
+
* A Follow Me journey. Stored PRIVATE in clarion-gis (it publishes nothing):
|
|
9
|
+
* clarion-safety shares the live position with the session's authorized
|
|
10
|
+
* followers itself. Its points live in trip_points, not the trackPoints array.
|
|
11
|
+
*/
|
|
12
|
+
FOLLOW_ME = "FOLLOW_ME"
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
9
15
|
* Who a trip is visible to.
|
|
@@ -14,6 +14,8 @@ export * from './dtos/geo-json-polygon.dto';
|
|
|
14
14
|
export * from './dtos/point-containment-result.dto';
|
|
15
15
|
export * from './dtos/point-location.dto';
|
|
16
16
|
export * from './dtos/private-trip.dto';
|
|
17
|
+
export * from './dtos/routing.dto';
|
|
18
|
+
export * from './dtos/trip-points.dto';
|
|
17
19
|
export * from './dtos/post-gis-geometry.dto';
|
|
18
20
|
export * from './dtos/route-incident.dto';
|
|
19
21
|
export * from './dtos/routing-coverage-result.dto';
|
|
@@ -27,6 +29,7 @@ export * from './dtos/zone-with-distance-result.dto';
|
|
|
27
29
|
export * from './enums/incident-routing-result-match-type.enum';
|
|
28
30
|
export * from './enums/trip-actions.enum';
|
|
29
31
|
export * from './enums/trip-privacy.enum';
|
|
32
|
+
export * from './enums/routing.enum';
|
|
30
33
|
export * from './enums/zone.enums';
|
|
31
34
|
export * from './interfaces/client-safe-trip';
|
|
32
35
|
export * from './interfaces/control-centre-routing-result';
|
|
@@ -35,6 +38,8 @@ export * from './interfaces/point-containment';
|
|
|
35
38
|
export * from './interfaces/point-location';
|
|
36
39
|
export * from './interfaces/polygon-validation-result';
|
|
37
40
|
export * from './interfaces/trip-summary';
|
|
41
|
+
export * from './interfaces/trip-point';
|
|
42
|
+
export * from './interfaces/routing';
|
|
38
43
|
export * from './interfaces/zone';
|
|
39
44
|
export * from './interfaces/zone-for-point';
|
|
40
45
|
export * from './interfaces/zone-match-result';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { GisRoutingProvider, SavedPlaceKind } from '../enums/routing.enum';
|
|
2
|
+
export interface ComputedRouteLeg {
|
|
3
|
+
distanceMeters: number;
|
|
4
|
+
durationSeconds: number;
|
|
5
|
+
}
|
|
6
|
+
/** A computed route. `polyline` is Google's encoded-polyline format (precision 5). */
|
|
7
|
+
export interface ComputedRoute {
|
|
8
|
+
provider: GisRoutingProvider;
|
|
9
|
+
polyline: string;
|
|
10
|
+
distanceMeters: number;
|
|
11
|
+
/** With traffic where available. */
|
|
12
|
+
durationSeconds: number;
|
|
13
|
+
/** Free-flow; equal to durationSeconds when traffic was not considered. */
|
|
14
|
+
staticDurationSeconds: number;
|
|
15
|
+
legs: ComputedRouteLeg[];
|
|
16
|
+
/** Human-readable caveats from the provider (tolls, ferries, "estimate only"...). */
|
|
17
|
+
warnings: string[];
|
|
18
|
+
computedAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PlaceSuggestion {
|
|
21
|
+
placeId: string;
|
|
22
|
+
primaryText: string;
|
|
23
|
+
secondaryText: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface PlaceDetails {
|
|
26
|
+
placeId: string | null;
|
|
27
|
+
label: string;
|
|
28
|
+
address: string | null;
|
|
29
|
+
lat: number;
|
|
30
|
+
lng: number;
|
|
31
|
+
provider: GisRoutingProvider;
|
|
32
|
+
}
|
|
33
|
+
export interface SavedPlaceView {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
kind: SavedPlaceKind;
|
|
37
|
+
lat: number;
|
|
38
|
+
lng: number;
|
|
39
|
+
address: string | null;
|
|
40
|
+
placeId: string | null;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** One recorded fix with everything the device told us about it. */
|
|
2
|
+
export interface TripPoint {
|
|
3
|
+
lat: number;
|
|
4
|
+
lng: number;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
accuracy?: number | null;
|
|
7
|
+
altitude?: number | null;
|
|
8
|
+
speed?: number | null;
|
|
9
|
+
heading?: number | null;
|
|
10
|
+
source?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface TripPointsPage {
|
|
13
|
+
points: TripPoint[];
|
|
14
|
+
/** Pass as `since` for the next page; null when there is nothing more. */
|
|
15
|
+
nextSince: string | null;
|
|
16
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TripPurpose, TripVisibility } from '../enums/trip-privacy.enum';
|
|
2
|
+
import { TripPoint } from './trip-point';
|
|
2
3
|
/**
|
|
3
4
|
* A trip without its path - what clarion-safety needs to run a check and what an
|
|
4
5
|
* admin may see of it. `lastPoint` is for clarion-safety alone (the SOS location);
|
|
@@ -17,10 +18,5 @@ export interface TripSummary {
|
|
|
17
18
|
sharedAt: string | null;
|
|
18
19
|
distanceMeters: number | null;
|
|
19
20
|
trackPointCount: number;
|
|
20
|
-
lastPoint:
|
|
21
|
-
lat: number;
|
|
22
|
-
lng: number;
|
|
23
|
-
accuracy?: number;
|
|
24
|
-
timestamp: string;
|
|
25
|
-
} | null;
|
|
21
|
+
lastPoint: TripPoint | null;
|
|
26
22
|
}
|
|
@@ -9,6 +9,7 @@ import { IncidentStatusDetailsDto } from "./incident-status-details.dto";
|
|
|
9
9
|
import { IncidentEntitlementTier } from "../../../entitlement/enums/incident-entitlement-tier.enum";
|
|
10
10
|
import { IncidentOriginType } from "../../enums/incident-origin-type.enum";
|
|
11
11
|
import { GuardianAudienceDto } from "../../../alert-dispatch/dtos/guardian-audience.dto";
|
|
12
|
+
import { SafetyAlertContextDto } from "../../../safety/dtos/safety-alert-context.dto";
|
|
12
13
|
declare const IncidentDto_base: import("@nestjs/common").Type<Omit<CreateIncidentDto, "reporter" | "statusDetails">>;
|
|
13
14
|
export declare class IncidentDto extends IncidentDto_base {
|
|
14
15
|
id: number;
|
|
@@ -34,6 +35,7 @@ export declare class IncidentDto extends IncidentDto_base {
|
|
|
34
35
|
*/
|
|
35
36
|
originType?: IncidentOriginType | null;
|
|
36
37
|
originReferenceId?: string | null;
|
|
38
|
+
originContext?: SafetyAlertContextDto | null;
|
|
37
39
|
/**
|
|
38
40
|
* Which guardians the alert is for; absent means all of them. Whitelisted here
|
|
39
41
|
* because clarion-notification validates this DTO with `whitelist: true` - a
|
|
@@ -8,5 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export declare enum IncidentOriginType {
|
|
10
10
|
/** A Safety Check the user missed or asked for help from. */
|
|
11
|
-
SAFETY_CHECK = "SAFETY_CHECK"
|
|
11
|
+
SAFETY_CHECK = "SAFETY_CHECK",
|
|
12
|
+
/** A Follow Me journey: an unanswered safety prompt, or SOS pressed during it. */
|
|
13
|
+
FOLLOW_ME = "FOLLOW_ME"
|
|
12
14
|
}
|
|
@@ -7,6 +7,7 @@ import { IncidentStatus } from "../enums/incident-status.enum";
|
|
|
7
7
|
import { IncidentWorkflowTaskQueueName } from "../enums/incident-workflow-queue-name.enum";
|
|
8
8
|
import { IncidentOriginType } from "../enums/incident-origin-type.enum";
|
|
9
9
|
import { GuardianAudience } from "../../alert-dispatch/interfaces/guardian-audience";
|
|
10
|
+
import { SafetyAlertContext } from "../../safety/interfaces/safety-alert-context";
|
|
10
11
|
import { IncidentAction } from "./incident-action";
|
|
11
12
|
import { IncidentAssignment } from "./incident-assignment";
|
|
12
13
|
import { IncidentCategory } from "./incident-category";
|
|
@@ -96,6 +97,8 @@ export interface Incident {
|
|
|
96
97
|
*/
|
|
97
98
|
originType?: IncidentOriginType | null;
|
|
98
99
|
originReferenceId?: string | null;
|
|
100
|
+
/** Why the safety feature raised it, for responders. Set only with originType. */
|
|
101
|
+
originContext?: SafetyAlertContext | null;
|
|
99
102
|
/**
|
|
100
103
|
* Which guardians the alert is for. Absent (the norm) means all of the
|
|
101
104
|
* reporter's guardians; a Safety Check SOS carries exactly the ones the user
|
|
@@ -194,6 +194,10 @@ export declare enum PermissionActions {
|
|
|
194
194
|
USE_SAFETY_CHECK = "use:safety-check",
|
|
195
195
|
READ_SAFETY_CHECK = "read:safety-check",
|
|
196
196
|
MANAGE_SAFETY_CHECK_REASON = "manage:safety-check-reason",
|
|
197
|
+
USE_FOLLOW_ME = "use:follow-me",
|
|
198
|
+
READ_FOLLOW_ME = "read:follow-me",
|
|
199
|
+
TRACK_FOLLOW_ME = "track:follow-me",
|
|
200
|
+
MANAGE_SAVED_PLACE = "manage:saved-place",
|
|
197
201
|
/**
|
|
198
202
|
* @deprecated Split into the connection / message / screened-message /
|
|
199
203
|
* analytics actions above, which the gateway now requires instead. Still
|
|
@@ -12,3 +12,13 @@ export declare const SAFETY_MANAGER_ROLES: string[];
|
|
|
12
12
|
* organization, and a control-centre admin within their control centre.
|
|
13
13
|
*/
|
|
14
14
|
export declare const SAFETY_VIEWER_ROLES: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Staff who may see an organization's Follow Me sessions (read:follow-me) and,
|
|
17
|
+
* for a session shared with the provider or turned SOS, where the user is
|
|
18
|
+
* (track:follow-me): the organization's managers and its control room.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FOLLOW_ME_VIEWER_ROLES: string[];
|
|
21
|
+
/** Admitted by clarion-socket to `followme:org:{orgId}` (their own organization). */
|
|
22
|
+
export declare const FOLLOW_ME_ORG_TRACKER_ROLES: string[];
|
|
23
|
+
/** Admitted by clarion-socket to `followme:cc:{orgId}:{ccId}` (their own control centre). */
|
|
24
|
+
export declare const FOLLOW_ME_CC_TRACKER_ROLES: string[];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { FollowMeTransportMode } from '../enums/follow-me.enums';
|
|
2
|
+
/**
|
|
3
|
+
* Follow Me limits. clarion-safety enforces every one of them; the app reads the
|
|
4
|
+
* same values from GET /safety/follow-me/start-options rather than keeping a copy.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FOLLOW_ME_LIMITS: {
|
|
7
|
+
readonly minDurationMinutes: 5;
|
|
8
|
+
/** A session can never outlive this, whatever the route says. */
|
|
9
|
+
readonly maxDurationMinutes: number;
|
|
10
|
+
/** Used when there is no planned route. */
|
|
11
|
+
readonly defaultDurationMinutes: 60;
|
|
12
|
+
/** With a route, the default is its travel time plus this, rounded up to 15 minutes. */
|
|
13
|
+
readonly routeDurationBufferMinutes: 30;
|
|
14
|
+
readonly minPromptCountdownSeconds: 15;
|
|
15
|
+
readonly maxPromptCountdownSeconds: number;
|
|
16
|
+
readonly defaultPromptCountdownSeconds: 60;
|
|
17
|
+
/** Server grace after the visible countdown before the SOS (same idea as Safety Check). */
|
|
18
|
+
readonly promptGraceSeconds: 10;
|
|
19
|
+
/** A prompt whose deadline passed longer ago than this (platform outage) is not escalated. */
|
|
20
|
+
readonly staleSosWindowMinutes: number;
|
|
21
|
+
readonly maxIntermediateStops: 5;
|
|
22
|
+
readonly customReasonMaxLength: 120;
|
|
23
|
+
readonly maxTrackPointsPerBatch: 200;
|
|
24
|
+
/** How long a route preview can be used to start a session. */
|
|
25
|
+
readonly routePreviewTtlMinutes: 30;
|
|
26
|
+
/** Live sharing is shown as stale after this long without a location. */
|
|
27
|
+
readonly trackingStaleAfterSeconds: 120;
|
|
28
|
+
/** External guardian page: how often it may poll, and the per-link budget. */
|
|
29
|
+
readonly externalPollIntervalSeconds: 10;
|
|
30
|
+
readonly externalRequestsPerMinute: 20;
|
|
31
|
+
/** Token entropy (bytes before base64url). */
|
|
32
|
+
readonly externalTokenBytes: 32;
|
|
33
|
+
};
|
|
34
|
+
/** Where the setup screens start. */
|
|
35
|
+
export declare const FOLLOW_ME_DEFAULTS: {
|
|
36
|
+
readonly durationMinutes: 60;
|
|
37
|
+
readonly promptCountdownSeconds: 60;
|
|
38
|
+
readonly allGuardiansSelected: true;
|
|
39
|
+
/** Premium/Trial only, as for Safety Check. */
|
|
40
|
+
readonly notifyServiceProvider: true;
|
|
41
|
+
readonly notifyGuardiansOnStartEnd: true;
|
|
42
|
+
readonly transportMode: FollowMeTransportMode.DRIVE;
|
|
43
|
+
readonly vibrate: true;
|
|
44
|
+
readonly alarmSound: true;
|
|
45
|
+
};
|
|
46
|
+
/** How the app should sample and upload while Follow Me runs. */
|
|
47
|
+
export declare const FOLLOW_ME_TRACKING: {
|
|
48
|
+
readonly locationIntervalSeconds: 5;
|
|
49
|
+
readonly distanceFilterMeters: 10;
|
|
50
|
+
readonly uploadIntervalSeconds: 10;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Monitor thresholds per transport mode. The monitors are deliberately slow to
|
|
54
|
+
* alarm: every trigger needs sustained, good-quality evidence, and a prompt is
|
|
55
|
+
* only the first step - the user answers it before anything escalates.
|
|
56
|
+
*/
|
|
57
|
+
export interface FollowMeMonitorThresholds {
|
|
58
|
+
/** Fixes less accurate than this feed no detector (they are still recorded). */
|
|
59
|
+
maxPointAccuracyMeters: number;
|
|
60
|
+
/** Half-width of the corridor around the route; widened by the fix's own accuracy. */
|
|
61
|
+
routeCorridorMeters: number;
|
|
62
|
+
/** Consecutive good off-corridor fixes before a deviation is suspected... */
|
|
63
|
+
deviationMinSamples: number;
|
|
64
|
+
/** ...spanning at least this long. */
|
|
65
|
+
deviationMinSeconds: number;
|
|
66
|
+
/** A recalculated route adding more than max(minutes, fraction) of the remaining time is significant. */
|
|
67
|
+
deviationDetourToleranceMinutes: number;
|
|
68
|
+
deviationDetourToleranceFraction: number;
|
|
69
|
+
/** In-corridor fixes needed to call the user back on route (hysteresis). */
|
|
70
|
+
backOnRouteSamples: number;
|
|
71
|
+
/** Below this speed (m/s) a fix counts as stationary. */
|
|
72
|
+
stationarySpeedMps: number;
|
|
73
|
+
/** A stop longer than this away from any planned point is suspicious. */
|
|
74
|
+
prolongedStopMinutes: number;
|
|
75
|
+
/** At a planned stop the allowance is longer. */
|
|
76
|
+
plannedStopMinutes: number;
|
|
77
|
+
/** Heavy traffic (traffic-aware duration / free-flow duration above this) defers a stop prompt once. */
|
|
78
|
+
congestionRatio: number;
|
|
79
|
+
/** Arrival: inside this radius (widened by accuracy) for the dwell time. */
|
|
80
|
+
arrivalRadiusMeters: number;
|
|
81
|
+
arrivalDwellSeconds: number;
|
|
82
|
+
/** Overdue once past the expected arrival by max(minutes, fraction of planned duration). */
|
|
83
|
+
etaGraceMinutes: number;
|
|
84
|
+
etaGraceFraction: number;
|
|
85
|
+
/** Crash detection runs for this mode. */
|
|
86
|
+
crashDetection: boolean;
|
|
87
|
+
}
|
|
88
|
+
export declare const FOLLOW_ME_MONITOR_THRESHOLDS: Readonly<Record<FollowMeTransportMode, FollowMeMonitorThresholds>>;
|
|
89
|
+
/** Thresholds when the user did not plan a route (no corridor, no ETA; stops and crashes only). */
|
|
90
|
+
export declare const FOLLOW_ME_UNPLANNED_THRESHOLDS: FollowMeMonitorThresholds;
|
|
91
|
+
/**
|
|
92
|
+
* Crash detection runs ON THE DEVICE (sensors) and is only a suspicion until the
|
|
93
|
+
* server has checked it against the recorded track and the user has failed to
|
|
94
|
+
* answer the prompt. The app receives these values from start-options.
|
|
95
|
+
*
|
|
96
|
+
* A report needs ALL of: an impact well above anything a vehicle does in normal
|
|
97
|
+
* driving, NOT preceded by free fall (a dropped phone falls before it hits), a
|
|
98
|
+
* vehicle moving at speed just before, and a sharp loss of speed plus stillness
|
|
99
|
+
* after. Rotation adds confidence (roll-over) but is never required.
|
|
100
|
+
*/
|
|
101
|
+
export declare const FOLLOW_ME_CRASH_DETECTION: {
|
|
102
|
+
readonly sampleRateHz: 50;
|
|
103
|
+
readonly impactThresholdG: 4;
|
|
104
|
+
/** Sustained above this for at least impactMinDurationMs. */
|
|
105
|
+
readonly impactSustainG: 2.5;
|
|
106
|
+
readonly impactMinDurationMs: 30;
|
|
107
|
+
readonly freeFallThresholdG: 0.35;
|
|
108
|
+
readonly freeFallMinDurationMs: 150;
|
|
109
|
+
readonly minSpeedBeforeKph: 25;
|
|
110
|
+
readonly maxSpeedAfterKph: 8;
|
|
111
|
+
readonly speedDropWindowSeconds: 10;
|
|
112
|
+
readonly stillnessSeconds: 10;
|
|
113
|
+
readonly rotationThresholdRadS: 3;
|
|
114
|
+
/** Reports below this confidence are not sent. */
|
|
115
|
+
readonly confidenceThreshold: 0.7;
|
|
116
|
+
/** Server: the recorded track must show at least this speed shortly before. */
|
|
117
|
+
readonly serverMinTrackSpeedKph: 20;
|
|
118
|
+
readonly serverTrackLookbackSeconds: 60;
|
|
119
|
+
readonly evidenceVersion: "crash-v1";
|
|
120
|
+
};
|
|
@@ -62,3 +62,82 @@ export declare const SAFETY_REDIS_KEYS: {
|
|
|
62
62
|
readonly sweeperLock: "safety:lock:sweeper";
|
|
63
63
|
readonly rateLimit: (userId: number, bucket: string) => string;
|
|
64
64
|
};
|
|
65
|
+
/** Temporal: the durable Follow Me timer (expiry, prompt deadline, ETA checks). */
|
|
66
|
+
export declare const FOLLOW_ME_WORKFLOW: {
|
|
67
|
+
readonly workflowType: "followMeWorkflow";
|
|
68
|
+
/** Shares the Safety task queue and worker with the Safety Check timer. */
|
|
69
|
+
readonly taskQueue: "safety-check-task-queue";
|
|
70
|
+
readonly changedSignal: "followMeChanged";
|
|
71
|
+
readonly stateQuery: "followMeWorkflowState";
|
|
72
|
+
};
|
|
73
|
+
/** One workflow per session, ever. */
|
|
74
|
+
export declare function followMeWorkflowId(sessionId: string): string;
|
|
75
|
+
/** Internal HTTP paths for Follow Me (never proxied by the gateway). */
|
|
76
|
+
export declare const FOLLOW_ME_INTERNAL_PATHS: {
|
|
77
|
+
/** clarion-safety: the one step the durable timer drives. */
|
|
78
|
+
readonly advanceSession: (sessionId: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* clarion-safety: mint a fresh external follow link for one participant, at the
|
|
81
|
+
* moment the SMS is sent. The raw token exists only in this response and the
|
|
82
|
+
* SMS - never on a Kafka topic, never in a log.
|
|
83
|
+
*/
|
|
84
|
+
readonly mintExternalLink: (participantId: string) => string;
|
|
85
|
+
/** clarion-workflow-manager. */
|
|
86
|
+
readonly startWorkflow: "/follow-me/workflows";
|
|
87
|
+
readonly signalWorkflow: (sessionId: string) => string;
|
|
88
|
+
/** clarion-gis routing and places (internal; the gateway exposes the places ones to the app). */
|
|
89
|
+
readonly computeRoute: "/gis/routes/compute";
|
|
90
|
+
readonly placesAutocomplete: "/gis/places/autocomplete";
|
|
91
|
+
readonly placeDetails: "/gis/places/details";
|
|
92
|
+
readonly reverseGeocode: "/gis/places/reverse";
|
|
93
|
+
/** clarion-gis: a page of a trip's recorded points. */
|
|
94
|
+
readonly tripPoints: (tripId: string) => string;
|
|
95
|
+
};
|
|
96
|
+
/** App locations for Follow Me pushes (go_router, never API paths). */
|
|
97
|
+
export declare const FOLLOW_ME_MOBILE_ROUTES: {
|
|
98
|
+
readonly active: "/follow-me/active";
|
|
99
|
+
readonly prompt: "/follow-me/prompt";
|
|
100
|
+
readonly requests: "/follow-me/requests";
|
|
101
|
+
readonly follow: (sessionId: string) => string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Header the external follow page sends its token in. The link carries the token
|
|
105
|
+
* in the URL FRAGMENT (`/follow#t=...`), which browsers never send to a server, so
|
|
106
|
+
* it cannot land in a proxy or access log; the page reads it and sends it here.
|
|
107
|
+
*/
|
|
108
|
+
export declare const FOLLOW_ME_TOKEN_HEADER = "x-follow-token";
|
|
109
|
+
/**
|
|
110
|
+
* Set by clarion-api-gateway - and ONLY by it, it strips any client value - on the
|
|
111
|
+
* admin Follow Me detail when the caller holds track:follow-me. clarion-safety
|
|
112
|
+
* cannot see permissions, only roles; this is how it learns the caller may see
|
|
113
|
+
* location. It still also requires provider participation or an SOS.
|
|
114
|
+
*/
|
|
115
|
+
export declare const SAFETY_LOCATION_ACCESS_HEADER = "x-safety-location-access";
|
|
116
|
+
/**
|
|
117
|
+
* Redis pub/sub channel clarion-safety publishes live Safety events on. The
|
|
118
|
+
* envelope DECLARES its rooms (as support does); clarion-socket validates them
|
|
119
|
+
* against SAFETY_REALTIME_ROOM_PATTERNS and never adds any.
|
|
120
|
+
*/
|
|
121
|
+
export declare const SAFETY_REALTIME_CHANNEL = "realtime:safety";
|
|
122
|
+
/** Socket.IO event name clients listen to. */
|
|
123
|
+
export declare const SAFETY_SOCKET_EVENT = "safety.event";
|
|
124
|
+
/** The only rooms a Safety envelope may target. */
|
|
125
|
+
export declare const SAFETY_REALTIME_ROOM_PATTERNS: readonly RegExp[];
|
|
126
|
+
/**
|
|
127
|
+
* Staff rooms that receive a session's live Follow Me updates - ONLY when the user
|
|
128
|
+
* chose to include their provider. clarion-socket admits staff by role:
|
|
129
|
+
* org rooms FOLLOW_ME_ORG_TRACKER_ROLES of that organization, cc rooms
|
|
130
|
+
* FOLLOW_ME_CC_TRACKER_ROLES of that organization and control centre.
|
|
131
|
+
*/
|
|
132
|
+
export declare const FOLLOW_ME_ROOMS: {
|
|
133
|
+
readonly user: (userId: number) => string;
|
|
134
|
+
readonly organization: (organizationId: number) => string;
|
|
135
|
+
readonly controlCentre: (organizationId: number, controlCentreId: number) => string;
|
|
136
|
+
};
|
|
137
|
+
export declare const FOLLOW_ME_REDIS_KEYS: {
|
|
138
|
+
readonly lastLocation: (sessionId: string) => string;
|
|
139
|
+
readonly routePreview: (token: string) => string;
|
|
140
|
+
readonly presence: (sessionId: string, participantId: string) => string;
|
|
141
|
+
readonly realtimeThrottle: (sessionId: string) => string;
|
|
142
|
+
readonly externalRateLimit: (bucket: string) => string;
|
|
143
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { GuardianAudienceDto } from '../../alert-dispatch/dtos/guardian-audience.dto';
|
|
2
|
+
import { FollowMeStatus, FollowMeTransportMode, FollowMeWaypointKind } from '../enums/follow-me.enums';
|
|
3
|
+
import { SafetyCheckLocationDto } from './safety-check.dto';
|
|
4
|
+
/** One point of a planned journey: where it starts, a stop, or where it ends. */
|
|
5
|
+
export declare class FollowMeWaypointDto {
|
|
6
|
+
kind: FollowMeWaypointKind;
|
|
7
|
+
lat: number;
|
|
8
|
+
lng: number;
|
|
9
|
+
label: string;
|
|
10
|
+
address?: string;
|
|
11
|
+
placeId?: string;
|
|
12
|
+
savedPlaceId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Plan a route (POST /safety/follow-me/routes/preview). Exactly one START (the
|
|
16
|
+
* app defaults it to the current location), 0..5 STOPs in order, exactly one
|
|
17
|
+
* DESTINATION. clarion-safety validates the shape; clarion-gis computes it.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PreviewFollowMeRouteDto {
|
|
20
|
+
transportMode: FollowMeTransportMode;
|
|
21
|
+
waypoints: FollowMeWaypointDto[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The planned route a session starts with. The geometry is never taken from the
|
|
25
|
+
* client: `routeToken` names a preview clarion-safety computed and stored for
|
|
26
|
+
* this user, and the waypoints must match it.
|
|
27
|
+
*/
|
|
28
|
+
export declare class FollowMeRoutePlanDto {
|
|
29
|
+
routeToken: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Starting Follow Me. Every field is re-checked server-side: the reason against
|
|
33
|
+
* the database, each guardian against clarion-authentication, provider
|
|
34
|
+
* participation against clarion-billing, the duration against the 24 h cap, and
|
|
35
|
+
* the route against the stored preview.
|
|
36
|
+
*/
|
|
37
|
+
export declare class StartFollowMeDto {
|
|
38
|
+
reasonId: string;
|
|
39
|
+
customReason?: string;
|
|
40
|
+
durationMinutes: number;
|
|
41
|
+
promptCountdownSeconds?: number;
|
|
42
|
+
guardians: GuardianAudienceDto;
|
|
43
|
+
notifyServiceProvider: boolean;
|
|
44
|
+
notifyGuardiansOnStartEnd: boolean;
|
|
45
|
+
transportMode?: FollowMeTransportMode;
|
|
46
|
+
route?: FollowMeRoutePlanDto;
|
|
47
|
+
startLocation?: SafetyCheckLocationDto;
|
|
48
|
+
backgroundLocationGranted?: boolean;
|
|
49
|
+
crashDetectionAvailable?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** One recorded fix, with everything the device knows about it. */
|
|
52
|
+
export declare class FollowMeTrackPointDto {
|
|
53
|
+
lat: number;
|
|
54
|
+
lng: number;
|
|
55
|
+
timestamp: string;
|
|
56
|
+
accuracy?: number;
|
|
57
|
+
altitude?: number;
|
|
58
|
+
speed?: number;
|
|
59
|
+
heading?: number;
|
|
60
|
+
source?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare class FollowMeTrackPointsDto {
|
|
63
|
+
points: FollowMeTrackPointDto[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The device's evidence for a suspected crash. Only a SUSPICION: clarion-safety
|
|
67
|
+
* checks it against the recorded track and then asks the user, it never raises an
|
|
68
|
+
* SOS from this alone.
|
|
69
|
+
*/
|
|
70
|
+
export declare class ReportFollowMeCrashDto {
|
|
71
|
+
detectedAt: string;
|
|
72
|
+
confidence: number;
|
|
73
|
+
peakAccelerationG: number;
|
|
74
|
+
peakRotationRadS?: number;
|
|
75
|
+
speedBeforeKph?: number;
|
|
76
|
+
speedAfterKph?: number;
|
|
77
|
+
stillnessSeconds?: number;
|
|
78
|
+
freeFallDetected: boolean;
|
|
79
|
+
evidenceVersion: string;
|
|
80
|
+
location?: SafetyCheckLocationDto;
|
|
81
|
+
}
|
|
82
|
+
/** Answering a prompt: names the prompt so a stale screen cannot answer a newer one. */
|
|
83
|
+
export declare class ConfirmFollowMePromptDto {
|
|
84
|
+
promptId: string;
|
|
85
|
+
location?: SafetyCheckLocationDto;
|
|
86
|
+
}
|
|
87
|
+
/** Filters for the admin Follow Me list; narrows only (scope comes from the caller). */
|
|
88
|
+
export declare class FollowMeAdminQueryDto {
|
|
89
|
+
page?: number;
|
|
90
|
+
limit?: number;
|
|
91
|
+
status?: FollowMeStatus;
|
|
92
|
+
activeOnly?: boolean;
|
|
93
|
+
organizationId?: number;
|
|
94
|
+
userId?: number;
|
|
95
|
+
sosOnly?: boolean;
|
|
96
|
+
providerParticipation?: boolean;
|
|
97
|
+
from?: string;
|
|
98
|
+
to?: string;
|
|
99
|
+
id?: string;
|
|
100
|
+
sortBy?: 'startedAt' | 'createdAt';
|
|
101
|
+
}
|
|
102
|
+
/** clarion-safety -> clarion-workflow-manager: start the Follow Me timer (idempotent). */
|
|
103
|
+
export declare class StartFollowMeWorkflowDto {
|
|
104
|
+
sessionId: string;
|
|
105
|
+
firstWakeAt: string;
|
|
106
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SafetyCheckStatus } from '../enums/safety-check-status.enum';
|
|
2
|
+
import { SafetyFeature } from '../enums/safety-enums';
|
|
2
3
|
/**
|
|
3
4
|
* Filters for the admin Safety Check list. Every field NARROWS what the caller
|
|
4
5
|
* may already see: `organizationId` is honoured only for a super-admin; anybody
|
|
@@ -21,6 +22,7 @@ export declare class CreateSafetyCheckReasonDto {
|
|
|
21
22
|
description?: string;
|
|
22
23
|
organizationId?: number;
|
|
23
24
|
countryCode?: string;
|
|
25
|
+
feature?: SafetyFeature;
|
|
24
26
|
isCustom?: boolean;
|
|
25
27
|
active?: boolean;
|
|
26
28
|
displayOrder?: number;
|
|
@@ -36,4 +38,5 @@ export declare class UpdateSafetyCheckReasonDto {
|
|
|
36
38
|
export declare class SafetyCheckReasonAdminQueryDto {
|
|
37
39
|
organizationId?: number;
|
|
38
40
|
includeInactive?: boolean;
|
|
41
|
+
feature?: SafetyFeature;
|
|
39
42
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class SafetyAlertContextFactDto {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* What a responder needs to understand an automatic SOS at a glance, stored on
|
|
7
|
+
* the incident (`originContext`). Plain labelled facts rather than a feature
|
|
8
|
+
* specific schema, so the admin renders any safety feature's context the same
|
|
9
|
+
* way. Never a location history - the incident's trip has that.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SafetyAlertContextDto {
|
|
12
|
+
summary: string;
|
|
13
|
+
facts: SafetyAlertContextFactDto[];
|
|
14
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GuardianAudienceDto } from '../../alert-dispatch/dtos/guardian-audience.dto';
|
|
2
2
|
import { SafetyCheckSosTrigger, SafetyFeature } from '../enums/safety-enums';
|
|
3
3
|
import { SafetyCheckLocationDto } from './safety-check.dto';
|
|
4
|
+
import { SafetyAlertContextDto } from './safety-alert-context.dto';
|
|
4
5
|
/**
|
|
5
6
|
* clarion-safety -> clarion-incident: raise the SOS for a safety feature.
|
|
6
7
|
*
|
|
@@ -26,6 +27,8 @@ export declare class CreateSafetyAlertIncidentDto {
|
|
|
26
27
|
guardianAudience: GuardianAudienceDto;
|
|
27
28
|
tripId?: string;
|
|
28
29
|
description?: string;
|
|
30
|
+
conversationId?: string;
|
|
31
|
+
context?: SafetyAlertContextDto;
|
|
29
32
|
}
|
|
30
33
|
/** clarion-safety -> clarion-workflow-manager: start the durable timer. Idempotent per check. */
|
|
31
34
|
export declare class StartSafetyCheckWorkflowDto {
|