grm-shared-library 1.1.220 → 1.1.222
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/README.md +17 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/kafka/topics.js +10 -1
- package/dist/cjs/kafka/topics.js.map +1 -1
- package/dist/cjs/modules/alert-dispatch/dtos/guardian-audience.dto.js +41 -0
- package/dist/cjs/modules/alert-dispatch/dtos/guardian-audience.dto.js.map +1 -0
- package/dist/cjs/modules/alert-dispatch/index.js +4 -0
- package/dist/cjs/modules/alert-dispatch/index.js.map +1 -1
- package/dist/cjs/modules/alert-dispatch/interfaces/guardian-audience.js +3 -0
- package/dist/cjs/modules/alert-dispatch/interfaces/guardian-audience.js.map +1 -0
- package/dist/cjs/modules/alert-dispatch/utils/guardian-audience.util.js +63 -0
- package/dist/cjs/modules/alert-dispatch/utils/guardian-audience.util.js.map +1 -0
- package/dist/cjs/modules/common/constants/service.const.js +1 -0
- package/dist/cjs/modules/common/constants/service.const.js.map +1 -1
- package/dist/cjs/modules/gis/dtos/private-trip.dto.js +180 -0
- package/dist/cjs/modules/gis/dtos/private-trip.dto.js.map +1 -0
- package/dist/cjs/modules/gis/enums/trip-privacy.enum.js +28 -0
- package/dist/cjs/modules/gis/enums/trip-privacy.enum.js.map +1 -0
- package/dist/cjs/modules/gis/index.js +3 -0
- package/dist/cjs/modules/gis/index.js.map +1 -1
- package/dist/cjs/modules/gis/interfaces/trip-summary.js +3 -0
- package/dist/cjs/modules/gis/interfaces/trip-summary.js.map +1 -0
- package/dist/cjs/modules/incident/dtos/incident/incident.dto.js +22 -0
- package/dist/cjs/modules/incident/dtos/incident/incident.dto.js.map +1 -1
- package/dist/cjs/modules/incident/enums/incident-origin-type.enum.js +17 -0
- package/dist/cjs/modules/incident/enums/incident-origin-type.enum.js.map +1 -0
- package/dist/cjs/modules/incident/index.js +1 -0
- package/dist/cjs/modules/incident/index.js.map +1 -1
- package/dist/cjs/modules/organization/index.js +1 -0
- package/dist/cjs/modules/organization/index.js.map +1 -1
- package/dist/cjs/modules/organization/interfaces/organization-created-event.js +3 -0
- package/dist/cjs/modules/organization/interfaces/organization-created-event.js.map +1 -0
- package/dist/cjs/modules/permission/data/permissions.data.js +12 -1
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +28 -1
- 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/newsfeed-roles.js +28 -0
- package/dist/cjs/modules/role/constants/newsfeed-roles.js.map +1 -0
- package/dist/cjs/modules/role/constants/safety-roles.js +25 -0
- package/dist/cjs/modules/role/constants/safety-roles.js.map +1 -0
- package/dist/cjs/modules/role/data/roles.data.js +99 -7
- package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
- package/dist/cjs/modules/role/index.js +2 -0
- package/dist/cjs/modules/role/index.js.map +1 -1
- package/dist/cjs/modules/safety/constants/safety-check-limits.const.js +51 -0
- package/dist/cjs/modules/safety/constants/safety-check-limits.const.js.map +1 -0
- package/dist/cjs/modules/safety/constants/safety-integration.const.js +71 -0
- package/dist/cjs/modules/safety/constants/safety-integration.const.js.map +1 -0
- package/dist/cjs/modules/safety/constants/safety-taxonomy.const.js +50 -0
- package/dist/cjs/modules/safety/constants/safety-taxonomy.const.js.map +1 -0
- package/dist/cjs/modules/safety/dtos/safety-admin.dto.js +232 -0
- package/dist/cjs/modules/safety/dtos/safety-admin.dto.js.map +1 -0
- package/dist/cjs/modules/safety/dtos/safety-check.dto.js +170 -0
- package/dist/cjs/modules/safety/dtos/safety-check.dto.js.map +1 -0
- package/dist/cjs/modules/safety/dtos/safety-internal.dto.js +162 -0
- package/dist/cjs/modules/safety/dtos/safety-internal.dto.js.map +1 -0
- package/dist/cjs/modules/safety/enums/safety-check-status.enum.js +45 -0
- package/dist/cjs/modules/safety/enums/safety-check-status.enum.js.map +1 -0
- package/dist/cjs/modules/safety/enums/safety-enums.js +93 -0
- package/dist/cjs/modules/safety/enums/safety-enums.js.map +1 -0
- package/dist/cjs/modules/safety/enums/safety-error-code.enum.js +27 -0
- package/dist/cjs/modules/safety/enums/safety-error-code.enum.js.map +1 -0
- package/dist/cjs/modules/safety/index.js +35 -0
- package/dist/cjs/modules/safety/index.js.map +1 -0
- package/dist/cjs/modules/safety/interfaces/safety-check-event.js +3 -0
- package/dist/cjs/modules/safety/interfaces/safety-check-event.js.map +1 -0
- package/dist/cjs/modules/safety/interfaces/safety-check.js +3 -0
- package/dist/cjs/modules/safety/interfaces/safety-check.js.map +1 -0
- package/dist/cjs/modules/safety/utils/safety-check-state-machine.js +75 -0
- package/dist/cjs/modules/safety/utils/safety-check-state-machine.js.map +1 -0
- package/dist/cjs/modules/safety/utils/safety-check-timing.util.js +68 -0
- package/dist/cjs/modules/safety/utils/safety-check-timing.util.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/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/kafka/topics.js +10 -1
- package/dist/esm/kafka/topics.js.map +1 -1
- package/dist/esm/modules/alert-dispatch/dtos/guardian-audience.dto.js +37 -0
- package/dist/esm/modules/alert-dispatch/dtos/guardian-audience.dto.js.map +1 -0
- package/dist/esm/modules/alert-dispatch/index.js +4 -0
- package/dist/esm/modules/alert-dispatch/index.js.map +1 -1
- package/dist/esm/modules/alert-dispatch/interfaces/guardian-audience.js +2 -0
- package/dist/esm/modules/alert-dispatch/interfaces/guardian-audience.js.map +1 -0
- package/dist/esm/modules/alert-dispatch/utils/guardian-audience.util.js +56 -0
- package/dist/esm/modules/alert-dispatch/utils/guardian-audience.util.js.map +1 -0
- package/dist/esm/modules/common/constants/service.const.js +1 -0
- package/dist/esm/modules/common/constants/service.const.js.map +1 -1
- package/dist/esm/modules/gis/dtos/private-trip.dto.js +171 -0
- package/dist/esm/modules/gis/dtos/private-trip.dto.js.map +1 -0
- package/dist/esm/modules/gis/enums/trip-privacy.enum.js +25 -0
- package/dist/esm/modules/gis/enums/trip-privacy.enum.js.map +1 -0
- package/dist/esm/modules/gis/index.js +3 -0
- package/dist/esm/modules/gis/index.js.map +1 -1
- package/dist/esm/modules/gis/interfaces/trip-summary.js +2 -0
- package/dist/esm/modules/gis/interfaces/trip-summary.js.map +1 -0
- package/dist/esm/modules/incident/dtos/incident/incident.dto.js +23 -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 +14 -0
- package/dist/esm/modules/incident/enums/incident-origin-type.enum.js.map +1 -0
- package/dist/esm/modules/incident/index.js +1 -0
- package/dist/esm/modules/incident/index.js.map +1 -1
- package/dist/esm/modules/organization/index.js +1 -0
- package/dist/esm/modules/organization/index.js.map +1 -1
- package/dist/esm/modules/organization/interfaces/organization-created-event.js +2 -0
- package/dist/esm/modules/organization/interfaces/organization-created-event.js.map +1 -0
- package/dist/esm/modules/permission/data/permissions.data.js +12 -1
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +28 -1
- 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/newsfeed-roles.js +25 -0
- package/dist/esm/modules/role/constants/newsfeed-roles.js.map +1 -0
- package/dist/esm/modules/role/constants/safety-roles.js +22 -0
- package/dist/esm/modules/role/constants/safety-roles.js.map +1 -0
- package/dist/esm/modules/role/data/roles.data.js +99 -7
- package/dist/esm/modules/role/data/roles.data.js.map +1 -1
- package/dist/esm/modules/role/index.js +2 -0
- package/dist/esm/modules/role/index.js.map +1 -1
- package/dist/esm/modules/safety/constants/safety-check-limits.const.js +48 -0
- package/dist/esm/modules/safety/constants/safety-check-limits.const.js.map +1 -0
- package/dist/esm/modules/safety/constants/safety-integration.const.js +67 -0
- package/dist/esm/modules/safety/constants/safety-integration.const.js.map +1 -0
- package/dist/esm/modules/safety/constants/safety-taxonomy.const.js +45 -0
- package/dist/esm/modules/safety/constants/safety-taxonomy.const.js.map +1 -0
- package/dist/esm/modules/safety/dtos/safety-admin.dto.js +225 -0
- package/dist/esm/modules/safety/dtos/safety-admin.dto.js.map +1 -0
- package/dist/esm/modules/safety/dtos/safety-check.dto.js +161 -0
- package/dist/esm/modules/safety/dtos/safety-check.dto.js.map +1 -0
- package/dist/esm/modules/safety/dtos/safety-internal.dto.js +155 -0
- package/dist/esm/modules/safety/dtos/safety-internal.dto.js.map +1 -0
- package/dist/esm/modules/safety/enums/safety-check-status.enum.js +42 -0
- package/dist/esm/modules/safety/enums/safety-check-status.enum.js.map +1 -0
- package/dist/esm/modules/safety/enums/safety-enums.js +90 -0
- package/dist/esm/modules/safety/enums/safety-enums.js.map +1 -0
- package/dist/esm/modules/safety/enums/safety-error-code.enum.js +24 -0
- package/dist/esm/modules/safety/enums/safety-error-code.enum.js.map +1 -0
- package/dist/esm/modules/safety/index.js +19 -0
- package/dist/esm/modules/safety/index.js.map +1 -0
- package/dist/esm/modules/safety/interfaces/safety-check-event.js +2 -0
- package/dist/esm/modules/safety/interfaces/safety-check-event.js.map +1 -0
- package/dist/esm/modules/safety/interfaces/safety-check.js +2 -0
- package/dist/esm/modules/safety/interfaces/safety-check.js.map +1 -0
- package/dist/esm/modules/safety/utils/safety-check-state-machine.js +67 -0
- package/dist/esm/modules/safety/utils/safety-check-state-machine.js.map +1 -0
- package/dist/esm/modules/safety/utils/safety-check-timing.util.js +59 -0
- package/dist/esm/modules/safety/utils/safety-check-timing.util.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/index.d.ts +1 -0
- package/dist/types/kafka/topics.d.ts +4 -0
- package/dist/types/modules/alert-dispatch/dtos/guardian-audience.dto.d.ts +6 -0
- package/dist/types/modules/alert-dispatch/index.d.ts +3 -0
- package/dist/types/modules/alert-dispatch/interfaces/guardian-audience.d.ts +23 -0
- package/dist/types/modules/alert-dispatch/utils/guardian-audience.util.d.ts +18 -0
- package/dist/types/modules/common/constants/service.const.d.ts +4 -0
- package/dist/types/modules/gis/dtos/private-trip.dto.d.ts +42 -0
- package/dist/types/modules/gis/enums/trip-privacy.enum.d.ts +22 -0
- package/dist/types/modules/gis/index.d.ts +3 -0
- package/dist/types/modules/gis/interfaces/client-safe-trip.d.ts +8 -0
- package/dist/types/modules/gis/interfaces/trip-summary.d.ts +26 -0
- package/dist/types/modules/incident/dtos/incident/incident.dto.d.ts +14 -0
- package/dist/types/modules/incident/enums/incident-origin-type.enum.d.ts +12 -0
- package/dist/types/modules/incident/index.d.ts +1 -0
- package/dist/types/modules/incident/intefaces/incident-category.d.ts +10 -0
- package/dist/types/modules/incident/intefaces/incident-type.d.ts +10 -0
- package/dist/types/modules/incident/intefaces/incident.d.ts +14 -0
- package/dist/types/modules/organization/index.d.ts +1 -0
- package/dist/types/modules/organization/interfaces/organization-created-event.d.ts +18 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +6 -0
- package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +2 -1
- package/dist/types/modules/role/constants/newsfeed-roles.d.ts +16 -0
- package/dist/types/modules/role/constants/safety-roles.d.ts +14 -0
- package/dist/types/modules/role/index.d.ts +2 -0
- package/dist/types/modules/safety/constants/safety-check-limits.const.d.ts +47 -0
- package/dist/types/modules/safety/constants/safety-integration.const.d.ts +64 -0
- package/dist/types/modules/safety/constants/safety-taxonomy.const.d.ts +31 -0
- package/dist/types/modules/safety/dtos/safety-admin.dto.d.ts +39 -0
- package/dist/types/modules/safety/dtos/safety-check.dto.d.ts +38 -0
- package/dist/types/modules/safety/dtos/safety-internal.dto.d.ts +51 -0
- package/dist/types/modules/safety/enums/safety-check-status.enum.d.ts +40 -0
- package/dist/types/modules/safety/enums/safety-enums.d.ts +81 -0
- package/dist/types/modules/safety/enums/safety-error-code.enum.d.ts +22 -0
- package/dist/types/modules/safety/index.d.ts +13 -0
- package/dist/types/modules/safety/interfaces/safety-check-event.d.ts +36 -0
- package/dist/types/modules/safety/interfaces/safety-check.d.ts +180 -0
- package/dist/types/modules/safety/utils/safety-check-state-machine.d.ts +30 -0
- package/dist/types/modules/safety/utils/safety-check-timing.util.d.ts +37 -0
- package/dist/types/modules/sms/enums/sms-template.enum.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,5 +4,15 @@ export interface IncidentCategory {
|
|
|
4
4
|
name: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
organizationId: number;
|
|
7
|
+
/**
|
|
8
|
+
* Stable code of a platform-managed row (e.g. SAFETY_CHECK_SOS); null for
|
|
9
|
+
* everything an organization created itself.
|
|
10
|
+
*/
|
|
11
|
+
code?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Platform-managed: provisioned for every organization, hidden from the SOS
|
|
14
|
+
* sheet and from package configuration, and not editable or deletable.
|
|
15
|
+
*/
|
|
16
|
+
isSystem?: boolean;
|
|
7
17
|
types?: IncidentType[];
|
|
8
18
|
}
|
|
@@ -5,5 +5,15 @@ export interface IncidentType {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
categoryId?: number;
|
|
7
7
|
organizationId: number;
|
|
8
|
+
/**
|
|
9
|
+
* Stable code of a platform-managed row (e.g. SAFETY_CHECK_SOS); null for
|
|
10
|
+
* everything an organization created itself.
|
|
11
|
+
*/
|
|
12
|
+
code?: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Platform-managed: provisioned for every organization, hidden from the SOS
|
|
15
|
+
* sheet and from package configuration, and not editable or deletable.
|
|
16
|
+
*/
|
|
17
|
+
isSystem?: boolean;
|
|
8
18
|
category?: IncidentCategory;
|
|
9
19
|
}
|
|
@@ -5,6 +5,8 @@ import { IncidentClass } from "../enums/incident-class.enum";
|
|
|
5
5
|
import { IncidentPriority } from "../enums/incident-priority.enum";
|
|
6
6
|
import { IncidentStatus } from "../enums/incident-status.enum";
|
|
7
7
|
import { IncidentWorkflowTaskQueueName } from "../enums/incident-workflow-queue-name.enum";
|
|
8
|
+
import { IncidentOriginType } from "../enums/incident-origin-type.enum";
|
|
9
|
+
import { GuardianAudience } from "../../alert-dispatch/interfaces/guardian-audience";
|
|
8
10
|
import { IncidentAction } from "./incident-action";
|
|
9
11
|
import { IncidentAssignment } from "./incident-assignment";
|
|
10
12
|
import { IncidentCategory } from "./incident-category";
|
|
@@ -88,6 +90,18 @@ export interface Incident {
|
|
|
88
90
|
* billing withheld is not an alert somebody chose to withhold.
|
|
89
91
|
*/
|
|
90
92
|
notifyServiceProviderRequested?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Set when a safety feature raised the incident (see IncidentOriginType).
|
|
95
|
+
* Absent for everything a person raised.
|
|
96
|
+
*/
|
|
97
|
+
originType?: IncidentOriginType | null;
|
|
98
|
+
originReferenceId?: string | null;
|
|
99
|
+
/**
|
|
100
|
+
* Which guardians the alert is for. Absent (the norm) means all of the
|
|
101
|
+
* reporter's guardians; a Safety Check SOS carries exactly the ones the user
|
|
102
|
+
* selected. Honoured by clarion-notification and by the incident chat.
|
|
103
|
+
*/
|
|
104
|
+
guardianAudience?: GuardianAudience | null;
|
|
91
105
|
createdAt?: string;
|
|
92
106
|
updatedAt?: string;
|
|
93
107
|
category?: IncidentCategory;
|
|
@@ -3,5 +3,6 @@ export * from './dtos/update-organization.dto';
|
|
|
3
3
|
export * from './dtos/organization-sla.dto';
|
|
4
4
|
export * from './interfaces/organization';
|
|
5
5
|
export * from './interfaces/organization-sla';
|
|
6
|
+
export * from './interfaces/organization-created-event';
|
|
6
7
|
export * from './enums/org-status.enum';
|
|
7
8
|
export * from './enums/org-type.enum';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload of KAFKA_TOPICS.ORG_CREATED, published by clarion-organization after
|
|
3
|
+
* the organization (and its HQ control centre) has been committed. Consumers
|
|
4
|
+
* provision their per-organization defaults from it - clarion-incident creates
|
|
5
|
+
* the Safety Alerts category - and must be idempotent: the event is delivered at
|
|
6
|
+
* least once, and every consumer also reconciles on its own schedule, so a lost
|
|
7
|
+
* event delays provisioning rather than skipping it.
|
|
8
|
+
*/
|
|
9
|
+
export interface OrganizationCreatedEvent {
|
|
10
|
+
eventId: string;
|
|
11
|
+
occurredAt: string;
|
|
12
|
+
organizationId: number;
|
|
13
|
+
name: string;
|
|
14
|
+
countryCode: string | null;
|
|
15
|
+
incidentClass: string | null;
|
|
16
|
+
appId: string | null;
|
|
17
|
+
hqControlCentreId: number | null;
|
|
18
|
+
}
|
|
@@ -155,6 +155,9 @@ export declare enum PermissionActions {
|
|
|
155
155
|
PUBLISH_NEWSFEED_POST = "publish:newsfeed-post",
|
|
156
156
|
ARCHIVE_NEWSFEED_POST = "archive:newsfeed-post",
|
|
157
157
|
DELETE_NEWSFEED_POST = "delete:newsfeed-post",
|
|
158
|
+
READ_NEWSFEED_FEED = "read:newsfeed-feed",
|
|
159
|
+
ENGAGE_NEWSFEED_POST = "engage:newsfeed-post",
|
|
160
|
+
MODERATE_NEWSFEED_COMMENT = "moderate:newsfeed-comment",
|
|
158
161
|
READ_NOTIFICATION_BRANDING = "read:notification-branding",
|
|
159
162
|
UPDATE_NOTIFICATION_BRANDING = "update:notification-branding",
|
|
160
163
|
CREATE_NOTIFICATION_EMAIL_SENDER = "create:notification-email-sender",
|
|
@@ -188,6 +191,9 @@ export declare enum PermissionActions {
|
|
|
188
191
|
REVIEW_ALERT_INTAKE_SCREENED_MESSAGE = "review:alert-intake-screened-message",
|
|
189
192
|
READ_ALERT_INTAKE_ANALYTICS = "read:alert-intake-analytics",
|
|
190
193
|
MANAGE_ALERT_INTAKE_PLATFORM = "manage:alert-intake-platform",
|
|
194
|
+
USE_SAFETY_CHECK = "use:safety-check",
|
|
195
|
+
READ_SAFETY_CHECK = "read:safety-check",
|
|
196
|
+
MANAGE_SAFETY_CHECK_REASON = "manage:safety-check-reason",
|
|
191
197
|
/**
|
|
192
198
|
* @deprecated Split into the connection / message / screened-message /
|
|
193
199
|
* analytics actions above, which the gateway now requires instead. Still
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The organization roles that RUN its newsfeed - write, publish, archive and
|
|
3
|
+
* delete posts, and moderate comments. Each holds every Newsfeed action
|
|
4
|
+
* (roles.spec.ts asserts it).
|
|
5
|
+
*
|
|
6
|
+
* For the places that decide by role NAME: clarion-newsfeed's own check on who
|
|
7
|
+
* may manage and moderate (it sees role names and scope, not permissions), and
|
|
8
|
+
* the admin deciding whether to offer a change at all.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NEWSFEED_MANAGER_ROLES: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The organization roles that may SEE its newsfeed as staff do - drafts and
|
|
13
|
+
* archived posts included: the managers, plus Organization:User, which reads and
|
|
14
|
+
* changes nothing.
|
|
15
|
+
*/
|
|
16
|
+
export declare const NEWSFEED_VIEWER_ROLES: string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The organization roles that curate the Safety Check reasons their app offers.
|
|
3
|
+
* Each holds manage:safety-check-reason (roles.spec.ts asserts it). Platform-wide
|
|
4
|
+
* reasons are Super-Admin's alone.
|
|
5
|
+
*
|
|
6
|
+
* For the places that decide by role NAME: clarion-safety's own scoping and the
|
|
7
|
+
* admin deciding whether to offer an edit at all.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SAFETY_MANAGER_ROLES: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The staff roles that may read Safety Checks: the managers across the whole
|
|
12
|
+
* organization, and a control-centre admin within their control centre.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SAFETY_VIEWER_ROLES: string[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Safety Check limits. The mobile app, the gateway-facing DTOs and the
|
|
3
|
+
* clarion-safety domain all read THESE numbers, so client-side and server-side
|
|
4
|
+
* validation cannot drift apart. The app additionally receives them from
|
|
5
|
+
* GET /safety/checks/start-options rather than hard-coding its own copy.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SAFETY_CHECK_LIMITS: {
|
|
8
|
+
/** Shortest check the platform accepts. */
|
|
9
|
+
readonly minDurationMinutes: 1;
|
|
10
|
+
/** Longest check - including every extension - measured from startedAt. */
|
|
11
|
+
readonly maxDurationMinutes: number;
|
|
12
|
+
readonly defaultDurationMinutes: 15;
|
|
13
|
+
/** The quick picks offered on the setup screen ("Other" is a custom value). */
|
|
14
|
+
readonly presetDurationsMinutes: readonly number[];
|
|
15
|
+
/** How long the user has to confirm once prompted. */
|
|
16
|
+
readonly minPromptCountdownSeconds: 15;
|
|
17
|
+
readonly maxPromptCountdownSeconds: number;
|
|
18
|
+
readonly defaultPromptCountdownSeconds: 60;
|
|
19
|
+
/**
|
|
20
|
+
* Server-side grace after the visible countdown reaches zero before the SOS is
|
|
21
|
+
* raised. Covers an "I'm OK" that was sent at the last second and is still in
|
|
22
|
+
* flight. The app never shows it - the countdown it shows ends at
|
|
23
|
+
* promptDeadlineAt.
|
|
24
|
+
*/
|
|
25
|
+
readonly checkInGraceSeconds: 10;
|
|
26
|
+
/**
|
|
27
|
+
* A check whose check-in window closed longer ago than this - only possible
|
|
28
|
+
* after a platform outage - is EXPIRED instead of raising an SOS hours late.
|
|
29
|
+
*/
|
|
30
|
+
readonly staleSosWindowMinutes: number;
|
|
31
|
+
/** Free-text reason for "Write my own". */
|
|
32
|
+
readonly customReasonMaxLength: 120;
|
|
33
|
+
/** One track-point upload. */
|
|
34
|
+
readonly maxTrackPointsPerBatch: 200;
|
|
35
|
+
};
|
|
36
|
+
/** Where the setup screen starts. */
|
|
37
|
+
export declare const SAFETY_CHECK_DEFAULTS: {
|
|
38
|
+
readonly durationMinutes: 15;
|
|
39
|
+
readonly promptCountdownSeconds: 60;
|
|
40
|
+
/** Every eligible guardian starts selected. */
|
|
41
|
+
readonly allGuardiansSelected: true;
|
|
42
|
+
/** Premium/Trial only - Free users are never offered the option. */
|
|
43
|
+
readonly notifyServiceProvider: true;
|
|
44
|
+
readonly notifyGuardiansOnStartEnd: true;
|
|
45
|
+
readonly vibrate: true;
|
|
46
|
+
readonly alarmSound: true;
|
|
47
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-service contracts for the Safety domain. Each value is read by more than
|
|
3
|
+
* one repository - change both sides together.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Header carrying the shared internal service token on the calls that can raise
|
|
7
|
+
* or steer an SOS: workflow-manager -> clarion-safety (advance), clarion-safety
|
|
8
|
+
* -> workflow-manager (start/signal) and clarion-safety -> clarion-incident
|
|
9
|
+
* (create the Safety SOS incident). Same header workflow-manager already
|
|
10
|
+
* requires on its API.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SAFETY_INTERNAL_TOKEN_HEADER = "x-internal-service-token";
|
|
13
|
+
/**
|
|
14
|
+
* Env vars the token is read from, in order. `SAFETY_INTERNAL_API_TOKEN` may hold
|
|
15
|
+
* a comma-separated list (rotation); when it is unset every party falls back to
|
|
16
|
+
* `WORKFLOW_MANAGER_API_TOKEN`, which every pod already receives from
|
|
17
|
+
* runtime-secrets. Senders use the FIRST value; receivers accept ANY.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SAFETY_INTERNAL_TOKEN_ENV_KEYS: readonly ["SAFETY_INTERNAL_API_TOKEN", "WORKFLOW_MANAGER_API_TOKEN"];
|
|
20
|
+
/** Temporal: the durable Safety Check timer. */
|
|
21
|
+
export declare const SAFETY_CHECK_WORKFLOW: {
|
|
22
|
+
/** Registered workflow function name in clarion-workflow-manager. */
|
|
23
|
+
readonly workflowType: "safetyCheckWorkflow";
|
|
24
|
+
/** Default task queue; overridable with TEMPORAL_SAFETY_TASK_QUEUE. */
|
|
25
|
+
readonly taskQueue: "safety-check-task-queue";
|
|
26
|
+
/** Signal that wakes the workflow early (extension, check-in, stop, SOS). */
|
|
27
|
+
readonly changedSignal: "safetyCheckChanged";
|
|
28
|
+
/** Query returning the workflow's view of the next wake time. */
|
|
29
|
+
readonly stateQuery: "safetyCheckWorkflowState";
|
|
30
|
+
};
|
|
31
|
+
/** Workflow id for a Safety Check. One per check, ever - the id IS the idempotency key. */
|
|
32
|
+
export declare function safetyCheckWorkflowId(safetyCheckId: string): string;
|
|
33
|
+
/** Internal HTTP paths (not proxied by the gateway). */
|
|
34
|
+
export declare const SAFETY_INTERNAL_PATHS: {
|
|
35
|
+
/** clarion-safety: the one domain step the durable timer drives. */
|
|
36
|
+
readonly advanceCheck: (safetyCheckId: string) => string;
|
|
37
|
+
/** clarion-workflow-manager: start the timer for a check. */
|
|
38
|
+
readonly startWorkflow: "/safety-checks/workflows";
|
|
39
|
+
/** clarion-workflow-manager: wake the timer early. */
|
|
40
|
+
readonly signalWorkflow: (safetyCheckId: string) => string;
|
|
41
|
+
/** clarion-incident: raise the Safety SOS incident (idempotent per origin). */
|
|
42
|
+
readonly createSafetyAlertIncident: "/incidents/safety-alerts";
|
|
43
|
+
/** clarion-incident: which of these incident type ids are platform-managed system types. */
|
|
44
|
+
readonly classifyIncidentTypes: "/incident-types/classify";
|
|
45
|
+
/** clarion-gis private trips (tracked privately until an SOS shares them). */
|
|
46
|
+
readonly createPrivateTrip: "/trips/private";
|
|
47
|
+
readonly tripTrackPoints: (tripId: string) => string;
|
|
48
|
+
readonly shareTrip: (tripId: string) => string;
|
|
49
|
+
readonly stopPrivateTrip: (tripId: string) => string;
|
|
50
|
+
readonly tripSummary: (tripId: string) => string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* go_router locations in clarion_mobile that pushes deep-link to. A push route
|
|
54
|
+
* is an APP location, never an API path.
|
|
55
|
+
*/
|
|
56
|
+
export declare const SAFETY_MOBILE_ROUTES: {
|
|
57
|
+
readonly active: "/safety-check/active";
|
|
58
|
+
readonly prompt: "/safety-check/prompt";
|
|
59
|
+
};
|
|
60
|
+
/** Redis keys clarion-safety owns. */
|
|
61
|
+
export declare const SAFETY_REDIS_KEYS: {
|
|
62
|
+
readonly sweeperLock: "safety:lock:sweeper";
|
|
63
|
+
readonly rateLimit: (userId: number, bucket: string) => string;
|
|
64
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SafetyFeature, SafetyIncidentCategoryCode, SafetyIncidentTypeCode } from '../enums/safety-enums';
|
|
2
|
+
export interface SafetyIncidentTypeDefinition {
|
|
3
|
+
code: SafetyIncidentTypeCode;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
feature: SafetyFeature;
|
|
7
|
+
}
|
|
8
|
+
export interface SafetyIncidentCategoryDefinition {
|
|
9
|
+
code: SafetyIncidentCategoryCode;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
types: readonly SafetyIncidentTypeDefinition[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The incident category and types EVERY organization receives - existing ones by
|
|
16
|
+
* migration and reconciliation, new ones on `org.created`. There is no
|
|
17
|
+
* per-organization exception (NAVCDP included).
|
|
18
|
+
*
|
|
19
|
+
* They are SYSTEM rows in clarion-incident (`isSystem = true`, matched by
|
|
20
|
+
* `code`, never by name): hidden from the SOS bottom sheet and from package
|
|
21
|
+
* configuration, immutable through the admin API, and raised only by the
|
|
22
|
+
* safety features themselves.
|
|
23
|
+
*
|
|
24
|
+
* Names are stored once at provisioning; renaming here does not rename existing
|
|
25
|
+
* rows.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SAFETY_ALERTS_TAXONOMY: SafetyIncidentCategoryDefinition;
|
|
28
|
+
/** The incident type a safety feature raises its SOS as. */
|
|
29
|
+
export declare function safetyIncidentTypeCodeFor(feature: SafetyFeature): SafetyIncidentTypeCode;
|
|
30
|
+
/** True for a code clarion-incident treats as a platform-managed safety type. */
|
|
31
|
+
export declare function isSafetyIncidentTypeCode(code: string | null | undefined): code is SafetyIncidentTypeCode;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SafetyCheckStatus } from '../enums/safety-check-status.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Filters for the admin Safety Check list. Every field NARROWS what the caller
|
|
4
|
+
* may already see: `organizationId` is honoured only for a super-admin; anybody
|
|
5
|
+
* else is scoped from their trusted context regardless of what arrives here.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SafetyCheckAdminQueryDto {
|
|
8
|
+
page?: number;
|
|
9
|
+
limit?: number;
|
|
10
|
+
status?: SafetyCheckStatus;
|
|
11
|
+
organizationId?: number;
|
|
12
|
+
userId?: number;
|
|
13
|
+
sosOnly?: boolean;
|
|
14
|
+
from?: string;
|
|
15
|
+
to?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class CreateSafetyCheckReasonDto {
|
|
19
|
+
code: string;
|
|
20
|
+
label: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
organizationId?: number;
|
|
23
|
+
countryCode?: string;
|
|
24
|
+
isCustom?: boolean;
|
|
25
|
+
active?: boolean;
|
|
26
|
+
displayOrder?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Code, organization and custom-ness are fixed once created; everything shown to users can change. */
|
|
29
|
+
export declare class UpdateSafetyCheckReasonDto {
|
|
30
|
+
label?: string;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
countryCode?: string | null;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
displayOrder?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class SafetyCheckReasonAdminQueryDto {
|
|
37
|
+
organizationId?: number;
|
|
38
|
+
includeInactive?: boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GuardianAudienceDto } from '../../alert-dispatch/dtos/guardian-audience.dto';
|
|
2
|
+
/** A device-reported position. Never logged by any Safety service. */
|
|
3
|
+
export declare class SafetyCheckLocationDto {
|
|
4
|
+
lat: number;
|
|
5
|
+
lng: number;
|
|
6
|
+
accuracy?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Starting a Safety Check.
|
|
10
|
+
*
|
|
11
|
+
* Nothing here is trusted beyond its shape: clarion-safety re-checks the reason
|
|
12
|
+
* against the database, every guardian against clarion-authentication, and the
|
|
13
|
+
* provider option against clarion-billing. The duration is bounded here AND in
|
|
14
|
+
* the domain.
|
|
15
|
+
*/
|
|
16
|
+
export declare class StartSafetyCheckDto {
|
|
17
|
+
reasonId: string;
|
|
18
|
+
customReason?: string;
|
|
19
|
+
durationMinutes: number;
|
|
20
|
+
promptCountdownSeconds?: number;
|
|
21
|
+
guardians: GuardianAudienceDto;
|
|
22
|
+
notifyServiceProvider: boolean;
|
|
23
|
+
notifyGuardiansOnStartEnd: boolean;
|
|
24
|
+
startLocation?: SafetyCheckLocationDto;
|
|
25
|
+
}
|
|
26
|
+
export declare class ExtendSafetyCheckDto {
|
|
27
|
+
additionalMinutes: number;
|
|
28
|
+
}
|
|
29
|
+
/** Body of check-in, stop and manual SOS. The location is optional context. */
|
|
30
|
+
export declare class SafetyCheckActionDto {
|
|
31
|
+
location?: SafetyCheckLocationDto;
|
|
32
|
+
}
|
|
33
|
+
export declare class SafetyCheckTrackPointDto extends SafetyCheckLocationDto {
|
|
34
|
+
timestamp: string;
|
|
35
|
+
}
|
|
36
|
+
export declare class SafetyCheckTrackPointsDto {
|
|
37
|
+
points: SafetyCheckTrackPointDto[];
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GuardianAudienceDto } from '../../alert-dispatch/dtos/guardian-audience.dto';
|
|
2
|
+
import { SafetyCheckSosTrigger, SafetyFeature } from '../enums/safety-enums';
|
|
3
|
+
import { SafetyCheckLocationDto } from './safety-check.dto';
|
|
4
|
+
/**
|
|
5
|
+
* clarion-safety -> clarion-incident: raise the SOS for a safety feature.
|
|
6
|
+
*
|
|
7
|
+
* Internal only (never proxied by the gateway) and token-protected. Idempotent on
|
|
8
|
+
* (feature, originReferenceId): a retry - from a workflow, the sweeper, or a user
|
|
9
|
+
* pressing twice - returns the incident the first call created.
|
|
10
|
+
*
|
|
11
|
+
* clarion-incident builds the incident itself: the reporter from the user's
|
|
12
|
+
* account, the Safety Alerts category and type from the organization's system
|
|
13
|
+
* rows, and entitlement/dispatch through the same pipeline as every SOS. The
|
|
14
|
+
* caller cannot choose a type, a class or an entitlement tier.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CreateSafetyAlertIncidentDto {
|
|
17
|
+
feature: SafetyFeature;
|
|
18
|
+
originReferenceId: string;
|
|
19
|
+
trigger: SafetyCheckSosTrigger;
|
|
20
|
+
organizationId: number;
|
|
21
|
+
userId: number;
|
|
22
|
+
appId: string;
|
|
23
|
+
controlCentreId?: number;
|
|
24
|
+
location?: SafetyCheckLocationDto;
|
|
25
|
+
notifyServiceProvider: boolean;
|
|
26
|
+
guardianAudience: GuardianAudienceDto;
|
|
27
|
+
tripId?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
/** clarion-safety -> clarion-workflow-manager: start the durable timer. Idempotent per check. */
|
|
31
|
+
export declare class StartSafetyCheckWorkflowDto {
|
|
32
|
+
safetyCheckId: string;
|
|
33
|
+
firstWakeAt: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* clarion-safety -> clarion-workflow-manager: something changed. Purely an
|
|
37
|
+
* optimisation - a lost signal only means the workflow wakes at its previous
|
|
38
|
+
* time and asks clarion-safety, which answers with the truth.
|
|
39
|
+
*/
|
|
40
|
+
export declare class SignalSafetyCheckWorkflowDto {
|
|
41
|
+
done?: boolean;
|
|
42
|
+
nextWakeAt?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* clarion-billing -> clarion-incident: which of these incident type ids are
|
|
46
|
+
* platform-managed system types (the Safety SOS types). Billing refuses to put
|
|
47
|
+
* those in a package, whatever the admin UI shows.
|
|
48
|
+
*/
|
|
49
|
+
export declare class ClassifyIncidentTypesDto {
|
|
50
|
+
ids: number[];
|
|
51
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle of one Safety Check. clarion-safety is the only writer; every
|
|
3
|
+
* transition is validated against SAFETY_CHECK_TRANSITIONS
|
|
4
|
+
* (utils/safety-check-state-machine.ts) and applied as a conditional update, so
|
|
5
|
+
* two racing writers can never both win.
|
|
6
|
+
*
|
|
7
|
+
* CREATED accepted and persisted; tracking and the durable timer are
|
|
8
|
+
* still being set up. The user already counts as being in a
|
|
9
|
+
* check (the clock started when it was accepted).
|
|
10
|
+
* ACTIVE running; the user is expected to check in at
|
|
11
|
+
* scheduledCheckInAt.
|
|
12
|
+
* PROMPTING the check-in time has passed and the user is being asked to
|
|
13
|
+
* confirm they are safe. SOS is raised at promptDeadlineAt.
|
|
14
|
+
* CHECKED_IN the user confirmed they are safe. Terminal, successful.
|
|
15
|
+
* SOS_TRIGGERED an SOS was raised - the user missed the check-in or asked for
|
|
16
|
+
* one. Terminal for the check; the incident lives on in
|
|
17
|
+
* clarion-incident. `incidentId` is null until the incident
|
|
18
|
+
* has been created (clarion-safety keeps retrying).
|
|
19
|
+
* STOPPED the user ended the check before it completed. Terminal.
|
|
20
|
+
* EXPIRED the check-in window closed so long ago (a platform outage
|
|
21
|
+
* longer than SAFETY_CHECK_LIMITS.staleSosWindowMinutes) that
|
|
22
|
+
* raising an SOS now would be noise rather than help. Terminal;
|
|
23
|
+
* always an operational alarm.
|
|
24
|
+
* CANCELLED ended by the platform rather than the user (e.g. the account
|
|
25
|
+
* was signed out and the user chose to end it). Terminal.
|
|
26
|
+
* FAILED the SOS could not be raised because clarion-incident refused
|
|
27
|
+
* it outright (a non-retryable error). Terminal; the user is
|
|
28
|
+
* told to call for help and operators are alerted.
|
|
29
|
+
*/
|
|
30
|
+
export declare enum SafetyCheckStatus {
|
|
31
|
+
CREATED = "CREATED",
|
|
32
|
+
ACTIVE = "ACTIVE",
|
|
33
|
+
PROMPTING = "PROMPTING",
|
|
34
|
+
CHECKED_IN = "CHECKED_IN",
|
|
35
|
+
SOS_TRIGGERED = "SOS_TRIGGERED",
|
|
36
|
+
STOPPED = "STOPPED",
|
|
37
|
+
EXPIRED = "EXPIRED",
|
|
38
|
+
CANCELLED = "CANCELLED",
|
|
39
|
+
FAILED = "FAILED"
|
|
40
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** Why a Safety Check raised an SOS. */
|
|
2
|
+
export declare enum SafetyCheckSosTrigger {
|
|
3
|
+
/** The prompt countdown ran out without the user confirming they were safe. */
|
|
4
|
+
MISSED_CHECK_IN = "MISSED_CHECK_IN",
|
|
5
|
+
/** The user pressed SOS from the Safety Check screen. */
|
|
6
|
+
USER_REQUESTED = "USER_REQUESTED"
|
|
7
|
+
}
|
|
8
|
+
/** Who caused a Safety Check transition - recorded on every audit entry. */
|
|
9
|
+
export declare enum SafetyCheckActorType {
|
|
10
|
+
USER = "USER",
|
|
11
|
+
/** The durable timer in clarion-workflow-manager. */
|
|
12
|
+
WORKFLOW = "WORKFLOW",
|
|
13
|
+
/** clarion-safety's backstop sweeper, acting on an overdue check. */
|
|
14
|
+
RECONCILER = "RECONCILER",
|
|
15
|
+
SYSTEM = "SYSTEM"
|
|
16
|
+
}
|
|
17
|
+
/** Audit trail entries (safety_check_events.eventType). Never carries a location. */
|
|
18
|
+
export declare enum SafetyCheckAuditEventType {
|
|
19
|
+
CREATED = "CREATED",
|
|
20
|
+
ACTIVATED = "ACTIVATED",
|
|
21
|
+
TRACKING_STARTED = "TRACKING_STARTED",
|
|
22
|
+
TRACKING_UNAVAILABLE = "TRACKING_UNAVAILABLE",
|
|
23
|
+
WORKFLOW_STARTED = "WORKFLOW_STARTED",
|
|
24
|
+
WORKFLOW_START_FAILED = "WORKFLOW_START_FAILED",
|
|
25
|
+
EXTENDED = "EXTENDED",
|
|
26
|
+
PROMPT_STARTED = "PROMPT_STARTED",
|
|
27
|
+
CHECKED_IN = "CHECKED_IN",
|
|
28
|
+
STOPPED = "STOPPED",
|
|
29
|
+
CANCELLED = "CANCELLED",
|
|
30
|
+
SOS_TRIGGERED = "SOS_TRIGGERED",
|
|
31
|
+
SOS_INCIDENT_CREATED = "SOS_INCIDENT_CREATED",
|
|
32
|
+
SOS_INCIDENT_RETRY = "SOS_INCIDENT_RETRY",
|
|
33
|
+
SOS_FAILED = "SOS_FAILED",
|
|
34
|
+
EXPIRED = "EXPIRED"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The safety features that can raise an incident. Phase 1 raises only
|
|
38
|
+
* SAFETY_CHECK; FOLLOW_ME exists because its incident type is provisioned for
|
|
39
|
+
* every organization from day one.
|
|
40
|
+
*/
|
|
41
|
+
export declare enum SafetyFeature {
|
|
42
|
+
SAFETY_CHECK = "SAFETY_CHECK",
|
|
43
|
+
FOLLOW_ME = "FOLLOW_ME"
|
|
44
|
+
}
|
|
45
|
+
/** Stable code of the incident category every organization receives. */
|
|
46
|
+
export declare enum SafetyIncidentCategoryCode {
|
|
47
|
+
SAFETY_ALERTS = "SAFETY_ALERTS"
|
|
48
|
+
}
|
|
49
|
+
/** Stable codes of the incident types inside the Safety Alerts category. */
|
|
50
|
+
export declare enum SafetyIncidentTypeCode {
|
|
51
|
+
SAFETY_CHECK_SOS = "SAFETY_CHECK_SOS",
|
|
52
|
+
FOLLOW_ME_SOS = "FOLLOW_ME_SOS"
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Kafka event types published by clarion-safety (the `eventType` field of
|
|
56
|
+
* SafetyCheckEvent). One topic per type, see KAFKA_TOPICS.SAFETY_CHECK_*.
|
|
57
|
+
*/
|
|
58
|
+
export declare enum SafetyCheckEventType {
|
|
59
|
+
STARTED = "SAFETY_CHECK_STARTED",
|
|
60
|
+
PROMPTING = "SAFETY_CHECK_PROMPTING",
|
|
61
|
+
ENDED = "SAFETY_CHECK_ENDED",
|
|
62
|
+
SOS_TRIGGERED = "SAFETY_CHECK_SOS_TRIGGERED"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Push `data.action` / `data.type` values the mobile app routes on. Sent by
|
|
66
|
+
* clarion-notification; the app allow-lists them in
|
|
67
|
+
* notification_deep_link_coordinator.dart. Changing a value is a breaking
|
|
68
|
+
* change to installed apps.
|
|
69
|
+
*/
|
|
70
|
+
export declare enum SafetyPushAction {
|
|
71
|
+
/** To the user: it is time to confirm you are safe. */
|
|
72
|
+
SAFETY_CHECK_PROMPT = "SAFETY_CHECK_PROMPT",
|
|
73
|
+
/** To the user: an SOS was raised for your Safety Check. */
|
|
74
|
+
SAFETY_CHECK_SOS_TRIGGERED = "SAFETY_CHECK_SOS_TRIGGERED",
|
|
75
|
+
/** To the user: the Safety Check ended without them (FAILED/EXPIRED/CANCELLED). */
|
|
76
|
+
SAFETY_CHECK_ENDED = "SAFETY_CHECK_ENDED",
|
|
77
|
+
/** To a guardian: somebody who chose you started a Safety Check. */
|
|
78
|
+
SAFETY_CHECK_GUARDIAN_STARTED = "SAFETY_CHECK_GUARDIAN_STARTED",
|
|
79
|
+
/** To a guardian: that Safety Check ended safely. */
|
|
80
|
+
SAFETY_CHECK_GUARDIAN_ENDED = "SAFETY_CHECK_GUARDIAN_ENDED"
|
|
81
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine-readable `code` on every error clarion-safety returns, so the app can
|
|
3
|
+
* react (e.g. adopt the check a duplicate start collided with) without parsing
|
|
4
|
+
* the human message.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum SafetyCheckErrorCode {
|
|
7
|
+
NOT_FOUND = "SAFETY_CHECK_NOT_FOUND",
|
|
8
|
+
ALREADY_ACTIVE = "SAFETY_CHECK_ALREADY_ACTIVE",
|
|
9
|
+
ALREADY_ENDED = "SAFETY_CHECK_ENDED",
|
|
10
|
+
SOS_ALREADY_TRIGGERED = "SAFETY_CHECK_SOS_ALREADY_TRIGGERED",
|
|
11
|
+
INVALID_TRANSITION = "SAFETY_CHECK_INVALID_TRANSITION",
|
|
12
|
+
INVALID_DURATION = "SAFETY_CHECK_INVALID_DURATION",
|
|
13
|
+
MAX_DURATION_EXCEEDED = "SAFETY_CHECK_MAX_DURATION_EXCEEDED",
|
|
14
|
+
INVALID_REASON = "SAFETY_CHECK_INVALID_REASON",
|
|
15
|
+
CUSTOM_REASON_REQUIRED = "SAFETY_CHECK_CUSTOM_REASON_REQUIRED",
|
|
16
|
+
GUARDIAN_NOT_FOUND = "SAFETY_CHECK_GUARDIAN_NOT_FOUND",
|
|
17
|
+
GUARDIANS_UNAVAILABLE = "SAFETY_CHECK_GUARDIANS_UNAVAILABLE",
|
|
18
|
+
NO_SOS_RECIPIENTS = "SAFETY_CHECK_NO_SOS_RECIPIENTS",
|
|
19
|
+
SERVICE_PROVIDER_NOT_ENTITLED = "SAFETY_CHECK_SERVICE_PROVIDER_NOT_ENTITLED",
|
|
20
|
+
TRACKING_CLOSED = "SAFETY_CHECK_TRACKING_CLOSED",
|
|
21
|
+
RATE_LIMITED = "SAFETY_CHECK_RATE_LIMITED"
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './enums/safety-check-status.enum';
|
|
2
|
+
export * from './enums/safety-enums';
|
|
3
|
+
export * from './enums/safety-error-code.enum';
|
|
4
|
+
export * from './constants/safety-check-limits.const';
|
|
5
|
+
export * from './constants/safety-taxonomy.const';
|
|
6
|
+
export * from './constants/safety-integration.const';
|
|
7
|
+
export * from './interfaces/safety-check';
|
|
8
|
+
export * from './interfaces/safety-check-event';
|
|
9
|
+
export * from './dtos/safety-check.dto';
|
|
10
|
+
export * from './dtos/safety-admin.dto';
|
|
11
|
+
export * from './dtos/safety-internal.dto';
|
|
12
|
+
export * from './utils/safety-check-state-machine';
|
|
13
|
+
export * from './utils/safety-check-timing.util';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GuardianAudience } from '../../alert-dispatch/interfaces/guardian-audience';
|
|
2
|
+
import { SafetyCheckStatus } from '../enums/safety-check-status.enum';
|
|
3
|
+
import { SafetyCheckEventType, SafetyCheckSosTrigger } from '../enums/safety-enums';
|
|
4
|
+
/**
|
|
5
|
+
* The Kafka payload for every KAFKA_TOPICS.SAFETY_CHECK_* topic. Published by
|
|
6
|
+
* clarion-safety through its transactional outbox (at-least-once, keyed by the
|
|
7
|
+
* check id so one check's events stay in order); consumers dedupe on `eventId`.
|
|
8
|
+
*
|
|
9
|
+
* Carries NO location. `guardianAudience` holds guardian identifiers because
|
|
10
|
+
* clarion-notification needs them to reach exactly the chosen guardians.
|
|
11
|
+
*/
|
|
12
|
+
export interface SafetyCheckEvent {
|
|
13
|
+
eventId: string;
|
|
14
|
+
eventType: SafetyCheckEventType;
|
|
15
|
+
version: 1;
|
|
16
|
+
occurredAt: string;
|
|
17
|
+
correlationId: string | null;
|
|
18
|
+
safetyCheckId: string;
|
|
19
|
+
userId: number;
|
|
20
|
+
organizationId: number;
|
|
21
|
+
controlCentreId: number | null;
|
|
22
|
+
appId: string | null;
|
|
23
|
+
countryCode: string | null;
|
|
24
|
+
status: SafetyCheckStatus;
|
|
25
|
+
reasonLabel: string;
|
|
26
|
+
durationMinutes: number;
|
|
27
|
+
startedAt: string;
|
|
28
|
+
scheduledCheckInAt: string;
|
|
29
|
+
promptStartedAt: string | null;
|
|
30
|
+
promptDeadlineAt: string | null;
|
|
31
|
+
endedAt: string | null;
|
|
32
|
+
notifyGuardiansOnStartEnd: boolean;
|
|
33
|
+
guardianAudience: GuardianAudience;
|
|
34
|
+
sosTrigger: SafetyCheckSosTrigger | null;
|
|
35
|
+
incidentId: number | null;
|
|
36
|
+
}
|