tabletcommand-backend-models 7.4.109 → 7.4.111
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/constants.js +1 -1
- package/build/constants.js.map +1 -1
- package/build/models/department.js +69 -3
- package/build/models/department.js.map +1 -1
- package/build/models/location.js +18 -1
- package/build/models/location.js.map +1 -1
- package/build/models/managed-incident.js +6 -0
- package/build/models/managed-incident.js.map +1 -1
- package/build/test/mock.js +4 -0
- package/build/test/mock.js.map +1 -1
- package/definitions/constants.d.ts +1 -1
- package/definitions/constants.d.ts.map +1 -1
- package/definitions/models/department.d.ts +12 -10
- package/definitions/models/department.d.ts.map +1 -1
- package/definitions/models/location.d.ts.map +1 -1
- package/definitions/models/managed-incident.d.ts.map +1 -1
- package/definitions/test/mock.d.ts.map +1 -1
- package/definitions/types/department.d.ts +12 -0
- package/definitions/types/department.d.ts.map +1 -1
- package/definitions/types/location.d.ts +2 -0
- package/definitions/types/location.d.ts.map +1 -1
- package/definitions/types/managed-incident.d.ts +2 -0
- package/definitions/types/managed-incident.d.ts.map +1 -1
- package/gulpfile.ts +25 -0
- package/package.json +17 -14
- package/src/constants.ts +1 -1
- package/src/models/department.ts +73 -3
- package/src/models/location.ts +21 -2
- package/src/models/managed-incident.ts +6 -0
- package/src/test/mock.ts +4 -0
- package/src/types/department.ts +15 -0
- package/src/types/location.ts +2 -0
- package/src/types/managed-incident.ts +2 -0
- package/gulpfile.js +0 -24
package/src/models/department.ts
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
ManagedIncidentModeItem,
|
|
58
58
|
ManagedIncidentPriority,
|
|
59
59
|
ManagedIncidentPriorityItem,
|
|
60
|
+
GMRConfigType,
|
|
60
61
|
Mark43ConfigType,
|
|
61
62
|
Mark43ProcessCommentConfigType,
|
|
62
63
|
Mark43ProcessConfigType,
|
|
@@ -88,7 +89,7 @@ import {
|
|
|
88
89
|
export interface Department extends DepartmentType, Record<string, unknown> {
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
export const Mark43StatusConfigDefault = {
|
|
92
|
+
export const Mark43StatusConfigDefault: UnitStatusCodesConfigType = {
|
|
92
93
|
TimeDispatched: ["D"],
|
|
93
94
|
TimeEnroute: ["EN"],
|
|
94
95
|
TimeStaged: ["ST"],
|
|
@@ -98,6 +99,16 @@ export const Mark43StatusConfigDefault = {
|
|
|
98
99
|
TimeArrived: ["ATS", "A"],
|
|
99
100
|
};
|
|
100
101
|
|
|
102
|
+
export const GMRStatusConfigDefault: UnitStatusCodesConfigType = {
|
|
103
|
+
TimeDispatched: ["SentToVehicle"],
|
|
104
|
+
TimeEnroute: ["EnRouteToPickup"],
|
|
105
|
+
TimeStaged: [],
|
|
106
|
+
TimeCleared: ["Finished"],
|
|
107
|
+
TimeAtHospital: [],
|
|
108
|
+
TimeTransporting: [],
|
|
109
|
+
TimeArrived: ["ArrivedToPickup"],
|
|
110
|
+
};
|
|
111
|
+
|
|
101
112
|
export const IntterraFieldsDefault = [
|
|
102
113
|
{
|
|
103
114
|
key: "IncidentNumber",
|
|
@@ -280,6 +291,16 @@ export const Mark43ConfigDefault = {
|
|
|
280
291
|
enabled: false,
|
|
281
292
|
};
|
|
282
293
|
|
|
294
|
+
export const GMRConfigDefault = {
|
|
295
|
+
baseUrl: "",
|
|
296
|
+
authToken: "",
|
|
297
|
+
apiToken: "",
|
|
298
|
+
enabled: false,
|
|
299
|
+
webhookSecret: "",
|
|
300
|
+
agencyId: "",
|
|
301
|
+
radioNamePrefixesToStrip: [],
|
|
302
|
+
};
|
|
303
|
+
|
|
283
304
|
export const WebhookConfigDefault = {
|
|
284
305
|
enabled: false,
|
|
285
306
|
bulkProcessingEnabled: false,
|
|
@@ -568,7 +589,7 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
|
|
|
568
589
|
const WebhookConfig = WebhookSchema(mongoose);
|
|
569
590
|
const WSFeedConfig = WSFeedSchema(mongoose);
|
|
570
591
|
|
|
571
|
-
const
|
|
592
|
+
const UnitStatusCodesConfig = new Schema<UnitStatusCodesConfigType>({
|
|
572
593
|
TimeDispatched: {
|
|
573
594
|
type: [String],
|
|
574
595
|
default: []
|
|
@@ -693,7 +714,7 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
|
|
|
693
714
|
default: false,
|
|
694
715
|
},
|
|
695
716
|
unitStatusCodes: {
|
|
696
|
-
type:
|
|
717
|
+
type: UnitStatusCodesConfig,
|
|
697
718
|
default: Mark43StatusConfigDefault,
|
|
698
719
|
},
|
|
699
720
|
process: {
|
|
@@ -704,6 +725,44 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
|
|
|
704
725
|
id: false,
|
|
705
726
|
});
|
|
706
727
|
|
|
728
|
+
const GMRConfig = new Schema<GMRConfigType>({
|
|
729
|
+
baseUrl: {
|
|
730
|
+
type: String,
|
|
731
|
+
default: "",
|
|
732
|
+
},
|
|
733
|
+
authToken: {
|
|
734
|
+
type: String,
|
|
735
|
+
default: "",
|
|
736
|
+
},
|
|
737
|
+
apiToken: {
|
|
738
|
+
type: String,
|
|
739
|
+
default: "",
|
|
740
|
+
},
|
|
741
|
+
enabled: {
|
|
742
|
+
type: Boolean,
|
|
743
|
+
default: false,
|
|
744
|
+
},
|
|
745
|
+
unitStatusCodes: {
|
|
746
|
+
type: UnitStatusCodesConfig,
|
|
747
|
+
default: GMRStatusConfigDefault,
|
|
748
|
+
},
|
|
749
|
+
webhookSecret: {
|
|
750
|
+
type: String,
|
|
751
|
+
default: "",
|
|
752
|
+
},
|
|
753
|
+
agencyId: {
|
|
754
|
+
type: String,
|
|
755
|
+
default: "",
|
|
756
|
+
},
|
|
757
|
+
radioNamePrefixesToStrip: {
|
|
758
|
+
type: [String],
|
|
759
|
+
default: [],
|
|
760
|
+
},
|
|
761
|
+
}, {
|
|
762
|
+
_id: false,
|
|
763
|
+
id: false,
|
|
764
|
+
});
|
|
765
|
+
|
|
707
766
|
const IntterraFields = new Schema<IntterraFieldsType>({
|
|
708
767
|
key: {
|
|
709
768
|
type: String,
|
|
@@ -2226,6 +2285,13 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
|
|
|
2226
2285
|
type: Number,
|
|
2227
2286
|
default: 45000,
|
|
2228
2287
|
},
|
|
2288
|
+
area: {
|
|
2289
|
+
type: GeoPolygon,
|
|
2290
|
+
default: {
|
|
2291
|
+
type: "Polygon",
|
|
2292
|
+
coordinates: [],
|
|
2293
|
+
},
|
|
2294
|
+
}
|
|
2229
2295
|
},
|
|
2230
2296
|
shareIncident: {
|
|
2231
2297
|
enabled: {
|
|
@@ -2348,6 +2414,10 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
|
|
|
2348
2414
|
type: Mark43Config,
|
|
2349
2415
|
default: Mark43ConfigDefault
|
|
2350
2416
|
},
|
|
2417
|
+
gmr: {
|
|
2418
|
+
type: GMRConfig,
|
|
2419
|
+
default: GMRConfigDefault
|
|
2420
|
+
},
|
|
2351
2421
|
webhook: {
|
|
2352
2422
|
type: WebhookConfig,
|
|
2353
2423
|
default: WebhookConfigDefault,
|
package/src/models/location.ts
CHANGED
|
@@ -11,7 +11,7 @@ import ColorModule from "./schema/color";
|
|
|
11
11
|
import { GeoPointSchema } from "./schema/geojson";
|
|
12
12
|
import { Model } from "mongoose";
|
|
13
13
|
import { LocationType } from "../types/location";
|
|
14
|
-
import { LocationVisibility } from "../constants";
|
|
14
|
+
import { AccountIndustry, LocationVisibility } from "../constants";
|
|
15
15
|
|
|
16
16
|
export interface Location extends LocationType, Record<string, unknown> { }
|
|
17
17
|
|
|
@@ -208,6 +208,11 @@ export default async function LocationModule(mongoose: MongooseModule) {
|
|
|
208
208
|
type: Date,
|
|
209
209
|
},
|
|
210
210
|
|
|
211
|
+
industry: {
|
|
212
|
+
type: String,
|
|
213
|
+
default: AccountIndustry.Fire,
|
|
214
|
+
},
|
|
215
|
+
|
|
211
216
|
// combines .sendToCAD, .active, .shared as LocationVisibility[]
|
|
212
217
|
visibility: {
|
|
213
218
|
type: [String],
|
|
@@ -359,13 +364,27 @@ export default async function LocationModule(mongoose: MongooseModule) {
|
|
|
359
364
|
shared: 1,
|
|
360
365
|
modified: 1,
|
|
361
366
|
movedAt: 1,
|
|
362
|
-
// departmentId: 1,
|
|
363
367
|
locationGeoJSON: "2dsphere",
|
|
364
368
|
}, {
|
|
365
369
|
name: "shared_1_modified_1_movedAt_1_locationGeoJSON_2dsphere",
|
|
366
370
|
"2dsphereIndexVersion": 3
|
|
367
371
|
});
|
|
368
372
|
|
|
373
|
+
// Duplicate of the above, but also including industry
|
|
374
|
+
// Test in production, and if it's used, drop the above, keep this
|
|
375
|
+
// All indexes are populated manually
|
|
376
|
+
modelSchema.index({
|
|
377
|
+
// This seems to need to be the first position, otherwise the query plan selects the wrong index (?)
|
|
378
|
+
shared: 1,
|
|
379
|
+
industry: 1,
|
|
380
|
+
modified: 1,
|
|
381
|
+
movedAt: 1,
|
|
382
|
+
locationGeoJSON: "2dsphere",
|
|
383
|
+
}, {
|
|
384
|
+
name: "shared_1_industry_1_modified_1_movedAt_1_locationGeoJSON_2dsphere",
|
|
385
|
+
"2dsphereIndexVersion": 3
|
|
386
|
+
});
|
|
387
|
+
|
|
369
388
|
// Expire data after 45d
|
|
370
389
|
modelSchema.index({
|
|
371
390
|
movedAt: -1,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
SharedSourceSchema,
|
|
15
15
|
SharedToSchema,
|
|
16
16
|
} from "./schema/common-incident";
|
|
17
|
+
import { GeoPointSchema } from "./schema/geojson";
|
|
17
18
|
import { Model } from "mongoose";
|
|
18
19
|
import {
|
|
19
20
|
HistoryItemType,
|
|
@@ -34,6 +35,7 @@ export default async function ManagedIncidentModule(mongoose: MongooseModule) {
|
|
|
34
35
|
const CADPerson = CADPersonSchema(mongoose);
|
|
35
36
|
const Caller = CallerSchema(mongoose);
|
|
36
37
|
const FilterLabel = IncidentFilterLabelSchema(mongoose);
|
|
38
|
+
const GeoPoint = GeoPointSchema(mongoose);
|
|
37
39
|
const RadioChannel = RadioChannelSchema(mongoose);
|
|
38
40
|
const RecordValue = RecordSchema(mongoose);
|
|
39
41
|
const ReportNumber = ReportNumberSchema(mongoose);
|
|
@@ -470,6 +472,10 @@ export default async function ManagedIncidentModule(mongoose: MongooseModule) {
|
|
|
470
472
|
CallerNumber: String,
|
|
471
473
|
CommandChannel: String,
|
|
472
474
|
CommonPlaceName: String,
|
|
475
|
+
coordinate: {
|
|
476
|
+
type: GeoPoint,
|
|
477
|
+
default: null,
|
|
478
|
+
},
|
|
473
479
|
cross_streets: String,
|
|
474
480
|
deviceTime: {
|
|
475
481
|
type: String,
|
package/src/test/mock.ts
CHANGED
|
@@ -841,6 +841,10 @@ export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
|
841
841
|
opAreaCode: "DAL",
|
|
842
842
|
opAreaName: "Delta Operations",
|
|
843
843
|
fadeZoomLevel: 1,
|
|
844
|
+
area: {
|
|
845
|
+
type: "Polygon",
|
|
846
|
+
coordinates: [],
|
|
847
|
+
},
|
|
844
848
|
},
|
|
845
849
|
shareLocationPhones: false,
|
|
846
850
|
shareLocationTablets: true,
|
package/src/types/department.ts
CHANGED
|
@@ -155,6 +155,17 @@ export interface Mark43ConfigType {
|
|
|
155
155
|
process: Mark43ProcessConfigType
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
export interface GMRConfigType {
|
|
159
|
+
baseUrl: string,
|
|
160
|
+
authToken: string,
|
|
161
|
+
apiToken: string,
|
|
162
|
+
enabled: boolean,
|
|
163
|
+
unitStatusCodes: UnitStatusCodesConfigType,
|
|
164
|
+
webhookSecret: string,
|
|
165
|
+
agencyId: string,
|
|
166
|
+
radioNamePrefixesToStrip: string[],
|
|
167
|
+
}
|
|
168
|
+
|
|
158
169
|
export interface IntterraFieldsType {
|
|
159
170
|
key: string,
|
|
160
171
|
value: string,
|
|
@@ -537,6 +548,9 @@ export type AccountConfigurationShareAVL = {
|
|
|
537
548
|
opAreaName: string,
|
|
538
549
|
opAreaCode: string,
|
|
539
550
|
fadeZoomLevel: number,
|
|
551
|
+
// When sharing location, only view what's in this area
|
|
552
|
+
// GeoPolygon should already support multiple area (rings)
|
|
553
|
+
area: GeoPolygon,
|
|
540
554
|
};
|
|
541
555
|
|
|
542
556
|
export type AccountConfigurationShareIncident = {
|
|
@@ -669,6 +683,7 @@ export interface DepartmentType {
|
|
|
669
683
|
managedIncidentMode: ManagedIncidentMode,
|
|
670
684
|
managedIncidentPriority: ManagedIncidentPriority,
|
|
671
685
|
mark43: Mark43ConfigType,
|
|
686
|
+
gmr: GMRConfigType,
|
|
672
687
|
minPasswordLength: number,
|
|
673
688
|
modified_unix_date: number,
|
|
674
689
|
modified: Date,
|
package/src/types/location.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Types } from "mongoose";
|
|
2
2
|
import { ColorSchemaType } from "./color";
|
|
3
3
|
import { GeoPoint } from "./geojson";
|
|
4
|
+
import { AccountIndustry } from "../constants";
|
|
4
5
|
|
|
5
6
|
export interface LocationType {
|
|
6
7
|
_id: Types.ObjectId,
|
|
@@ -16,6 +17,7 @@ export interface LocationType {
|
|
|
16
17
|
device_type: string,
|
|
17
18
|
esriId: number,
|
|
18
19
|
heading: number,
|
|
20
|
+
industry: AccountIndustry,
|
|
19
21
|
kindType: string,
|
|
20
22
|
kind?: string,
|
|
21
23
|
type?: string,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
SharedSourceSchemaType,
|
|
10
10
|
SharedToSchemaType,
|
|
11
11
|
} from "./common-incident";
|
|
12
|
+
import { GeoPoint } from "./geojson";
|
|
12
13
|
|
|
13
14
|
export interface HistoryItemType extends Record<string, unknown> {
|
|
14
15
|
entity_id: string,
|
|
@@ -135,6 +136,7 @@ export interface ManagedIncidentType {
|
|
|
135
136
|
channel: string,
|
|
136
137
|
channel_owner: string,
|
|
137
138
|
checklists: IncidentChecklistType[]
|
|
139
|
+
coordinate?: GeoPoint, // Set only if coordinate is valid, not 0,0 and inside bounds
|
|
138
140
|
cross_streets: string,
|
|
139
141
|
departmentId: string,
|
|
140
142
|
deviceTime: string,
|
package/gulpfile.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const gulp = require("gulp");
|
|
2
|
-
const exec = require("gulp-execa");
|
|
3
|
-
const { deleteAsync } = require("del");
|
|
4
|
-
|
|
5
|
-
gulp.task("clean", function cleanTask() {
|
|
6
|
-
return deleteAsync([
|
|
7
|
-
"build/**",
|
|
8
|
-
"definitions/**",
|
|
9
|
-
], {
|
|
10
|
-
force: true
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
gulp.task("build", gulp.series("clean", exec.task("tsc -p src")));
|
|
15
|
-
|
|
16
|
-
gulp.task("lint", exec.task("eslint src"));
|
|
17
|
-
|
|
18
|
-
gulp.task("test", exec.task("tsx --test --test-concurrency=1 --test-reporter=spec src/test/*.ts"));
|
|
19
|
-
|
|
20
|
-
gulp.task("spell", exec.task("cspell --no-progress"));
|
|
21
|
-
|
|
22
|
-
gulp.task("type-coverage", exec.task("type-coverage --detail"));
|
|
23
|
-
|
|
24
|
-
gulp.task("default", gulp.series("spell", "type-coverage", "lint", "build", "test"));
|