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.
- package/build/domain.js +7 -8
- package/build/domain.js.map +1 -1
- package/build/incidentProcessor.js +15 -12
- package/build/incidentProcessor.js.map +1 -1
- package/build/ruleProcessorLegacy.js +1 -1
- package/build/ruleProcessorLegacy.js.map +1 -1
- package/build/rules/clean-up-comments.js.map +1 -1
- package/build/rules/close-incident-after-hours.js.map +1 -1
- package/build/rules/close-incident-matching-incident-number.js.map +1 -1
- package/build/rules/close-incident-of-certain-type.js.map +1 -1
- package/build/rules/copy-incident-number.js.map +1 -1
- package/build/rules/copy-location-comment.js.map +1 -1
- package/build/rules/index.js +2 -2
- package/build/rules/index.js.map +1 -1
- package/build/rules/map-unit-dates-verdugo.js.map +1 -1
- package/build/rules/remove-person-from-unit.js.map +1 -1
- package/build/rules/set-address.js.map +1 -1
- package/build/rules/set-communication-channels-from-radio-names.js.map +1 -1
- package/build/rules/set-fire-alarm-at-dispatch-from-alarm-level.js.map +1 -1
- package/build/rules/set-fire-map-from-map-pages-southern-marin.js.map +1 -1
- package/build/rules/set-format-units-pulsepoint.js.map +1 -1
- package/build/store.js +10 -4
- package/build/store.js.map +1 -1
- package/build/test/domain.js.map +1 -1
- package/build/test/index.js +20 -21
- package/build/test/index.js.map +1 -1
- package/build/test/mock.js +34 -33
- package/build/test/mock.js.map +1 -1
- package/build/test/rules/map-unit-dates-verdugo.js.map +1 -1
- package/build/test/rules/remove-person-from-unit.js.map +1 -1
- package/build/test/rules/set-format-units-pulsepoint.js.map +1 -1
- package/definitions/domain.d.ts +5 -5
- package/definitions/domain.d.ts.map +1 -1
- package/definitions/incidentProcessor.d.ts.map +1 -1
- package/definitions/rules/clean-up-comments.d.ts +2 -2
- package/definitions/rules/clean-up-comments.d.ts.map +1 -1
- package/definitions/rules/close-incident-matching-incident-number.d.ts.map +1 -1
- package/definitions/rules/copy-incident-number.d.ts.map +1 -1
- package/definitions/rules/copy-location-comment.d.ts.map +1 -1
- package/definitions/rules/index.d.ts.map +1 -1
- package/definitions/rules/map-unit-dates-verdugo.d.ts.map +1 -1
- package/definitions/rules/remove-person-from-unit.d.ts +2 -2
- package/definitions/rules/remove-person-from-unit.d.ts.map +1 -1
- package/definitions/rules/set-address.d.ts.map +1 -1
- package/definitions/rules/set-communication-channels-from-radio-names.d.ts.map +1 -1
- package/definitions/rules/set-format-units-pulsepoint.d.ts.map +1 -1
- package/definitions/store.d.ts +33 -1
- package/definitions/store.d.ts.map +1 -1
- package/definitions/test/mock.d.ts.map +1 -1
- package/definitions/test/rules/map-unit-dates-verdugo.d.ts.map +1 -1
- package/definitions/types.d.ts +0 -40
- package/definitions/types.d.ts.map +1 -1
- package/package.json +2 -5
- package/src/domain.ts +30 -38
- package/src/incidentProcessor.ts +9 -10
- package/src/ruleProcessorLegacy.js +1 -1
- package/src/rules/clean-up-comments.ts +9 -9
- package/src/rules/close-incident-after-hours.ts +1 -1
- package/src/rules/close-incident-matching-incident-number.ts +3 -3
- package/src/rules/close-incident-of-certain-type.ts +1 -1
- package/src/rules/copy-incident-number.ts +2 -2
- package/src/rules/copy-location-comment.ts +3 -3
- package/src/rules/index.ts +1 -2
- package/src/rules/map-unit-dates-verdugo.ts +3 -3
- package/src/rules/remove-person-from-unit.ts +6 -5
- package/src/rules/set-address.ts +4 -4
- package/src/rules/set-communication-channels-from-radio-names.ts +2 -2
- package/src/rules/set-fire-alarm-at-dispatch-from-alarm-level.ts +4 -4
- package/src/rules/set-fire-map-from-map-pages-southern-marin.ts +3 -3
- package/src/rules/set-format-units-pulsepoint.ts +4 -4
- package/src/store.ts +16 -10
- package/src/test/domain.ts +17 -17
- package/src/test/index.ts +23 -26
- package/src/test/mock.ts +34 -33
- package/src/test/rules/map-unit-dates-verdugo.ts +2 -2
- package/src/test/rules/remove-person-from-unit.ts +2 -2
- package/src/test/rules/set-format-units-pulsepoint.ts +3 -3
- 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:
|
|
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 {
|
|
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<
|
|
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
|
|
42
|
-
const u = _.first(result.Unit as
|
|
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
|