tabletcommand-backend-models 7.4.27 → 7.4.29
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/index.js +6 -1
- package/build/index.js.map +1 -1
- package/build/models/agency.js +3 -3
- package/build/models/agency.js.map +1 -1
- package/build/models/cad-incident.js +28 -33
- package/build/models/cad-incident.js.map +1 -1
- package/build/models/cad-status.js +1 -1
- package/build/models/cad-status.js.map +1 -1
- package/build/models/cad-vehicle-status.js +28 -0
- package/build/models/cad-vehicle-status.js.map +1 -1
- package/build/models/global-settings.js +0 -4
- package/build/models/global-settings.js.map +1 -1
- package/build/models/incident-event.js +4 -3
- package/build/models/incident-event.js.map +1 -1
- package/build/models/incident-filter.js +0 -1
- package/build/models/incident-filter.js.map +1 -1
- package/build/models/managed-incident.js +10 -0
- package/build/models/managed-incident.js.map +1 -1
- package/build/models/{schema/agency-saml.js → saml.js} +21 -5
- package/build/models/saml.js.map +1 -0
- package/build/test/0index.js +1 -0
- package/build/test/0index.js.map +1 -1
- package/build/test/agency.js +1 -0
- package/build/test/agency.js.map +1 -1
- package/build/test/cad-status.js +1 -1
- package/build/test/cad-status.js.map +1 -1
- package/build/test/cad-vehicle-status.js +11 -0
- package/build/test/cad-vehicle-status.js.map +1 -1
- package/build/test/mock.js +20 -2
- package/build/test/mock.js.map +1 -1
- package/build/test/saml.js +38 -0
- package/build/test/saml.js.map +1 -0
- package/build/types/saml.js +3 -0
- package/build/types/saml.js.map +1 -0
- package/definitions/index.d.ts +7 -1
- package/definitions/index.d.ts.map +1 -1
- package/definitions/models/cad-incident.d.ts.map +1 -1
- package/definitions/models/cad-vehicle-status.d.ts.map +1 -1
- package/definitions/models/global-settings.d.ts.map +1 -1
- package/definitions/models/incident-event.d.ts.map +1 -1
- package/definitions/models/incident-filter.d.ts.map +1 -1
- package/definitions/models/managed-incident.d.ts.map +1 -1
- package/definitions/models/saml.d.ts +22 -0
- package/definitions/models/saml.d.ts.map +1 -0
- package/definitions/test/mock.d.ts +11 -2
- package/definitions/test/mock.d.ts.map +1 -1
- package/definitions/test/saml.d.ts +2 -0
- package/definitions/test/saml.d.ts.map +1 -0
- package/definitions/types/agency.d.ts +2 -9
- package/definitions/types/agency.d.ts.map +1 -1
- package/definitions/types/cad.d.ts +9 -1
- package/definitions/types/cad.d.ts.map +1 -1
- package/definitions/types/saml.d.ts +13 -0
- package/definitions/types/saml.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/index.ts +9 -1
- package/src/models/agency.ts +3 -3
- package/src/models/cad-incident.ts +30 -36
- package/src/models/cad-status.ts +1 -1
- package/src/models/cad-vehicle-status.ts +28 -0
- package/src/models/global-settings.ts +0 -4
- package/src/models/incident-event.ts +4 -3
- package/src/models/incident-filter.ts +0 -1
- package/src/models/managed-incident.ts +11 -0
- package/src/models/{schema/agency-saml.ts → saml.ts} +29 -5
- package/src/test/0index.ts +1 -0
- package/src/test/agency.ts +1 -0
- package/src/test/cad-status.ts +1 -1
- package/src/test/cad-vehicle-status.ts +10 -0
- package/src/test/mock.ts +23 -3
- package/src/test/saml.ts +38 -0
- package/src/types/agency.ts +2 -10
- package/src/types/cad.ts +10 -1
- package/src/types/saml.ts +13 -0
- package/build/models/schema/agency-saml.js.map +0 -1
- package/definitions/models/schema/agency-saml.d.ts +0 -12
- package/definitions/models/schema/agency-saml.d.ts.map +0 -1
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assign } from "lodash";
|
|
2
2
|
import { ConnectOptions } from "mongoose";
|
|
3
3
|
import { MongooseModule } from "./helpers";
|
|
4
|
+
|
|
4
5
|
export {
|
|
5
6
|
AccountCallerType,
|
|
6
7
|
AccountIndustry,
|
|
@@ -15,6 +16,7 @@ export {
|
|
|
15
16
|
|
|
16
17
|
async function wireModels(mongoose: MongooseModule) {
|
|
17
18
|
type ModelType<TModule extends Record<"default", (m: MongooseModule) => unknown>> = ReturnType<TModule["default"]>;
|
|
19
|
+
|
|
18
20
|
async function getModel<TModule extends Record<"default", (m: MongooseModule) => unknown>>(m: Promise<TModule>): Promise<ModelType<TModule>> {
|
|
19
21
|
const module = await m;
|
|
20
22
|
return module.default(mongoose) as Promise<ModelType<TModule>>;
|
|
@@ -69,6 +71,7 @@ async function wireModels(mongoose: MongooseModule) {
|
|
|
69
71
|
RemoteLog: await getModel(import("./models/remote-log")),
|
|
70
72
|
RemoteLogStream: await getModel(import("./models/remote-log-stream")),
|
|
71
73
|
Session: await getModel(import("./models/session")),
|
|
74
|
+
SAML: await getModel(import("./models/saml")),
|
|
72
75
|
SMSLog: await getModel(import("./models/sms-log")),
|
|
73
76
|
SMTPUnhandled: await getModel(import("./models/smtp-unhandled")),
|
|
74
77
|
Template: await getModel(import("./models/template")),
|
|
@@ -127,6 +130,7 @@ export { ReleaseNote, ReleaseNoteModel } from "./models/release-note";
|
|
|
127
130
|
export { RemoteLog, RemoteLogModel } from "./models/remote-log";
|
|
128
131
|
export { RemoteLogStream, RemoteLogStreamModel } from "./models/remote-log-stream";
|
|
129
132
|
export { Session, SessionModel } from "./models/session";
|
|
133
|
+
export { SAML, SAMLModel } from "./models/saml";
|
|
130
134
|
export { SMSLog, SMSLogModel } from "./models/sms-log";
|
|
131
135
|
export { SMTPUnhandled, SMTPUnhandledModel } from "./models/smtp-unhandled";
|
|
132
136
|
export { Template, TemplateModel } from "./models/template";
|
|
@@ -156,7 +160,11 @@ export async function connect(url: string, overwriteOpts?: ConnectOptions, enabl
|
|
|
156
160
|
const opts: ConnectOptions = assign({}, defaultOpts, overwriteOpts);
|
|
157
161
|
const connection = await mongoose.connect(url, opts);
|
|
158
162
|
|
|
159
|
-
return {
|
|
163
|
+
return {
|
|
164
|
+
connection,
|
|
165
|
+
models,
|
|
166
|
+
mongoose,
|
|
167
|
+
};
|
|
160
168
|
}
|
|
161
169
|
|
|
162
170
|
type UnboxPromise<T extends Promise<unknown>> = T extends Promise<infer U> ? U : never;
|
package/src/models/agency.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "../helpers";
|
|
10
10
|
|
|
11
11
|
import AgencyCronConfigModule from "./schema/agency-cron-config";
|
|
12
|
-
import
|
|
12
|
+
import { SAMLSchema as SAMLModule } from "./saml";
|
|
13
13
|
import { CrossStaffedUnitType, AgencyType } from "../types/agency";
|
|
14
14
|
|
|
15
15
|
export interface Agency extends AgencyType, Record<string, unknown> { }
|
|
@@ -17,7 +17,7 @@ export interface Agency extends AgencyType, Record<string, unknown> { }
|
|
|
17
17
|
export function AgencySchema(mongoose: MongooseModule) {
|
|
18
18
|
const { Schema } = mongoose;
|
|
19
19
|
const AgencyCronConfig = AgencyCronConfigModule(mongoose);
|
|
20
|
-
const
|
|
20
|
+
const SAML = SAMLModule(mongoose);
|
|
21
21
|
|
|
22
22
|
const CrossStaffedUnit = new Schema<CrossStaffedUnitType>({
|
|
23
23
|
radioName: {
|
|
@@ -125,7 +125,7 @@ export function AgencySchema(mongoose: MongooseModule) {
|
|
|
125
125
|
default: null,
|
|
126
126
|
},
|
|
127
127
|
saml: {
|
|
128
|
-
type: [
|
|
128
|
+
type: [SAML],
|
|
129
129
|
default: [],
|
|
130
130
|
select: false, // Not a secret but not needed in all the queries
|
|
131
131
|
},
|
|
@@ -20,13 +20,6 @@ export default async function CADIncidentModule(mongoose: MongooseModule) {
|
|
|
20
20
|
name: "closed_unix_date_1_departmentId_1_modified_unix_date_1",
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
modelSchema.index({
|
|
24
|
-
closed_unix_date: 1,
|
|
25
|
-
modified_unix_date: 1
|
|
26
|
-
}, {
|
|
27
|
-
name: "closed_unix_date_modified_unix_date",
|
|
28
|
-
});
|
|
29
|
-
|
|
30
23
|
modelSchema.index({
|
|
31
24
|
departmentId: 1,
|
|
32
25
|
ClosedDateTime: -1
|
|
@@ -74,35 +67,6 @@ export default async function CADIncidentModule(mongoose: MongooseModule) {
|
|
|
74
67
|
name: "departmentId_1_start_unix_date_1",
|
|
75
68
|
});
|
|
76
69
|
|
|
77
|
-
modelSchema.index({
|
|
78
|
-
expiration_date: 1,
|
|
79
|
-
ClosedDateTime: 1
|
|
80
|
-
}, {
|
|
81
|
-
name: "expiration_date_1_ClosedDateTime_1",
|
|
82
|
-
partialFilterExpression: {
|
|
83
|
-
expiration_date: {
|
|
84
|
-
$gt: ""
|
|
85
|
-
},
|
|
86
|
-
ClosedDateTime: {
|
|
87
|
-
$eq: ""
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
modelSchema.index({
|
|
93
|
-
expiration_date: 1,
|
|
94
|
-
ClosedDateTime: 1,
|
|
95
|
-
departmentId: 1
|
|
96
|
-
}, {
|
|
97
|
-
name: "expiration_date_1_ClosedDateTime_1_departmentId_1",
|
|
98
|
-
partialFilterExpression: {
|
|
99
|
-
expiration_date: {
|
|
100
|
-
$gt: ""
|
|
101
|
-
},
|
|
102
|
-
ClosedDateTime: ""
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
70
|
modelSchema.index({
|
|
107
71
|
"sharedTo.departmentId": 1,
|
|
108
72
|
"sharedTo.expireAt": 1
|
|
@@ -217,6 +181,36 @@ export default async function CADIncidentModule(mongoose: MongooseModule) {
|
|
|
217
181
|
name: "IncidentNumber_1_sharedTo.userId_1",
|
|
218
182
|
});
|
|
219
183
|
|
|
184
|
+
//
|
|
185
|
+
modelSchema.index({
|
|
186
|
+
ClosedDateTime: 1,
|
|
187
|
+
expiration_date: 1,
|
|
188
|
+
}, {
|
|
189
|
+
name: "ClosedDateTime_1_expiration_date_1",
|
|
190
|
+
partialFilterExpression: {
|
|
191
|
+
ClosedDateTime: {
|
|
192
|
+
$eq: ""
|
|
193
|
+
},
|
|
194
|
+
expiration_date: {
|
|
195
|
+
$gt: ""
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
modelSchema.index({
|
|
201
|
+
ClosedDateTime: 1,
|
|
202
|
+
expiration_date: 1,
|
|
203
|
+
departmentId: 1
|
|
204
|
+
}, {
|
|
205
|
+
name: "ClosedDateTime_1_expiration_date_1_departmentId_1",
|
|
206
|
+
partialFilterExpression: {
|
|
207
|
+
expiration_date: {
|
|
208
|
+
$gt: ""
|
|
209
|
+
},
|
|
210
|
+
ClosedDateTime: ""
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
220
214
|
return mongoose.model<CADIncident>("CADIncident", modelSchema, "massive_incident_cad", { overwriteModels: true });
|
|
221
215
|
}
|
|
222
216
|
|
package/src/models/cad-status.ts
CHANGED
|
@@ -127,6 +127,34 @@ export default async function CADVehicleStatusModule(mongoose: MongooseModule) {
|
|
|
127
127
|
type: Destination,
|
|
128
128
|
default: null,
|
|
129
129
|
},
|
|
130
|
+
extra: {
|
|
131
|
+
type: new Schema({
|
|
132
|
+
doorCode: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: "",
|
|
135
|
+
},
|
|
136
|
+
destinationStatus: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: "",
|
|
139
|
+
},
|
|
140
|
+
destinationNote: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: "",
|
|
143
|
+
},
|
|
144
|
+
latitude: {
|
|
145
|
+
type: Number,
|
|
146
|
+
default: 0,
|
|
147
|
+
},
|
|
148
|
+
longitude: {
|
|
149
|
+
type: Number,
|
|
150
|
+
default: 0,
|
|
151
|
+
},
|
|
152
|
+
}, {
|
|
153
|
+
_id: false,
|
|
154
|
+
id: false,
|
|
155
|
+
}),
|
|
156
|
+
default: null,
|
|
157
|
+
},
|
|
130
158
|
// Used by frontend
|
|
131
159
|
assignableByUser: {
|
|
132
160
|
type: Boolean,
|
|
@@ -197,11 +197,12 @@ export default async function IncidentEventModule(mongoose: MongooseModule) {
|
|
|
197
197
|
name: "sharedTo.userId_1_IncidentNumber_1_modified_unix_date_1",
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
+
// This index will be converted to unique using `prepareUnique: true` later
|
|
200
201
|
modelSchema.index({
|
|
201
|
-
uuid: 1,
|
|
202
|
+
uuid: -1,
|
|
202
203
|
}, {
|
|
203
|
-
name: "
|
|
204
|
-
unique: true,
|
|
204
|
+
name: "uuid_tmp",
|
|
205
|
+
// unique: true,
|
|
205
206
|
});
|
|
206
207
|
|
|
207
208
|
modelSchema.index({
|
|
@@ -599,6 +599,17 @@ export default async function ManagedIncidentModule(mongoose: MongooseModule) {
|
|
|
599
599
|
name: "departmentId_1_api_incident_number_1",
|
|
600
600
|
});
|
|
601
601
|
|
|
602
|
+
// To be used with prepareUnique: true
|
|
603
|
+
modelSchema.index({
|
|
604
|
+
departmentId: 1,
|
|
605
|
+
api_incident_number: 1
|
|
606
|
+
}, {
|
|
607
|
+
name: "departmentId_1_api_incident_number_1_rts_true",
|
|
608
|
+
partialFilterExpression: {
|
|
609
|
+
rts: true
|
|
610
|
+
},
|
|
611
|
+
});
|
|
612
|
+
|
|
602
613
|
modelSchema.index({
|
|
603
614
|
departmentId: 1,
|
|
604
615
|
end_unix_time: 1,
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import { Model } from "mongoose";
|
|
1
2
|
import {
|
|
2
3
|
MongooseModule,
|
|
3
|
-
} from "
|
|
4
|
-
import {
|
|
4
|
+
} from "../helpers";
|
|
5
|
+
import { SAMLType } from "../types/saml";
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
+
export interface SAML extends SAMLType { }
|
|
8
|
+
|
|
9
|
+
export function SAMLSchema(mongoose: MongooseModule) {
|
|
7
10
|
const { Schema } = mongoose;
|
|
8
11
|
|
|
9
|
-
const
|
|
12
|
+
const SAML = new Schema<SAMLType>({
|
|
13
|
+
_id: {
|
|
14
|
+
type: Schema.Types.ObjectId,
|
|
15
|
+
auto: true,
|
|
16
|
+
},
|
|
17
|
+
|
|
10
18
|
selector: {
|
|
11
19
|
type: String,
|
|
12
20
|
required: true,
|
|
@@ -45,5 +53,21 @@ export default function AgencySAMLSchema(mongoose: MongooseModule) {
|
|
|
45
53
|
}
|
|
46
54
|
});
|
|
47
55
|
|
|
48
|
-
return
|
|
56
|
+
return SAML;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default async function SAMLModule(mongoose: MongooseModule) {
|
|
60
|
+
const modelSchema = SAMLSchema(mongoose);
|
|
61
|
+
|
|
62
|
+
// Unique selector
|
|
63
|
+
modelSchema.index({
|
|
64
|
+
selector: 1,
|
|
65
|
+
}, {
|
|
66
|
+
name: "selector_unique",
|
|
67
|
+
unique: true,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return mongoose.model<SAML>("SAML", modelSchema, "massive_saml", { overwriteModels: true });
|
|
49
71
|
}
|
|
72
|
+
|
|
73
|
+
export interface SAMLModel extends Model<SAML> { }
|
package/src/test/0index.ts
CHANGED
|
@@ -65,6 +65,7 @@ describe(" Models", function() {
|
|
|
65
65
|
assert.isFunction(models.RemoteLog, "Missing RemoteLog");
|
|
66
66
|
assert.isFunction(models.RemoteLogStream, "Missing RemoteLogStream");
|
|
67
67
|
assert.isFunction(models.Session, "Missing Session");
|
|
68
|
+
assert.isFunction(models.SAML, "Missing SAML");
|
|
68
69
|
assert.isFunction(models.SMSLog, "Missing SMSLog");
|
|
69
70
|
assert.isFunction(models.SMTPUnhandled, "Missing SMTPUnhandled");
|
|
70
71
|
assert.isFunction(models.Template, "Missing Template");
|
package/src/test/agency.ts
CHANGED
package/src/test/cad-status.ts
CHANGED
|
@@ -53,7 +53,7 @@ describe("CADStatus", function() {
|
|
|
53
53
|
assert.equal(testItem.options[0]?.cadValues[0]?.longitude, sut.options[0]?.cadValues[0]?.longitude);
|
|
54
54
|
assert.equal(testItem.options[0]?.cadValues[0]?.time, sut.options[0]?.cadValues[0]?.time);
|
|
55
55
|
assert.equal(testItem.options[0]?.cadValues[0]?.doorCode, sut.options[0]?.cadValues[0]?.doorCode);
|
|
56
|
-
assert.equal(testItem.options[0]?.cadValues[0]?.
|
|
56
|
+
assert.equal(testItem.options[0]?.cadValues[0]?.destinationStatus, sut.options[0]?.cadValues[0]?.destinationStatus);
|
|
57
57
|
assert.equal(testItem.options[0]?.cadValues[0]?.destinationNote, sut.options[0]?.cadValues[0]?.destinationNote);
|
|
58
58
|
} else {
|
|
59
59
|
assert.equal(testItem.options?.length, 1);
|
|
@@ -39,5 +39,15 @@ describe("CADVehicleStatus", function() {
|
|
|
39
39
|
assert.equal(testItem.capability, sut.capability);
|
|
40
40
|
assert.equal(testItem.owner, sut.owner);
|
|
41
41
|
assert.equal(testItem.ownerId, sut.ownerId);
|
|
42
|
+
if (testItem.extra) {
|
|
43
|
+
assert.equal(testItem.extra.doorCode, sut.extra.doorCode);
|
|
44
|
+
assert.equal(testItem.extra.destinationStatus, sut.extra.destinationStatus);
|
|
45
|
+
assert.equal(testItem.extra.destinationNote, sut.extra.destinationNote);
|
|
46
|
+
assert.equal(testItem.extra.latitude, sut.extra.latitude);
|
|
47
|
+
assert.equal(testItem.extra.longitude, sut.extra.longitude);
|
|
48
|
+
} else {
|
|
49
|
+
assert.isNotOk(testItem.extra);
|
|
50
|
+
assert.isNotOk(sut.extra);
|
|
51
|
+
}
|
|
42
52
|
});
|
|
43
53
|
});
|
package/src/test/mock.ts
CHANGED
|
@@ -11,10 +11,11 @@ import {
|
|
|
11
11
|
import { Agency } from "../models/agency";
|
|
12
12
|
import { CADIncident } from "../models/cad-incident";
|
|
13
13
|
import { Department } from "../models/department";
|
|
14
|
+
import { GlobalSettingsType } from "../types/global-settings";
|
|
14
15
|
import { IncidentFilter } from "models/incident-filter";
|
|
15
16
|
import { Location } from "../models/location";
|
|
16
17
|
import { ManagedIncident } from "../models/managed-incident";
|
|
17
|
-
import {
|
|
18
|
+
import { SAML } from "../models/saml";
|
|
18
19
|
|
|
19
20
|
export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
20
21
|
function shouldRun() {
|
|
@@ -598,7 +599,7 @@ export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
|
598
599
|
longitude: -122.4194,
|
|
599
600
|
time: 300,
|
|
600
601
|
doorCode: "1234",
|
|
601
|
-
|
|
602
|
+
destinationStatus: "Open",
|
|
602
603
|
destinationNote: "Main entrance, ER available",
|
|
603
604
|
}
|
|
604
605
|
],
|
|
@@ -656,7 +657,14 @@ export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
|
656
657
|
incidentNumber: "INC19991",
|
|
657
658
|
capability: "",
|
|
658
659
|
owner: "user",
|
|
659
|
-
ownerId: "M1"
|
|
660
|
+
ownerId: "M1",
|
|
661
|
+
extra: {
|
|
662
|
+
doorCode: "5678",
|
|
663
|
+
destinationStatus: "Available",
|
|
664
|
+
destinationNote: "Side entrance, trauma center ready",
|
|
665
|
+
latitude: 34.0522,
|
|
666
|
+
longitude: -118.2437,
|
|
667
|
+
}
|
|
660
668
|
};
|
|
661
669
|
|
|
662
670
|
const cadVehicleStatusHistory = {
|
|
@@ -1244,6 +1252,17 @@ export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
|
1244
1252
|
ended: "2019-04-01T04:41:39.233Z"
|
|
1245
1253
|
};
|
|
1246
1254
|
|
|
1255
|
+
const saml: Partial<SAML> = {
|
|
1256
|
+
selector: "test-sso-selector",
|
|
1257
|
+
idp: "<?xml version="1.0" encoding="utf-8"?><EntityDescriptor></EntityDescriptor>",
|
|
1258
|
+
sp: "<EntityDescriptor><SPSSODescriptor WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"></SPSSODescriptor></EntityDescriptor>",
|
|
1259
|
+
env: "production",
|
|
1260
|
+
name: "Some SSO",
|
|
1261
|
+
jumpPoint: "google",
|
|
1262
|
+
createdAt: new Date("2025-11-10T20:01:01.111+0000"),
|
|
1263
|
+
updatedAt: new Date("2025-11-20T20:02:02.222+0000")
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1247
1266
|
const template = {
|
|
1248
1267
|
position: 1,
|
|
1249
1268
|
active: true,
|
|
@@ -1489,6 +1508,7 @@ export default function mockModule(dependencies: { mongoose: Mongoose; }) {
|
|
|
1489
1508
|
rateLimit,
|
|
1490
1509
|
releaseNote,
|
|
1491
1510
|
session,
|
|
1511
|
+
saml,
|
|
1492
1512
|
template,
|
|
1493
1513
|
user,
|
|
1494
1514
|
userDevice,
|
package/src/test/saml.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import "mocha";
|
|
3
|
+
import * as m from "../index";
|
|
4
|
+
import * as config from "./config";
|
|
5
|
+
import mockModule from "./mock";
|
|
6
|
+
|
|
7
|
+
describe("SAML", function() {
|
|
8
|
+
let models: m.BackendModels, mongoose: m.MongooseModule;
|
|
9
|
+
let testItem: Partial<m.SAML>;
|
|
10
|
+
beforeEach(async function() {
|
|
11
|
+
const c = await m.connect(config.url);
|
|
12
|
+
models = c.models;
|
|
13
|
+
mongoose = c.mongoose;
|
|
14
|
+
|
|
15
|
+
const mock = mockModule({
|
|
16
|
+
mongoose
|
|
17
|
+
});
|
|
18
|
+
testItem = mock.saml;
|
|
19
|
+
await mock.beforeEach();
|
|
20
|
+
});
|
|
21
|
+
afterEach(async function() {
|
|
22
|
+
await mongoose.disconnect();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("is saved", async function() {
|
|
26
|
+
const item = new models.SAML(testItem);
|
|
27
|
+
const sut = await item.save();
|
|
28
|
+
|
|
29
|
+
assert.isNotNull(testItem._id);
|
|
30
|
+
assert.equal(testItem.selector, sut.selector);
|
|
31
|
+
assert.equal(testItem.idp, sut.idp);
|
|
32
|
+
assert.equal(testItem.sp, sut.sp);
|
|
33
|
+
assert.equal(testItem.name, sut.name);
|
|
34
|
+
assert.equal(testItem.env, sut.env);
|
|
35
|
+
assert.equal(testItem.createdAt?.toISOString(), sut.createdAt?.toISOString());
|
|
36
|
+
// assert.equal(testItem.updatedAt?.toISOString(), sut.updatedAt?.toISOString()); // This seems to be set to createdAt (?)
|
|
37
|
+
});
|
|
38
|
+
});
|
package/src/types/agency.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
AccountIndustry,
|
|
4
4
|
} from "../constants";
|
|
5
5
|
import { EncryptedDataType } from "./common";
|
|
6
|
+
import { SAMLType } from "./saml";
|
|
6
7
|
|
|
7
8
|
export interface CronConfigSourceType extends Record<string, unknown> {
|
|
8
9
|
protocol: string,
|
|
@@ -77,15 +78,6 @@ export interface CrossStaffedUnitType {
|
|
|
77
78
|
alwaysCrossStaff: boolean,
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export interface AgencySAMLSchemaType extends Record<string, unknown> {
|
|
81
|
-
selector: string,
|
|
82
|
-
idp: string,
|
|
83
|
-
sp: string,
|
|
84
|
-
env: string,
|
|
85
|
-
name: string,
|
|
86
|
-
jumpPoint: string,
|
|
87
|
-
}
|
|
88
|
-
|
|
89
81
|
export interface AgencyType {
|
|
90
82
|
_id: Types.ObjectId,
|
|
91
83
|
active: boolean,
|
|
@@ -105,6 +97,6 @@ export interface AgencyType {
|
|
|
105
97
|
personnelApiKey: string,
|
|
106
98
|
personnelIntegration: boolean,
|
|
107
99
|
personnelMonitorHours: number,
|
|
108
|
-
saml:
|
|
100
|
+
saml: SAMLType[],
|
|
109
101
|
uuid: string,
|
|
110
102
|
}
|
package/src/types/cad.ts
CHANGED
|
@@ -30,6 +30,14 @@ export interface DestinationType {
|
|
|
30
30
|
name: string,
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export interface ExtraType {
|
|
34
|
+
doorCode: string,
|
|
35
|
+
destinationStatus: string,
|
|
36
|
+
destinationNote: string,
|
|
37
|
+
latitude: number,
|
|
38
|
+
longitude: number,
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
export interface CADVehicleStatusType {
|
|
34
42
|
assignableByUser: boolean,
|
|
35
43
|
backupDate: Date,
|
|
@@ -37,6 +45,7 @@ export interface CADVehicleStatusType {
|
|
|
37
45
|
changedAt: Date,
|
|
38
46
|
departmentId: string,
|
|
39
47
|
destination: DestinationType,
|
|
48
|
+
extra: ExtraType,
|
|
40
49
|
incidentNumber: string,
|
|
41
50
|
locationCurrent: string,
|
|
42
51
|
locationDestination: string,
|
|
@@ -75,13 +84,13 @@ export interface CADVehicleStatusHistoryType {
|
|
|
75
84
|
export interface StatusOptionValueType extends Record<string, unknown> {
|
|
76
85
|
doorCode: string,
|
|
77
86
|
destinationNote: string,
|
|
87
|
+
destinationStatus: string,
|
|
78
88
|
favorite: boolean,
|
|
79
89
|
isDefault: boolean,
|
|
80
90
|
latitude: number,
|
|
81
91
|
longitude: number,
|
|
82
92
|
name: string,
|
|
83
93
|
position: number,
|
|
84
|
-
status: string,
|
|
85
94
|
time: number,
|
|
86
95
|
type: string,
|
|
87
96
|
value: string,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agency-saml.js","sourceRoot":"","sources":["../../../src/models/schema/agency-saml.ts"],"names":[],"mappings":";;AAKA,mCA2CC;AA3CD,SAAwB,gBAAgB,CAAC,QAAwB;IAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IAE5B,MAAM,UAAU,GAAG,IAAI,MAAM,CAAuB;QAClD,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,6EAA6E;SAC9E;QACD,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;QACD,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;QACD,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;QACD,mFAAmF;QACnF,wBAAwB;QACxB,SAAS,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;SACZ;KACF,EAAE;QACD,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,KAAK;QACT,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SAClB;KACF,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MongooseModule } from "../../helpers";
|
|
2
|
-
import { AgencySAMLSchemaType } from "../../types/agency";
|
|
3
|
-
export default function AgencySAMLSchema(mongoose: MongooseModule): import("mongoose").Schema<AgencySAMLSchemaType, import("mongoose").Model<AgencySAMLSchemaType, any, any, any, import("mongoose").Document<unknown, any, AgencySAMLSchemaType, any, {}> & AgencySAMLSchemaType & {
|
|
4
|
-
_id: import("mongoose").Types.ObjectId;
|
|
5
|
-
} & {
|
|
6
|
-
__v: number;
|
|
7
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, AgencySAMLSchemaType, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<AgencySAMLSchemaType>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<AgencySAMLSchemaType> & {
|
|
8
|
-
_id: import("mongoose").Types.ObjectId;
|
|
9
|
-
} & {
|
|
10
|
-
__v: number;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=agency-saml.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agency-saml.d.ts","sourceRoot":"","sources":["../../../src/models/schema/agency-saml.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,QAAQ,EAAE,cAAc;;;;;;;;GA2ChE"}
|