@sonoransoftware/sonoran.js 1.0.18 → 1.0.20

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 (89) hide show
  1. package/.eslintrc.js +10 -10
  2. package/.github/workflows/npm-publish.yml +34 -34
  3. package/.prettierrc.js +6 -6
  4. package/dist/builders/cad/DispatchCall.d.ts +92 -92
  5. package/dist/builders/cad/DispatchCall.js +144 -144
  6. package/dist/builders/cad/index.d.ts +1 -1
  7. package/dist/builders/cad/index.js +17 -17
  8. package/dist/builders/index.d.ts +1 -1
  9. package/dist/builders/index.js +19 -19
  10. package/dist/constants.d.ts +230 -230
  11. package/dist/constants.js +27 -27
  12. package/dist/errors/LibraryErrors.d.ts +19 -19
  13. package/dist/errors/LibraryErrors.js +47 -47
  14. package/dist/errors/Messages.d.ts +1 -1
  15. package/dist/errors/Messages.js +8 -8
  16. package/dist/errors/index.d.ts +2 -2
  17. package/dist/errors/index.js +18 -18
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +24 -24
  20. package/dist/instance/Instance.d.ts +24 -24
  21. package/dist/instance/Instance.js +139 -139
  22. package/dist/instance/instance.types.d.ts +17 -17
  23. package/dist/instance/instance.types.js +2 -2
  24. package/dist/libs/rest/src/index.d.ts +6 -6
  25. package/dist/libs/rest/src/index.js +22 -22
  26. package/dist/libs/rest/src/lib/REST.d.ts +101 -101
  27. package/dist/libs/rest/src/lib/REST.js +136 -129
  28. package/dist/libs/rest/src/lib/RequestManager.d.ts +59 -59
  29. package/dist/libs/rest/src/lib/RequestManager.js +191 -191
  30. package/dist/libs/rest/src/lib/errors/APIError.d.ts +9 -9
  31. package/dist/libs/rest/src/lib/errors/APIError.js +17 -17
  32. package/dist/libs/rest/src/lib/errors/HTTPError.d.ts +17 -17
  33. package/dist/libs/rest/src/lib/errors/HTTPError.js +23 -23
  34. package/dist/libs/rest/src/lib/errors/RateLimitError.d.ts +13 -13
  35. package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -19
  36. package/dist/libs/rest/src/lib/errors/index.d.ts +4 -4
  37. package/dist/libs/rest/src/lib/errors/index.js +20 -20
  38. package/dist/libs/rest/src/lib/handlers/IHandler.d.ts +7 -7
  39. package/dist/libs/rest/src/lib/handlers/IHandler.js +2 -2
  40. package/dist/libs/rest/src/lib/handlers/SequentialHandler.d.ts +45 -45
  41. package/dist/libs/rest/src/lib/handlers/SequentialHandler.js +143 -143
  42. package/dist/libs/rest/src/lib/utils/constants.d.ts +533 -527
  43. package/dist/libs/rest/src/lib/utils/constants.js +463 -443
  44. package/dist/libs/rest/src/lib/utils/utils.d.ts +1 -1
  45. package/dist/libs/rest/src/lib/utils/utils.js +22 -22
  46. package/dist/managers/BaseManager.d.ts +14 -14
  47. package/dist/managers/BaseManager.js +18 -18
  48. package/dist/managers/CADActiveUnitsManager.d.ts +15 -15
  49. package/dist/managers/CADActiveUnitsManager.js +38 -38
  50. package/dist/managers/CADManager.d.ts +29 -29
  51. package/dist/managers/CADManager.js +86 -86
  52. package/dist/managers/CADServerManager.d.ts +8 -8
  53. package/dist/managers/CADServerManager.js +28 -28
  54. package/dist/managers/CMSManager.d.ts +101 -101
  55. package/dist/managers/CMSManager.js +266 -266
  56. package/dist/managers/CMSServerManager.d.ts +8 -8
  57. package/dist/managers/CMSServerManager.js +34 -34
  58. package/dist/managers/CacheManager.d.ts +10 -10
  59. package/dist/managers/CacheManager.js +36 -36
  60. package/dist/managers/DataManager.d.ts +31 -31
  61. package/dist/managers/DataManager.js +58 -58
  62. package/dist/structures/Base.d.ts +9 -9
  63. package/dist/structures/Base.js +24 -24
  64. package/dist/structures/CADActiveUnit.d.ts +47 -47
  65. package/dist/structures/CADActiveUnit.js +66 -66
  66. package/dist/structures/CADServer.d.ts +26 -26
  67. package/dist/structures/CADServer.js +15 -15
  68. package/dist/structures/CMSServer.d.ts +18 -18
  69. package/dist/structures/CMSServer.js +12 -12
  70. package/dist/utils/index.d.ts +1 -1
  71. package/dist/utils/index.js +17 -17
  72. package/dist/utils/utils.d.ts +13 -13
  73. package/dist/utils/utils.js +79 -79
  74. package/docs/CAD-Methods-and-Usage.md +58 -58
  75. package/docs/CMS-Methods-and-Usage.md +211 -211
  76. package/docs/REST-Methods-and-Usage.md +46 -46
  77. package/package.json +48 -48
  78. package/readme.md +53 -53
  79. package/src/constants.ts +248 -248
  80. package/src/instance/Instance.ts +121 -121
  81. package/src/instance/instance.types.ts +17 -17
  82. package/src/libs/rest/src/lib/REST.ts +241 -235
  83. package/src/libs/rest/src/lib/RequestManager.ts +260 -260
  84. package/src/libs/rest/src/lib/handlers/SequentialHandler.ts +160 -160
  85. package/src/libs/rest/src/lib/utils/constants.ts +1012 -985
  86. package/src/managers/CADManager.ts +63 -63
  87. package/src/managers/CMSManager.ts +226 -226
  88. package/src/managers/CMSServerManager.ts +32 -32
  89. package/tsconfig.json +71 -71
@@ -1,527 +1,533 @@
1
- import { productEnums } from '../../../../../constants';
2
- import type { RESTOptions } from '../REST';
3
- export declare const DefaultUserAgent = "Sonoran.js NPM Module";
4
- export declare const DefaultCADRestOptions: Required<RESTOptions>;
5
- export declare const DefaultCMSRestOptions: Required<RESTOptions>;
6
- /**
7
- * The events that the REST manager emits
8
- */
9
- export declare const enum RESTEvents {
10
- Debug = "restDebug",
11
- InvalidRequestWarning = "invalidRequestWarning",
12
- RateLimited = "rateLimited",
13
- Request = "request",
14
- Response = "response"
15
- }
16
- export interface APITypeData {
17
- type: string;
18
- path: string;
19
- method: 'POST' | 'GET' | 'DELETE' | 'PATCH';
20
- minVersion: number;
21
- }
22
- export interface AllAPITypeData {
23
- product: productEnums;
24
- type: string;
25
- path: string;
26
- method: 'POST' | 'GET' | 'DELETE' | 'PATCH';
27
- minVersion: number;
28
- }
29
- export declare const GeneralCADAPITypes: APITypeData[];
30
- export declare const CivilianCADAPITypes: APITypeData[];
31
- export declare const EmergencyCADAPITypes: APITypeData[];
32
- export declare const GeneralCMSAPITypes: APITypeData[];
33
- export declare const ServersCMSAPITypes: APITypeData[];
34
- export declare const EventsCMSAPITypes: APITypeData[];
35
- export declare const AllAPITypes: AllAPITypeData[];
36
- export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP';
37
- export interface CMSServerAPIStruct {
38
- id: number;
39
- name: string;
40
- description: string;
41
- }
42
- export interface CADServerAPIStruct {
43
- id: number;
44
- name: string;
45
- description: string;
46
- signal: string;
47
- mapUrl: string;
48
- mapIp: string;
49
- listenerPort: number;
50
- differingOutbound: boolean;
51
- outboundIp: string;
52
- enableMap: boolean;
53
- isStatic: boolean;
54
- mapType: string;
55
- }
56
- export interface CADPenalCodeStruct {
57
- code: string;
58
- type: string;
59
- title: string;
60
- bondType: string;
61
- jailTime: string;
62
- bondAmount: number;
63
- }
64
- export interface CADSetAPIIDStruct {
65
- username: string;
66
- sessionId?: string;
67
- apiIds: string[];
68
- pushNew: boolean;
69
- }
70
- export declare enum CADRecordTypeEnums {
71
- Warrant = 2,
72
- Bolo = 3,
73
- License = 4,
74
- VehicleRegistration = 5,
75
- Character = 7,
76
- PoliceRecord = 8,
77
- PoliceReport = 9,
78
- MedicalRecord = 10,
79
- MedicalReport = 11,
80
- FireRecord = 12,
81
- FireReport = 13,
82
- DMVRecord = 14,
83
- LawRecord = 15,
84
- LawReport = 16
85
- }
86
- export declare enum CADRecordSectionCategoryEnums {
87
- Custom = 0,
88
- Flags = 1,
89
- Speed = 5,
90
- Charges = 6,
91
- LinkedRecords = 9
92
- }
93
- export interface CADRecordDependencyStruct {
94
- type: string;
95
- fid: string;
96
- acceptableValues: string[];
97
- }
98
- export interface CADRecordSectionFieldStruct {
99
- type: 'INPUT' | 'TEXTAREA' | 'ADDRESS' | 'SELECT' | 'STATUS' | 'DATE' | 'TIME' | 'IMAGE' | 'CHECKBOXES' | 'LABEL' | 'UNIT_NUMBER' | 'UNIT_NAME' | 'UNIT_RANK' | 'UNIT_AGENCY' | 'UNIT_DEPARTMENT' | 'UNIT_SUBDIVISION' | 'UNIT_AGENCY_LOCATION' | 'UNIT_AGENCY_ZIP' | 'UNIT_LOCATION';
100
- value: string;
101
- size: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
102
- data: Record<string | number | symbol, unknown>;
103
- options: string[];
104
- isPreviewed: boolean;
105
- isSupervisor: boolean;
106
- isRequired: boolean;
107
- unique: boolean;
108
- readOnly: boolean;
109
- mask: string;
110
- maskReverse: boolean;
111
- dbMap: boolean;
112
- isFromSync: boolean;
113
- uid: string;
114
- dependency: CADRecordDependencyStruct;
115
- }
116
- export interface CADRecordSectionStruct {
117
- category: CADRecordSectionCategoryEnums;
118
- label: string;
119
- fields: CADRecordSectionFieldStruct[];
120
- searchCiv: boolean;
121
- searchVeh: boolean;
122
- enableDuplicate: boolean;
123
- dependency: CADRecordDependencyStruct;
124
- }
125
- export interface CADRecordStruct {
126
- recordTypeId: number;
127
- id: number;
128
- syncId: string;
129
- name: string;
130
- type: CADRecordTypeEnums;
131
- sections: CADRecordSectionStruct[];
132
- }
133
- export interface CADNewEditRecordOptionOneStruct {
134
- user: string;
135
- useDictionary: boolean;
136
- recordTypeId: number;
137
- replaceValues: Record<string, string>;
138
- }
139
- export interface CADNewEditRecordOptionTwoStruct {
140
- user: string;
141
- record: CADRecordStruct;
142
- }
143
- export declare enum CADLookupByIntSearchTypeEnums {
144
- IDENTIFIER = 0,
145
- SUPERVISOR_STATUS = 1,
146
- ACTIVE_STATUS = 2,
147
- NUMBER = 3
148
- }
149
- export interface CADLookupByIntStruct {
150
- apiId?: string;
151
- searchType: CADLookupByIntSearchTypeEnums;
152
- value: number;
153
- types: number[];
154
- limit?: number;
155
- offset?: number;
156
- }
157
- export interface CADLookupStruct {
158
- apiId?: string;
159
- types: number[];
160
- first: string;
161
- last: string;
162
- mi: string;
163
- plate: string;
164
- partial: boolean;
165
- agency?: string;
166
- department?: string;
167
- subdivision?: string;
168
- }
169
- export interface CADModifyAccountPermsStruct {
170
- apiId?: string;
171
- username?: string;
172
- active?: boolean;
173
- add: string[];
174
- remove: string[];
175
- }
176
- export interface CADKickBanUserStruct {
177
- apiId: string;
178
- isBan?: boolean;
179
- isKick?: boolean;
180
- }
181
- export interface CADSetPostalStruct {
182
- code: string;
183
- x: number;
184
- y: number;
185
- }
186
- export declare enum CADModifyIdentifierActionEnums {
187
- ADD = 0,
188
- EDIT = 1,
189
- REMOVE = 2
190
- }
191
- export interface CADModifyIdentifierStruct {
192
- apiId: string;
193
- action: CADModifyIdentifierActionEnums;
194
- identifier?: Record<string, string>;
195
- identId?: number;
196
- }
197
- export interface CADBlipStruct {
198
- id: number;
199
- coordinates: {
200
- x: number;
201
- y: number;
202
- };
203
- icon: string;
204
- color: string;
205
- tooltip: string;
206
- }
207
- export interface CADAddBlipStruct {
208
- serverId: number;
209
- blip: CADBlipStruct;
210
- }
211
- export interface CADModifyBlipStruct {
212
- id: number;
213
- coordinates?: {
214
- x: number;
215
- y: number;
216
- };
217
- icon?: string;
218
- color?: string;
219
- tooltip?: string;
220
- }
221
- export interface CADGetCallsStruct {
222
- serverId?: number;
223
- closedLimit?: number;
224
- closedOffset?: number;
225
- }
226
- export interface CADGetActiveUnitsStruct {
227
- serverId?: number;
228
- onlyUnits?: boolean;
229
- includeOffline?: boolean;
230
- limit?: number;
231
- offset?: number;
232
- }
233
- export declare enum CADDispatchOriginEnums {
234
- Caller = 0,
235
- RadioDispatch = 1,
236
- Observed = 2,
237
- WalkUp = 3
238
- }
239
- export declare enum CADDispatchStatusEnums {
240
- Pending = 0,
241
- Active = 1,
242
- Closed = 2
243
- }
244
- export interface CADNewDispatchStruct {
245
- serverId: number;
246
- origin: CADDispatchOriginEnums;
247
- status: CADDispatchStatusEnums;
248
- priority: 1 | 2 | 3;
249
- block: string;
250
- address: string;
251
- postal: string;
252
- title: string;
253
- code: string;
254
- primary: number;
255
- trackPrimary: boolean;
256
- description: string;
257
- metaData: Record<string, string>;
258
- units: string[];
259
- }
260
- export interface CADStreetSignStruct {
261
- id: number;
262
- label: string;
263
- text1: string;
264
- text2: string;
265
- text3: string;
266
- }
267
- export interface CADUnitLocationStruct {
268
- apiId: string;
269
- location: string;
270
- }
271
- export interface RESTTypedAPIDataStructs {
272
- GET_SERVERS: [];
273
- SET_SERVERS: [
274
- servers: CADServerAPIStruct[],
275
- deployMap: boolean
276
- ];
277
- GET_VERSION: [];
278
- SET_PENAL_CODES: [data: CADPenalCodeStruct[]];
279
- SET_API_ID: [data: CADSetAPIIDStruct];
280
- GET_TEMPLATES: [recordTypeId?: number];
281
- NEW_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
282
- EDIT_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
283
- REMOVE_RECORD: [id: number];
284
- LOOKUP_INT: [data: CADLookupByIntStruct];
285
- LOOKUP: [data: CADLookupStruct];
286
- GET_ACCOUNT: [
287
- apiId?: string,
288
- username?: string
289
- ];
290
- CHECK_APIID: [apiId: string];
291
- APPLY_PERMISSION_KEY: [
292
- apiId: string,
293
- permissionKey: string
294
- ];
295
- SET_ACCOUNT_PERMISSIONS: [data: CADModifyAccountPermsStruct];
296
- BAN_USER: [data: CADKickBanUserStruct];
297
- VERIFY_SECRET: [secret: string];
298
- AUTH_STREETSIGNS: [serverId: number];
299
- SET_POSTALS: [data: CADSetPostalStruct[]];
300
- SEND_PHOTO: [
301
- apiId: string,
302
- url: string
303
- ];
304
- GET_CHARACTERS: [apiId: string];
305
- NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
306
- EDIT_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
307
- REMOVE_CHARACTER: [id: number];
308
- GET_IDENTIFIERS: [apiId: string];
309
- MODIFY_IDENTIFIER: [data: CADModifyIdentifierStruct];
310
- SET_IDENTIFIER: [
311
- apiId: string,
312
- identId: number
313
- ];
314
- UNIT_PANIC: [
315
- apiId: string,
316
- isPanic: boolean
317
- ];
318
- UNIT_STATUS: [
319
- apiId: string,
320
- status: number,
321
- serverId: number
322
- ];
323
- GET_BLIPS: [serverId: number];
324
- ADD_BLIP: [data: CADAddBlipStruct[]];
325
- MODIFY_BLIP: [data: CADModifyBlipStruct[]];
326
- REMOVE_BLIP: [id: number];
327
- REMOVE_911: [callId: number];
328
- GET_CALLS: [data: CADGetCallsStruct];
329
- GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
330
- KICK_UNIT: [
331
- apiId: string,
332
- reason: string,
333
- serverId: number
334
- ];
335
- NEW_DISPATCH: [data: CADNewDispatchStruct];
336
- ATTACH_UNIT: [
337
- serverId: number,
338
- callId: number,
339
- units: string[]
340
- ];
341
- DETACH_UNIT: [
342
- serverId: number,
343
- units: string[]
344
- ];
345
- SET_CALL_POSTAL: [
346
- serverId: number,
347
- callId: number,
348
- postal: string
349
- ];
350
- SET_CALL_PRIMARY: [
351
- serverId: number,
352
- callId: number,
353
- primary: number,
354
- trackPrimary: boolean
355
- ];
356
- ADD_CALL_NOTE: [
357
- serverId: number,
358
- callId: number,
359
- note: string
360
- ];
361
- CLOSE_CALL: [
362
- serverId: number,
363
- callId: number
364
- ];
365
- 'CALL_911': [
366
- serverId: number,
367
- isEmergency: boolean,
368
- caller: string,
369
- location: string,
370
- description: string,
371
- metaData: Record<string, string>
372
- ];
373
- SET_STREETSIGN_CONFIG: [
374
- serverId: number,
375
- signConfig: CADStreetSignStruct[]
376
- ];
377
- UPDATE_STREETSIGN: [
378
- serverId: number,
379
- signData: {
380
- ids: number[];
381
- text1: string;
382
- text2: string;
383
- text3: string;
384
- }
385
- ];
386
- UNIT_LOCATION: [data: CADUnitLocationStruct[]];
387
- GET_COM_ACCOUNT: [
388
- apiId?: string,
389
- username?: string,
390
- accId?: string,
391
- discord?: string
392
- ];
393
- GET_SUB_VERSION: [];
394
- CHECK_COM_APIID: [apiId: string];
395
- CLOCK_IN_OUT: [
396
- apiId?: string,
397
- accId?: string,
398
- forceClockIn?: boolean
399
- ];
400
- GET_DEPARTMENTS: [];
401
- GET_ACCOUNT_RANKS: [
402
- apiId?: string,
403
- username?: string,
404
- accId?: string,
405
- discord?: string
406
- ];
407
- SET_ACCOUNT_RANKS: [
408
- accountId: string,
409
- set?: {
410
- primary?: string | null;
411
- secondary?: string[];
412
- },
413
- add?: string[],
414
- remove?: string[]
415
- ];
416
- GET_GAME_SERVERS: [];
417
- VERIFY_WHITELIST: [
418
- apiId: string | undefined,
419
- accId: string | undefined,
420
- serverId: number
421
- ];
422
- FULL_WHITELIST: [
423
- serverId?: number
424
- ];
425
- RSVP: [
426
- eventId: string,
427
- apiId: string | undefined,
428
- accId: string | undefined
429
- ];
430
- }
431
- export type PossibleRequestData = undefined | {
432
- data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
433
- } | {
434
- servers: CADServerAPIStruct[];
435
- deployMap: boolean;
436
- } | {
437
- id: number;
438
- } | {
439
- recordTypeId?: number;
440
- } | {
441
- apiId?: string;
442
- username?: string;
443
- } | {
444
- apiId: string;
445
- } | {
446
- apiId: string;
447
- permissionKey: string;
448
- } | {
449
- secret: string;
450
- } | {
451
- serverId: number;
452
- } | {
453
- serverId?: number;
454
- } | {
455
- apiId: string;
456
- url: string;
457
- } | {
458
- apiId: string;
459
- identId: number;
460
- } | {
461
- apiId: string;
462
- isPanic: boolean;
463
- } | {
464
- apiId: string;
465
- status: number;
466
- serverId: number;
467
- } | {
468
- callId: number;
469
- } | {
470
- serverId: number;
471
- callId: number;
472
- units: string[];
473
- } | {
474
- serverId: number;
475
- units: string[];
476
- } | {
477
- serverId: number;
478
- callId: number;
479
- postal: string;
480
- } | {
481
- serverId: number;
482
- callId: number;
483
- primary: number;
484
- trackPrimary: boolean;
485
- } | {
486
- serverId: number;
487
- callId: number;
488
- note: string;
489
- } | {
490
- serverId: number;
491
- callId: number;
492
- } | {
493
- serverId: number;
494
- isEmergency: boolean;
495
- caller: string;
496
- location: string;
497
- description: string;
498
- metaData: Record<string, string>;
499
- } | {
500
- serverId: number;
501
- signConfig: CADStreetSignStruct[];
502
- } | {
503
- serverId: number;
504
- signData: {
505
- ids: number[];
506
- text1: string;
507
- text2: string;
508
- text3: string;
509
- };
510
- } | {
511
- apiId?: string;
512
- username?: string;
513
- } | {
514
- apiId: string;
515
- serverId: number;
516
- } | {
517
- apiId: string;
518
- forceClockIn: boolean;
519
- } | {
520
- accountId: string;
521
- set?: {
522
- primary: string[];
523
- secondary: string[];
524
- };
525
- add?: string[];
526
- remove?: string[];
527
- };
1
+ import { productEnums } from '../../../../../constants';
2
+ import type { RESTOptions } from '../REST';
3
+ export declare const DefaultUserAgent = "Sonoran.js NPM Module";
4
+ export declare const DefaultCADRestOptions: Required<RESTOptions>;
5
+ export declare const DefaultCMSRestOptions: Required<RESTOptions>;
6
+ /**
7
+ * The events that the REST manager emits
8
+ */
9
+ export declare const enum RESTEvents {
10
+ Debug = "restDebug",
11
+ InvalidRequestWarning = "invalidRequestWarning",
12
+ RateLimited = "rateLimited",
13
+ Request = "request",
14
+ Response = "response"
15
+ }
16
+ export interface APITypeData {
17
+ type: string;
18
+ path: string;
19
+ method: 'POST' | 'GET' | 'DELETE' | 'PATCH';
20
+ minVersion: number;
21
+ }
22
+ export interface AllAPITypeData {
23
+ product: productEnums;
24
+ type: string;
25
+ path: string;
26
+ method: 'POST' | 'GET' | 'DELETE' | 'PATCH';
27
+ minVersion: number;
28
+ }
29
+ export declare const GeneralCADAPITypes: APITypeData[];
30
+ export declare const CivilianCADAPITypes: APITypeData[];
31
+ export declare const EmergencyCADAPITypes: APITypeData[];
32
+ export declare const GeneralCMSAPITypes: APITypeData[];
33
+ export declare const ServersCMSAPITypes: APITypeData[];
34
+ export declare const EventsCMSAPITypes: APITypeData[];
35
+ export declare const FormsCMSAPITypes: APITypeData[];
36
+ export declare const AllAPITypes: AllAPITypeData[];
37
+ export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE';
38
+ export interface CMSServerAPIStruct {
39
+ id: number;
40
+ name: string;
41
+ description: string;
42
+ }
43
+ export interface CADServerAPIStruct {
44
+ id: number;
45
+ name: string;
46
+ description: string;
47
+ signal: string;
48
+ mapUrl: string;
49
+ mapIp: string;
50
+ listenerPort: number;
51
+ differingOutbound: boolean;
52
+ outboundIp: string;
53
+ enableMap: boolean;
54
+ isStatic: boolean;
55
+ mapType: string;
56
+ }
57
+ export interface CADPenalCodeStruct {
58
+ code: string;
59
+ type: string;
60
+ title: string;
61
+ bondType: string;
62
+ jailTime: string;
63
+ bondAmount: number;
64
+ }
65
+ export interface CADSetAPIIDStruct {
66
+ username: string;
67
+ sessionId?: string;
68
+ apiIds: string[];
69
+ pushNew: boolean;
70
+ }
71
+ export declare enum CADRecordTypeEnums {
72
+ Warrant = 2,
73
+ Bolo = 3,
74
+ License = 4,
75
+ VehicleRegistration = 5,
76
+ Character = 7,
77
+ PoliceRecord = 8,
78
+ PoliceReport = 9,
79
+ MedicalRecord = 10,
80
+ MedicalReport = 11,
81
+ FireRecord = 12,
82
+ FireReport = 13,
83
+ DMVRecord = 14,
84
+ LawRecord = 15,
85
+ LawReport = 16
86
+ }
87
+ export declare enum CADRecordSectionCategoryEnums {
88
+ Custom = 0,
89
+ Flags = 1,
90
+ Speed = 5,
91
+ Charges = 6,
92
+ LinkedRecords = 9
93
+ }
94
+ export interface CADRecordDependencyStruct {
95
+ type: string;
96
+ fid: string;
97
+ acceptableValues: string[];
98
+ }
99
+ export interface CADRecordSectionFieldStruct {
100
+ type: 'INPUT' | 'TEXTAREA' | 'ADDRESS' | 'SELECT' | 'STATUS' | 'DATE' | 'TIME' | 'IMAGE' | 'CHECKBOXES' | 'LABEL' | 'UNIT_NUMBER' | 'UNIT_NAME' | 'UNIT_RANK' | 'UNIT_AGENCY' | 'UNIT_DEPARTMENT' | 'UNIT_SUBDIVISION' | 'UNIT_AGENCY_LOCATION' | 'UNIT_AGENCY_ZIP' | 'UNIT_LOCATION';
101
+ value: string;
102
+ size: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
103
+ data: Record<string | number | symbol, unknown>;
104
+ options: string[];
105
+ isPreviewed: boolean;
106
+ isSupervisor: boolean;
107
+ isRequired: boolean;
108
+ unique: boolean;
109
+ readOnly: boolean;
110
+ mask: string;
111
+ maskReverse: boolean;
112
+ dbMap: boolean;
113
+ isFromSync: boolean;
114
+ uid: string;
115
+ dependency: CADRecordDependencyStruct;
116
+ }
117
+ export interface CADRecordSectionStruct {
118
+ category: CADRecordSectionCategoryEnums;
119
+ label: string;
120
+ fields: CADRecordSectionFieldStruct[];
121
+ searchCiv: boolean;
122
+ searchVeh: boolean;
123
+ enableDuplicate: boolean;
124
+ dependency: CADRecordDependencyStruct;
125
+ }
126
+ export interface CADRecordStruct {
127
+ recordTypeId: number;
128
+ id: number;
129
+ syncId: string;
130
+ name: string;
131
+ type: CADRecordTypeEnums;
132
+ sections: CADRecordSectionStruct[];
133
+ }
134
+ export interface CADNewEditRecordOptionOneStruct {
135
+ user: string;
136
+ useDictionary: boolean;
137
+ recordTypeId: number;
138
+ replaceValues: Record<string, string>;
139
+ }
140
+ export interface CADNewEditRecordOptionTwoStruct {
141
+ user: string;
142
+ record: CADRecordStruct;
143
+ }
144
+ export declare enum CADLookupByIntSearchTypeEnums {
145
+ IDENTIFIER = 0,
146
+ SUPERVISOR_STATUS = 1,
147
+ ACTIVE_STATUS = 2,
148
+ NUMBER = 3
149
+ }
150
+ export interface CADLookupByIntStruct {
151
+ apiId?: string;
152
+ searchType: CADLookupByIntSearchTypeEnums;
153
+ value: number;
154
+ types: number[];
155
+ limit?: number;
156
+ offset?: number;
157
+ }
158
+ export interface CADLookupStruct {
159
+ apiId?: string;
160
+ types: number[];
161
+ first: string;
162
+ last: string;
163
+ mi: string;
164
+ plate: string;
165
+ partial: boolean;
166
+ agency?: string;
167
+ department?: string;
168
+ subdivision?: string;
169
+ }
170
+ export interface CADModifyAccountPermsStruct {
171
+ apiId?: string;
172
+ username?: string;
173
+ active?: boolean;
174
+ add: string[];
175
+ remove: string[];
176
+ }
177
+ export interface CADKickBanUserStruct {
178
+ apiId: string;
179
+ isBan?: boolean;
180
+ isKick?: boolean;
181
+ }
182
+ export interface CADSetPostalStruct {
183
+ code: string;
184
+ x: number;
185
+ y: number;
186
+ }
187
+ export declare enum CADModifyIdentifierActionEnums {
188
+ ADD = 0,
189
+ EDIT = 1,
190
+ REMOVE = 2
191
+ }
192
+ export interface CADModifyIdentifierStruct {
193
+ apiId: string;
194
+ action: CADModifyIdentifierActionEnums;
195
+ identifier?: Record<string, string>;
196
+ identId?: number;
197
+ }
198
+ export interface CADBlipStruct {
199
+ id: number;
200
+ coordinates: {
201
+ x: number;
202
+ y: number;
203
+ };
204
+ icon: string;
205
+ color: string;
206
+ tooltip: string;
207
+ }
208
+ export interface CADAddBlipStruct {
209
+ serverId: number;
210
+ blip: CADBlipStruct;
211
+ }
212
+ export interface CADModifyBlipStruct {
213
+ id: number;
214
+ coordinates?: {
215
+ x: number;
216
+ y: number;
217
+ };
218
+ icon?: string;
219
+ color?: string;
220
+ tooltip?: string;
221
+ }
222
+ export interface CADGetCallsStruct {
223
+ serverId?: number;
224
+ closedLimit?: number;
225
+ closedOffset?: number;
226
+ }
227
+ export interface CADGetActiveUnitsStruct {
228
+ serverId?: number;
229
+ onlyUnits?: boolean;
230
+ includeOffline?: boolean;
231
+ limit?: number;
232
+ offset?: number;
233
+ }
234
+ export declare enum CADDispatchOriginEnums {
235
+ Caller = 0,
236
+ RadioDispatch = 1,
237
+ Observed = 2,
238
+ WalkUp = 3
239
+ }
240
+ export declare enum CADDispatchStatusEnums {
241
+ Pending = 0,
242
+ Active = 1,
243
+ Closed = 2
244
+ }
245
+ export interface CADNewDispatchStruct {
246
+ serverId: number;
247
+ origin: CADDispatchOriginEnums;
248
+ status: CADDispatchStatusEnums;
249
+ priority: 1 | 2 | 3;
250
+ block: string;
251
+ address: string;
252
+ postal: string;
253
+ title: string;
254
+ code: string;
255
+ primary: number;
256
+ trackPrimary: boolean;
257
+ description: string;
258
+ metaData: Record<string, string>;
259
+ units: string[];
260
+ }
261
+ export interface CADStreetSignStruct {
262
+ id: number;
263
+ label: string;
264
+ text1: string;
265
+ text2: string;
266
+ text3: string;
267
+ }
268
+ export interface CADUnitLocationStruct {
269
+ apiId: string;
270
+ location: string;
271
+ }
272
+ export interface RESTTypedAPIDataStructs {
273
+ GET_SERVERS: [];
274
+ SET_SERVERS: [
275
+ servers: CADServerAPIStruct[],
276
+ deployMap: boolean
277
+ ];
278
+ GET_VERSION: [];
279
+ SET_PENAL_CODES: [data: CADPenalCodeStruct[]];
280
+ SET_API_ID: [data: CADSetAPIIDStruct];
281
+ GET_TEMPLATES: [recordTypeId?: number];
282
+ NEW_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
283
+ EDIT_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
284
+ REMOVE_RECORD: [id: number];
285
+ LOOKUP_INT: [data: CADLookupByIntStruct];
286
+ LOOKUP: [data: CADLookupStruct];
287
+ GET_ACCOUNT: [
288
+ apiId?: string,
289
+ username?: string
290
+ ];
291
+ CHECK_APIID: [apiId: string];
292
+ APPLY_PERMISSION_KEY: [
293
+ apiId: string,
294
+ permissionKey: string
295
+ ];
296
+ SET_ACCOUNT_PERMISSIONS: [data: CADModifyAccountPermsStruct];
297
+ BAN_USER: [data: CADKickBanUserStruct];
298
+ VERIFY_SECRET: [secret: string];
299
+ AUTH_STREETSIGNS: [serverId: number];
300
+ SET_POSTALS: [data: CADSetPostalStruct[]];
301
+ SEND_PHOTO: [
302
+ apiId: string,
303
+ url: string
304
+ ];
305
+ GET_CHARACTERS: [apiId: string];
306
+ NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
307
+ EDIT_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
308
+ REMOVE_CHARACTER: [id: number];
309
+ GET_IDENTIFIERS: [apiId: string];
310
+ MODIFY_IDENTIFIER: [data: CADModifyIdentifierStruct];
311
+ SET_IDENTIFIER: [
312
+ apiId: string,
313
+ identId: number
314
+ ];
315
+ UNIT_PANIC: [
316
+ apiId: string,
317
+ isPanic: boolean
318
+ ];
319
+ UNIT_STATUS: [
320
+ apiId: string,
321
+ status: number,
322
+ serverId: number
323
+ ];
324
+ GET_BLIPS: [serverId: number];
325
+ ADD_BLIP: [data: CADAddBlipStruct[]];
326
+ MODIFY_BLIP: [data: CADModifyBlipStruct[]];
327
+ REMOVE_BLIP: [id: number];
328
+ REMOVE_911: [callId: number];
329
+ GET_CALLS: [data: CADGetCallsStruct];
330
+ GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
331
+ KICK_UNIT: [
332
+ apiId: string,
333
+ reason: string,
334
+ serverId: number
335
+ ];
336
+ NEW_DISPATCH: [data: CADNewDispatchStruct];
337
+ ATTACH_UNIT: [
338
+ serverId: number,
339
+ callId: number,
340
+ units: string[]
341
+ ];
342
+ DETACH_UNIT: [
343
+ serverId: number,
344
+ units: string[]
345
+ ];
346
+ SET_CALL_POSTAL: [
347
+ serverId: number,
348
+ callId: number,
349
+ postal: string
350
+ ];
351
+ SET_CALL_PRIMARY: [
352
+ serverId: number,
353
+ callId: number,
354
+ primary: number,
355
+ trackPrimary: boolean
356
+ ];
357
+ ADD_CALL_NOTE: [
358
+ serverId: number,
359
+ callId: number,
360
+ note: string
361
+ ];
362
+ CLOSE_CALL: [
363
+ serverId: number,
364
+ callId: number
365
+ ];
366
+ 'CALL_911': [
367
+ serverId: number,
368
+ isEmergency: boolean,
369
+ caller: string,
370
+ location: string,
371
+ description: string,
372
+ metaData: Record<string, string>
373
+ ];
374
+ SET_STREETSIGN_CONFIG: [
375
+ serverId: number,
376
+ signConfig: CADStreetSignStruct[]
377
+ ];
378
+ UPDATE_STREETSIGN: [
379
+ serverId: number,
380
+ signData: {
381
+ ids: number[];
382
+ text1: string;
383
+ text2: string;
384
+ text3: string;
385
+ }
386
+ ];
387
+ UNIT_LOCATION: [data: CADUnitLocationStruct[]];
388
+ GET_COM_ACCOUNT: [
389
+ apiId?: string,
390
+ username?: string,
391
+ accId?: string,
392
+ discord?: string
393
+ ];
394
+ GET_SUB_VERSION: [];
395
+ CHECK_COM_APIID: [apiId: string];
396
+ CLOCK_IN_OUT: [
397
+ apiId?: string,
398
+ accId?: string,
399
+ forceClockIn?: boolean
400
+ ];
401
+ GET_DEPARTMENTS: [];
402
+ GET_ACCOUNT_RANKS: [
403
+ apiId?: string,
404
+ username?: string,
405
+ accId?: string,
406
+ discord?: string
407
+ ];
408
+ SET_ACCOUNT_RANKS: [
409
+ accountId: string,
410
+ set?: {
411
+ primary?: string | null;
412
+ secondary?: string[];
413
+ },
414
+ add?: string[],
415
+ remove?: string[]
416
+ ];
417
+ GET_GAME_SERVERS: [];
418
+ VERIFY_WHITELIST: [
419
+ apiId: string | undefined,
420
+ accId: string | undefined,
421
+ serverId: number
422
+ ];
423
+ FULL_WHITELIST: [
424
+ serverId?: number
425
+ ];
426
+ RSVP: [
427
+ eventId: string,
428
+ apiId: string | undefined,
429
+ accId: string | undefined
430
+ ];
431
+ CHANGE_FORM_STAGE: [
432
+ accId: string,
433
+ formId: number,
434
+ newStageId: string
435
+ ];
436
+ }
437
+ export type PossibleRequestData = undefined | {
438
+ data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
439
+ } | {
440
+ servers: CADServerAPIStruct[];
441
+ deployMap: boolean;
442
+ } | {
443
+ id: number;
444
+ } | {
445
+ recordTypeId?: number;
446
+ } | {
447
+ apiId?: string;
448
+ username?: string;
449
+ } | {
450
+ apiId: string;
451
+ } | {
452
+ apiId: string;
453
+ permissionKey: string;
454
+ } | {
455
+ secret: string;
456
+ } | {
457
+ serverId: number;
458
+ } | {
459
+ serverId?: number;
460
+ } | {
461
+ apiId: string;
462
+ url: string;
463
+ } | {
464
+ apiId: string;
465
+ identId: number;
466
+ } | {
467
+ apiId: string;
468
+ isPanic: boolean;
469
+ } | {
470
+ apiId: string;
471
+ status: number;
472
+ serverId: number;
473
+ } | {
474
+ callId: number;
475
+ } | {
476
+ serverId: number;
477
+ callId: number;
478
+ units: string[];
479
+ } | {
480
+ serverId: number;
481
+ units: string[];
482
+ } | {
483
+ serverId: number;
484
+ callId: number;
485
+ postal: string;
486
+ } | {
487
+ serverId: number;
488
+ callId: number;
489
+ primary: number;
490
+ trackPrimary: boolean;
491
+ } | {
492
+ serverId: number;
493
+ callId: number;
494
+ note: string;
495
+ } | {
496
+ serverId: number;
497
+ callId: number;
498
+ } | {
499
+ serverId: number;
500
+ isEmergency: boolean;
501
+ caller: string;
502
+ location: string;
503
+ description: string;
504
+ metaData: Record<string, string>;
505
+ } | {
506
+ serverId: number;
507
+ signConfig: CADStreetSignStruct[];
508
+ } | {
509
+ serverId: number;
510
+ signData: {
511
+ ids: number[];
512
+ text1: string;
513
+ text2: string;
514
+ text3: string;
515
+ };
516
+ } | {
517
+ apiId?: string;
518
+ username?: string;
519
+ } | {
520
+ apiId: string;
521
+ serverId: number;
522
+ } | {
523
+ apiId: string;
524
+ forceClockIn: boolean;
525
+ } | {
526
+ accountId: string;
527
+ set?: {
528
+ primary: string[];
529
+ secondary: string[];
530
+ };
531
+ add?: string[];
532
+ remove?: string[];
533
+ };