tabletcommand-incident 0.4.16 → 0.5.0

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 (78) hide show
  1. package/build/domain.js +7 -8
  2. package/build/domain.js.map +1 -1
  3. package/build/incidentProcessor.js +15 -12
  4. package/build/incidentProcessor.js.map +1 -1
  5. package/build/ruleProcessorLegacy.js +1 -1
  6. package/build/ruleProcessorLegacy.js.map +1 -1
  7. package/build/rules/clean-up-comments.js.map +1 -1
  8. package/build/rules/close-incident-after-hours.js.map +1 -1
  9. package/build/rules/close-incident-matching-incident-number.js.map +1 -1
  10. package/build/rules/close-incident-of-certain-type.js.map +1 -1
  11. package/build/rules/copy-incident-number.js.map +1 -1
  12. package/build/rules/copy-location-comment.js.map +1 -1
  13. package/build/rules/index.js +2 -2
  14. package/build/rules/index.js.map +1 -1
  15. package/build/rules/map-unit-dates-verdugo.js.map +1 -1
  16. package/build/rules/remove-person-from-unit.js.map +1 -1
  17. package/build/rules/set-address.js.map +1 -1
  18. package/build/rules/set-communication-channels-from-radio-names.js.map +1 -1
  19. package/build/rules/set-fire-alarm-at-dispatch-from-alarm-level.js.map +1 -1
  20. package/build/rules/set-fire-map-from-map-pages-southern-marin.js.map +1 -1
  21. package/build/rules/set-format-units-pulsepoint.js.map +1 -1
  22. package/build/store.js +10 -4
  23. package/build/store.js.map +1 -1
  24. package/build/test/domain.js.map +1 -1
  25. package/build/test/index.js +20 -21
  26. package/build/test/index.js.map +1 -1
  27. package/build/test/mock.js +34 -33
  28. package/build/test/mock.js.map +1 -1
  29. package/build/test/rules/map-unit-dates-verdugo.js.map +1 -1
  30. package/build/test/rules/remove-person-from-unit.js.map +1 -1
  31. package/build/test/rules/set-format-units-pulsepoint.js.map +1 -1
  32. package/definitions/domain.d.ts +5 -5
  33. package/definitions/domain.d.ts.map +1 -1
  34. package/definitions/incidentProcessor.d.ts.map +1 -1
  35. package/definitions/rules/clean-up-comments.d.ts +2 -2
  36. package/definitions/rules/clean-up-comments.d.ts.map +1 -1
  37. package/definitions/rules/close-incident-matching-incident-number.d.ts.map +1 -1
  38. package/definitions/rules/copy-incident-number.d.ts.map +1 -1
  39. package/definitions/rules/copy-location-comment.d.ts.map +1 -1
  40. package/definitions/rules/index.d.ts.map +1 -1
  41. package/definitions/rules/map-unit-dates-verdugo.d.ts.map +1 -1
  42. package/definitions/rules/remove-person-from-unit.d.ts +2 -2
  43. package/definitions/rules/remove-person-from-unit.d.ts.map +1 -1
  44. package/definitions/rules/set-address.d.ts.map +1 -1
  45. package/definitions/rules/set-communication-channels-from-radio-names.d.ts.map +1 -1
  46. package/definitions/rules/set-format-units-pulsepoint.d.ts.map +1 -1
  47. package/definitions/store.d.ts +33 -1
  48. package/definitions/store.d.ts.map +1 -1
  49. package/definitions/test/mock.d.ts.map +1 -1
  50. package/definitions/test/rules/map-unit-dates-verdugo.d.ts.map +1 -1
  51. package/definitions/types.d.ts +0 -40
  52. package/definitions/types.d.ts.map +1 -1
  53. package/package.json +2 -5
  54. package/src/domain.ts +30 -38
  55. package/src/incidentProcessor.ts +9 -10
  56. package/src/ruleProcessorLegacy.js +1 -1
  57. package/src/rules/clean-up-comments.ts +9 -9
  58. package/src/rules/close-incident-after-hours.ts +1 -1
  59. package/src/rules/close-incident-matching-incident-number.ts +3 -3
  60. package/src/rules/close-incident-of-certain-type.ts +1 -1
  61. package/src/rules/copy-incident-number.ts +2 -2
  62. package/src/rules/copy-location-comment.ts +3 -3
  63. package/src/rules/index.ts +1 -2
  64. package/src/rules/map-unit-dates-verdugo.ts +3 -3
  65. package/src/rules/remove-person-from-unit.ts +6 -5
  66. package/src/rules/set-address.ts +4 -4
  67. package/src/rules/set-communication-channels-from-radio-names.ts +2 -2
  68. package/src/rules/set-fire-alarm-at-dispatch-from-alarm-level.ts +4 -4
  69. package/src/rules/set-fire-map-from-map-pages-southern-marin.ts +3 -3
  70. package/src/rules/set-format-units-pulsepoint.ts +4 -4
  71. package/src/store.ts +16 -10
  72. package/src/test/domain.ts +17 -17
  73. package/src/test/index.ts +23 -26
  74. package/src/test/mock.ts +34 -33
  75. package/src/test/rules/map-unit-dates-verdugo.ts +2 -2
  76. package/src/test/rules/remove-person-from-unit.ts +2 -2
  77. package/src/test/rules/set-format-units-pulsepoint.ts +3 -3
  78. package/src/types.ts +0 -51
@@ -1,11 +1,11 @@
1
1
  import { assert } from "chai";
2
- import { CADUnit } from "../../types";
3
2
  import "mocha";
4
3
  import _ from "lodash";
5
4
 
6
5
  import {
7
6
  IncidentRuleMapUnitDatesVerdugo,
8
7
  } from "../../rules/map-unit-dates-verdugo";
8
+ import { CADUnitType } from "tabletcommand-backend-models/definitions/types/cad-incident";
9
9
 
10
10
  describe("IncidentRuleMapUnitDatesVerdugo", function describeFunc() {
11
11
  it("sets city from city code", function() {
@@ -30,7 +30,7 @@ describe("IncidentRuleMapUnitDatesVerdugo", function describeFunc() {
30
30
  assert.isTrue(rule.matched);
31
31
  assert.isTrue(rule.changed);
32
32
 
33
- const u: CADUnit | undefined = _.first(result.Unit as CADUnit[]);
33
+ const u: CADUnitType | undefined = _.first(result.Unit as CADUnitType[]);
34
34
  assert.isObject(u);
35
35
 
36
36
  if (!u) {
@@ -5,7 +5,7 @@ import _ from "lodash";
5
5
  import {
6
6
  IncidentRuleRemovePersonFromUnit,
7
7
  } from "../../rules/remove-person-from-unit";
8
- import { CADUnit } from "../../types";
8
+ import { CADUnitType } from "tabletcommand-backend-models/definitions/types/cad-incident";
9
9
 
10
10
  describe("IncidentRuleRemovePersonFromUnit", function describeFunc() {
11
11
  it("removes apparatus units", function() {
@@ -66,7 +66,7 @@ describe("IncidentRuleRemovePersonFromUnit", function describeFunc() {
66
66
  const result = rule.apply(testMatchIncident, atDate);
67
67
  assert.isTrue(rule.matched);
68
68
  assert.isTrue(rule.changed);
69
- const unit = _.first(_.filter(result.Unit as Partial<CADUnit>[], (u) => u?.UnitID === "T9"));
69
+ const unit = _.first(_.filter(result.Unit as Partial<CADUnitType>[], (u) => u?.UnitID === "T9"));
70
70
  assert.isObject(unit);
71
71
  assert.equal(unit?.Personnel?.length, 6);
72
72
  assert.equal(unit?.PersonnelCount, 6);
@@ -2,10 +2,10 @@ import { assert } from "chai";
2
2
  import "mocha";
3
3
  import _ from "lodash";
4
4
 
5
- import { CADUnit } from "../../types";
6
5
  import {
7
6
  IncidentRuleSetFormatUnitsPulsePoint,
8
7
  } from "../../rules/set-format-units-pulsepoint";
8
+ import { CADUnitType } from "tabletcommand-backend-models/definitions/types/cad-incident";
9
9
 
10
10
  describe("IncidentRuleSetFormatUnitsPulsePoint", function describeFunc() {
11
11
  it("sets common place name", function() {
@@ -38,8 +38,8 @@ describe("IncidentRuleSetFormatUnitsPulsePoint", function describeFunc() {
38
38
  const result = rule.apply(testItem, atDate);
39
39
  assert.isTrue(rule.matched);
40
40
  assert.isTrue(rule.changed);
41
- assert.equal((result.Unit as CADUnit[]).length, 1);
42
- const u = _.first(result.Unit as CADUnit[]);
41
+ assert.equal((result.Unit as CADUnitType[]).length, 1);
42
+ const u = _.first(result.Unit as CADUnitType[]);
43
43
  if (!u) {
44
44
  assert.fail("No unit parsed");
45
45
  return;
package/src/types.ts CHANGED
@@ -7,57 +7,6 @@ export type RuleProcessorModule = {
7
7
  ruleProcessor(incident: Partial<CADIncident>, department: Partial<Department>): void;
8
8
  }
9
9
 
10
- // Copied of CADPerson from backend-models (until we find a better way to reference that type)
11
- export interface CADPerson extends Record<string, unknown> {
12
- PersonnelID: string,
13
- PersonnelName: string,
14
- PersonnelNote: string,
15
- PersonnelRank: string,
16
- PersonnelWorkCode: string,
17
- }
18
-
19
- // Copied from CADUnit
20
- export interface CADUnit extends Record<string, unknown> {
21
- UnitID: string,
22
- UnitDispatchNumber: string,
23
-
24
- AlarmAtDispatch: string,
25
- TimeDispatched: string,
26
- TimeEnroute: string,
27
- TimeArrived: string,
28
- TimeStaged: string,
29
- TimeCleared: string,
30
- TimeAtHospital: string,
31
- TimePatient: string,
32
- TimeTransport: string,
33
- TimeTransporting: string,
34
-
35
- PersonnelCount: number,
36
- Personnel: CADPerson[],
37
- uuid: string,
38
- }
39
-
40
- export interface CADRadioChannel extends Record<string, unknown> {
41
- name: string,
42
- channel: string,
43
- channelDescription: string,
44
- url: string,
45
- }
46
-
47
- // Copied from "tabletcommand-backend-models
48
- // to be removed once we migrate backend-models to proper Typescript
49
- export interface CADComment extends Record<string, string | boolean | Record<string, string> | undefined> {
50
- Comment: string
51
- CommentSource: string
52
- CommentDateTime: string
53
- // These should be optional, but there are not compatible with the properties exported from the models
54
- CommentConfidential: boolean,
55
- CommentOpts: {
56
- type: string,
57
- item: string,
58
- },
59
- }
60
-
61
10
  export interface CADReportNumber extends Record<string, string | undefined> {
62
11
  name?: string
63
12
  number?: string