clarion-shared-types 1.0.99 → 1.0.101

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.
@@ -7,7 +7,7 @@
7
7
  * app is sent to.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AlertIntakeRejectionReason = exports.AlertIntakeWebhookVerification = exports.AlertIntakeRouteMatch = exports.AlertIntakeEmergencyPolicy = exports.AlertIntakeSecretSource = exports.AlertIntakeProvider = exports.AlertIntakeChannel = void 0;
10
+ exports.AlertIntakeScreeningDecision = exports.AlertIntakeScreeningStatus = exports.AlertIntakeScreeningSource = exports.AlertIntakeScreeningReason = exports.AlertIntakeMessageState = exports.AlertIntakeRejectionReason = exports.AlertIntakeWebhookVerification = exports.AlertIntakeRouteMatch = exports.AlertIntakeEmergencyPolicy = exports.AlertIntakeSecretSource = exports.AlertIntakeProvider = exports.AlertIntakeChannel = void 0;
11
11
  /** The channel a message arrived on. */
12
12
  var AlertIntakeChannel;
13
13
  (function (AlertIntakeChannel) {
@@ -94,4 +94,76 @@ var AlertIntakeRejectionReason;
94
94
  AlertIntakeRejectionReason["ORGANIZATION_INACTIVE"] = "ORGANIZATION_INACTIVE";
95
95
  AlertIntakeRejectionReason["RATE_LIMITED"] = "RATE_LIMITED";
96
96
  })(AlertIntakeRejectionReason || (exports.AlertIntakeRejectionReason = AlertIntakeRejectionReason = {}));
97
+ /**
98
+ * Where a stored message stands, as an operator reads it. Derived from the pipeline's
99
+ * processing status, retry schedule and rejection reason - not stored.
100
+ *
101
+ * QUEUED waiting for, or being worked on by, the pipeline
102
+ * RAISED became an incident
103
+ * RETRYING failed; another attempt is scheduled
104
+ * PARKED failed and will not be retried on its own: it ran out of attempts, or it
105
+ * has a `rejectionReason` (no organization, organization inactive)
106
+ * DUPLICATE the same sender repeating themselves; not raised
107
+ * FILTERED screened out as not a report (a greeting, a link, an advert); held for review
108
+ */
109
+ var AlertIntakeMessageState;
110
+ (function (AlertIntakeMessageState) {
111
+ AlertIntakeMessageState["QUEUED"] = "QUEUED";
112
+ AlertIntakeMessageState["RAISED"] = "RAISED";
113
+ AlertIntakeMessageState["RETRYING"] = "RETRYING";
114
+ AlertIntakeMessageState["PARKED"] = "PARKED";
115
+ AlertIntakeMessageState["DUPLICATE"] = "DUPLICATE";
116
+ AlertIntakeMessageState["FILTERED"] = "FILTERED";
117
+ })(AlertIntakeMessageState || (exports.AlertIntakeMessageState = AlertIntakeMessageState = {}));
118
+ /**
119
+ * Why a message was screened out instead of raised. Everything that arrives on a
120
+ * connection is kept: a screened message waits for a person to raise it or dismiss it.
121
+ *
122
+ * EMPTY nothing to read: no text, no file, no location
123
+ * SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
124
+ * UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
125
+ * GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
126
+ * LINK_ONLY a link and nothing else (a forwarded post or video)
127
+ * SPAM an advert, a promotion, a chain message, a scam
128
+ * OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
129
+ * TEST someone testing the number
130
+ */
131
+ var AlertIntakeScreeningReason;
132
+ (function (AlertIntakeScreeningReason) {
133
+ AlertIntakeScreeningReason["EMPTY"] = "EMPTY";
134
+ AlertIntakeScreeningReason["SYSTEM_EVENT"] = "SYSTEM_EVENT";
135
+ AlertIntakeScreeningReason["UNSUPPORTED_CONTENT"] = "UNSUPPORTED_CONTENT";
136
+ AlertIntakeScreeningReason["GREETING"] = "GREETING";
137
+ AlertIntakeScreeningReason["LINK_ONLY"] = "LINK_ONLY";
138
+ AlertIntakeScreeningReason["SPAM"] = "SPAM";
139
+ AlertIntakeScreeningReason["OFF_TOPIC"] = "OFF_TOPIC";
140
+ AlertIntakeScreeningReason["TEST"] = "TEST";
141
+ })(AlertIntakeScreeningReason || (exports.AlertIntakeScreeningReason = AlertIntakeScreeningReason = {}));
142
+ /** What decided a message was not a report: a fixed rule, or the AI screening model. */
143
+ var AlertIntakeScreeningSource;
144
+ (function (AlertIntakeScreeningSource) {
145
+ AlertIntakeScreeningSource["RULE"] = "RULE";
146
+ AlertIntakeScreeningSource["AI"] = "AI";
147
+ })(AlertIntakeScreeningSource || (exports.AlertIntakeScreeningSource = AlertIntakeScreeningSource = {}));
148
+ /**
149
+ * A screened message, from a reviewer's side.
150
+ *
151
+ * PENDING_REVIEW screened out; nobody has looked at it yet
152
+ * ELEVATED a person decided it IS a report: it was raised as an incident
153
+ * DISMISSED a person confirmed it is not a report
154
+ */
155
+ var AlertIntakeScreeningStatus;
156
+ (function (AlertIntakeScreeningStatus) {
157
+ AlertIntakeScreeningStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
158
+ AlertIntakeScreeningStatus["ELEVATED"] = "ELEVATED";
159
+ AlertIntakeScreeningStatus["DISMISSED"] = "DISMISSED";
160
+ })(AlertIntakeScreeningStatus || (exports.AlertIntakeScreeningStatus = AlertIntakeScreeningStatus = {}));
161
+ /** A reviewer's decision on screened messages. */
162
+ var AlertIntakeScreeningDecision;
163
+ (function (AlertIntakeScreeningDecision) {
164
+ /** Raise it as an incident (or a grievance, for a grievance desk) after all. */
165
+ AlertIntakeScreeningDecision["ELEVATE"] = "ELEVATE";
166
+ /** Confirm it is not a report. */
167
+ AlertIntakeScreeningDecision["DISMISS"] = "DISMISS";
168
+ })(AlertIntakeScreeningDecision || (exports.AlertIntakeScreeningDecision = AlertIntakeScreeningDecision = {}));
97
169
  //# sourceMappingURL=alert-intake.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wCAAwC;AACxC,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,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0BAA0B,QAOrC"}
1
+ {"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wCAAwC;AACxC,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,mCAAnB,mBAAmB,QAa9B;AAED;;;;;;;;;;GAUG;AACH,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,gEAAqC,CAAA;AACzC,CAAC,EAHW,uBAAuB,uCAAvB,uBAAuB,QAGlC;AAED;;;;GAIG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,mEAAqC,CAAA;IACrC,2EAA6C,CAAA;AACjD,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAED,qEAAqE;AACrE,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,oFAAoF;IACpF,4CAAmB,CAAA;IACnB,qEAAqE;IACrE,4CAAmB,CAAA;AACvB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,gEAAgE;AAChE,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACtC,8EAA8E;IAC9E,2DAAyB,CAAA;IACzB,gFAAgF;IAChF,+EAA6C,CAAA;IAC7C,m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mB,CAAA;AACvB,CAAC,EALW,4BAA4B,4CAA5B,4BAA4B,QAKvC"}
@@ -91,4 +91,76 @@ export var AlertIntakeRejectionReason;
91
91
  AlertIntakeRejectionReason["ORGANIZATION_INACTIVE"] = "ORGANIZATION_INACTIVE";
92
92
  AlertIntakeRejectionReason["RATE_LIMITED"] = "RATE_LIMITED";
93
93
  })(AlertIntakeRejectionReason || (AlertIntakeRejectionReason = {}));
94
+ /**
95
+ * Where a stored message stands, as an operator reads it. Derived from the pipeline's
96
+ * processing status, retry schedule and rejection reason - not stored.
97
+ *
98
+ * QUEUED waiting for, or being worked on by, the pipeline
99
+ * RAISED became an incident
100
+ * RETRYING failed; another attempt is scheduled
101
+ * PARKED failed and will not be retried on its own: it ran out of attempts, or it
102
+ * has a `rejectionReason` (no organization, organization inactive)
103
+ * DUPLICATE the same sender repeating themselves; not raised
104
+ * FILTERED screened out as not a report (a greeting, a link, an advert); held for review
105
+ */
106
+ export var AlertIntakeMessageState;
107
+ (function (AlertIntakeMessageState) {
108
+ AlertIntakeMessageState["QUEUED"] = "QUEUED";
109
+ AlertIntakeMessageState["RAISED"] = "RAISED";
110
+ AlertIntakeMessageState["RETRYING"] = "RETRYING";
111
+ AlertIntakeMessageState["PARKED"] = "PARKED";
112
+ AlertIntakeMessageState["DUPLICATE"] = "DUPLICATE";
113
+ AlertIntakeMessageState["FILTERED"] = "FILTERED";
114
+ })(AlertIntakeMessageState || (AlertIntakeMessageState = {}));
115
+ /**
116
+ * Why a message was screened out instead of raised. Everything that arrives on a
117
+ * connection is kept: a screened message waits for a person to raise it or dismiss it.
118
+ *
119
+ * EMPTY nothing to read: no text, no file, no location
120
+ * SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
121
+ * UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
122
+ * GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
123
+ * LINK_ONLY a link and nothing else (a forwarded post or video)
124
+ * SPAM an advert, a promotion, a chain message, a scam
125
+ * OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
126
+ * TEST someone testing the number
127
+ */
128
+ export var AlertIntakeScreeningReason;
129
+ (function (AlertIntakeScreeningReason) {
130
+ AlertIntakeScreeningReason["EMPTY"] = "EMPTY";
131
+ AlertIntakeScreeningReason["SYSTEM_EVENT"] = "SYSTEM_EVENT";
132
+ AlertIntakeScreeningReason["UNSUPPORTED_CONTENT"] = "UNSUPPORTED_CONTENT";
133
+ AlertIntakeScreeningReason["GREETING"] = "GREETING";
134
+ AlertIntakeScreeningReason["LINK_ONLY"] = "LINK_ONLY";
135
+ AlertIntakeScreeningReason["SPAM"] = "SPAM";
136
+ AlertIntakeScreeningReason["OFF_TOPIC"] = "OFF_TOPIC";
137
+ AlertIntakeScreeningReason["TEST"] = "TEST";
138
+ })(AlertIntakeScreeningReason || (AlertIntakeScreeningReason = {}));
139
+ /** What decided a message was not a report: a fixed rule, or the AI screening model. */
140
+ export var AlertIntakeScreeningSource;
141
+ (function (AlertIntakeScreeningSource) {
142
+ AlertIntakeScreeningSource["RULE"] = "RULE";
143
+ AlertIntakeScreeningSource["AI"] = "AI";
144
+ })(AlertIntakeScreeningSource || (AlertIntakeScreeningSource = {}));
145
+ /**
146
+ * A screened message, from a reviewer's side.
147
+ *
148
+ * PENDING_REVIEW screened out; nobody has looked at it yet
149
+ * ELEVATED a person decided it IS a report: it was raised as an incident
150
+ * DISMISSED a person confirmed it is not a report
151
+ */
152
+ export var AlertIntakeScreeningStatus;
153
+ (function (AlertIntakeScreeningStatus) {
154
+ AlertIntakeScreeningStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
155
+ AlertIntakeScreeningStatus["ELEVATED"] = "ELEVATED";
156
+ AlertIntakeScreeningStatus["DISMISSED"] = "DISMISSED";
157
+ })(AlertIntakeScreeningStatus || (AlertIntakeScreeningStatus = {}));
158
+ /** A reviewer's decision on screened messages. */
159
+ export var AlertIntakeScreeningDecision;
160
+ (function (AlertIntakeScreeningDecision) {
161
+ /** Raise it as an incident (or a grievance, for a grievance desk) after all. */
162
+ AlertIntakeScreeningDecision["ELEVATE"] = "ELEVATE";
163
+ /** Confirm it is not a report. */
164
+ AlertIntakeScreeningDecision["DISMISS"] = "DISMISS";
165
+ })(AlertIntakeScreeningDecision || (AlertIntakeScreeningDecision = {}));
94
166
  //# sourceMappingURL=alert-intake.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,gEAAqC,CAAA;AACzC,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,mEAAqC,CAAA;IACrC,2EAA6C,CAAA;AACjD,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,qEAAqE;AACrE,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,oFAAoF;IACpF,4CAAmB,CAAA;IACnB,qEAAqE;IACrE,4CAAmB,CAAA;AACvB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACtC,8EAA8E;IAC9E,2DAAyB,CAAA;IACzB,gFAAgF;IAChF,+EAA6C,CAAA;IAC7C,mFAAmF;IACnF,mEAAiC,CAAA;AACrC,CAAC,EAPW,8BAA8B,KAA9B,8BAA8B,QAOzC;AAED,yFAAyF;AACzF,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IAClC,uEAAyC,CAAA;IACzC,yEAA2C,CAAA;IAC3C,yEAA2C,CAAA;IAC3C,iEAAmC,CAAA;IACnC,6EAA+C,CAAA;IAC/C,2DAA6B,CAAA;AACjC,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC"}
1
+ {"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAED;;;;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;;;;GAYG;AACH,MAAM,CAAN,IAAY,0BASX;AATD,WAAY,0BAA0B;IAClC,6CAAe,CAAA;IACf,2DAA6B,CAAA;IAC7B,yEAA2C,CAAA;IAC3C,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;IACvB,2CAAa,CAAA;IACb,qDAAuB,CAAA;IACvB,2CAAa,CAAA;AACjB,CAAC,EATW,0BAA0B,KAA1B,0BAA0B,QASrC;AAED,wFAAwF;AACxF,MAAM,CAAN,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,uCAAS,CAAA;AACb,CAAC,EAHW,0BAA0B,KAA1B,0BAA0B,QAGrC;AAED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,+DAAiC,CAAA;IACjC,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;AAC3B,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,kDAAkD;AAClD,MAAM,CAAN,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACpC,gFAAgF;IAChF,mDAAmB,CAAA;IACnB,kCAAkC;IAClC,mDAAmB,CAAA;AACvB,CAAC,EALW,4BAA4B,KAA5B,4BAA4B,QAKvC"}
@@ -81,3 +81,70 @@ export declare enum AlertIntakeRejectionReason {
81
81
  ORGANIZATION_INACTIVE = "ORGANIZATION_INACTIVE",
82
82
  RATE_LIMITED = "RATE_LIMITED"
83
83
  }
84
+ /**
85
+ * Where a stored message stands, as an operator reads it. Derived from the pipeline's
86
+ * processing status, retry schedule and rejection reason - not stored.
87
+ *
88
+ * QUEUED waiting for, or being worked on by, the pipeline
89
+ * RAISED became an incident
90
+ * RETRYING failed; another attempt is scheduled
91
+ * PARKED failed and will not be retried on its own: it ran out of attempts, or it
92
+ * has a `rejectionReason` (no organization, organization inactive)
93
+ * DUPLICATE the same sender repeating themselves; not raised
94
+ * FILTERED screened out as not a report (a greeting, a link, an advert); held for review
95
+ */
96
+ export declare enum AlertIntakeMessageState {
97
+ QUEUED = "QUEUED",
98
+ RAISED = "RAISED",
99
+ RETRYING = "RETRYING",
100
+ PARKED = "PARKED",
101
+ DUPLICATE = "DUPLICATE",
102
+ FILTERED = "FILTERED"
103
+ }
104
+ /**
105
+ * Why a message was screened out instead of raised. Everything that arrives on a
106
+ * connection is kept: a screened message waits for a person to raise it or dismiss it.
107
+ *
108
+ * EMPTY nothing to read: no text, no file, no location
109
+ * SYSTEM_EVENT a notice from the channel itself (WhatsApp "changed number")
110
+ * UNSUPPORTED_CONTENT something the channel could not deliver, a reaction or a sticker
111
+ * GREETING a greeting or pleasantry and nothing else ("Hi", "How are you?")
112
+ * LINK_ONLY a link and nothing else (a forwarded post or video)
113
+ * SPAM an advert, a promotion, a chain message, a scam
114
+ * OFF_TOPIC reports nothing the organization handles (chat, unrelated questions)
115
+ * TEST someone testing the number
116
+ */
117
+ export declare enum AlertIntakeScreeningReason {
118
+ EMPTY = "EMPTY",
119
+ SYSTEM_EVENT = "SYSTEM_EVENT",
120
+ UNSUPPORTED_CONTENT = "UNSUPPORTED_CONTENT",
121
+ GREETING = "GREETING",
122
+ LINK_ONLY = "LINK_ONLY",
123
+ SPAM = "SPAM",
124
+ OFF_TOPIC = "OFF_TOPIC",
125
+ TEST = "TEST"
126
+ }
127
+ /** What decided a message was not a report: a fixed rule, or the AI screening model. */
128
+ export declare enum AlertIntakeScreeningSource {
129
+ RULE = "RULE",
130
+ AI = "AI"
131
+ }
132
+ /**
133
+ * A screened message, from a reviewer's side.
134
+ *
135
+ * PENDING_REVIEW screened out; nobody has looked at it yet
136
+ * ELEVATED a person decided it IS a report: it was raised as an incident
137
+ * DISMISSED a person confirmed it is not a report
138
+ */
139
+ export declare enum AlertIntakeScreeningStatus {
140
+ PENDING_REVIEW = "PENDING_REVIEW",
141
+ ELEVATED = "ELEVATED",
142
+ DISMISSED = "DISMISSED"
143
+ }
144
+ /** A reviewer's decision on screened messages. */
145
+ export declare enum AlertIntakeScreeningDecision {
146
+ /** Raise it as an incident (or a grievance, for a grievance desk) after all. */
147
+ ELEVATE = "ELEVATE",
148
+ /** Confirm it is not a report. */
149
+ DISMISS = "DISMISS"
150
+ }
@@ -1,5 +1,5 @@
1
1
  import { CountryCode } from '../../country/enums/country-code.enum';
2
- import { AlertIntakeChannel, AlertIntakeEmergencyPolicy, AlertIntakeProvider, AlertIntakeRouteMatch, AlertIntakeSecretSource, AlertIntakeWebhookVerification } from '../enums/alert-intake.enum';
2
+ import { AlertIntakeChannel, AlertIntakeEmergencyPolicy, AlertIntakeMessageState, AlertIntakeProvider, AlertIntakeRejectionReason, AlertIntakeRouteMatch, AlertIntakeScreeningDecision, AlertIntakeScreeningReason, AlertIntakeScreeningSource, AlertIntakeScreeningStatus, AlertIntakeSecretSource, AlertIntakeWebhookVerification } from '../enums/alert-intake.enum';
3
3
  /**
4
4
  * Alert intake settings.
5
5
  *
@@ -146,6 +146,152 @@ export interface OrganizationAlertIntakeSettings {
146
146
  platformFallbacks: AlertIntakePlatformFallback[];
147
147
  /** False when the service has no key to encrypt credentials with: only secret references can be used. */
148
148
  encryptedSecretsAvailable: boolean;
149
+ /** What arrived for this organization recently, and what needs someone's attention. */
150
+ activity?: AlertIntakeActivitySummary;
151
+ }
152
+ /** Counts over the last `windowHours` - except `parked` and `failingConnections`, which are as of now. */
153
+ export interface AlertIntakeActivitySummary {
154
+ windowHours: number;
155
+ received: number;
156
+ raised: number;
157
+ duplicates: number;
158
+ retrying: number;
159
+ /** Waiting for an operator: out of attempts, or held for a reason (no organization, organization inactive). */
160
+ parked: number;
161
+ /** Enabled connections whose last attempt failed (a rejected call, a mailbox that could not be read). */
162
+ failingConnections: number;
163
+ /** Screened out as not a report, in the window. */
164
+ screened?: number;
165
+ /** Screened messages nobody has reviewed yet (as of now). */
166
+ awaitingReview?: number;
167
+ }
168
+ /** What is kept of a file that came with a message. Never its contents. */
169
+ export interface AlertIntakeMessageAttachment {
170
+ fileName: string;
171
+ mimeType: string;
172
+ size: number;
173
+ /** True once the file is stored in DMS and linked to the incident. */
174
+ attached: boolean;
175
+ /** Why it was not attached, when it was not. */
176
+ error: string | null;
177
+ }
178
+ /**
179
+ * A stored message, as an operator sees it in a list. `preview` is the start of the
180
+ * text; the whole of it is only in the detail.
181
+ */
182
+ export interface AlertIntakeMessage {
183
+ id: string;
184
+ /** Null while no organization has been found for it. */
185
+ organizationId: number | null;
186
+ connectionId: string | null;
187
+ connectionName: string | null;
188
+ channel: AlertIntakeChannel;
189
+ /** Phone number, WhatsApp number or email address, as stored. */
190
+ sender: string | null;
191
+ senderName: string | null;
192
+ subject: string | null;
193
+ preview: string;
194
+ /** The keyword that routed it, on a platform connection. */
195
+ routeKeyword: string | null;
196
+ state: AlertIntakeMessageState;
197
+ rejectionReason: AlertIntakeRejectionReason | null;
198
+ /** Why it was screened out, for FILTERED (and for one raised after review). */
199
+ screeningReason?: AlertIntakeScreeningReason | null;
200
+ /** The last error, for RETRYING and PARKED. */
201
+ error: string | null;
202
+ attempts: number;
203
+ nextAttemptAt: string | null;
204
+ /** The incident it raised. */
205
+ incidentId: number | null;
206
+ attachmentCount: number;
207
+ /** When the sender was told their message was received, if they were. */
208
+ acknowledgedAt: string | null;
209
+ receivedAt: string;
210
+ updatedAt: string;
211
+ /** What the CALLER may do with it now. */
212
+ actions: {
213
+ /** Try again: a PARKED message that ran out of attempts, or whose organization is active again. */
214
+ retry: boolean;
215
+ /** Raise a message that was taken for a duplicate. */
216
+ raiseAnyway: boolean;
217
+ /** Give a message no route claimed to an organization (platform operators). */
218
+ assign: boolean;
219
+ };
220
+ }
221
+ export interface AlertIntakeMessageDetail extends AlertIntakeMessage {
222
+ /** What the incident is raised from (a routing keyword removed). */
223
+ content: string;
224
+ /** Exactly as received. */
225
+ originalContent: string;
226
+ attachments: AlertIntakeMessageAttachment[];
227
+ acknowledgementError: string | null;
228
+ }
229
+ export interface AlertIntakeMessagePage {
230
+ items: AlertIntakeMessage[];
231
+ total: number;
232
+ page: number;
233
+ limit: number;
234
+ }
235
+ /**
236
+ * A message screened out as not a report, waiting for (or after) a person's review.
237
+ * Kept in its own table: the review queue. Raising one ("elevate") sends it through the
238
+ * pipeline without the screening step, and links the incident it becomes.
239
+ */
240
+ export interface AlertIntakeScreenedMessage {
241
+ id: string;
242
+ /** The stored message (see the messages API). */
243
+ messageId: string;
244
+ organizationId: number;
245
+ connectionId: string | null;
246
+ connectionName: string | null;
247
+ channel: AlertIntakeChannel;
248
+ sender: string | null;
249
+ senderName: string | null;
250
+ subject: string | null;
251
+ preview: string;
252
+ /** ISO 639-1 code of the language it was written in, when known. */
253
+ language: string | null;
254
+ /** English translation, when it was written in another language. */
255
+ translation: string | null;
256
+ reason: AlertIntakeScreeningReason;
257
+ /** One sentence, for the reviewer: why it was screened out. */
258
+ explanation: string;
259
+ decidedBy: AlertIntakeScreeningSource;
260
+ /** The screening model's confidence (0-1). Null for a rule. */
261
+ confidence: number | null;
262
+ status: AlertIntakeScreeningStatus;
263
+ reviewedBy: number | null;
264
+ reviewedAt: string | null;
265
+ reviewNote: string | null;
266
+ /** The incident it became, once elevated and raised. */
267
+ incidentId: number | null;
268
+ attachmentCount: number;
269
+ receivedAt: string;
270
+ screenedAt: string;
271
+ /** What the CALLER may do with it now. */
272
+ actions: {
273
+ elevate: boolean;
274
+ dismiss: boolean;
275
+ };
276
+ }
277
+ export interface AlertIntakeScreenedMessageDetail extends AlertIntakeScreenedMessage {
278
+ /** Exactly as received. */
279
+ content: string;
280
+ attachments: AlertIntakeMessageAttachment[];
281
+ }
282
+ export interface AlertIntakeScreenedMessagePage {
283
+ items: AlertIntakeScreenedMessage[];
284
+ total: number;
285
+ page: number;
286
+ limit: number;
287
+ }
288
+ /** The outcome of a review: which messages changed, and why the others did not. */
289
+ export interface AlertIntakeScreeningReviewResult {
290
+ updated: string[];
291
+ skipped: Array<{
292
+ id: string;
293
+ reason: string;
294
+ }>;
149
295
  }
150
296
  export interface AlertIntakeConnectionTestResult {
151
297
  success: boolean;
@@ -200,3 +346,43 @@ export interface UpdateAlertIntakeRoute {
200
346
  export type AlertIntakePlatformConnection = AlertIntakeConnection & {
201
347
  routes: AlertIntakeRoute[];
202
348
  };
349
+ /** Filters for an organization's stored messages (query string). `limit` is at most 100. */
350
+ export interface ListAlertIntakeMessagesQuery {
351
+ state?: AlertIntakeMessageState;
352
+ channel?: AlertIntakeChannel;
353
+ connectionId?: string;
354
+ reason?: AlertIntakeRejectionReason;
355
+ page?: number;
356
+ limit?: number;
357
+ }
358
+ /** Platform operators: every organization's messages, and those no organization has yet. */
359
+ export interface ListPlatformAlertIntakeMessagesQuery extends ListAlertIntakeMessagesQuery {
360
+ organizationId?: number;
361
+ /** Only messages no organization has been found for. */
362
+ unrouted?: boolean;
363
+ }
364
+ /** Platform operators: give a message no route claimed to an organization, and raise it. */
365
+ export interface AssignAlertIntakeMessage {
366
+ organizationId: number;
367
+ }
368
+ /** Filters for an organization's screened messages (the review queue). `limit` is at most 100. */
369
+ export interface ListAlertIntakeScreenedMessagesQuery {
370
+ /** Omit for every status. */
371
+ status?: AlertIntakeScreeningStatus;
372
+ reason?: AlertIntakeScreeningReason;
373
+ decidedBy?: AlertIntakeScreeningSource;
374
+ channel?: AlertIntakeChannel;
375
+ connectionId?: string;
376
+ page?: number;
377
+ limit?: number;
378
+ }
379
+ /**
380
+ * A reviewer's decision on 1-100 screened messages. ELEVATE raises each as an incident
381
+ * without screening it again; DISMISS confirms it is not a report.
382
+ */
383
+ export interface ReviewAlertIntakeScreenedMessages {
384
+ ids: string[];
385
+ decision: AlertIntakeScreeningDecision;
386
+ /** At most 300 characters. */
387
+ note?: string;
388
+ }
@@ -30,6 +30,13 @@ export interface Incident {
30
30
  categoryId?: number;
31
31
  typeId?: number;
32
32
  description?: string;
33
+ /**
34
+ * The report as the reporter wrote it, when `description` is its English
35
+ * translation (messages received by SMS, WhatsApp or email in another language).
36
+ */
37
+ originalDescription?: string | null;
38
+ /** ISO 639-1 code of `originalDescription`'s language, e.g. `sw`. */
39
+ originalLanguage?: string | null;
33
40
  status?: IncidentStatus;
34
41
  statusDetails?: IncidentStatusDetails;
35
42
  priority?: IncidentPriority;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarion-shared-types",
3
- "version": "1.0.99",
3
+ "version": "1.0.101",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",