tabletcommand-backend-models 7.0.12 → 7.0.14

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 (299) hide show
  1. package/build/constants.js +14 -1
  2. package/build/constants.js.map +1 -1
  3. package/build/index.js +3 -1
  4. package/build/index.js.map +1 -1
  5. package/build/models/cad-incident-block.js +0 -6
  6. package/build/models/cad-incident-block.js.map +1 -1
  7. package/build/models/department.js +5 -0
  8. package/build/models/department.js.map +1 -1
  9. package/build/models/device-mapping.js +4 -0
  10. package/build/models/device-mapping.js.map +1 -1
  11. package/build/models/schema/cad-incident.js +1 -0
  12. package/build/models/schema/cad-incident.js.map +1 -1
  13. package/build/models/user.js +6 -1
  14. package/build/models/user.js.map +1 -1
  15. package/build/test/0index.js +72 -0
  16. package/build/test/0index.js.map +1 -0
  17. package/build/test/action-log.js +40 -0
  18. package/build/test/action-log.js.map +1 -0
  19. package/build/test/agency.js +41 -0
  20. package/build/test/agency.js.map +1 -0
  21. package/build/test/arcgis-group.js +48 -85
  22. package/build/test/arcgis-group.js.map +1 -1
  23. package/build/test/assignment.js +39 -0
  24. package/build/test/assignment.js.map +1 -0
  25. package/build/test/battalion.js +45 -0
  26. package/build/test/battalion.js.map +1 -0
  27. package/build/test/cad-incident-block.js +43 -0
  28. package/build/test/cad-incident-block.js.map +1 -0
  29. package/build/test/cad-incident.js +159 -0
  30. package/build/test/cad-incident.js.map +1 -0
  31. package/build/test/cad-simulation.js +32 -0
  32. package/build/test/cad-simulation.js.map +1 -0
  33. package/build/test/cad-status-map.js +41 -0
  34. package/build/test/cad-status-map.js.map +1 -0
  35. package/build/test/cad-status.js +57 -0
  36. package/build/test/cad-status.js.map +1 -0
  37. package/build/test/cad-vehicle-status-history.js +36 -0
  38. package/build/test/cad-vehicle-status-history.js.map +1 -0
  39. package/build/test/cad-vehicle-status.js +42 -0
  40. package/build/test/cad-vehicle-status.js.map +1 -0
  41. package/build/test/cad-vehicle.js +38 -0
  42. package/build/test/cad-vehicle.js.map +1 -0
  43. package/build/test/checklist-item.js +42 -0
  44. package/build/test/checklist-item.js.map +1 -0
  45. package/build/test/checklist.js +43 -0
  46. package/build/test/checklist.js.map +1 -0
  47. package/build/test/config.js +2 -1
  48. package/build/test/config.js.map +1 -1
  49. package/build/test/csv-import.js +44 -0
  50. package/build/test/csv-import.js.map +1 -0
  51. package/build/test/department.js +99 -0
  52. package/build/test/department.js.map +1 -0
  53. package/build/test/device-mapping.js +51 -0
  54. package/build/test/device-mapping.js.map +1 -0
  55. package/build/test/esri.js +67 -0
  56. package/build/test/esri.js.map +1 -0
  57. package/build/test/gst-mapping.js +37 -0
  58. package/build/test/gst-mapping.js.map +1 -0
  59. package/build/test/helpers.js +14 -0
  60. package/build/test/helpers.js.map +1 -0
  61. package/build/test/incident-event.js +52 -0
  62. package/build/test/incident-event.js.map +1 -0
  63. package/build/test/incident-notified.js +42 -0
  64. package/build/test/incident-notified.js.map +1 -0
  65. package/build/test/incident-takeover.js +38 -0
  66. package/build/test/incident-takeover.js.map +1 -0
  67. package/build/test/job-log.js +36 -0
  68. package/build/test/job-log.js.map +1 -0
  69. package/build/test/location.js +76 -0
  70. package/build/test/location.js.map +1 -0
  71. package/build/test/mail-log.js +52 -0
  72. package/build/test/mail-log.js.map +1 -0
  73. package/build/test/managed-incident.js +107 -0
  74. package/build/test/managed-incident.js.map +1 -0
  75. package/build/test/mark43-incident-retry.js +33 -0
  76. package/build/test/mark43-incident-retry.js.map +1 -0
  77. package/build/test/message.js +38 -0
  78. package/build/test/message.js.map +1 -0
  79. package/build/test/mock.js +1280 -910
  80. package/build/test/mock.js.map +1 -1
  81. package/build/test/monitor.js +34 -0
  82. package/build/test/monitor.js.map +1 -0
  83. package/build/test/personnel-import.js +55 -0
  84. package/build/test/personnel-import.js.map +1 -0
  85. package/build/test/rate-limit.js +32 -0
  86. package/build/test/rate-limit.js.map +1 -0
  87. package/build/test/release-note.js +34 -0
  88. package/build/test/release-note.js.map +1 -0
  89. package/build/test/session.js +42 -0
  90. package/build/test/session.js.map +1 -0
  91. package/build/test/template.js +43 -0
  92. package/build/test/template.js.map +1 -0
  93. package/build/test/user-device.js +69 -0
  94. package/build/test/user-device.js.map +1 -0
  95. package/build/test/user-registration.js +44 -0
  96. package/build/test/user-registration.js.map +1 -0
  97. package/build/test/user.js +51 -0
  98. package/build/test/user.js.map +1 -0
  99. package/build/test/validation-report.js +33 -0
  100. package/build/test/validation-report.js.map +1 -0
  101. package/cspell.json +11 -8
  102. package/definitions/constants.d.ts +11 -0
  103. package/definitions/constants.d.ts.map +1 -1
  104. package/definitions/index.d.ts +2 -2
  105. package/definitions/index.d.ts.map +1 -1
  106. package/definitions/models/cad-incident-block.d.ts.map +1 -1
  107. package/definitions/models/department.d.ts.map +1 -1
  108. package/definitions/models/device-mapping.d.ts.map +1 -1
  109. package/definitions/models/schema/cad-incident.d.ts.map +1 -1
  110. package/definitions/models/user.d.ts.map +1 -1
  111. package/definitions/test/0index.d.ts +2 -0
  112. package/definitions/test/0index.d.ts.map +1 -0
  113. package/definitions/test/action-log.d.ts +2 -0
  114. package/definitions/test/action-log.d.ts.map +1 -0
  115. package/definitions/test/agency.d.ts +2 -0
  116. package/definitions/test/agency.d.ts.map +1 -0
  117. package/definitions/test/arcgis-group.d.ts.map +1 -1
  118. package/definitions/test/assignment.d.ts +2 -0
  119. package/definitions/test/assignment.d.ts.map +1 -0
  120. package/definitions/test/battalion.d.ts +2 -0
  121. package/definitions/test/battalion.d.ts.map +1 -0
  122. package/definitions/test/cad-incident-block.d.ts +2 -0
  123. package/definitions/test/cad-incident-block.d.ts.map +1 -0
  124. package/definitions/test/cad-incident.d.ts +2 -0
  125. package/definitions/test/cad-incident.d.ts.map +1 -0
  126. package/definitions/test/cad-simulation.d.ts +2 -0
  127. package/definitions/test/cad-simulation.d.ts.map +1 -0
  128. package/definitions/test/cad-status-map.d.ts +2 -0
  129. package/definitions/test/cad-status-map.d.ts.map +1 -0
  130. package/definitions/test/cad-status.d.ts +2 -0
  131. package/definitions/test/cad-status.d.ts.map +1 -0
  132. package/definitions/test/cad-vehicle-status-history.d.ts +2 -0
  133. package/definitions/test/cad-vehicle-status-history.d.ts.map +1 -0
  134. package/definitions/test/cad-vehicle-status.d.ts +2 -0
  135. package/definitions/test/cad-vehicle-status.d.ts.map +1 -0
  136. package/definitions/test/cad-vehicle.d.ts +2 -0
  137. package/definitions/test/cad-vehicle.d.ts.map +1 -0
  138. package/definitions/test/checklist-item.d.ts +2 -0
  139. package/definitions/test/checklist-item.d.ts.map +1 -0
  140. package/definitions/test/checklist.d.ts +2 -0
  141. package/definitions/test/checklist.d.ts.map +1 -0
  142. package/definitions/test/config.d.ts.map +1 -1
  143. package/definitions/test/csv-import.d.ts +2 -0
  144. package/definitions/test/csv-import.d.ts.map +1 -0
  145. package/definitions/test/department.d.ts +2 -0
  146. package/definitions/test/department.d.ts.map +1 -0
  147. package/definitions/test/device-mapping.d.ts +2 -0
  148. package/definitions/test/device-mapping.d.ts.map +1 -0
  149. package/definitions/test/esri.d.ts +2 -0
  150. package/definitions/test/esri.d.ts.map +1 -0
  151. package/definitions/test/gst-mapping.d.ts +2 -0
  152. package/definitions/test/gst-mapping.d.ts.map +1 -0
  153. package/definitions/test/helpers.d.ts +2 -0
  154. package/definitions/test/helpers.d.ts.map +1 -0
  155. package/definitions/test/incident-event.d.ts +2 -0
  156. package/definitions/test/incident-event.d.ts.map +1 -0
  157. package/definitions/test/incident-notified.d.ts +2 -0
  158. package/definitions/test/incident-notified.d.ts.map +1 -0
  159. package/definitions/test/incident-takeover.d.ts +2 -0
  160. package/definitions/test/incident-takeover.d.ts.map +1 -0
  161. package/definitions/test/job-log.d.ts +2 -0
  162. package/definitions/test/job-log.d.ts.map +1 -0
  163. package/definitions/test/location.d.ts +2 -0
  164. package/definitions/test/location.d.ts.map +1 -0
  165. package/definitions/test/mail-log.d.ts +2 -0
  166. package/definitions/test/mail-log.d.ts.map +1 -0
  167. package/definitions/test/managed-incident.d.ts +2 -0
  168. package/definitions/test/managed-incident.d.ts.map +1 -0
  169. package/definitions/test/mark43-incident-retry.d.ts +2 -0
  170. package/definitions/test/mark43-incident-retry.d.ts.map +1 -0
  171. package/definitions/test/message.d.ts +2 -0
  172. package/definitions/test/message.d.ts.map +1 -0
  173. package/definitions/test/mock.d.ts +1056 -3
  174. package/definitions/test/mock.d.ts.map +1 -1
  175. package/definitions/test/monitor.d.ts +2 -0
  176. package/definitions/test/monitor.d.ts.map +1 -0
  177. package/definitions/test/personnel-import.d.ts +2 -0
  178. package/definitions/test/personnel-import.d.ts.map +1 -0
  179. package/definitions/test/rate-limit.d.ts +2 -0
  180. package/definitions/test/rate-limit.d.ts.map +1 -0
  181. package/definitions/test/release-note.d.ts +2 -0
  182. package/definitions/test/release-note.d.ts.map +1 -0
  183. package/definitions/test/session.d.ts +2 -0
  184. package/definitions/test/session.d.ts.map +1 -0
  185. package/definitions/test/template.d.ts +2 -0
  186. package/definitions/test/template.d.ts.map +1 -0
  187. package/definitions/test/user-device.d.ts +2 -0
  188. package/definitions/test/user-device.d.ts.map +1 -0
  189. package/definitions/test/user-registration.d.ts +2 -0
  190. package/definitions/test/user-registration.d.ts.map +1 -0
  191. package/definitions/test/user.d.ts +2 -0
  192. package/definitions/test/user.d.ts.map +1 -0
  193. package/definitions/test/validation-report.d.ts +2 -0
  194. package/definitions/test/validation-report.d.ts.map +1 -0
  195. package/definitions/types/cad.d.ts +2 -4
  196. package/definitions/types/cad.d.ts.map +1 -1
  197. package/definitions/types/department.d.ts +1 -0
  198. package/definitions/types/department.d.ts.map +1 -1
  199. package/definitions/types/user.d.ts +39 -38
  200. package/definitions/types/user.d.ts.map +1 -1
  201. package/package.json +4 -4
  202. package/src/constants.ts +13 -0
  203. package/src/index.ts +4 -0
  204. package/src/models/cad-incident-block.ts +0 -10
  205. package/src/models/department.ts +6 -0
  206. package/src/models/device-mapping.ts +4 -0
  207. package/src/models/schema/cad-incident.ts +2 -0
  208. package/src/models/user.ts +7 -1
  209. package/src/test/0index.ts +71 -0
  210. package/src/test/action-log.ts +41 -0
  211. package/src/test/agency.ts +41 -0
  212. package/src/test/arcgis-group.ts +25 -63
  213. package/src/test/assignment.ts +41 -0
  214. package/src/test/battalion.ts +45 -0
  215. package/src/test/cad-incident-block.ts +44 -0
  216. package/src/test/cad-incident.ts +168 -0
  217. package/src/test/cad-simulation.ts +33 -0
  218. package/src/test/cad-status-map.ts +41 -0
  219. package/src/test/cad-status.ts +57 -0
  220. package/src/test/cad-vehicle-status-history.ts +37 -0
  221. package/src/test/cad-vehicle-status.ts +43 -0
  222. package/src/test/cad-vehicle.ts +38 -0
  223. package/src/test/checklist-item.ts +43 -0
  224. package/src/test/checklist.ts +44 -0
  225. package/src/test/config.ts +3 -3
  226. package/src/test/csv-import.ts +44 -0
  227. package/src/test/department.ts +95 -0
  228. package/src/test/device-mapping.ts +53 -0
  229. package/src/test/esri.ts +69 -0
  230. package/src/test/gst-mapping.ts +38 -0
  231. package/src/test/helpers.ts +15 -0
  232. package/src/test/incident-event.ts +53 -0
  233. package/src/test/incident-notified.ts +41 -0
  234. package/src/test/incident-takeover.ts +39 -0
  235. package/src/test/job-log.ts +37 -0
  236. package/src/test/location.ts +79 -0
  237. package/src/test/mail-log.ts +51 -0
  238. package/src/test/managed-incident.ts +116 -0
  239. package/src/test/mark43-incident-retry.ts +34 -0
  240. package/src/test/message.ts +39 -0
  241. package/src/test/mock.ts +590 -163
  242. package/src/test/monitor.ts +35 -0
  243. package/src/test/personnel-import.ts +55 -0
  244. package/src/test/rate-limit.ts +33 -0
  245. package/src/test/release-note.ts +36 -0
  246. package/src/test/session.ts +43 -0
  247. package/src/test/template.ts +44 -0
  248. package/src/test/user-device.ts +66 -0
  249. package/src/test/user-registration.ts +45 -0
  250. package/src/test/user.ts +51 -0
  251. package/src/test/validation-report.ts +33 -0
  252. package/src/tsconfig.json +13 -3
  253. package/src/types/cad.ts +2 -4
  254. package/src/types/department.ts +1 -0
  255. package/src/types/user.ts +40 -39
  256. package/tslint.json +0 -28
  257. /package/{test → test-legacy}/0index.js +0 -0
  258. /package/{test → test-legacy}/action-log.js +0 -0
  259. /package/{test → test-legacy}/agency.js +0 -0
  260. /package/{test → test-legacy}/arcgis-group.js +0 -0
  261. /package/{test → test-legacy}/assignment.js +0 -0
  262. /package/{test → test-legacy}/battalion.js +0 -0
  263. /package/{test → test-legacy}/cad-incident-block.js +0 -0
  264. /package/{test → test-legacy}/cad-incident.js +0 -0
  265. /package/{test → test-legacy}/cad-simulation.js +0 -0
  266. /package/{test → test-legacy}/cad-status-map.js +0 -0
  267. /package/{test → test-legacy}/cad-status.js +0 -0
  268. /package/{test → test-legacy}/cad-vehicle-status-history.js +0 -0
  269. /package/{test → test-legacy}/cad-vehicle-status.js +0 -0
  270. /package/{test → test-legacy}/cad-vehicle.js +0 -0
  271. /package/{test → test-legacy}/checklist-item.js +0 -0
  272. /package/{test → test-legacy}/checklist.js +0 -0
  273. /package/{test → test-legacy}/config.js +0 -0
  274. /package/{test → test-legacy}/csv-import.js +0 -0
  275. /package/{test → test-legacy}/department.js +0 -0
  276. /package/{test → test-legacy}/device-mapping.js +0 -0
  277. /package/{test → test-legacy}/esri.js +0 -0
  278. /package/{test → test-legacy}/gst-mapping.js +0 -0
  279. /package/{test → test-legacy}/helpers.js +0 -0
  280. /package/{test → test-legacy}/incident-event.js +0 -0
  281. /package/{test → test-legacy}/incident-notified.js +0 -0
  282. /package/{test → test-legacy}/incident-takeover.js +0 -0
  283. /package/{test → test-legacy}/job-log.js +0 -0
  284. /package/{test → test-legacy}/location.js +0 -0
  285. /package/{test → test-legacy}/mail-log.js +0 -0
  286. /package/{test → test-legacy}/managed-incident.js +0 -0
  287. /package/{test → test-legacy}/mark43-incident-retry.js +0 -0
  288. /package/{test → test-legacy}/message.js +0 -0
  289. /package/{test → test-legacy}/mock.js +0 -0
  290. /package/{test → test-legacy}/monitor.js +0 -0
  291. /package/{test → test-legacy}/personnel-import.js +0 -0
  292. /package/{test → test-legacy}/rate-limit.js +0 -0
  293. /package/{test → test-legacy}/release-note.js +0 -0
  294. /package/{test → test-legacy}/session.js +0 -0
  295. /package/{test → test-legacy}/template.js +0 -0
  296. /package/{test → test-legacy}/user-device.js +0 -0
  297. /package/{test → test-legacy}/user-registration.js +0 -0
  298. /package/{test → test-legacy}/user.js +0 -0
  299. /package/{test → test-legacy}/validation-report.js +0 -0
@@ -0,0 +1,35 @@
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("Monitor", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.Monitor>;
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.monitor;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.Monitor(testItem);
26
+ const sut = await item.save();
27
+ assert.isNotNull(sut._id);
28
+
29
+ assert.equal(testItem.departmentId, sut.departmentId);
30
+ assert.equal(testItem.agencyId, sut.agencyId);
31
+ assert.equal(testItem.notificationType, sut.notificationType);
32
+ assert.equal(testItem.status, sut.status);
33
+ assert.equal(testItem.sentUnixDate, sut.sentUnixDate);
34
+ });
35
+ });
@@ -0,0 +1,55 @@
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("PersonnelImport", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.PersonnelImport>;
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.personnelImport;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+
25
+ it("is saved", async function() {
26
+ const item = new models.PersonnelImport(testItem);
27
+ const sut = await item.save();
28
+ assert.equal(testItem._id, sut._id);
29
+ assert.equal(testItem.PersonnelID, sut.PersonnelID);
30
+ assert.equal(testItem.PersonnelName, sut.PersonnelName);
31
+ assert.equal(testItem.PersonnelRank, sut.PersonnelRank);
32
+ assert.equal(testItem.PersonnelWorkCode, sut.PersonnelWorkCode);
33
+ assert.equal(testItem.PersonnelNote, sut.PersonnelNote);
34
+ assert.equal(testItem.departmentId, sut.departmentId);
35
+ if (testItem.radioNames?.length) {
36
+ assert.equal(testItem.radioNames[0], sut.radioNames[0]);
37
+ assert.equal(testItem.radioNames[1], sut.radioNames[1]);
38
+ } else {
39
+ assert.equal(testItem.radioNames?.length, 1);
40
+ }
41
+ assert.equal(sut.radioNames.length, 2);
42
+ assert.equal(testItem.shiftStartTime, sut.shiftStartTime);
43
+ assert.equal(testItem.shiftEndTime, sut.shiftEndTime);
44
+ assert.equal(testItem.modified_unix_date, sut.modified_unix_date);
45
+ assert.equal(testItem.active, sut.active);
46
+ assert.equal(testItem.agencyName, sut.agencyName);
47
+ assert.equal(testItem.agencyCode, sut.agencyCode);
48
+ assert.equal(testItem.agencyId, sut.agencyId);
49
+ assert.equal(testItem.importNotes, sut.importNotes);
50
+ assert.equal(testItem.modified?.toISOString(), sut.modified.toISOString());
51
+ assert.equal(testItem.shiftStart?.toISOString(), sut.shiftStart.toISOString());
52
+ assert.equal(testItem.shiftEnd?.toISOString(), sut.shiftEnd.toISOString());
53
+ });
54
+ });
55
+
@@ -0,0 +1,33 @@
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("RateLimit", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.RateLimit>;
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.rateLimit;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.RateLimit(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(testItem._id);
29
+ assert.equal(sut.username, testItem.username);
30
+ assert.equal(sut.modified_unix_date, testItem.modified_unix_date);
31
+ assert.equal(sut.count, testItem.count);
32
+ });
33
+ });
@@ -0,0 +1,36 @@
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("ReleaseNote", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.ReleaseNote>;
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.releaseNote;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+
25
+ it("is saved", async function() {
26
+ const item = new models.ReleaseNote(testItem);
27
+ const sut = await item.save();
28
+
29
+ assert.isNotNull(testItem._id);
30
+ assert.equal(testItem.title, sut.title);
31
+ assert.equal(testItem.notes, sut.notes);
32
+ assert.equal(testItem.version, sut.version);
33
+ assert.equal(testItem.releaseDate, sut.releaseDate);
34
+ assert.equal(testItem.status, sut.status);
35
+ });
36
+ });
@@ -0,0 +1,43 @@
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("Session", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.Session>;
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.session;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.Session(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(testItem._id);
29
+ assert.equal(sut.user, testItem.user);
30
+ assert.equal(sut.email, testItem.email);
31
+ assert.equal(sut.nick, testItem.nick);
32
+ assert.isFalse(sut.active);
33
+ assert.equal(sut.deviceId, testItem.deviceId);
34
+ assert.equal(sut.remoteAddress, testItem.remoteAddress);
35
+ assert.equal(sut.userAgent, testItem.userAgent);
36
+ assert.equal(sut.source, testItem.source);
37
+ assert.equal(sut.token, testItem.token);
38
+ assert.equal(sut.ended, testItem.ended);
39
+ assert.equal(sut.departmentId, testItem.departmentId);
40
+ assert.equal(sut.when, testItem.when);
41
+ assert.equal(sut.id, sut._id);
42
+ });
43
+ });
@@ -0,0 +1,44 @@
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("Template", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.Template>;
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.template;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.Template(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(item._id);
29
+ assert.equal(item._id, sut.id);
30
+ assert.equal(sut.id, sut._id);
31
+ assert.equal(testItem.position, sut.position);
32
+ assert.equal(testItem.active, sut.active);
33
+ assert.equal(testItem.name, sut.name);
34
+ assert.equal(testItem.userId, sut.userId);
35
+ assert.equal(testItem.departmentId, sut.departmentId);
36
+ assert.equal(testItem.isMandatory, sut.isMandatory);
37
+ assert.isArray(testItem.group);
38
+ assert.isArray(testItem.checklist);
39
+ assert.equal(testItem.agencyId, sut.agencyId);
40
+ const expectedDate = new Date().valueOf() / 1000.0;
41
+ const timeDelta = expectedDate - sut.modified_unix_date;
42
+ assert.isTrue(timeDelta < 1);
43
+ });
44
+ });
@@ -0,0 +1,66 @@
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("UserDevice", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.UserDevice>;
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.userDevice;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.UserDevice(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(testItem._id);
29
+ assert.equal(sut.id, sut._id);
30
+ assert.equal(testItem.userId, sut.userId);
31
+ assert.equal(testItem.departmentId, sut.departmentId);
32
+ assert.equal(sut.devices.length, 1);
33
+ if (testItem.devices?.length) {
34
+ assert.equal(testItem.devices[0]?.token, sut.devices[0]?.token);
35
+ assert.equal(testItem.devices[0]?.env, sut.devices[0]?.env);
36
+ assert.equal(testItem.devices[0]?.ua, sut.devices[0]?.ua);
37
+ assert.equal(testItem.devices[0]?.time, sut.devices[0]?.time);
38
+ assert.equal(testItem.devices[0]?.drift, sut.devices[0]?.drift);
39
+ assert.equal(testItem.devices[0]?.bundleIdentifier, sut.devices[0]?.bundleIdentifier);
40
+ assert.equal(testItem.devices[0]?.silentEnabled, sut.devices[0]?.silentEnabled);
41
+ assert.equal(testItem.devices[0]?.criticalAlertsEnabled, sut.devices[0]?.criticalAlertsEnabled);
42
+ assert.equal(testItem.devices[0]?.session, sut.devices[0]?.session);
43
+ assert.equal(testItem.devices[0]?.active, sut.devices[0]?.active);
44
+ assert.equal(testItem.devices[0]?.offDuty, sut.devices[0]?.offDuty);
45
+ } else {
46
+ assert.equal(testItem.devices?.length, 1);
47
+ }
48
+ assert.equal(testItem.notificationCount, sut.notificationCount);
49
+ if (testItem.notificationIncidentSettings?.length) {
50
+ assert.equal(JSON.stringify(testItem.notificationIncidentSettings[0]), JSON.stringify(sut.notificationIncidentSettings[0]));
51
+ } else {
52
+ assert.equal(testItem.notificationIncidentSettings?.length, 1);
53
+ }
54
+ if (testItem.notificationUnitSettings?.length) {
55
+ assert.equal(JSON.stringify(testItem.notificationUnitSettings[0]), JSON.stringify(sut.notificationUnitSettings[0]));
56
+ } else {
57
+ assert.equal(testItem.notificationUnitSettings?.length, 1);
58
+ }
59
+ assert.equal(testItem.offDuty, true);
60
+ assert.equal(testItem.criticalAlertsVolume, "MED");
61
+ assert.isObject(sut.notificationSounds);
62
+ assert.deepEqual(sut.notificationSounds, item.notificationSounds);
63
+ assert.isObject(sut.notificationSounds.ios);
64
+ assert.isObject(sut.notificationSounds.android);
65
+ });
66
+ });
@@ -0,0 +1,45 @@
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("UserRegistration", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.UserRegistration>;
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.userRegistration;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.UserRegistration(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(sut._id);
29
+ assert.equal(sut.id, sut._id);
30
+ assert.equal(testItem.email, sut.email);
31
+ assert.equal(testItem.name, sut.name);
32
+ assert.equal(testItem.firstName, sut.firstName);
33
+ assert.equal(testItem.lastName, sut.lastName);
34
+ assert.equal(testItem.department, sut.department);
35
+ assert.equal(testItem.title, sut.title);
36
+ assert.equal(testItem.modifiedDate, sut.modifiedDate);
37
+ assert.equal(testItem.stage, sut.stage);
38
+ assert.equal(testItem.presentedAt, sut.presentedAt);
39
+ assert.equal(testItem.managedIncidentsCount, sut.managedIncidentsCount);
40
+ assert.equal(testItem.checklistsCount, sut.checklistsCount);
41
+ assert.equal(testItem.firstIncidentUnixTime, sut.firstIncidentUnixTime);
42
+ assert.equal(testItem.lastIncidentLocation, sut.lastIncidentLocation);
43
+ assert.equal(testItem.lastIncidentUnixTime, sut.lastIncidentUnixTime);
44
+ });
45
+ });
@@ -0,0 +1,51 @@
1
+ import { assert } from "chai";
2
+ import * as m from "../index";
3
+ import * as config from "./config";
4
+ import mockModule from "./mock";
5
+
6
+ describe("User", function() {
7
+ let models: m.BackendModels, mongoose: m.MongooseModule;
8
+ let testItem: Partial<m.User>;
9
+ beforeEach(async function() {
10
+ const c = await m.connect(config.url);
11
+ models = c.models;
12
+ mongoose = c.mongoose;
13
+
14
+ const mock = mockModule({
15
+ mongoose
16
+ });
17
+ testItem = mock.user;
18
+ });
19
+ afterEach(async function() {
20
+ await mongoose.disconnect();
21
+ });
22
+
23
+ it("is saved", async function() {
24
+ const item = new models.User(testItem);
25
+ const sut = await item.save();
26
+ assert.isNotNull(sut.uuid);
27
+ assert.isNotNull(testItem._id);
28
+ assert.equal(sut.nick, testItem.nick);
29
+ assert.equal(sut.email, testItem.email);
30
+ assert.equal(sut.mapId, testItem.mapId);
31
+ assert.equal(sut.departmentId, testItem.departmentId);
32
+ assert.isFalse(sut.active);
33
+ assert.isFalse(sut.admin);
34
+ assert.isFalse(sut.superuser);
35
+ assert.isTrue(sut.isPro);
36
+ assert.isTrue(sut.mobileAccess);
37
+ assert.isFalse(sut.webAccess);
38
+ assert.isFalse(sut.shareLocationPhone);
39
+ assert.isTrue(sut.shareLocationTablet);
40
+ assert.equal(item.uuid, sut.uuid);
41
+ assert.equal(item.agencyId, sut.agencyId);
42
+ assert.equal(item.offDutyEnabled, sut.offDutyEnabled);
43
+ assert.equal(item.managedAgencies[0], sut.managedAgencies[0]);
44
+ assert.isTrue(sut.offlineMapsEnabled);
45
+ assert.equal(item.webMapSettings.defaultZoomLevel, 10);
46
+ assert.equal(item.webMapSettings.defaultCenter[0], 1);
47
+ assert.equal(item.webMapSettings.defaultCenter[1], 1);
48
+ assert.equal(item.webMapSettings.defaultMap, "Default");
49
+ assert.equal(item.restrictedCommentsEnabled, true);
50
+ });
51
+ });
@@ -0,0 +1,33 @@
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("ValidationReport", function() {
8
+ let models: m.BackendModels, mongoose: m.MongooseModule;
9
+ let testItem: Partial<m.ValidationReport>;
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.validationReport;
19
+ });
20
+ afterEach(async function() {
21
+ await mongoose.disconnect();
22
+ });
23
+
24
+ it("is saved", async function() {
25
+ const item = new models.ValidationReport(testItem);
26
+ const sut = await item.save();
27
+
28
+ assert.isNotNull(item._id);
29
+ assert.equal(testItem.departmentId?.toString(), sut.departmentId.toString());
30
+ assert.equal(testItem.modified?.toString(), sut.modified.toString());
31
+ assert.deepEqual(testItem.location, []);
32
+ });
33
+ });
package/src/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "baseUrl": "./",
3
4
  "declaration": true,
4
5
  "declarationDir": "../definitions",
5
6
  "declarationMap": true,
@@ -10,12 +11,21 @@
10
11
  "noImplicitAny": true,
11
12
  "noImplicitReturns": true,
12
13
  "noUncheckedIndexedAccess": true,
14
+ "noUnusedLocals": true,
13
15
  "outDir": "../build",
14
- "typeRoots": ["./types", "node_modules/@types"],
16
+ "paths": {
17
+ "*": [
18
+ "../node_modules/@types/*",
19
+ "*"
20
+ ]
21
+ },
15
22
  "resolveJsonModule": true,
16
23
  "sourceMap": true,
17
24
  "strict": true,
18
25
  "target": "es2017",
19
- // "noUnusedLocals": true,
26
+ "types": [
27
+ "node",
28
+ "mocha"
29
+ ]
20
30
  }
21
- }
31
+ }
package/src/types/cad.ts CHANGED
@@ -67,7 +67,7 @@ export interface CADVehicleStatusHistoryType {
67
67
  locationDestination: string,
68
68
  }
69
69
 
70
- export interface StatusOptionValueType {
70
+ export interface StatusOptionValueType extends Record<string, unknown> {
71
71
  name: string,
72
72
  type: string,
73
73
  visible: boolean,
@@ -100,7 +100,7 @@ export interface CADStatusType {
100
100
  normalized: string,
101
101
  selfAssignable: boolean,
102
102
  roaming: boolean,
103
- options: StatusOptionValueType,
103
+ options: StatusOptionType[],
104
104
  color: ColorSchemaType,
105
105
  backupDate: Date,
106
106
  }
@@ -202,7 +202,6 @@ export interface CADSimulationType {
202
202
 
203
203
  export interface CADIncidentStreamType {
204
204
  _id: Types.ObjectId,
205
- id?: string,
206
205
  uuid: string,
207
206
  tag: string,
208
207
  departmentId: string,
@@ -213,7 +212,6 @@ export interface CADIncidentStreamType {
213
212
 
214
213
  export interface CADIncidentBlockType {
215
214
  _id: Types.ObjectId,
216
- id?: string,
217
215
  departmentId: string,
218
216
  source: string,
219
217
  IncidentNumber: string,
@@ -385,4 +385,5 @@ export interface DepartmentType {
385
385
  somewear: SomewearType,
386
386
  cadBidirectionalException: boolean,
387
387
  forwarding: ForwardingConfigType,
388
+ reportOdometer: string,
388
389
  }
package/src/types/user.ts CHANGED
@@ -7,6 +7,7 @@ export interface UnitSettingType {
7
7
  notificationType: string,
8
8
  notificationMode: string,
9
9
  }
10
+
10
11
  export interface IncidentSettingType {
11
12
  incidentType: string,
12
13
  notificationType: string,
@@ -76,7 +77,6 @@ export interface UserRegistrationType {
76
77
  syncedToHubSpot: boolean,
77
78
  }
78
79
 
79
-
80
80
  export interface VehicleSchemaType {
81
81
  radioName: string,
82
82
  vehicleId: string,
@@ -84,57 +84,58 @@ export interface VehicleSchemaType {
84
84
 
85
85
  export interface UserType {
86
86
  _id: Types.ObjectId,
87
- id?: string,
88
- nick: string,
89
- email: string,
90
- name: string,
91
- uuid: string,
92
- departmentId: string,
93
- modified_date: Date,
94
- when: Date,
95
- agencyId: Types.ObjectId,
96
- managedAgencies: Types.ObjectId[],
97
87
  active: boolean,
98
88
  admin: boolean,
99
- superuser: boolean,
100
- isPro: boolean,
101
- isIncidentManager: boolean,
102
- mobileAccess: boolean,
103
- webAccess: boolean,
104
- cadSimulatorAccess: boolean,
105
- canAddRemoveVehicle: boolean,
89
+ agencyId: Types.ObjectId,
90
+ arcGISAuth: EsriAuthSchemaType,
91
+ arcGISAuthError: EsriErrorSchemaType,
92
+ auth: string[],
106
93
  beaconEnabled: boolean,
107
- userContributionEnabled: boolean,
108
- syncLoggingExpireDate: Date,
109
94
  beacons: string[],
110
- salt: string,
111
- pass: string,
112
- auth: string[],
95
+ cadSimulatorAccess: boolean,
96
+ canAddRemoveVehicle: boolean,
97
+ departmentId: string,
98
+ email: string,
99
+ fireMapperProEnabled: boolean,
100
+ id?: string,
101
+ isIncidentManager: boolean,
102
+ isPro: boolean,
103
+ locationToCAD: boolean,
104
+ logOffEnabled: boolean,
105
+ managedAgencies: Types.ObjectId[],
113
106
  mapHidden: boolean,
114
107
  mapId: string,
115
- vehicle: VehicleSchemaType,
116
- sessionCountiPhone: number,
117
- sessionCountiPad: number,
118
- rtsAuthKey: string,
108
+ mobileAccess: boolean,
109
+ modified_date: Date,
110
+ name: string,
111
+ nick: string,
112
+ offDutyEnabled: boolean,
113
+ offlineMapsEnabled: boolean,
114
+ pass: string,
119
115
  pubNubV2: PubNubTokenSchemaType
120
116
  pubNubV3: PubNubTokenSchemaType
117
+ restrictedCommentsEnabled: boolean,
118
+ rtsAuthKey: string,
119
+ salt: string,
120
+ sessionCountiPad: number,
121
+ sessionCountiPhone: number,
122
+ shareLocationPhone: boolean,
123
+ shareLocationTablet: boolean,
121
124
  socketIO: PubNubTokenSchemaType,
125
+ stealthStatus: string, // UserStealthStatus
126
+ superuser: boolean,
127
+ superUserReadOnly: boolean
128
+ syncLoggingExpireDate: Date,
122
129
  token: string,
123
130
  tokenExpireAt: Date,
124
- shareLocationPhone: boolean,
125
- shareLocationTablet: boolean,
126
- offlineMapsEnabled: boolean,
127
- fireMapperProEnabled: boolean,
128
- arcGISAuth: EsriAuthSchemaType,
129
- arcGISAuthError: EsriErrorSchemaType,
130
- offDutyEnabled: boolean,
131
+ userContributionEnabled: boolean,
132
+ uuid: string,
133
+ vehicle: VehicleSchemaType,
134
+ webAccess: boolean,
135
+ when: Date,
131
136
  webMapSettings: {
132
- defaultZoomLevel: number,
133
137
  defaultCenter: number[],
134
138
  defaultMap: string,
139
+ defaultZoomLevel: number,
135
140
  },
136
- locationToCAD: boolean,
137
- logOffEnabled: boolean,
138
- restrictedCommentsEnabled: boolean,
139
- superUserReadOnly: boolean
140
141
  }
package/tslint.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "defaultSeverity": "error",
3
- "extends": [
4
- "tslint:recommended"
5
- ],
6
- "linterOptions": {
7
- "exclude": ["package.json"]
8
- },
9
- "jsRules": {},
10
- "rules": {
11
- "quotemark": [true, "double"],
12
- "no-var-requires": true,
13
- "ordered-imports": false,
14
- "object-literal-sort-keys":false,
15
- "only-arrow-functions": false,
16
- "no-namespace":false,
17
- "interface-name":false,
18
- "no-shadowed-variable":false,
19
- "no-console":false,
20
- "no-any": true,
21
- "no-unsafe-any":true,
22
- "max-line-length":false,
23
- "radix":false,
24
- "no-floating-promises": true,
25
- "no-trailing-whitespace": true
26
- },
27
- "rulesDirectory": []
28
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes