@sonoransoftware/sonoran.js 1.0.51 → 1.0.52
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/dist/constants.d.ts +1 -0
- package/dist/libs/rest/src/lib/REST.js +2 -1
- package/dist/libs/rest/src/lib/utils/constants.d.ts +3 -1
- package/dist/managers/CMSManager.d.ts +1 -0
- package/dist/managers/CMSManager.js +2 -1
- package/docs/CMS-Methods-and-Usage.md +8 -1
- package/package.json +1 -1
- package/readme.md +2 -1
- package/src/constants.ts +1 -0
- package/src/libs/rest/src/lib/REST.ts +2 -1
- package/src/libs/rest/src/lib/utils/constants.ts +3 -1
- package/src/managers/CMSManager.ts +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -504,7 +504,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
504
504
|
forceClockIn?: boolean,
|
|
505
505
|
discord?: string,
|
|
506
506
|
uniqueId?: string,
|
|
507
|
-
type?: string
|
|
507
|
+
type?: string,
|
|
508
|
+
forceClockOut?: boolean
|
|
508
509
|
];
|
|
509
510
|
GET_DEPARTMENTS: [];
|
|
510
511
|
GET_ACCOUNT_RANKS: [
|
|
@@ -784,6 +785,7 @@ export type PossibleRequestData = undefined | {
|
|
|
784
785
|
apiId?: string;
|
|
785
786
|
accId?: string;
|
|
786
787
|
forceClockIn?: boolean;
|
|
788
|
+
forceClockOut?: boolean;
|
|
787
789
|
discord?: string;
|
|
788
790
|
uniqueId?: string;
|
|
789
791
|
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.
|
|
3
|
+
"version": "1.0.52",
|
|
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
|
@@ -1179,7 +1179,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1179
1179
|
forceClockIn?: boolean,
|
|
1180
1180
|
discord?: string,
|
|
1181
1181
|
uniqueId?: string,
|
|
1182
|
-
type?: string
|
|
1182
|
+
type?: string,
|
|
1183
|
+
forceClockOut?: boolean
|
|
1183
1184
|
];
|
|
1184
1185
|
GET_DEPARTMENTS: [];
|
|
1185
1186
|
GET_ACCOUNT_RANKS: [
|
|
@@ -1496,6 +1497,7 @@ export type PossibleRequestData =
|
|
|
1496
1497
|
apiId?: string;
|
|
1497
1498
|
accId?: string;
|
|
1498
1499
|
forceClockIn?: boolean;
|
|
1500
|
+
forceClockOut?: boolean;
|
|
1499
1501
|
discord?: string;
|
|
1500
1502
|
uniqueId?: string;
|
|
1501
1503
|
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 });
|