grm-shared-library 1.1.195 → 1.1.196
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/kafka/topics.js +3 -0
- package/dist/cjs/kafka/topics.js.map +1 -1
- 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/partner/constants/partner-defaults.const.js +74 -0
- package/dist/cjs/modules/partner/constants/partner-defaults.const.js.map +1 -0
- package/dist/cjs/modules/partner/constants/partner-kafka.const.js +20 -0
- package/dist/cjs/modules/partner/constants/partner-kafka.const.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/create-partner-coverage-rule.dto.js +101 -0
- package/dist/cjs/modules/partner/dtos/create-partner-coverage-rule.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/create-partner-integration.dto.js +178 -0
- package/dist/cjs/modules/partner/dtos/create-partner-integration.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/partner-dispatch-decision.dto.js +36 -0
- package/dist/cjs/modules/partner/dtos/partner-dispatch-decision.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/route-incident-to-partners.dto.js +230 -0
- package/dist/cjs/modules/partner/dtos/route-incident-to-partners.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/update-incident-partner-routing.dto.js +132 -0
- package/dist/cjs/modules/partner/dtos/update-incident-partner-routing.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/update-partner-coverage-rule.dto.js +9 -0
- package/dist/cjs/modules/partner/dtos/update-partner-coverage-rule.dto.js.map +1 -0
- package/dist/cjs/modules/partner/dtos/update-partner-integration.dto.js +15 -0
- package/dist/cjs/modules/partner/dtos/update-partner-integration.dto.js.map +1 -0
- package/dist/cjs/modules/partner/enums/incident-partner-routing-status.enum.js +30 -0
- package/dist/cjs/modules/partner/enums/incident-partner-routing-status.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-adapter-operation.enum.js +18 -0
- package/dist/cjs/modules/partner/enums/partner-adapter-operation.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-coverage-match-type.enum.js +23 -0
- package/dist/cjs/modules/partner/enums/partner-coverage-match-type.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-failure-reason.enum.js +51 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-failure-reason.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-scope.enum.js +21 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-scope.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-status.enum.js +52 -0
- package/dist/cjs/modules/partner/enums/partner-dispatch-status.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-integration-environment.enum.js +17 -0
- package/dist/cjs/modules/partner/enums/partner-integration-environment.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-integration-status.enum.js +23 -0
- package/dist/cjs/modules/partner/enums/partner-integration-status.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-location-provider.enum.js +20 -0
- package/dist/cjs/modules/partner/enums/partner-location-provider.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-provider-code.enum.js +28 -0
- package/dist/cjs/modules/partner/enums/partner-provider-code.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-routing-mode.enum.js +25 -0
- package/dist/cjs/modules/partner/enums/partner-routing-mode.enum.js.map +1 -0
- package/dist/cjs/modules/partner/enums/partner-service-capability.enum.js +29 -0
- package/dist/cjs/modules/partner/enums/partner-service-capability.enum.js.map +1 -0
- package/dist/cjs/modules/partner/index.js +55 -0
- package/dist/cjs/modules/partner/index.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/incident-partner-routing.js +3 -0
- package/dist/cjs/modules/partner/interfaces/incident-partner-routing.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-connection-test-result.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-connection-test-result.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-coverage-rule.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-coverage-rule.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch-events.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch-events.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch-location.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch-location.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-dispatch.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-emergency-contact.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-emergency-contact.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-integration.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-integration.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-provider-descriptor.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-provider-descriptor.js.map +1 -0
- package/dist/cjs/modules/partner/interfaces/partner-routing-result.js +3 -0
- package/dist/cjs/modules/partner/interfaces/partner-routing-result.js.map +1 -0
- package/dist/cjs/modules/partner/utils/partner-payload.util.js +116 -0
- package/dist/cjs/modules/partner/utils/partner-payload.util.js.map +1 -0
- package/dist/cjs/modules/partner/utils/partner-routing.util.js +137 -0
- package/dist/cjs/modules/partner/utils/partner-routing.util.js.map +1 -0
- package/dist/cjs/modules/permission/data/permissions.data.js +5 -1
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- 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/role/data/roles.data.js +26 -0
- package/dist/cjs/modules/role/data/roles.data.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 +3 -0
- package/dist/esm/kafka/topics.js.map +1 -1
- 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/partner/constants/partner-defaults.const.js +71 -0
- package/dist/esm/modules/partner/constants/partner-defaults.const.js.map +1 -0
- package/dist/esm/modules/partner/constants/partner-kafka.const.js +17 -0
- package/dist/esm/modules/partner/constants/partner-kafka.const.js.map +1 -0
- package/dist/esm/modules/partner/dtos/create-partner-coverage-rule.dto.js +97 -0
- package/dist/esm/modules/partner/dtos/create-partner-coverage-rule.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/create-partner-integration.dto.js +174 -0
- package/dist/esm/modules/partner/dtos/create-partner-integration.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/partner-dispatch-decision.dto.js +32 -0
- package/dist/esm/modules/partner/dtos/partner-dispatch-decision.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/route-incident-to-partners.dto.js +224 -0
- package/dist/esm/modules/partner/dtos/route-incident-to-partners.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/update-incident-partner-routing.dto.js +127 -0
- package/dist/esm/modules/partner/dtos/update-incident-partner-routing.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/update-partner-coverage-rule.dto.js +5 -0
- package/dist/esm/modules/partner/dtos/update-partner-coverage-rule.dto.js.map +1 -0
- package/dist/esm/modules/partner/dtos/update-partner-integration.dto.js +11 -0
- package/dist/esm/modules/partner/dtos/update-partner-integration.dto.js.map +1 -0
- package/dist/esm/modules/partner/enums/incident-partner-routing-status.enum.js +27 -0
- package/dist/esm/modules/partner/enums/incident-partner-routing-status.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-adapter-operation.enum.js +15 -0
- package/dist/esm/modules/partner/enums/partner-adapter-operation.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-coverage-match-type.enum.js +20 -0
- package/dist/esm/modules/partner/enums/partner-coverage-match-type.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-failure-reason.enum.js +48 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-failure-reason.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-scope.enum.js +18 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-scope.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-status.enum.js +49 -0
- package/dist/esm/modules/partner/enums/partner-dispatch-status.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-integration-environment.enum.js +14 -0
- package/dist/esm/modules/partner/enums/partner-integration-environment.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-integration-status.enum.js +20 -0
- package/dist/esm/modules/partner/enums/partner-integration-status.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-location-provider.enum.js +17 -0
- package/dist/esm/modules/partner/enums/partner-location-provider.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-provider-code.enum.js +25 -0
- package/dist/esm/modules/partner/enums/partner-provider-code.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-routing-mode.enum.js +22 -0
- package/dist/esm/modules/partner/enums/partner-routing-mode.enum.js.map +1 -0
- package/dist/esm/modules/partner/enums/partner-service-capability.enum.js +26 -0
- package/dist/esm/modules/partner/enums/partner-service-capability.enum.js.map +1 -0
- package/dist/esm/modules/partner/index.js +39 -0
- package/dist/esm/modules/partner/index.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/incident-partner-routing.js +2 -0
- package/dist/esm/modules/partner/interfaces/incident-partner-routing.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-connection-test-result.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-connection-test-result.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-coverage-rule.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-coverage-rule.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch-events.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch-events.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch-location.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch-location.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-dispatch.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-emergency-contact.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-emergency-contact.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-integration.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-integration.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-provider-descriptor.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-provider-descriptor.js.map +1 -0
- package/dist/esm/modules/partner/interfaces/partner-routing-result.js +2 -0
- package/dist/esm/modules/partner/interfaces/partner-routing-result.js.map +1 -0
- package/dist/esm/modules/partner/utils/partner-payload.util.js +109 -0
- package/dist/esm/modules/partner/utils/partner-payload.util.js.map +1 -0
- package/dist/esm/modules/partner/utils/partner-routing.util.js +127 -0
- package/dist/esm/modules/partner/utils/partner-routing.util.js.map +1 -0
- package/dist/esm/modules/permission/data/permissions.data.js +5 -1
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- 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/role/data/roles.data.js +26 -0
- package/dist/esm/modules/role/data/roles.data.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/kafka/topics.d.ts +2 -0
- package/dist/types/modules/common/constants/service.const.d.ts +4 -0
- package/dist/types/modules/partner/constants/partner-defaults.const.d.ts +60 -0
- package/dist/types/modules/partner/constants/partner-kafka.const.d.ts +16 -0
- package/dist/types/modules/partner/dtos/create-partner-coverage-rule.dto.d.ts +24 -0
- package/dist/types/modules/partner/dtos/create-partner-integration.dto.d.ts +31 -0
- package/dist/types/modules/partner/dtos/partner-dispatch-decision.dto.d.ts +11 -0
- package/dist/types/modules/partner/dtos/route-incident-to-partners.dto.d.ts +52 -0
- package/dist/types/modules/partner/dtos/update-incident-partner-routing.dto.d.ts +34 -0
- package/dist/types/modules/partner/dtos/update-partner-coverage-rule.dto.d.ts +5 -0
- package/dist/types/modules/partner/dtos/update-partner-integration.dto.d.ts +11 -0
- package/dist/types/modules/partner/enums/incident-partner-routing-status.enum.d.ts +25 -0
- package/dist/types/modules/partner/enums/partner-adapter-operation.enum.d.ts +13 -0
- package/dist/types/modules/partner/enums/partner-coverage-match-type.enum.d.ts +18 -0
- package/dist/types/modules/partner/enums/partner-dispatch-failure-reason.enum.d.ts +37 -0
- package/dist/types/modules/partner/enums/partner-dispatch-scope.enum.d.ts +16 -0
- package/dist/types/modules/partner/enums/partner-dispatch-status.enum.d.ts +37 -0
- package/dist/types/modules/partner/enums/partner-integration-environment.enum.d.ts +12 -0
- package/dist/types/modules/partner/enums/partner-integration-status.enum.d.ts +18 -0
- package/dist/types/modules/partner/enums/partner-location-provider.enum.d.ts +15 -0
- package/dist/types/modules/partner/enums/partner-provider-code.enum.d.ts +23 -0
- package/dist/types/modules/partner/enums/partner-routing-mode.enum.d.ts +20 -0
- package/dist/types/modules/partner/enums/partner-service-capability.enum.d.ts +24 -0
- package/dist/types/modules/partner/index.d.ts +33 -0
- package/dist/types/modules/partner/interfaces/incident-partner-routing.d.ts +43 -0
- package/dist/types/modules/partner/interfaces/partner-connection-test-result.d.ts +22 -0
- package/dist/types/modules/partner/interfaces/partner-coverage-rule.d.ts +36 -0
- package/dist/types/modules/partner/interfaces/partner-dispatch-events.d.ts +40 -0
- package/dist/types/modules/partner/interfaces/partner-dispatch-location.d.ts +13 -0
- package/dist/types/modules/partner/interfaces/partner-dispatch.d.ts +119 -0
- package/dist/types/modules/partner/interfaces/partner-emergency-contact.d.ts +15 -0
- package/dist/types/modules/partner/interfaces/partner-integration.d.ts +63 -0
- package/dist/types/modules/partner/interfaces/partner-provider-descriptor.d.ts +56 -0
- package/dist/types/modules/partner/interfaces/partner-routing-result.d.ts +24 -0
- package/dist/types/modules/partner/utils/partner-payload.util.d.ts +49 -0
- package/dist/types/modules/partner/utils/partner-routing.util.d.ts +71 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a dispatch did not reach its partner.
|
|
3
|
+
*
|
|
4
|
+
* Split into two families that the retry policy treats very differently:
|
|
5
|
+
* transient reasons are retried on a backoff, permanent ones fail the dispatch
|
|
6
|
+
* immediately so an operator sees the truth instead of a spinner.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum PartnerDispatchFailureReason {
|
|
9
|
+
/** The partner rejected the request body (HTTP 400). Permanent. */
|
|
10
|
+
INVALID_PAYLOAD = "INVALID_PAYLOAD",
|
|
11
|
+
/** The incident lacks something the partner requires (phone, location). Permanent. */
|
|
12
|
+
MISSING_REQUIRED_FIELD = "MISSING_REQUIRED_FIELD",
|
|
13
|
+
/** The partner refused the credentials (HTTP 401). Permanent after one re-auth. */
|
|
14
|
+
AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
|
|
15
|
+
/** The partner account lacks the requested feature (HTTP 403). Permanent. */
|
|
16
|
+
FEATURE_NOT_ENABLED = "FEATURE_NOT_ENABLED",
|
|
17
|
+
/** The partner said no for a business reason (HTTP 409/422). Permanent. */
|
|
18
|
+
PROVIDER_REJECTED = "PROVIDER_REJECTED",
|
|
19
|
+
/** No adapter is registered for the partnership's provider code. Permanent. */
|
|
20
|
+
ADAPTER_NOT_SUPPORTED = "ADAPTER_NOT_SUPPORTED",
|
|
21
|
+
/** The partnership was disabled or its routing mode turned off mid-flight. Permanent. */
|
|
22
|
+
INTEGRATION_DISABLED = "INTEGRATION_DISABLED",
|
|
23
|
+
/** The configured credential could not be resolved from the secret store. Transient. */
|
|
24
|
+
CREDENTIAL_UNAVAILABLE = "CREDENTIAL_UNAVAILABLE",
|
|
25
|
+
/** The partner was rate limiting (HTTP 429). Transient. */
|
|
26
|
+
RATE_LIMITED = "RATE_LIMITED",
|
|
27
|
+
/** The partner errored (HTTP 5xx). Transient. */
|
|
28
|
+
PROVIDER_UNAVAILABLE = "PROVIDER_UNAVAILABLE",
|
|
29
|
+
/** The request timed out or the network failed. Transient. */
|
|
30
|
+
TIMEOUT = "TIMEOUT",
|
|
31
|
+
/** Every transient retry was used up. Terminal. */
|
|
32
|
+
MAX_ATTEMPTS_EXCEEDED = "MAX_ATTEMPTS_EXCEEDED",
|
|
33
|
+
/** Anything the list above does not describe. Treated as transient. */
|
|
34
|
+
UNKNOWN = "UNKNOWN"
|
|
35
|
+
}
|
|
36
|
+
/** Failure reasons that must NOT be retried - retrying them cannot succeed. */
|
|
37
|
+
export declare const PERMANENT_PARTNER_DISPATCH_FAILURE_REASONS: readonly PartnerDispatchFailureReason[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List filter for the admin "partner routing" views, in the same shape as the
|
|
3
|
+
* entitlement and alert-dispatch scopes already used by the incident list.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum PartnerDispatchScope {
|
|
6
|
+
/** No filter. */
|
|
7
|
+
ALL = "ALL",
|
|
8
|
+
/** Incidents a partner was asked to attend (any status other than NOT_ROUTED). */
|
|
9
|
+
ROUTED = "ROUTED",
|
|
10
|
+
/** Incidents currently waiting on a manual routing decision. */
|
|
11
|
+
AWAITING_APPROVAL = "AWAITING_APPROVAL",
|
|
12
|
+
/** Incidents whose partner routing failed outright. */
|
|
13
|
+
FAILED = "FAILED",
|
|
14
|
+
/** Incidents no partnership covered. */
|
|
15
|
+
NOT_ROUTED = "NOT_ROUTED"
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle of one incident's routing to one partner.
|
|
3
|
+
*
|
|
4
|
+
* Terminal states are SENT/ACKNOWLEDGED (the partner has the emergency),
|
|
5
|
+
* FAILED, REJECTED, CANCELLED and EXPIRED. Everything else is in flight.
|
|
6
|
+
*
|
|
7
|
+
* MANUAL routing starts at PENDING_APPROVAL and reaches QUEUED only when an
|
|
8
|
+
* operator approves; declining gives REJECTED, withdrawing gives CANCELLED and
|
|
9
|
+
* letting the approval window elapse gives EXPIRED. AUTO routing starts at
|
|
10
|
+
* QUEUED directly. QUEUED -> SENDING -> SENT on success, or back to QUEUED for a
|
|
11
|
+
* transient retry, or FAILED when the failure is permanent or the attempts run
|
|
12
|
+
* out. SENT -> ACKNOWLEDGED when the partner later reports progress.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum PartnerDispatchStatus {
|
|
15
|
+
/** MANUAL routing: waiting for the organization to confirm or decline. */
|
|
16
|
+
PENDING_APPROVAL = "PENDING_APPROVAL",
|
|
17
|
+
/** Cleared to send - either AUTO, or approved - and waiting for a send attempt. */
|
|
18
|
+
QUEUED = "QUEUED",
|
|
19
|
+
/** A send attempt is in flight. */
|
|
20
|
+
SENDING = "SENDING",
|
|
21
|
+
/** The partner accepted the request and returned its own reference. */
|
|
22
|
+
SENT = "SENT",
|
|
23
|
+
/** The partner has since confirmed progress on the request (status callback). */
|
|
24
|
+
ACKNOWLEDGED = "ACKNOWLEDGED",
|
|
25
|
+
/** Permanently failed - rejected by the partner, or out of attempts. */
|
|
26
|
+
FAILED = "FAILED",
|
|
27
|
+
/** Declined by the organization instead of being sent. */
|
|
28
|
+
REJECTED = "REJECTED",
|
|
29
|
+
/** Withdrawn by the organization (before or after approval, never after SENT). */
|
|
30
|
+
CANCELLED = "CANCELLED",
|
|
31
|
+
/** The manual-approval window elapsed with no decision. */
|
|
32
|
+
EXPIRED = "EXPIRED"
|
|
33
|
+
}
|
|
34
|
+
/** Statuses from which no further transition happens. */
|
|
35
|
+
export declare const TERMINAL_PARTNER_DISPATCH_STATUSES: readonly PartnerDispatchStatus[];
|
|
36
|
+
/** Statuses that mean the partner is (or should shortly be) working the emergency. */
|
|
37
|
+
export declare const DELIVERED_PARTNER_DISPATCH_STATUSES: readonly PartnerDispatchStatus[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of a partner's environments a partnership points at.
|
|
3
|
+
*
|
|
4
|
+
* Kept explicit — and part of the uniqueness key of a partnership — so an
|
|
5
|
+
* organization can hold a sandbox and a production integration with the same
|
|
6
|
+
* partner side by side, and so a dispatch record always says which one an
|
|
7
|
+
* emergency was actually sent to.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum PartnerIntegrationEnvironment {
|
|
10
|
+
SANDBOX = "SANDBOX",
|
|
11
|
+
PRODUCTION = "PRODUCTION"
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last known health of a partnership's connection to its partner, refreshed by
|
|
3
|
+
* explicit connection tests and by the outcome of real dispatches.
|
|
4
|
+
*
|
|
5
|
+
* Advisory only: it is never consulted to decide whether to attempt a dispatch —
|
|
6
|
+
* an emergency is always attempted against a live partner, whatever the last
|
|
7
|
+
* probe said.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum PartnerIntegrationStatus {
|
|
10
|
+
/** Never probed, or probed before the last configuration change. */
|
|
11
|
+
UNKNOWN = "UNKNOWN",
|
|
12
|
+
/** Last probe or dispatch succeeded. */
|
|
13
|
+
HEALTHY = "HEALTHY",
|
|
14
|
+
/** Reachable but erroring — e.g. authentication succeeds, dispatches reject. */
|
|
15
|
+
DEGRADED = "DEGRADED",
|
|
16
|
+
/** Last probe or dispatch could not reach the partner at all. */
|
|
17
|
+
UNREACHABLE = "UNREACHABLE"
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the location attached to a partner dispatch was obtained.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the vocabulary emergency-service APIs expect (Rescue.co among them)
|
|
5
|
+
* and is derived from the incident's reporting channel rather than asked for -
|
|
6
|
+
* see `mapChannelToLocationProvider`.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum PartnerLocationProvider {
|
|
9
|
+
/** A satellite fix. */
|
|
10
|
+
GPS = "GPS",
|
|
11
|
+
/** Derived from cell/Wi-Fi network positioning, or entered by an operator. */
|
|
12
|
+
NETWORK = "NETWORK",
|
|
13
|
+
/** A platform fused-location fix combining GPS, network and sensors. */
|
|
14
|
+
FUSED = "FUSED"
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifies the third-party service partner an organization has integrated
|
|
3
|
+
* with.
|
|
4
|
+
*
|
|
5
|
+
* Provider-neutral by design: the partnership model, coverage rules, dispatch
|
|
6
|
+
* records, audit trail and REST surface in clarion-partner-services never branch
|
|
7
|
+
* on a specific partner — only the per-provider adapter inside that service
|
|
8
|
+
* understands a partner's wire format, authentication and payload shape.
|
|
9
|
+
*
|
|
10
|
+
* Only {@link PartnerProviderCode.RESCUE_CO} has a working adapter today. The
|
|
11
|
+
* remaining values are reserved so a new partner can be added without changing
|
|
12
|
+
* the shared contracts, database columns or Kafka events.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum PartnerProviderCode {
|
|
15
|
+
/** Rescue.co — ambulance / emergency medical response (Kenya). */
|
|
16
|
+
RESCUE_CO = "RESCUE_CO",
|
|
17
|
+
/** AAR Healthcare emergency medical response (reserved — no adapter yet). */
|
|
18
|
+
AAR = "AAR",
|
|
19
|
+
/** St John Ambulance (reserved — no adapter yet). */
|
|
20
|
+
ST_JOHN = "ST_JOHN",
|
|
21
|
+
/** Generic REST partner driven purely by configuration (reserved). */
|
|
22
|
+
GENERIC_REST = "GENERIC_REST"
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an incident that a partnership covers reaches the partner.
|
|
3
|
+
*
|
|
4
|
+
* The distinction is deliberately a stored fact rather than a runtime policy:
|
|
5
|
+
* an organization that wants a human in the loop before an ambulance is
|
|
6
|
+
* requested on its behalf sets MANUAL, and every covered incident then waits in
|
|
7
|
+
* PENDING_APPROVAL until an operator confirms it.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum PartnerRoutingMode {
|
|
10
|
+
/** Send to the partner as soon as the incident is created. */
|
|
11
|
+
AUTO = "AUTO",
|
|
12
|
+
/** Hold for explicit confirmation by the organization before sending. */
|
|
13
|
+
MANUAL = "MANUAL",
|
|
14
|
+
/**
|
|
15
|
+
* Keep the configuration but route nothing. Distinct from deleting the
|
|
16
|
+
* partnership (which loses its coverage rules and history) and from
|
|
17
|
+
* `enabled = false` (which is the operational kill switch).
|
|
18
|
+
*/
|
|
19
|
+
DISABLED = "DISABLED"
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class of emergency service a partner can be asked to provide.
|
|
3
|
+
*
|
|
4
|
+
* A partnership declares which capabilities it buys from a partner, and every
|
|
5
|
+
* coverage rule names the capability an incident should be routed for. This is
|
|
6
|
+
* what makes "GardaWorld sends medical incidents to Rescue.co" expressible
|
|
7
|
+
* without either side hard-coding the other.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum PartnerServiceCapability {
|
|
10
|
+
/** Ground ambulance dispatch to a scene. */
|
|
11
|
+
AMBULANCE = "AMBULANCE",
|
|
12
|
+
/** Air or long-distance medical evacuation. */
|
|
13
|
+
MEDICAL_EVACUATION = "MEDICAL_EVACUATION",
|
|
14
|
+
/** Fire and rescue response. */
|
|
15
|
+
FIRE_RESPONSE = "FIRE_RESPONSE",
|
|
16
|
+
/** Armed or unarmed security response to a scene. */
|
|
17
|
+
SECURITY_RESPONSE = "SECURITY_RESPONSE",
|
|
18
|
+
/** Roadside/breakdown assistance. */
|
|
19
|
+
ROADSIDE_ASSISTANCE = "ROADSIDE_ASSISTANCE",
|
|
20
|
+
/** Vehicle recovery / towing. */
|
|
21
|
+
TOWING = "TOWING",
|
|
22
|
+
/** Anything the list above does not describe. */
|
|
23
|
+
OTHER = "OTHER"
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './enums/partner-provider-code.enum';
|
|
2
|
+
export * from './enums/partner-service-capability.enum';
|
|
3
|
+
export * from './enums/partner-routing-mode.enum';
|
|
4
|
+
export * from './enums/partner-integration-environment.enum';
|
|
5
|
+
export * from './enums/partner-integration-status.enum';
|
|
6
|
+
export * from './enums/partner-coverage-match-type.enum';
|
|
7
|
+
export * from './enums/partner-dispatch-status.enum';
|
|
8
|
+
export * from './enums/partner-dispatch-failure-reason.enum';
|
|
9
|
+
export * from './enums/partner-location-provider.enum';
|
|
10
|
+
export * from './enums/partner-adapter-operation.enum';
|
|
11
|
+
export * from './enums/incident-partner-routing-status.enum';
|
|
12
|
+
export * from './enums/partner-dispatch-scope.enum';
|
|
13
|
+
export * from './interfaces/partner-provider-descriptor';
|
|
14
|
+
export * from './interfaces/partner-integration';
|
|
15
|
+
export * from './interfaces/partner-coverage-rule';
|
|
16
|
+
export * from './interfaces/partner-dispatch-location';
|
|
17
|
+
export * from './interfaces/partner-emergency-contact';
|
|
18
|
+
export * from './interfaces/partner-dispatch';
|
|
19
|
+
export * from './interfaces/incident-partner-routing';
|
|
20
|
+
export * from './interfaces/partner-routing-result';
|
|
21
|
+
export * from './interfaces/partner-connection-test-result';
|
|
22
|
+
export * from './interfaces/partner-dispatch-events';
|
|
23
|
+
export * from './constants/partner-defaults.const';
|
|
24
|
+
export * from './constants/partner-kafka.const';
|
|
25
|
+
export * from './dtos/create-partner-integration.dto';
|
|
26
|
+
export * from './dtos/update-partner-integration.dto';
|
|
27
|
+
export * from './dtos/create-partner-coverage-rule.dto';
|
|
28
|
+
export * from './dtos/update-partner-coverage-rule.dto';
|
|
29
|
+
export * from './dtos/route-incident-to-partners.dto';
|
|
30
|
+
export * from './dtos/partner-dispatch-decision.dto';
|
|
31
|
+
export * from './dtos/update-incident-partner-routing.dto';
|
|
32
|
+
export * from './utils/partner-routing.util';
|
|
33
|
+
export * from './utils/partner-payload.util';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IncidentPartnerRoutingStatus } from '../enums/incident-partner-routing-status.enum';
|
|
2
|
+
import { PartnerDispatchStatus } from '../enums/partner-dispatch-status.enum';
|
|
3
|
+
import { PartnerProviderCode } from '../enums/partner-provider-code.enum';
|
|
4
|
+
import { PartnerRoutingMode } from '../enums/partner-routing-mode.enum';
|
|
5
|
+
import { PartnerServiceCapability } from '../enums/partner-service-capability.enum';
|
|
6
|
+
/** One partner's leg of an incident's routing, as recorded on the incident. */
|
|
7
|
+
export interface IncidentPartnerRoutingEntry {
|
|
8
|
+
integrationId: number;
|
|
9
|
+
providerCode: PartnerProviderCode;
|
|
10
|
+
/** Operator-facing partnership name, so the control room needs no extra lookup. */
|
|
11
|
+
providerName?: string | null;
|
|
12
|
+
capability: PartnerServiceCapability;
|
|
13
|
+
routingMode: PartnerRoutingMode;
|
|
14
|
+
dispatchId: number;
|
|
15
|
+
dispatchReference: string;
|
|
16
|
+
status: PartnerDispatchStatus;
|
|
17
|
+
/** The partner's own reference once it has accepted the request. */
|
|
18
|
+
partnerReference?: string | null;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The third-party routing summary stored on an incident in clarion-incident.
|
|
23
|
+
*
|
|
24
|
+
* A denormalized read model, owned and pushed by clarion-partner-services: it
|
|
25
|
+
* lets the control room show and filter "was an ambulance called?" from the
|
|
26
|
+
* incident row alone, while clarion-partner-services stays the source of truth
|
|
27
|
+
* for the dispatches themselves.
|
|
28
|
+
*/
|
|
29
|
+
export interface IncidentPartnerRoutingSnapshot {
|
|
30
|
+
status: IncidentPartnerRoutingStatus;
|
|
31
|
+
/** When the routing decision this snapshot describes was made. */
|
|
32
|
+
evaluatedAt: string;
|
|
33
|
+
/** Partnerships considered for this incident, matched or not. */
|
|
34
|
+
consideredIntegrationCount: number;
|
|
35
|
+
entries: IncidentPartnerRoutingEntry[];
|
|
36
|
+
/**
|
|
37
|
+
* True when the snapshot was produced without a live answer from
|
|
38
|
+
* clarion-partner-services (the caller's fail-open default applied). An
|
|
39
|
+
* emergency is never blocked on partner routing, so this is expected to
|
|
40
|
+
* appear during a partner-services outage and is reconciled afterwards.
|
|
41
|
+
*/
|
|
42
|
+
degraded?: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PartnerIntegrationStatus } from '../enums/partner-integration-status.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Outcome of a non-mutating probe against a partnership - the "test connection"
|
|
4
|
+
* button in the admin UI.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately never creates a real emergency: an adapter's probe authenticates
|
|
7
|
+
* and calls the partner's health endpoint, nothing more.
|
|
8
|
+
*/
|
|
9
|
+
export interface PartnerConnectionTestResult {
|
|
10
|
+
integrationId: number;
|
|
11
|
+
status: PartnerIntegrationStatus;
|
|
12
|
+
success: boolean;
|
|
13
|
+
/** True when the stored credential was accepted by the partner. */
|
|
14
|
+
authenticated: boolean;
|
|
15
|
+
/** The partner's reported service version/name, when it publishes one. */
|
|
16
|
+
partnerServiceVersion?: string | null;
|
|
17
|
+
latencyMs: number;
|
|
18
|
+
checkedAt: string;
|
|
19
|
+
errorCode?: string | null;
|
|
20
|
+
/** Sanitized. Never contains a credential or token. */
|
|
21
|
+
errorMessage?: string | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IncidentEmergencyType } from '../../incident/enums/incident-emergency-type.enum';
|
|
2
|
+
import { PartnerCoverageMatchType } from '../enums/partner-coverage-match-type.enum';
|
|
3
|
+
import { PartnerRoutingMode } from '../enums/partner-routing-mode.enum';
|
|
4
|
+
import { PartnerServiceCapability } from '../enums/partner-service-capability.enum';
|
|
5
|
+
/**
|
|
6
|
+
* One "this kind of incident goes to this partner" statement.
|
|
7
|
+
*
|
|
8
|
+
* A partnership holds many rules and an incident is covered if ANY rule matches
|
|
9
|
+
* it. Rules are evaluated in `priority` order (ascending), and the first match
|
|
10
|
+
* decides the capability and routing mode used for the dispatch.
|
|
11
|
+
*/
|
|
12
|
+
export interface PartnerCoverageRule {
|
|
13
|
+
id: number;
|
|
14
|
+
integrationId: number;
|
|
15
|
+
/** Denormalized from the partnership so tenant scoping never needs a join. */
|
|
16
|
+
organizationId: number;
|
|
17
|
+
matchType: PartnerCoverageMatchType;
|
|
18
|
+
/** Set when `matchType` is INCIDENT_TYPE - a `types` row in clarion-incident. */
|
|
19
|
+
incidentTypeId?: number | null;
|
|
20
|
+
/** Set when `matchType` is INCIDENT_CATEGORY - a `categories` row in clarion-incident. */
|
|
21
|
+
incidentCategoryId?: number | null;
|
|
22
|
+
/** Set when `matchType` is EMERGENCY_TYPE. */
|
|
23
|
+
emergencyType?: IncidentEmergencyType | null;
|
|
24
|
+
/** The service the partner is asked for when this rule matches. */
|
|
25
|
+
capability: PartnerServiceCapability;
|
|
26
|
+
/** Overrides the partnership routing mode for incidents this rule matches. */
|
|
27
|
+
routingModeOverride?: PartnerRoutingMode | null;
|
|
28
|
+
priority: number;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
/** Free-text note for whoever configured it. */
|
|
31
|
+
notes?: string | null;
|
|
32
|
+
createdBy?: number | null;
|
|
33
|
+
updatedBy?: number | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PartnerDispatchFailureReason } from '../enums/partner-dispatch-failure-reason.enum';
|
|
2
|
+
import { PartnerDispatchStatus } from '../enums/partner-dispatch-status.enum';
|
|
3
|
+
import { PartnerProviderCode } from '../enums/partner-provider-code.enum';
|
|
4
|
+
import { PartnerRoutingMode } from '../enums/partner-routing-mode.enum';
|
|
5
|
+
import { PartnerServiceCapability } from '../enums/partner-service-capability.enum';
|
|
6
|
+
/**
|
|
7
|
+
* Canonical Kafka contract for partner dispatch lifecycle, produced by
|
|
8
|
+
* clarion-partner-services.
|
|
9
|
+
*
|
|
10
|
+
* Secret-free by construction: no credential, no token, no raw partner
|
|
11
|
+
* response - only the identifiers a consumer needs to notify an operator, drive
|
|
12
|
+
* a live admin view or reconcile afterwards. Versioned in the topic name so a
|
|
13
|
+
* later shape change never breaks an existing consumer.
|
|
14
|
+
*/
|
|
15
|
+
export interface PartnerDispatchEventV1 {
|
|
16
|
+
/** Deterministic id, so a consumer can dedupe a redelivered message. */
|
|
17
|
+
eventId: string;
|
|
18
|
+
/** ISO-8601 instant the event was produced. */
|
|
19
|
+
occurredAt: string;
|
|
20
|
+
organizationId: number;
|
|
21
|
+
controlCentreId?: number | null;
|
|
22
|
+
incidentId: number;
|
|
23
|
+
dispatchId: number;
|
|
24
|
+
dispatchReference: string;
|
|
25
|
+
integrationId: number;
|
|
26
|
+
providerCode: PartnerProviderCode;
|
|
27
|
+
/** Operator-facing partnership name. */
|
|
28
|
+
providerName?: string | null;
|
|
29
|
+
capability: PartnerServiceCapability;
|
|
30
|
+
routingMode: PartnerRoutingMode;
|
|
31
|
+
status: PartnerDispatchStatus;
|
|
32
|
+
/** The status the dispatch moved from. Absent on the created event. */
|
|
33
|
+
previousStatus?: PartnerDispatchStatus | null;
|
|
34
|
+
failureReason?: PartnerDispatchFailureReason | null;
|
|
35
|
+
/** The partner's own reference, once it has accepted the request. */
|
|
36
|
+
partnerReference?: string | null;
|
|
37
|
+
/** Set on approve / reject / cancel, so a consumer can attribute the decision. */
|
|
38
|
+
actorUserId?: number | null;
|
|
39
|
+
countryCode: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PartnerLocationProvider } from '../enums/partner-location-provider.enum';
|
|
2
|
+
/** Where the emergency is, in the shape partner APIs expect. */
|
|
3
|
+
export interface PartnerDispatchLocation {
|
|
4
|
+
/** Decimal degrees, -90..90. */
|
|
5
|
+
latitude: number;
|
|
6
|
+
/** Decimal degrees, -180..180. */
|
|
7
|
+
longitude: number;
|
|
8
|
+
/** ISO-8601 instant the fix was taken - the incident's creation time. */
|
|
9
|
+
measuredAt: string;
|
|
10
|
+
provider: PartnerLocationProvider;
|
|
11
|
+
/** Reverse-geocoded or operator-entered street address, when known. */
|
|
12
|
+
address?: string | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { CountryCode } from '../../country/enums/country-code.enum';
|
|
2
|
+
import { PartnerAdapterOperation } from '../enums/partner-adapter-operation.enum';
|
|
3
|
+
import { PartnerDispatchFailureReason } from '../enums/partner-dispatch-failure-reason.enum';
|
|
4
|
+
import { PartnerDispatchStatus } from '../enums/partner-dispatch-status.enum';
|
|
5
|
+
import { PartnerProviderCode } from '../enums/partner-provider-code.enum';
|
|
6
|
+
import { PartnerRoutingMode } from '../enums/partner-routing-mode.enum';
|
|
7
|
+
import { PartnerServiceCapability } from '../enums/partner-service-capability.enum';
|
|
8
|
+
import { PartnerDispatchLocation } from './partner-dispatch-location';
|
|
9
|
+
import { PartnerEmergencyContact } from './partner-emergency-contact';
|
|
10
|
+
/**
|
|
11
|
+
* The incident facts a dispatch was built from, frozen at routing time.
|
|
12
|
+
*
|
|
13
|
+
* Kept on the dispatch so an audit, a resend or a partner dispute can be settled
|
|
14
|
+
* without re-reading clarion-incident, whose row may have moved on (status
|
|
15
|
+
* changes, reassignment, redaction of an anonymous reporter).
|
|
16
|
+
*/
|
|
17
|
+
export interface PartnerDispatchIncidentSnapshot {
|
|
18
|
+
incidentId: number;
|
|
19
|
+
organizationId: number;
|
|
20
|
+
controlCentreId?: number | null;
|
|
21
|
+
incidentTypeId?: number | null;
|
|
22
|
+
incidentTypeName?: string | null;
|
|
23
|
+
incidentCategoryId?: number | null;
|
|
24
|
+
incidentCategoryName?: string | null;
|
|
25
|
+
emergencyType?: string | null;
|
|
26
|
+
incidentClass?: string | null;
|
|
27
|
+
channel?: string | null;
|
|
28
|
+
priority?: string | null;
|
|
29
|
+
description?: string | null;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
reporterName?: string | null;
|
|
32
|
+
/** E.164. Masked in logs, never in the stored snapshot. */
|
|
33
|
+
reporterPhoneNumber?: string | null;
|
|
34
|
+
reporterUserId?: number | null;
|
|
35
|
+
location?: PartnerDispatchLocation | null;
|
|
36
|
+
address?: string | null;
|
|
37
|
+
}
|
|
38
|
+
/** One outbound call made on a dispatch's behalf, success or failure. */
|
|
39
|
+
export interface PartnerDispatchAttempt {
|
|
40
|
+
id: number;
|
|
41
|
+
dispatchId: number;
|
|
42
|
+
attemptNumber: number;
|
|
43
|
+
operation: PartnerAdapterOperation;
|
|
44
|
+
/** Request URL with any query string masked. Never contains a credential. */
|
|
45
|
+
requestUrl: string;
|
|
46
|
+
httpStatus?: number | null;
|
|
47
|
+
success: boolean;
|
|
48
|
+
failureReason?: PartnerDispatchFailureReason | null;
|
|
49
|
+
errorCode?: string | null;
|
|
50
|
+
/** Sanitized partner message. Never contains a credential or token. */
|
|
51
|
+
errorMessage?: string | null;
|
|
52
|
+
durationMs: number;
|
|
53
|
+
/** Sanitized excerpt of the partner response, for support and disputes. */
|
|
54
|
+
responseSnapshot?: Record<string, unknown> | null;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* One incident's routing to one partnership: the decision, its approval state,
|
|
59
|
+
* the outbound result and the audit trail behind it.
|
|
60
|
+
*
|
|
61
|
+
* There is at most one dispatch per (incident, partnership) pair - enforced by a
|
|
62
|
+
* unique constraint - so a redelivered routing request, a retried HTTP call or a
|
|
63
|
+
* duplicated Kafka message can never summon two ambulances for one emergency.
|
|
64
|
+
*/
|
|
65
|
+
export interface PartnerDispatch {
|
|
66
|
+
id: number;
|
|
67
|
+
/** Stable external identifier, safe to quote to a partner or in a support ticket. */
|
|
68
|
+
dispatchReference: string;
|
|
69
|
+
organizationId: number;
|
|
70
|
+
controlCentreId?: number | null;
|
|
71
|
+
integrationId: number;
|
|
72
|
+
providerCode: PartnerProviderCode;
|
|
73
|
+
capability: PartnerServiceCapability;
|
|
74
|
+
/** The coverage rule that matched, when the dispatch came from automatic routing. */
|
|
75
|
+
coverageRuleId?: number | null;
|
|
76
|
+
incidentId: number;
|
|
77
|
+
incidentTypeId?: number | null;
|
|
78
|
+
incidentCategoryId?: number | null;
|
|
79
|
+
/** The mode actually applied, after any rule-level override. */
|
|
80
|
+
routingMode: PartnerRoutingMode;
|
|
81
|
+
status: PartnerDispatchStatus;
|
|
82
|
+
countryCode: CountryCode;
|
|
83
|
+
attemptCount: number;
|
|
84
|
+
maxAttempts: number;
|
|
85
|
+
/** When the retry job should next pick this dispatch up. */
|
|
86
|
+
nextAttemptAt?: string | null;
|
|
87
|
+
/** When an unapproved MANUAL dispatch expires. Null means never. */
|
|
88
|
+
approvalExpiresAt?: string | null;
|
|
89
|
+
approvedByUserId?: number | null;
|
|
90
|
+
approvedAt?: string | null;
|
|
91
|
+
rejectedByUserId?: number | null;
|
|
92
|
+
rejectedAt?: string | null;
|
|
93
|
+
cancelledByUserId?: number | null;
|
|
94
|
+
cancelledAt?: string | null;
|
|
95
|
+
/** Operator's stated reason for rejecting or cancelling. */
|
|
96
|
+
decisionReason?: string | null;
|
|
97
|
+
/** The partner's own identifier for the request, e.g. a Rescue.co SOS id. */
|
|
98
|
+
partnerReference?: string | null;
|
|
99
|
+
/** The partner's human-facing reference, e.g. an SOS number read out on a call. */
|
|
100
|
+
partnerNumber?: string | null;
|
|
101
|
+
/** The partner's own status string, passed through verbatim. */
|
|
102
|
+
partnerStatus?: string | null;
|
|
103
|
+
/** The sanitized body sent to the partner. Never contains a credential. */
|
|
104
|
+
requestPayload?: Record<string, unknown> | null;
|
|
105
|
+
/** The sanitized body the partner returned. */
|
|
106
|
+
responsePayload?: Record<string, unknown> | null;
|
|
107
|
+
failureReason?: PartnerDispatchFailureReason | null;
|
|
108
|
+
lastErrorCode?: string | null;
|
|
109
|
+
/** Sanitized. Never contains a credential or token. */
|
|
110
|
+
lastErrorMessage?: string | null;
|
|
111
|
+
incidentSnapshot: PartnerDispatchIncidentSnapshot;
|
|
112
|
+
emergencyContact?: PartnerEmergencyContact | null;
|
|
113
|
+
sentAt?: string | null;
|
|
114
|
+
completedAt?: string | null;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
updatedAt: string;
|
|
117
|
+
/** Present on the detail endpoint. */
|
|
118
|
+
attempts?: PartnerDispatchAttempt[];
|
|
119
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who a partner should call about the person in trouble.
|
|
3
|
+
*
|
|
4
|
+
* Resolved from the reporter's guardians in clarion-authentication: the primary
|
|
5
|
+
* guardian names the contact and supplies the relationship, and every guardian's
|
|
6
|
+
* number is offered so a partner that cannot reach the first can try the rest.
|
|
7
|
+
* Omitted entirely when the reporter has no guardians.
|
|
8
|
+
*/
|
|
9
|
+
export interface PartnerEmergencyContact {
|
|
10
|
+
emergencyContactName: string;
|
|
11
|
+
/** E.164 numbers, primary guardian first. Never empty when this object is present. */
|
|
12
|
+
phoneNumbers: string[];
|
|
13
|
+
/** e.g. `Spouse`. Free text, because partners do not share a relationship vocabulary. */
|
|
14
|
+
relationship?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CountryCode } from '../../country/enums/country-code.enum';
|
|
2
|
+
import { PartnerIntegrationEnvironment } from '../enums/partner-integration-environment.enum';
|
|
3
|
+
import { PartnerIntegrationStatus } from '../enums/partner-integration-status.enum';
|
|
4
|
+
import { PartnerProviderCode } from '../enums/partner-provider-code.enum';
|
|
5
|
+
import { PartnerRoutingMode } from '../enums/partner-routing-mode.enum';
|
|
6
|
+
import { PartnerServiceCapability } from '../enums/partner-service-capability.enum';
|
|
7
|
+
import { PartnerCoverageRule } from './partner-coverage-rule';
|
|
8
|
+
/**
|
|
9
|
+
* One organization's configured partnership with one third-party service
|
|
10
|
+
* partner - "GardaWorld sends medical emergencies to Rescue.co".
|
|
11
|
+
*
|
|
12
|
+
* This is the client-safe projection returned by the REST API. It deliberately
|
|
13
|
+
* has NO credential value: the stored credential reference names a secret
|
|
14
|
+
* resolved at runtime, and `credentialConfigured` is all a client is told.
|
|
15
|
+
*/
|
|
16
|
+
export interface PartnerIntegration {
|
|
17
|
+
id: number;
|
|
18
|
+
/** The Clarion tenant that owns the partnership. */
|
|
19
|
+
organizationId: number;
|
|
20
|
+
/** Narrows the partnership to a single control centre when set. */
|
|
21
|
+
controlCentreId?: number | null;
|
|
22
|
+
providerCode: PartnerProviderCode;
|
|
23
|
+
/** Operator-facing label, e.g. "Rescue.co Ambulance (Production)". */
|
|
24
|
+
name: string;
|
|
25
|
+
environment: PartnerIntegrationEnvironment;
|
|
26
|
+
/** Partner API base URL, e.g. https://api.rescue.co */
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
/** True when a credential reference is stored. The reference itself is never returned. */
|
|
29
|
+
credentialConfigured: boolean;
|
|
30
|
+
/** Provider-neutral, non-secret settings the adapter reads (e.g. the Rescue.co source). */
|
|
31
|
+
configuration: Record<string, unknown>;
|
|
32
|
+
/** Services bought from this partner. Coverage rules may only request these. */
|
|
33
|
+
capabilities: PartnerServiceCapability[];
|
|
34
|
+
/** Default routing mode; a coverage rule may override it. */
|
|
35
|
+
routingMode: PartnerRoutingMode;
|
|
36
|
+
/**
|
|
37
|
+
* Minutes a MANUAL dispatch may wait for a decision before it expires.
|
|
38
|
+
* Null means it never expires on its own.
|
|
39
|
+
*/
|
|
40
|
+
approvalWindowMinutes?: number | null;
|
|
41
|
+
/** Operational kill switch, independent of `routingMode`. */
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
/** Order in which partnerships are considered when several cover one incident. */
|
|
44
|
+
priority: number;
|
|
45
|
+
/** ISO 3166-1 alpha-2 country the partnership operates in. */
|
|
46
|
+
countryCode: CountryCode;
|
|
47
|
+
status: PartnerIntegrationStatus;
|
|
48
|
+
partnerContactName?: string | null;
|
|
49
|
+
partnerContactPhone?: string | null;
|
|
50
|
+
partnerContactEmail?: string | null;
|
|
51
|
+
lastHealthCheckAt?: string | null;
|
|
52
|
+
lastSuccessAt?: string | null;
|
|
53
|
+
lastErrorAt?: string | null;
|
|
54
|
+
lastErrorCode?: string | null;
|
|
55
|
+
/** Sanitized - never contains credentials or a raw partner response. */
|
|
56
|
+
lastErrorMessage?: string | null;
|
|
57
|
+
createdBy?: number | null;
|
|
58
|
+
updatedBy?: number | null;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
updatedAt: string;
|
|
61
|
+
/** Present on the detail endpoint. */
|
|
62
|
+
coverageRules?: PartnerCoverageRule[];
|
|
63
|
+
}
|