grm-shared-library 1.1.192 → 1.1.194

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.
Files changed (68) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js +27 -0
  4. package/dist/cjs/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js.map +1 -0
  5. package/dist/cjs/modules/alert-dispatch/index.js +23 -0
  6. package/dist/cjs/modules/alert-dispatch/index.js.map +1 -0
  7. package/dist/cjs/modules/alert-dispatch/interfaces/alert-dispatch.js +3 -0
  8. package/dist/cjs/modules/alert-dispatch/interfaces/alert-dispatch.js.map +1 -0
  9. package/dist/cjs/modules/alert-dispatch/utils/alert-dispatch.util.js +86 -0
  10. package/dist/cjs/modules/alert-dispatch/utils/alert-dispatch.util.js.map +1 -0
  11. package/dist/cjs/modules/incident/dtos/incident/create-incident.dto.js +18 -0
  12. package/dist/cjs/modules/incident/dtos/incident/create-incident.dto.js.map +1 -1
  13. package/dist/cjs/modules/incident/dtos/incident/incident.dto.js +11 -0
  14. package/dist/cjs/modules/incident/dtos/incident/incident.dto.js.map +1 -1
  15. package/dist/cjs/modules/system-user/constants/system-user.const.js +31 -0
  16. package/dist/cjs/modules/system-user/constants/system-user.const.js.map +1 -0
  17. package/dist/cjs/modules/system-user/index.js +27 -0
  18. package/dist/cjs/modules/system-user/index.js.map +1 -0
  19. package/dist/cjs/modules/system-user/interfaces/system-user-env-source.js +3 -0
  20. package/dist/cjs/modules/system-user/interfaces/system-user-env-source.js.map +1 -0
  21. package/dist/cjs/modules/system-user/services/system-user.service.js +60 -0
  22. package/dist/cjs/modules/system-user/services/system-user.service.js.map +1 -0
  23. package/dist/cjs/modules/system-user/system-user.module.js +33 -0
  24. package/dist/cjs/modules/system-user/system-user.module.js.map +1 -0
  25. package/dist/cjs/modules/system-user/utils/system-user.util.js +57 -0
  26. package/dist/cjs/modules/system-user/utils/system-user.util.js.map +1 -0
  27. package/dist/esm/index.js +2 -0
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js +24 -0
  30. package/dist/esm/modules/alert-dispatch/enums/incident-dispatch-scope.enum.js.map +1 -0
  31. package/dist/esm/modules/alert-dispatch/index.js +7 -0
  32. package/dist/esm/modules/alert-dispatch/index.js.map +1 -0
  33. package/dist/esm/modules/alert-dispatch/interfaces/alert-dispatch.js +2 -0
  34. package/dist/esm/modules/alert-dispatch/interfaces/alert-dispatch.js.map +1 -0
  35. package/dist/esm/modules/alert-dispatch/utils/alert-dispatch.util.js +78 -0
  36. package/dist/esm/modules/alert-dispatch/utils/alert-dispatch.util.js.map +1 -0
  37. package/dist/esm/modules/incident/dtos/incident/create-incident.dto.js +18 -0
  38. package/dist/esm/modules/incident/dtos/incident/create-incident.dto.js.map +1 -1
  39. package/dist/esm/modules/incident/dtos/incident/incident.dto.js +12 -1
  40. package/dist/esm/modules/incident/dtos/incident/incident.dto.js.map +1 -1
  41. package/dist/esm/modules/system-user/constants/system-user.const.js +28 -0
  42. package/dist/esm/modules/system-user/constants/system-user.const.js.map +1 -0
  43. package/dist/esm/modules/system-user/index.js +11 -0
  44. package/dist/esm/modules/system-user/index.js.map +1 -0
  45. package/dist/esm/modules/system-user/interfaces/system-user-env-source.js +2 -0
  46. package/dist/esm/modules/system-user/interfaces/system-user-env-source.js.map +1 -0
  47. package/dist/esm/modules/system-user/services/system-user.service.js +57 -0
  48. package/dist/esm/modules/system-user/services/system-user.service.js.map +1 -0
  49. package/dist/esm/modules/system-user/system-user.module.js +30 -0
  50. package/dist/esm/modules/system-user/system-user.module.js.map +1 -0
  51. package/dist/esm/modules/system-user/utils/system-user.util.js +53 -0
  52. package/dist/esm/modules/system-user/utils/system-user.util.js.map +1 -0
  53. package/dist/types/index.d.ts +2 -0
  54. package/dist/types/interfaces/pagination.d.ts +8 -0
  55. package/dist/types/modules/alert-dispatch/enums/incident-dispatch-scope.enum.d.ts +22 -0
  56. package/dist/types/modules/alert-dispatch/index.d.ts +3 -0
  57. package/dist/types/modules/alert-dispatch/interfaces/alert-dispatch.d.ts +33 -0
  58. package/dist/types/modules/alert-dispatch/utils/alert-dispatch.util.d.ts +51 -0
  59. package/dist/types/modules/incident/dtos/incident/create-incident.dto.d.ts +14 -0
  60. package/dist/types/modules/incident/dtos/incident/incident.dto.d.ts +8 -0
  61. package/dist/types/modules/incident/intefaces/incident.d.ts +9 -0
  62. package/dist/types/modules/system-user/constants/system-user.const.d.ts +24 -0
  63. package/dist/types/modules/system-user/index.d.ts +5 -0
  64. package/dist/types/modules/system-user/interfaces/system-user-env-source.d.ts +10 -0
  65. package/dist/types/modules/system-user/services/system-user.service.d.ts +26 -0
  66. package/dist/types/modules/system-user/system-user.module.d.ts +13 -0
  67. package/dist/types/modules/system-user/utils/system-user.util.d.ts +41 -0
  68. package/package.json +5 -3
@@ -0,0 +1,78 @@
1
+ import { isFreeUserTier } from '../../entitlement/utils/entitlement.util';
2
+ import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
3
+ /**
4
+ * Whether an incident reaches the provider control room - live map, live list,
5
+ * kanban, operator assignment and operator notifications.
6
+ *
7
+ * Two independent reasons keep an alert out, and this is the single place both
8
+ * are expressed so no consumer can honour one and forget the other:
9
+ *
10
+ * 1. the reporter is a Free user, so the provider was never entitled to it;
11
+ * 2. the reporter explicitly unchecked the provider option ("Marked Ignore").
12
+ *
13
+ * A missing flag counts as dispatched: incidents written before this feature
14
+ * existed, and every operator-created record, keep their original behaviour.
15
+ */
16
+ export function reachesControlRoom(incident) {
17
+ if (!incident)
18
+ return true;
19
+ if (isFreeUserTier(incident.entitlementTier))
20
+ return false;
21
+ return incident.notifyServiceProvider !== false;
22
+ }
23
+ /** Whether the reporter's guardians should be pulled in and notified. */
24
+ export function reachesGuardians(incident) {
25
+ return !incident || incident.notifyGuardians !== false;
26
+ }
27
+ /**
28
+ * Whether the reporter deliberately withheld this alert from the provider, as
29
+ * opposed to never having been entitled to send it. Only the former belongs in
30
+ * the "Marked Ignore" admin list; a Free user's alert belongs in
31
+ * "Incident List - Free Users".
32
+ */
33
+ export function isMarkedIgnore(incident) {
34
+ if (!incident)
35
+ return false;
36
+ return incident.notifyServiceProvider === false && !isFreeUserTier(incident.entitlementTier);
37
+ }
38
+ /**
39
+ * Applies dispatch policy to what the client asked for.
40
+ *
41
+ * The client's checkboxes are an intent, never the decision: a Free user's
42
+ * provider option is unchecked and read-only in the app, and this is what makes
43
+ * that true even for a caller that ignores the UI. Anything the client omits
44
+ * defaults to "notify", so existing callers (web admin, older app builds) are
45
+ * unaffected.
46
+ *
47
+ * Returns resolved flags only - it deliberately does not reject the
48
+ * both-off combination, so callers can decide whether that is a validation
49
+ * error (the SOS path) or simply nobody to notify.
50
+ */
51
+ export function resolveIncidentAlertDispatch(request) {
52
+ const applies = request.applies !== false;
53
+ if (!applies) {
54
+ return { notifyServiceProvider: true, notifyGuardians: true };
55
+ }
56
+ const notifyGuardians = request.notifyGuardians !== false;
57
+ const notifyServiceProvider = isFreeUserTier(request.tier)
58
+ ? false
59
+ : request.notifyServiceProvider !== false;
60
+ return { notifyServiceProvider, notifyGuardians };
61
+ }
62
+ /** True when an alert would reach nobody at all. */
63
+ export function reachesNobody(dispatch) {
64
+ return (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyServiceProvider) === false && (dispatch === null || dispatch === void 0 ? void 0 : dispatch.notifyGuardians) === false;
65
+ }
66
+ /**
67
+ * Parses a client-supplied dispatch scope. Unknown/absent values fall back to
68
+ * `ALL` so an unrecognised query string never silently hides incidents.
69
+ */
70
+ export function parseIncidentDispatchScope(value) {
71
+ if (!value)
72
+ return IncidentDispatchScope.ALL;
73
+ const normalized = value.trim().toUpperCase();
74
+ return Object.values(IncidentDispatchScope).includes(normalized)
75
+ ? normalized
76
+ : IncidentDispatchScope.ALL;
77
+ }
78
+ //# sourceMappingURL=alert-dispatch.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-dispatch.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-dispatch/utils/alert-dispatch.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAG9E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAC9B,QAA+F;IAE/F,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3D,OAAO,QAAQ,CAAC,qBAAqB,KAAK,KAAK,CAAC;AACpD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,QAA+B;IAC5D,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,eAAe,KAAK,KAAK,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC1B,QAA+F;IAE/F,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAO,QAAQ,CAAC,qBAAqB,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AACjG,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAA6B;IACtE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;IAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAClE,CAAC;IAED,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,KAAK,KAAK,CAAC;IAC1D,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,OAAO,CAAC,qBAAqB,KAAK,KAAK,CAAC;IAE9C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,QAA+B;IACzD,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,qBAAqB,MAAK,KAAK,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,MAAK,KAAK,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAqB;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,qBAAqB,CAAC,GAAG,CAAC;IAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAQ,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC1E,CAAC,CAAE,UAAoC;QACvC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC;AACpC,CAAC"}
@@ -263,4 +263,22 @@ __decorate([
263
263
  IsNotEmpty(),
264
264
  __metadata("design:type", Number)
265
265
  ], CreateIncidentDto.prototype, "organizationId", void 0);
266
+ __decorate([
267
+ ApiPropertyOptional({
268
+ description: "Whether the service provider's control room should be alerted. Defaults to true.",
269
+ example: true
270
+ }),
271
+ IsBoolean(),
272
+ IsOptional(),
273
+ __metadata("design:type", Boolean)
274
+ ], CreateIncidentDto.prototype, "notifyServiceProvider", void 0);
275
+ __decorate([
276
+ ApiPropertyOptional({
277
+ description: "Whether the reporter's guardians should be alerted and added to the incident chat. Defaults to true.",
278
+ example: true
279
+ }),
280
+ IsBoolean(),
281
+ IsOptional(),
282
+ __metadata("design:type", Boolean)
283
+ ], CreateIncidentDto.prototype, "notifyGuardians", void 0);
266
284
  //# sourceMappingURL=create-incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,MAAM,OAAO,iBAAiB;CAwN7B;AAhNG;IAPC,WAAW,CAAC;QACT,WAAW,EAAE,+CAA+C;QAC5D,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,aAAa,CAAC,KAAK;KAC/B,CAAC;IACD,MAAM,CAAC,aAAa,CAAC;IACrB,UAAU,EAAE;;gDACS;AAStB;IAPC,WAAW,CAAC;QACT,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,aAAa,CAAC,QAAQ;KAClC,CAAC;IACD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,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;0DACY;AAQzB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;yDACW"}
1
+ {"version":3,"file":"create-incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/create-incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,MAAM,OAAO,iBAAiB;CAoP7B;AA5OG;IAPC,WAAW,CAAC;QACT,WAAW,EAAE,+CAA+C;QAC5D,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,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PC,WAAW,CAAC;QACT,WAAW,EAAE,sDAAsD;QACnE,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,6BAA6B,CAAC,cAAc;KACxD,CAAC;IACD,MAAM,CAAC,6BAA6B,CAAC;IACrC,UAAU,EAAE;;gEACyC;AAQtD;IANC,mBAAmB,CAAC;QACjB,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;0DACY;AAQzB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,CAAC;KACb,CAAC;IACD,QAAQ,EAAE;IACV,UAAU,EAAE;;yDACW;AAgBxB;IANC,mBAAmB,CAAC;QACjB,WAAW,EAAE,kFAAkF;QAC/F,OAAO,EAAE,IAAI;KAChB,CAAC;IACD,SAAS,EAAE;IACX,UAAU,EAAE;;gEACmB;AAYhC;IANC,mBAAmB,CAAC;QACjB,WAAW,EAAE,sGAAsG;QACnH,OAAO,EAAE,IAAI;KAChB,CAAC;IACD,SAAS,EAAE;IACX,UAAU,EAAE;;0DACa"}
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsOptional, ValidateNested } from "class-validator";
10
+ import { IsArray, IsDateString, IsEnum, IsNotEmpty, IsNumber, IsOptional, ValidateNested } from "class-validator";
11
11
  import { ApiProperty, ApiPropertyOptional, OmitType } from "@nestjs/swagger";
12
12
  import { CreateIncidentDto } from "./create-incident.dto";
13
13
  import { Type } from "class-transformer";
@@ -18,6 +18,7 @@ import { IncidentAssignmentDto } from "../assignment/incident-assignment.dto";
18
18
  import { IncidentResponseUnitAssignmentDto } from "../response-unit-assignment/update-incident-response-unit-assignment.dto";
19
19
  import { IncidentReporterDto } from "../reporter/incident-reporter.dto";
20
20
  import { IncidentStatusDetailsDto } from "./incident-status-details.dto";
21
+ import { IncidentEntitlementTier } from "../../../entitlement/enums/incident-entitlement-tier.enum";
21
22
  export class IncidentDto extends OmitType(CreateIncidentDto, ['reporter', 'statusDetails']) {
22
23
  }
23
24
  __decorate([
@@ -120,4 +121,14 @@ __decorate([
120
121
  IsNotEmpty(),
121
122
  __metadata("design:type", String)
122
123
  ], IncidentDto.prototype, "updatedAt", void 0);
124
+ __decorate([
125
+ ApiPropertyOptional({
126
+ description: 'Premium entitlement tier stamped on the incident at creation',
127
+ enum: IncidentEntitlementTier,
128
+ example: IncidentEntitlementTier.PREMIUM
129
+ }),
130
+ IsEnum(IncidentEntitlementTier),
131
+ IsOptional(),
132
+ __metadata("design:type", String)
133
+ ], IncidentDto.prototype, "entitlementTier", void 0);
123
134
  //# sourceMappingURL=incident.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,iCAAiC,EAAE,MAAM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iBAAiB,CAAC;KAC5B,CAAC;IACD,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC;;4CACA;AAU9B;IARC,mBAAmB,CAAC;QACjB,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,CAAC,qBAAqB,CAAC;KAChC,CAAC;IACD,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC;;gDACI;AAUtC;IARC,mBAAmB,CAAC;QACjB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,CAAC,iCAAiC,CAAC;KAC5C,CAAC;IACD,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,iCAAiC,CAAC;;4DACgB;AAQ9D;IANC,WAAW,CAAC;QACT,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM;AAQnB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM"}
1
+ {"version":3,"file":"incident.dto.js","sourceRoot":"","sources":["../../../../../../src/modules/incident/dtos/incident/incident.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,i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AQnB;IANC,WAAW,CAAC;QACT,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,0BAA0B;KACtC,CAAC;IACD,YAAY,EAAE;IACd,UAAU,EAAE;;8CACM;AAenB;IAPC,mBAAmB,CAAC;QACjB,WAAW,EAAE,8DAA8D;QAC3E,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,uBAAuB,CAAC,OAAO;KAC3C,CAAC;IACD,MAAM,CAAC,uBAAuB,CAAC;IAC/B,UAAU,EAAE;;oDAC6B"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Canonical environment variable that carries the platform "system user" id.
3
+ *
4
+ * The system user is a real row in the clarion-authentication `users` table
5
+ * that services stamp on records they create or mutate on their own behalf —
6
+ * i.e. when there is no authenticated human in the request (auto-assignment,
7
+ * automated status changes, service-to-service document uploads).
8
+ *
9
+ * It is deliberately NOT a compile-time constant: it is an environment-specific
10
+ * database row id, so dev / staging / production each carry their own value.
11
+ * The library owns the *contract* (key name, parsing, validation, fallback
12
+ * policy); the deployment owns the *value* (see clarion-deployment configmap).
13
+ */
14
+ export const SYSTEM_USER_ID_ENV_KEY = 'SYSTEM_USER_ID';
15
+ /**
16
+ * Per-service keys that predate {@link SYSTEM_USER_ID_ENV_KEY}.
17
+ *
18
+ * Still read — in order — when the canonical key is absent, so that a rollback
19
+ * to an older ConfigMap does not take a service down. Remove once every
20
+ * environment has been migrated to the canonical key.
21
+ *
22
+ * @deprecated Set {@link SYSTEM_USER_ID_ENV_KEY} instead.
23
+ */
24
+ export const LEGACY_SYSTEM_USER_ID_ENV_KEYS = [
25
+ 'BILLING_DMS_SERVICE_USER_ID',
26
+ 'NEWSFEED_DMS_SERVICE_USER_ID',
27
+ ];
28
+ //# sourceMappingURL=system-user.const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-user.const.js","sourceRoot":"","sources":["../../../../../src/modules/system-user/constants/system-user.const.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAsB;IAC7D,6BAA6B;IAC7B,8BAA8B;CACjC,CAAC"}
@@ -0,0 +1,11 @@
1
+ // Constants
2
+ export * from './constants/system-user.const';
3
+ // Interfaces
4
+ export * from './interfaces/system-user-env-source';
5
+ // Utilities
6
+ export * from './utils/system-user.util';
7
+ // Services
8
+ export * from './services/system-user.service';
9
+ // Module
10
+ export * from './system-user.module';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/system-user/index.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,cAAc,+BAA+B,CAAC;AAE9C,aAAa;AACb,cAAc,qCAAqC,CAAC;AAEpD,YAAY;AACZ,cAAc,0BAA0B,CAAC;AAEzC,WAAW;AACX,cAAc,gCAAgC,CAAC;AAE/C,SAAS;AACT,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=system-user-env-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-user-env-source.js","sourceRoot":"","sources":["../../../../../src/modules/system-user/interfaces/system-user-env-source.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var SystemUserService_1;
11
+ import { Injectable, Logger } from '@nestjs/common';
12
+ import { ConfigService } from '@nestjs/config';
13
+ import { SYSTEM_USER_ID_ENV_KEY } from '../constants/system-user.const';
14
+ import { resolveSystemUserId } from '../utils/system-user.util';
15
+ /**
16
+ * Single source of truth for the platform system user id inside a service.
17
+ *
18
+ * Resolution happens once, on module init, so a mis-set `SYSTEM_USER_ID`
19
+ * fails the pod's startup probe instead of surfacing later as records stamped
20
+ * with a user id that clarion-authentication cannot resolve.
21
+ *
22
+ * @example
23
+ * constructor(private readonly systemUser: SystemUserService) {}
24
+ * ...
25
+ * const actorId = userContext?.userId ?? this.systemUser.id;
26
+ */
27
+ let SystemUserService = SystemUserService_1 = class SystemUserService {
28
+ constructor(configService) {
29
+ this.configService = configService;
30
+ this.logger = new Logger(SystemUserService_1.name);
31
+ this.resolvedId = null;
32
+ }
33
+ onModuleInit() {
34
+ this.resolvedId = resolveSystemUserId(this.configService, {
35
+ onLegacyKeyUsed: (key) => this.logger.warn(`Resolved the system user id from deprecated env key "${key}". ` +
36
+ `Set ${SYSTEM_USER_ID_ENV_KEY} instead — legacy keys will be removed.`),
37
+ });
38
+ this.logger.log(`System user id resolved to ${this.resolvedId}`);
39
+ }
40
+ /**
41
+ * The system user id. Throws if read before module init completed, which
42
+ * only happens if a provider resolves it inside its own constructor.
43
+ */
44
+ get id() {
45
+ if (this.resolvedId === null) {
46
+ // Resolve on demand so constructor-time reads still work.
47
+ this.resolvedId = resolveSystemUserId(this.configService);
48
+ }
49
+ return this.resolvedId;
50
+ }
51
+ };
52
+ SystemUserService = SystemUserService_1 = __decorate([
53
+ Injectable(),
54
+ __metadata("design:paramtypes", [ConfigService])
55
+ ], SystemUserService);
56
+ export { SystemUserService };
57
+ //# sourceMappingURL=system-user.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-user.service.js","sourceRoot":"","sources":["../../../../../src/modules/system-user/services/system-user.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;;;;;;;;GAWG;AAEI,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAI1B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAHxC,WAAM,GAAG,IAAI,MAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QACrD,eAAU,GAAkB,IAAI,CAAC;IAEoB,CAAC;IAE9D,YAAY;QACR,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE;YACtD,eAAe,EAAE,CAAC,GAAG,EAAE,EAAE,CACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,wDAAwD,GAAG,KAAK;gBAChE,OAAO,sBAAsB,yCAAyC,CACzE;SACR,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,IAAI,EAAE;QACF,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC3B,0DAA0D;YAC1D,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ,CAAA;AA5BY,iBAAiB;IAD7B,UAAU,EAAE;qCAKmC,aAAa;GAJhD,iBAAiB,CA4B7B"}
@@ -0,0 +1,30 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Global, Module } from '@nestjs/common';
8
+ import { SystemUserService } from './services/system-user.service';
9
+ /**
10
+ * Global module exposing {@link SystemUserService} to every provider in the
11
+ * host application. Import once in the service's root `AppModule`:
12
+ *
13
+ * @example
14
+ * @Module({ imports: [ConfigModule.forRoot({ ... }), SystemUserModule] })
15
+ * export class AppModule {}
16
+ *
17
+ * Requires `ConfigModule` to be global (the convention across clarion
18
+ * services) or otherwise available where this module is imported.
19
+ */
20
+ let SystemUserModule = class SystemUserModule {
21
+ };
22
+ SystemUserModule = __decorate([
23
+ Global(),
24
+ Module({
25
+ providers: [SystemUserService],
26
+ exports: [SystemUserService],
27
+ })
28
+ ], SystemUserModule);
29
+ export { SystemUserModule };
30
+ //# sourceMappingURL=system-user.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-user.module.js","sourceRoot":"","sources":["../../../../src/modules/system-user/system-user.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;;;;;;;;GAUG;AAMI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAI,CAAA;AAApB,gBAAgB;IAL5B,MAAM,EAAE;IACR,MAAM,CAAC;QACJ,SAAS,EAAE,CAAC,iBAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,iBAAiB,CAAC;KAC/B,CAAC;GACW,gBAAgB,CAAI"}
@@ -0,0 +1,53 @@
1
+ import { LEGACY_SYSTEM_USER_ID_ENV_KEYS, SYSTEM_USER_ID_ENV_KEY } from '../constants/system-user.const';
2
+ /**
3
+ * Parses a raw environment value into a usable user id.
4
+ *
5
+ * Returns `null` for anything that is not a positive integer — including
6
+ * `'0'`, `'-1'`, `'abc'` and the empty string — so that a typo'd ConfigMap
7
+ * entry surfaces as a clear failure rather than silently stamping user `0`
8
+ * onto production records.
9
+ */
10
+ export function parseSystemUserId(raw) {
11
+ if (raw === null || raw === undefined) {
12
+ return null;
13
+ }
14
+ const text = String(raw).trim();
15
+ if (!text || !/^\d+$/.test(text)) {
16
+ return null;
17
+ }
18
+ const parsed = Number(text);
19
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
20
+ }
21
+ /**
22
+ * Resolves the platform system user id from the environment.
23
+ *
24
+ * Precedence: {@link SYSTEM_USER_ID_ENV_KEY} → each legacy key in order →
25
+ * `options.fallback`. Throws when nothing resolves and no fallback is given,
26
+ * which is the intended behaviour at startup: a service that stamps records
27
+ * with the system user should refuse to boot rather than write a wrong id.
28
+ *
29
+ * @example
30
+ * // In a Nest provider that already injects ConfigService:
31
+ * this.systemUserId = resolveSystemUserId(this.configService);
32
+ */
33
+ export function resolveSystemUserId(source, options = {}) {
34
+ const { legacyKeys = LEGACY_SYSTEM_USER_ID_ENV_KEYS, fallback, onLegacyKeyUsed } = options;
35
+ const canonical = parseSystemUserId(source.get(SYSTEM_USER_ID_ENV_KEY));
36
+ if (canonical !== null) {
37
+ return canonical;
38
+ }
39
+ for (const key of legacyKeys) {
40
+ const legacy = parseSystemUserId(source.get(key));
41
+ if (legacy !== null) {
42
+ onLegacyKeyUsed === null || onLegacyKeyUsed === void 0 ? void 0 : onLegacyKeyUsed(key);
43
+ return legacy;
44
+ }
45
+ }
46
+ if (fallback !== undefined) {
47
+ return fallback;
48
+ }
49
+ throw new Error(`${SYSTEM_USER_ID_ENV_KEY} is not set to a positive integer. ` +
50
+ `Set it to the id of the platform system user in clarion-authentication ` +
51
+ `(checked legacy keys: ${legacyKeys.length ? legacyKeys.join(', ') : 'none'}).`);
52
+ }
53
+ //# sourceMappingURL=system-user.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-user.util.js","sourceRoot":"","sources":["../../../../../src/modules/system-user/utils/system-user.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAqBxG;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC1C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAC/B,MAA2B,EAC3B,UAAsC,EAAE;IAExC,MAAM,EAAE,UAAU,GAAG,8BAA8B,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAE3F,MAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACxE,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClB,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAG,GAAG,CAAC,CAAC;YACvB,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,IAAI,KAAK,CACX,GAAG,sBAAsB,qCAAqC;QAC9D,yEAAyE;QACzE,yBAAyB,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAClF,CAAC;AACN,CAAC"}
@@ -20,6 +20,8 @@ export * from './modules/country/index';
20
20
  export * from './modules/phone/index';
21
21
  export * from './modules/tracking/index';
22
22
  export * from './modules/entitlement/index';
23
+ export * from './modules/alert-dispatch/index';
24
+ export * from './modules/system-user/index';
23
25
  export * from './interfaces/server-message';
24
26
  export * from './interfaces/i-request-with-user';
25
27
  export * from './interfaces/validated-user';
@@ -6,6 +6,7 @@ import { ResponseUnit } from "../modules/response-unit";
6
6
  import { User } from "../modules/user";
7
7
  import { WebNotification } from "../modules/web-notification";
8
8
  import { IncidentEntitlementScope } from "../modules/entitlement/enums/incident-entitlement-scope.enum";
9
+ import { IncidentDispatchScope } from "../modules/alert-dispatch/enums/incident-dispatch-scope.enum";
9
10
  export interface CursorPaginatedResponse<T> {
10
11
  data: T[];
11
12
  nextCursor: string | null;
@@ -26,6 +27,13 @@ export interface PaginationParams {
26
27
  */
27
28
  export interface IncidentQueryParams extends PaginationParams {
28
29
  entitlementScope?: IncidentEntitlementScope;
30
+ /**
31
+ * Independent of `entitlementScope`: filters on whether the reporter asked
32
+ * for the provider to be alerted at all. The control room combines
33
+ * `ENTITLED` + `DISPATCHED`; the "Incident List - Marked Ignore" view asks
34
+ * for `ENTITLED` + `SUPPRESSED`. Omitting it applies no dispatch filter.
35
+ */
36
+ dispatchScope?: IncidentDispatchScope;
29
37
  }
30
38
  export interface PaginatedResponse<T> {
31
39
  data: T[];
@@ -0,0 +1,22 @@
1
+ /**
2
+ * List filter applied to incident queries on the *dispatch* dimension - i.e.
3
+ * whether the reporter asked for the service provider to be alerted at all.
4
+ *
5
+ * ALL - no dispatch filter (default; preserves legacy behaviour).
6
+ * DISPATCHED - only incidents the provider was asked to receive. Used by the
7
+ * primary admin incident list, map and kanban views.
8
+ * SUPPRESSED - only incidents the reporter explicitly withheld from the
9
+ * provider. Backs the "Incident List - Marked Ignore" admin
10
+ * view.
11
+ *
12
+ * Deliberately separate from {@link IncidentEntitlementScope}: entitlement is a
13
+ * billing fact about the reporter, dispatch is a choice the reporter made on
14
+ * this one alert. The two compose - the control room asks for
15
+ * `ENTITLED` + `DISPATCHED`, "Marked Ignore" asks for `ENTITLED` + `SUPPRESSED`,
16
+ * and "Free Users" asks for `FREE` on the entitlement dimension alone.
17
+ */
18
+ export declare enum IncidentDispatchScope {
19
+ ALL = "ALL",
20
+ DISPATCHED = "DISPATCHED",
21
+ SUPPRESSED = "SUPPRESSED"
22
+ }
@@ -0,0 +1,3 @@
1
+ export * from './enums/incident-dispatch-scope.enum';
2
+ export * from './interfaces/alert-dispatch';
3
+ export * from './utils/alert-dispatch.util';
@@ -0,0 +1,33 @@
1
+ import { IncidentEntitlementTier } from '../../entitlement/enums/incident-entitlement-tier.enum';
2
+ /**
3
+ * Who an incident's alert was actually dispatched to.
4
+ *
5
+ * Both flags are resolved server-side at creation and then stored on the
6
+ * incident, so every downstream consumer (realtime publisher, notification
7
+ * service, admin lists, the mobile confirmation dialog) reads one recorded fact
8
+ * rather than re-deriving policy. `undefined` means "not recorded" and is
9
+ * always treated as `true`, which is what every incident written before this
10
+ * existed implicitly did.
11
+ */
12
+ export interface IncidentAlertDispatch {
13
+ /**
14
+ * False when the alert must not reach the provider control room: the
15
+ * reporter unchecked the option, or they are a Free user who never had it.
16
+ */
17
+ notifyServiceProvider?: boolean;
18
+ /**
19
+ * False when the reporter's guardians must not be pulled into the incident
20
+ * chat or notified about the alert.
21
+ */
22
+ notifyGuardians?: boolean;
23
+ }
24
+ /** The inputs {@link resolveIncidentAlertDispatch} decides from. */
25
+ export interface AlertDispatchRequest extends IncidentAlertDispatch {
26
+ /** Entitlement tier already decided for this incident. */
27
+ tier?: IncidentEntitlementTier | string | null;
28
+ /**
29
+ * False for records that predate or sit outside the SOS flow (grievances,
30
+ * operator-created incidents), which keep both channels on.
31
+ */
32
+ applies?: boolean;
33
+ }
@@ -0,0 +1,51 @@
1
+ import { IncidentEntitlementTier } from '../../entitlement/enums/incident-entitlement-tier.enum';
2
+ import { IncidentDispatchScope } from '../enums/incident-dispatch-scope.enum';
3
+ import { AlertDispatchRequest, IncidentAlertDispatch } from '../interfaces/alert-dispatch';
4
+ /**
5
+ * Whether an incident reaches the provider control room - live map, live list,
6
+ * kanban, operator assignment and operator notifications.
7
+ *
8
+ * Two independent reasons keep an alert out, and this is the single place both
9
+ * are expressed so no consumer can honour one and forget the other:
10
+ *
11
+ * 1. the reporter is a Free user, so the provider was never entitled to it;
12
+ * 2. the reporter explicitly unchecked the provider option ("Marked Ignore").
13
+ *
14
+ * A missing flag counts as dispatched: incidents written before this feature
15
+ * existed, and every operator-created record, keep their original behaviour.
16
+ */
17
+ export declare function reachesControlRoom(incident: IncidentAlertDispatch & {
18
+ entitlementTier?: IncidentEntitlementTier | string | null;
19
+ }): boolean;
20
+ /** Whether the reporter's guardians should be pulled in and notified. */
21
+ export declare function reachesGuardians(incident: IncidentAlertDispatch): boolean;
22
+ /**
23
+ * Whether the reporter deliberately withheld this alert from the provider, as
24
+ * opposed to never having been entitled to send it. Only the former belongs in
25
+ * the "Marked Ignore" admin list; a Free user's alert belongs in
26
+ * "Incident List - Free Users".
27
+ */
28
+ export declare function isMarkedIgnore(incident: IncidentAlertDispatch & {
29
+ entitlementTier?: IncidentEntitlementTier | string | null;
30
+ }): boolean;
31
+ /**
32
+ * Applies dispatch policy to what the client asked for.
33
+ *
34
+ * The client's checkboxes are an intent, never the decision: a Free user's
35
+ * provider option is unchecked and read-only in the app, and this is what makes
36
+ * that true even for a caller that ignores the UI. Anything the client omits
37
+ * defaults to "notify", so existing callers (web admin, older app builds) are
38
+ * unaffected.
39
+ *
40
+ * Returns resolved flags only - it deliberately does not reject the
41
+ * both-off combination, so callers can decide whether that is a validation
42
+ * error (the SOS path) or simply nobody to notify.
43
+ */
44
+ export declare function resolveIncidentAlertDispatch(request: AlertDispatchRequest): Required<IncidentAlertDispatch>;
45
+ /** True when an alert would reach nobody at all. */
46
+ export declare function reachesNobody(dispatch: IncidentAlertDispatch): boolean;
47
+ /**
48
+ * Parses a client-supplied dispatch scope. Unknown/absent values fall back to
49
+ * `ALL` so an unrecognised query string never silently hides incidents.
50
+ */
51
+ export declare function parseIncidentDispatchScope(value?: string | null): IncidentDispatchScope;
@@ -34,4 +34,18 @@ export declare class CreateIncidentDto {
34
34
  workflowTaskQueueName: IncidentWorkflowTaskQueueName;
35
35
  controlCentreId?: number;
36
36
  organizationId: number;
37
+ /**
38
+ * Whether the service provider's control room should receive this alert.
39
+ *
40
+ * The reporter's choice, not the decision: clarion-incident resolves it
41
+ * against the reporter's entitlement before storing it (a Free user's option
42
+ * is always off). Omitting it means "notify", so callers that predate the
43
+ * option - the web admin, older app builds - are unaffected.
44
+ */
45
+ notifyServiceProvider?: boolean;
46
+ /**
47
+ * Whether the reporter's guardians should join the incident chat and be
48
+ * notified. Omitting it means "notify".
49
+ */
50
+ notifyGuardians?: boolean;
37
51
  }
@@ -6,6 +6,7 @@ import { IncidentAssignmentDto } from "../assignment/incident-assignment.dto";
6
6
  import { IncidentResponseUnitAssignmentDto } from "../response-unit-assignment/update-incident-response-unit-assignment.dto";
7
7
  import { IncidentReporterDto } from "../reporter/incident-reporter.dto";
8
8
  import { IncidentStatusDetailsDto } from "./incident-status-details.dto";
9
+ import { IncidentEntitlementTier } from "../../../entitlement/enums/incident-entitlement-tier.enum";
9
10
  declare const IncidentDto_base: import("@nestjs/common").Type<Omit<CreateIncidentDto, "reporter" | "statusDetails">>;
10
11
  export declare class IncidentDto extends IncidentDto_base {
11
12
  id: number;
@@ -18,5 +19,12 @@ export declare class IncidentDto extends IncidentDto_base {
18
19
  responseUnitAssignments?: IncidentResponseUnitAssignmentDto[];
19
20
  createdAt: string;
20
21
  updatedAt: string;
22
+ /**
23
+ * Premium standing of the reporter when the alert was raised. Server-derived
24
+ * and read-only; it appears here so Kafka consumers (notably
25
+ * clarion-notification, which whitelists this DTO) can tell a Free-user
26
+ * alert from an entitled one without calling back into billing.
27
+ */
28
+ entitlementTier?: IncidentEntitlementTier;
21
29
  }
22
30
  export {};
@@ -57,6 +57,15 @@ export interface Incident {
57
57
  entitlementTier?: IncidentEntitlementTier;
58
58
  /** Point-in-time audit of how `entitlementTier` was decided. */
59
59
  entitlementSnapshot?: IncidentEntitlementSnapshot | null;
60
+ /**
61
+ * Who the reporter asked to be alerted, resolved against their entitlement
62
+ * at creation. `false` on the provider flag withholds the incident from the
63
+ * control room exactly as a Free tier does; `false` on the guardian flag
64
+ * keeps guardians out of the incident chat and its notifications. Absent on
65
+ * incidents raised before the options existed, which notified both.
66
+ */
67
+ notifyServiceProvider?: boolean;
68
+ notifyGuardians?: boolean;
60
69
  createdAt?: string;
61
70
  updatedAt?: string;
62
71
  category?: IncidentCategory;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Canonical environment variable that carries the platform "system user" id.
3
+ *
4
+ * The system user is a real row in the clarion-authentication `users` table
5
+ * that services stamp on records they create or mutate on their own behalf —
6
+ * i.e. when there is no authenticated human in the request (auto-assignment,
7
+ * automated status changes, service-to-service document uploads).
8
+ *
9
+ * It is deliberately NOT a compile-time constant: it is an environment-specific
10
+ * database row id, so dev / staging / production each carry their own value.
11
+ * The library owns the *contract* (key name, parsing, validation, fallback
12
+ * policy); the deployment owns the *value* (see clarion-deployment configmap).
13
+ */
14
+ export declare const SYSTEM_USER_ID_ENV_KEY = "SYSTEM_USER_ID";
15
+ /**
16
+ * Per-service keys that predate {@link SYSTEM_USER_ID_ENV_KEY}.
17
+ *
18
+ * Still read — in order — when the canonical key is absent, so that a rollback
19
+ * to an older ConfigMap does not take a service down. Remove once every
20
+ * environment has been migrated to the canonical key.
21
+ *
22
+ * @deprecated Set {@link SYSTEM_USER_ID_ENV_KEY} instead.
23
+ */
24
+ export declare const LEGACY_SYSTEM_USER_ID_ENV_KEYS: readonly string[];
@@ -0,0 +1,5 @@
1
+ export * from './constants/system-user.const';
2
+ export * from './interfaces/system-user-env-source';
3
+ export * from './utils/system-user.util';
4
+ export * from './services/system-user.service';
5
+ export * from './system-user.module';