@sonoransoftware/sonoran.js 1.0.51 → 1.0.55

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.
@@ -148,6 +148,7 @@ export interface CMSClockInOutParams {
148
148
  accId?: string;
149
149
  apiId?: string;
150
150
  forceClockIn?: boolean;
151
+ forceClockOut?: boolean;
151
152
  discord?: string;
152
153
  uniqueId?: string;
153
154
  type?: string;
@@ -222,7 +222,8 @@ class REST extends events_1.EventEmitter {
222
222
  forceClockIn: args[2],
223
223
  discord: args[3],
224
224
  uniqueId: args[4],
225
- type: args[5]
225
+ type: args[5],
226
+ forceClockOut: args[6]
226
227
  };
227
228
  }
228
229
  case 'ADD_CALL_NOTE': {
@@ -237,6 +238,16 @@ class REST extends events_1.EventEmitter {
237
238
  label: args[3]
238
239
  };
239
240
  }
241
+ case 'CLOSE_CALL': {
242
+ const payload = args[0];
243
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
244
+ return payload;
245
+ }
246
+ return {
247
+ serverId: args[0],
248
+ callId: args[1]
249
+ };
250
+ }
240
251
  case 'UNIT_STATUS': {
241
252
  const payload = args[0];
242
253
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
@@ -239,6 +239,10 @@ class RequestManager extends events_1.EventEmitter {
239
239
  }
240
240
  break;
241
241
  }
242
+ case 'CLOSE_CALL': {
243
+ apiData.data.data = [clonedData];
244
+ break;
245
+ }
242
246
  case 'UNIT_PANIC': {
243
247
  const payload = data.data;
244
248
  if (Array.isArray(payload)) {
@@ -245,6 +245,12 @@ export interface CADGetActiveUnitsStruct {
245
245
  limit?: number;
246
246
  offset?: number;
247
247
  }
248
+ export interface CADDispatchNoteStruct {
249
+ time: string;
250
+ label: string;
251
+ type: string;
252
+ content: string;
253
+ }
248
254
  export interface CADAttachUnitsStruct {
249
255
  serverId: number;
250
256
  callId: number;
@@ -285,6 +291,7 @@ interface CADNewDispatchBaseStruct {
285
291
  primary: number;
286
292
  trackPrimary: boolean;
287
293
  description: string;
294
+ notes: CADDispatchNoteStruct[];
288
295
  metaData: Record<string, string>;
289
296
  }
290
297
  export type CADNewDispatchStruct = (CADNewDispatchBaseStruct & {
@@ -504,7 +511,8 @@ export interface RESTTypedAPIDataStructs {
504
511
  forceClockIn?: boolean,
505
512
  discord?: string,
506
513
  uniqueId?: string,
507
- type?: string
514
+ type?: string,
515
+ forceClockOut?: boolean
508
516
  ];
509
517
  GET_DEPARTMENTS: [];
510
518
  GET_ACCOUNT_RANKS: [
@@ -784,6 +792,7 @@ export type PossibleRequestData = undefined | {
784
792
  apiId?: string;
785
793
  accId?: string;
786
794
  forceClockIn?: boolean;
795
+ forceClockOut?: boolean;
787
796
  discord?: string;
788
797
  uniqueId?: string;
789
798
  type?: string;
@@ -77,6 +77,7 @@ export declare class CMSManager extends BaseManager {
77
77
  * @param {string} [data.accId] (Optional) The account id to clock in or out.
78
78
  * @param {string} [data.apiId] (Optional) The api id to clock in or out.
79
79
  * @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
80
+ * @param {boolean} [data.forceClockOut] If true, it will force a clock out regardless of current status.
80
81
  * @param {string} [data.discord] (Optional) The discord ID to clock in or out.
81
82
  * @param {string} [data.uniqueId] (Optional) The unique ID to clock in or out.
82
83
  * @param {string} [data.type] (Optional) The UUID of a specific clock-in type to use.
@@ -176,6 +176,7 @@ class CMSManager extends BaseManager_1.BaseManager {
176
176
  * @param {string} [data.accId] (Optional) The account id to clock in or out.
177
177
  * @param {string} [data.apiId] (Optional) The api id to clock in or out.
178
178
  * @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
179
+ * @param {boolean} [data.forceClockOut] If true, it will force a clock out regardless of current status.
179
180
  * @param {string} [data.discord] (Optional) The discord ID to clock in or out.
180
181
  * @param {string} [data.uniqueId] (Optional) The unique ID to clock in or out.
181
182
  * @param {string} [data.type] (Optional) The UUID of a specific clock-in type to use.
@@ -185,7 +186,7 @@ class CMSManager extends BaseManager_1.BaseManager {
185
186
  return new Promise(async (resolve, reject) => {
186
187
  var _a;
187
188
  try {
188
- const clockInOutRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId, data.type));
189
+ const clockInOutRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId, data.type, !!data.forceClockOut));
189
190
  const clockInOutResponse = clockInOutRequest;
190
191
  if (!clockInOutResponse)
191
192
  resolve({ success: false, reason: clockInOutRequest });
@@ -139,6 +139,7 @@ if (comAccount.success) {
139
139
  | data.apiId | Yes | String | Must have at least apiId or accId |
140
140
  | data.accId | Yes | String | Must have at least apiId or accId |
141
141
  | data.forceClockIn | Yes | Boolean | Will start a new clock in and overrite any current clock in |
142
+ | data.forceClockOut | Yes | Boolean | Forces a clock out regardless of the current status |
142
143
 
143
144
  Returns *clockResult*;
144
145
  | Property | Optional | Type | Note |
@@ -162,6 +163,12 @@ const clockResult = await instance.cms.clockInOut({
162
163
  forceClockIn: true
163
164
  });
164
165
  // OR
166
+ // This will force a clock out on the community account found by the specified API ID if found.
167
+ const clockResult = await instance.cms.clockInOut({
168
+ apiId: '235947056630333440',
169
+ forceClockOut: true
170
+ });
171
+ // OR
165
172
  // This will either clock in or out the community account found by the specified API ID if found.
166
173
  // Will determine to clock in or out depending on what is pending.
167
174
  const clockResult = await instance.cms.clockInOut({
@@ -209,4 +216,4 @@ if (checkResult.success) {
209
216
  } else {
210
217
  console.log('Unsuccessful', checkResult.reason);
211
218
  }
212
- ```
219
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.51",
3
+ "version": "1.0.55",
4
4
  "description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -267,12 +267,13 @@ const getRanks = await instance.cms.getAccountRanks(params);
267
267
  ### clockInOut(obj)
268
268
  Clock a user in or out in the CMS system
269
269
  #### Arugment `obj`
270
- ##### Type `object` `{accId?: string, apiId?: string, forceClockIn?: boolean, discord?: string, uniqueId?: string, type?: string}`
270
+ ##### Type `object` `{accId?: string, apiId?: string, forceClockIn?: boolean, forceClockOut?: boolean, discord?: string, uniqueId?: string, type?: string}`
271
271
  ```js
272
272
  const params = {
273
273
  accId: '',
274
274
  apiId: '',
275
275
  forceClockIn: true,
276
+ forceClockOut: false,
276
277
  discord: '',
277
278
  uniqueId: '1234',
278
279
  type: 'clockin-type-uuid'
package/src/constants.ts CHANGED
@@ -168,6 +168,7 @@ export interface CMSClockInOutParams {
168
168
  accId?: string;
169
169
  apiId?: string;
170
170
  forceClockIn?: boolean;
171
+ forceClockOut?: boolean;
171
172
  discord?: string;
172
173
  uniqueId?: string;
173
174
  type?: string;
@@ -326,7 +326,8 @@ export class REST extends EventEmitter {
326
326
  forceClockIn: args[2],
327
327
  discord: args[3],
328
328
  uniqueId: args[4],
329
- type: args[5]
329
+ type: args[5],
330
+ forceClockOut: args[6]
330
331
  };
331
332
  }
332
333
  case 'ADD_CALL_NOTE': {
@@ -341,6 +342,16 @@ export class REST extends EventEmitter {
341
342
  label: args[3]
342
343
  };
343
344
  }
345
+ case 'CLOSE_CALL': {
346
+ const payload = args[0];
347
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
348
+ return payload;
349
+ }
350
+ return {
351
+ serverId: args[0],
352
+ callId: args[1]
353
+ };
354
+ }
344
355
  case 'UNIT_STATUS': {
345
356
  const payload = args[0];
346
357
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
@@ -306,6 +306,10 @@ export class RequestManager extends EventEmitter {
306
306
  }
307
307
  break;
308
308
  }
309
+ case 'CLOSE_CALL': {
310
+ apiData.data.data = [clonedData];
311
+ break;
312
+ }
309
313
  case 'UNIT_PANIC': {
310
314
  const payload = data.data;
311
315
  if (Array.isArray(payload)) {
@@ -914,6 +914,13 @@ export interface CADGetActiveUnitsStruct {
914
914
  offset?: number;
915
915
  }
916
916
 
917
+ export interface CADDispatchNoteStruct {
918
+ time: string;
919
+ label: string;
920
+ type: string;
921
+ content: string;
922
+ }
923
+
917
924
  export interface CADAttachUnitsStruct {
918
925
  serverId: number;
919
926
  callId: number;
@@ -959,6 +966,7 @@ interface CADNewDispatchBaseStruct {
959
966
  primary: number;
960
967
  trackPrimary: boolean;
961
968
  description: string;
969
+ notes: CADDispatchNoteStruct[];
962
970
  metaData: Record<string, string>;
963
971
  }
964
972
 
@@ -1179,7 +1187,8 @@ export interface RESTTypedAPIDataStructs {
1179
1187
  forceClockIn?: boolean,
1180
1188
  discord?: string,
1181
1189
  uniqueId?: string,
1182
- type?: string
1190
+ type?: string,
1191
+ forceClockOut?: boolean
1183
1192
  ];
1184
1193
  GET_DEPARTMENTS: [];
1185
1194
  GET_ACCOUNT_RANKS: [
@@ -1496,6 +1505,7 @@ export type PossibleRequestData =
1496
1505
  apiId?: string;
1497
1506
  accId?: string;
1498
1507
  forceClockIn?: boolean;
1508
+ forceClockOut?: boolean;
1499
1509
  discord?: string;
1500
1510
  uniqueId?: string;
1501
1511
  type?: string;
@@ -149,6 +149,7 @@ export class CMSManager extends BaseManager {
149
149
  * @param {string} [data.accId] (Optional) The account id to clock in or out.
150
150
  * @param {string} [data.apiId] (Optional) The api id to clock in or out.
151
151
  * @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
152
+ * @param {boolean} [data.forceClockOut] If true, it will force a clock out regardless of current status.
152
153
  * @param {string} [data.discord] (Optional) The discord ID to clock in or out.
153
154
  * @param {string} [data.uniqueId] (Optional) The unique ID to clock in or out.
154
155
  * @param {string} [data.type] (Optional) The UUID of a specific clock-in type to use.
@@ -157,7 +158,7 @@ export class CMSManager extends BaseManager {
157
158
  public async clockInOut(data: globalTypes.CMSClockInOutParams): Promise<globalTypes.CMSClockInOutPromiseResult> {
158
159
  return new Promise(async (resolve, reject) => {
159
160
  try {
160
- const clockInOutRequest = await this.rest?.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId, data.type);
161
+ const clockInOutRequest = await this.rest?.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId, data.type, !!data.forceClockOut);
161
162
  const clockInOutResponse = clockInOutRequest as globalTypes.clockInOutRequest;
162
163
  if (!clockInOutResponse) resolve({ success: false, reason: clockInOutRequest as string });
163
164
  resolve({ success: true, clockedIn: clockInOutResponse.completed });