scheduler-node-models 1.0.75 → 1.0.79
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/package.json +21 -6
- package/.npmignore +0 -1
- package/general/emailer.d.ts +0 -1
- package/general/emailer.js +0 -31
- package/general/general.d.ts +0 -12
- package/general/general.js +0 -2
- package/general/index.d.ts +0 -4
- package/general/index.js +0 -20
- package/general/report.d.ts +0 -12
- package/general/report.js +0 -70
- package/general/reportStyle.d.ts +0 -0
- package/general/reportStyle.js +0 -1
- package/general/viewstate.d.ts +0 -5
- package/general/viewstate.js +0 -9
- package/index.d.ts +0 -0
- package/metrics/images.d.ts +0 -22
- package/metrics/images.js +0 -33
- package/metrics/index.d.ts +0 -5
- package/metrics/index.js +0 -21
- package/metrics/mission.d.ts +0 -47
- package/metrics/mission.js +0 -81
- package/metrics/missionSensorOutage.d.ts +0 -11
- package/metrics/missionSensorOutage.js +0 -14
- package/metrics/missionsensor.d.ts +0 -67
- package/metrics/missionsensor.js +0 -128
- package/metrics/outage.d.ts +0 -43
- package/metrics/outage.js +0 -55
- package/metrics/reports/drawSummary.d.ts +0 -24
- package/metrics/reports/drawSummary.js +0 -311
- package/metrics/reports/index.d.ts +0 -5
- package/metrics/reports/index.js +0 -21
- package/metrics/reports/missionDay.d.ts +0 -8
- package/metrics/reports/missionDay.js +0 -23
- package/metrics/reports/missionSummary.d.ts +0 -25
- package/metrics/reports/missionSummary.js +0 -421
- package/metrics/reports/missionType.d.ts +0 -20
- package/metrics/reports/missionType.js +0 -314
- package/metrics/reports/outageDay.d.ts +0 -8
- package/metrics/reports/outageDay.js +0 -23
- package/metrics/systemdata/classifications.d.ts +0 -18
- package/metrics/systemdata/classifications.js +0 -23
- package/metrics/systemdata/communications.d.ts +0 -21
- package/metrics/systemdata/communications.js +0 -40
- package/metrics/systemdata/dcgs.d.ts +0 -19
- package/metrics/systemdata/dcgs.js +0 -29
- package/metrics/systemdata/exploitations.d.ts +0 -18
- package/metrics/systemdata/exploitations.js +0 -23
- package/metrics/systemdata/groundSystems.d.ts +0 -86
- package/metrics/systemdata/groundSystems.js +0 -143
- package/metrics/systemdata/index.d.ts +0 -7
- package/metrics/systemdata/index.js +0 -23
- package/metrics/systemdata/platform.d.ts +0 -124
- package/metrics/systemdata/platform.js +0 -176
- package/metrics/systemdata/systeminfo.d.ts +0 -28
- package/metrics/systemdata/systeminfo.js +0 -64
- package/scheduler/employees/assignment.d.ts +0 -139
- package/scheduler/employees/assignment.js +0 -304
- package/scheduler/employees/balance.d.ts +0 -35
- package/scheduler/employees/balance.js +0 -39
- package/scheduler/employees/companyinfo.d.ts +0 -16
- package/scheduler/employees/companyinfo.js +0 -6
- package/scheduler/employees/contact.d.ts +0 -36
- package/scheduler/employees/contact.js +0 -40
- package/scheduler/employees/employee.d.ts +0 -420
- package/scheduler/employees/employee.js +0 -1862
- package/scheduler/employees/employeename.d.ts +0 -48
- package/scheduler/employees/employeename.js +0 -97
- package/scheduler/employees/index.d.ts +0 -14
- package/scheduler/employees/index.js +0 -30
- package/scheduler/employees/labor.d.ts +0 -31
- package/scheduler/employees/labor.js +0 -39
- package/scheduler/employees/leave.d.ts +0 -58
- package/scheduler/employees/leave.js +0 -73
- package/scheduler/employees/leaverequest.d.ts +0 -105
- package/scheduler/employees/leaverequest.js +0 -226
- package/scheduler/employees/specialty.d.ts +0 -35
- package/scheduler/employees/specialty.js +0 -40
- package/scheduler/employees/variation.d.ts +0 -80
- package/scheduler/employees/variation.js +0 -132
- package/scheduler/employees/web.d.ts +0 -6
- package/scheduler/employees/web.js +0 -2
- package/scheduler/employees/work.d.ts +0 -96
- package/scheduler/employees/work.js +0 -133
- package/scheduler/employees/workday.d.ts +0 -91
- package/scheduler/employees/workday.js +0 -170
- package/scheduler/labor/index.d.ts +0 -2
- package/scheduler/labor/index.js +0 -18
- package/scheduler/labor/laborcode.d.ts +0 -33
- package/scheduler/labor/laborcode.js +0 -55
- package/scheduler/labor/workcode.d.ts +0 -28
- package/scheduler/labor/workcode.js +0 -35
- package/scheduler/reports/chargeStatus.d.ts +0 -66
- package/scheduler/reports/chargeStatus.js +0 -702
- package/scheduler/reports/cofsReports.d.ts +0 -11
- package/scheduler/reports/cofsReports.js +0 -36
- package/scheduler/reports/enterpriseSchedule.d.ts +0 -18
- package/scheduler/reports/enterpriseSchedule.js +0 -159
- package/scheduler/reports/index.d.ts +0 -4
- package/scheduler/reports/index.js +0 -20
- package/scheduler/reports/scheduleReport.d.ts +0 -17
- package/scheduler/reports/scheduleReport.js +0 -311
- package/scheduler/sites/index.d.ts +0 -1
- package/scheduler/sites/index.js +0 -17
- package/scheduler/sites/reports/cofsReport.d.ts +0 -41
- package/scheduler/sites/reports/cofsReport.js +0 -104
- package/scheduler/sites/reports/forecast.d.ts +0 -57
- package/scheduler/sites/reports/forecast.js +0 -205
- package/scheduler/sites/reports/index.d.ts +0 -4
- package/scheduler/sites/reports/index.js +0 -20
- package/scheduler/sites/reports/period.d.ts +0 -11
- package/scheduler/sites/reports/period.js +0 -27
- package/scheduler/sites/reports/section.d.ts +0 -63
- package/scheduler/sites/reports/section.js +0 -174
- package/scheduler/sites/site.d.ts +0 -39
- package/scheduler/sites/site.js +0 -61
- package/scheduler/sites/workcenters/index.d.ts +0 -3
- package/scheduler/sites/workcenters/index.js +0 -19
- package/scheduler/sites/workcenters/position.d.ts +0 -27
- package/scheduler/sites/workcenters/position.js +0 -36
- package/scheduler/sites/workcenters/shift.d.ts +0 -32
- package/scheduler/sites/workcenters/shift.js +0 -47
- package/scheduler/sites/workcenters/workcenter.d.ts +0 -43
- package/scheduler/sites/workcenters/workcenter.js +0 -123
- package/scheduler/teams/company/company.d.ts +0 -99
- package/scheduler/teams/company/company.js +0 -256
- package/scheduler/teams/company/holiday.d.ts +0 -55
- package/scheduler/teams/company/holiday.js +0 -108
- package/scheduler/teams/company/index.d.ts +0 -3
- package/scheduler/teams/company/index.js +0 -19
- package/scheduler/teams/company/modperiod.d.ts +0 -21
- package/scheduler/teams/company/modperiod.js +0 -24
- package/scheduler/teams/contact.d.ts +0 -18
- package/scheduler/teams/contact.js +0 -23
- package/scheduler/teams/index.d.ts +0 -3
- package/scheduler/teams/index.js +0 -19
- package/scheduler/teams/specialty.d.ts +0 -18
- package/scheduler/teams/specialty.js +0 -23
- package/scheduler/teams/team.d.ts +0 -95
- package/scheduler/teams/team.js +0 -351
- package/users/index.d.ts +0 -2
- package/users/index.js +0 -18
- package/users/user.d.ts +0 -130
- package/users/user.js +0 -254
- package/users/web.d.ts +0 -22
- package/users/web.js +0 -2
package/users/user.js
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.User = void 0;
|
4
|
-
const mongodb_1 = require("mongodb");
|
5
|
-
const bcrypt_1 = require("bcrypt");
|
6
|
-
/**
|
7
|
-
* This class represents a user and all the actions available to the user object.
|
8
|
-
* The main class members are:
|
9
|
-
* id (primary key),
|
10
|
-
* email address (used in authentication and email messages for reset),
|
11
|
-
* password (authentication), password expires (old use -
|
12
|
-
* to determine the when the password would expire, but new use is to track when
|
13
|
-
* created to allow for the warning to change after 90 days and requiring after 1 year),
|
14
|
-
* badAttempts (count of number of mismatch of password since last known good
|
15
|
-
* authentication),
|
16
|
-
* first, middle and last names (name - middle is optional),
|
17
|
-
* workgroups (string array to provide identificationn of permission within an
|
18
|
-
* application),
|
19
|
-
* resetToken and resettokenexp (a storage location or a reset token used in forgot
|
20
|
-
* password change, plus token expiration date/time the reset token expires)
|
21
|
-
*/
|
22
|
-
class User {
|
23
|
-
_id;
|
24
|
-
emailAddress;
|
25
|
-
password;
|
26
|
-
passwordExpires;
|
27
|
-
badAttempts;
|
28
|
-
firstName;
|
29
|
-
middleName;
|
30
|
-
lastName;
|
31
|
-
workgroups;
|
32
|
-
resettoken;
|
33
|
-
resettokenexp;
|
34
|
-
additionalEmails;
|
35
|
-
constructor(user) {
|
36
|
-
this._id = (user && user._id) ? user._id : new mongodb_1.ObjectId();
|
37
|
-
this.emailAddress = (user) ? user.emailAddress : '';
|
38
|
-
this.password = (user) ? user.password : undefined;
|
39
|
-
this.passwordExpires = (user) ? new Date(user.passwordExpires) : new Date();
|
40
|
-
this.badAttempts = (user) ? user.badAttempts : 0;
|
41
|
-
this.firstName = (user) ? user.firstName : '';
|
42
|
-
this.middleName = (user) ? user.middleName : undefined;
|
43
|
-
this.lastName = (user) ? user.lastName : '';
|
44
|
-
this.workgroups = [];
|
45
|
-
if (user) {
|
46
|
-
user.workgroups.forEach(wg => {
|
47
|
-
this.workgroups.push(wg);
|
48
|
-
});
|
49
|
-
user.workgroups.sort((a, b) => (a < b) ? -1 : 1);
|
50
|
-
}
|
51
|
-
this.resettoken = (user && user.resettoken) ? user.resettoken : undefined;
|
52
|
-
this.resettokenexp = (user && user.resettokenexp)
|
53
|
-
? new Date(user.resettokenexp) : undefined;
|
54
|
-
this.additionalEmails = [];
|
55
|
-
if (user && user.additionalEmails) {
|
56
|
-
user.additionalEmails.forEach(em => {
|
57
|
-
this.additionalEmails?.push(em);
|
58
|
-
});
|
59
|
-
this.additionalEmails.sort();
|
60
|
-
}
|
61
|
-
}
|
62
|
-
/**
|
63
|
-
* This function is used to sort this class' objects into an ordered list. The order
|
64
|
-
* is determined by last, first and middle names
|
65
|
-
* @param other Another user object used during comparison
|
66
|
-
* @returns a numeric value to show the object is before or after the other object.
|
67
|
-
* -1 is for before and 1 is for after.
|
68
|
-
*/
|
69
|
-
compareTo(other) {
|
70
|
-
if (other) {
|
71
|
-
if (other.lastName === this.lastName) {
|
72
|
-
if (other.firstName === this.firstName) {
|
73
|
-
if (this.middleName && other.middleName) {
|
74
|
-
return (this.middleName < other.middleName) ? -1 : 1;
|
75
|
-
}
|
76
|
-
else if (!this.middleName) {
|
77
|
-
return -1;
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
return 1;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
return (this.firstName < other.firstName) ? -1 : 1;
|
84
|
-
}
|
85
|
-
return (this.lastName < other.lastName) ? -1 : 1;
|
86
|
-
}
|
87
|
-
return -1;
|
88
|
-
}
|
89
|
-
/**
|
90
|
-
* This function provides a copy of the user object to the web client. We don't want to
|
91
|
-
* pass the password, reset token or expiration date/time.
|
92
|
-
* @returns A new User interface for passing
|
93
|
-
*/
|
94
|
-
cloneForOutput() {
|
95
|
-
const output = new User(this);
|
96
|
-
output.password = undefined;
|
97
|
-
output.resettoken = undefined;
|
98
|
-
output.resettokenexp = undefined;
|
99
|
-
return output;
|
100
|
-
}
|
101
|
-
/**
|
102
|
-
* This function will reset the password, bad attemtps and expiration date. The new
|
103
|
-
* password will be excrypted for storage.
|
104
|
-
* @param passwd The string value for the new password
|
105
|
-
*/
|
106
|
-
setPassword(passwd) {
|
107
|
-
const salt = (0, bcrypt_1.genSaltSync)(12);
|
108
|
-
const result = (0, bcrypt_1.hashSync)(passwd, salt);
|
109
|
-
this.password = result;
|
110
|
-
this.passwordExpires = new Date();
|
111
|
-
this.badAttempts = 0;
|
112
|
-
}
|
113
|
-
/**
|
114
|
-
* This function will be used in authentication to verify if the password provided is
|
115
|
-
* equivelent to the stored one.
|
116
|
-
* @param pwd The string value to compare against the encrypted password.
|
117
|
-
* @throws An error if the account is locked or there is a mismatch with the password.
|
118
|
-
*/
|
119
|
-
checkPassword(pwd) {
|
120
|
-
if (this.password && (0, bcrypt_1.compareSync)(pwd, this.password)) {
|
121
|
-
if (this.badAttempts > 2) {
|
122
|
-
throw new Error("Account Locked");
|
123
|
-
}
|
124
|
-
this.badAttempts = 0;
|
125
|
-
return;
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
this.badAttempts++;
|
129
|
-
throw new Error("Account Mismatch");
|
130
|
-
}
|
131
|
-
}
|
132
|
-
/**
|
133
|
-
* This function will provide a random 16 character password.
|
134
|
-
* @returns A string value representing the new random password.
|
135
|
-
*/
|
136
|
-
createRandomPassword() {
|
137
|
-
let result = '';
|
138
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
139
|
-
+ '0123456789';
|
140
|
-
const charLength = characters.length;
|
141
|
-
for (let i = 0; i < 16; i++) {
|
142
|
-
result += characters.charAt(Math.floor(Math.random() * charLength));
|
143
|
-
}
|
144
|
-
this.setPassword(result);
|
145
|
-
this.badAttempts = -1;
|
146
|
-
return result;
|
147
|
-
}
|
148
|
-
/**
|
149
|
-
* This function will unlock the user account to allow for access.
|
150
|
-
*/
|
151
|
-
unlock() {
|
152
|
-
this.badAttempts = 0;
|
153
|
-
}
|
154
|
-
/**
|
155
|
-
* This function will provide the user's name in the form first middle and last.
|
156
|
-
* @returns A string value for the user's name.
|
157
|
-
*/
|
158
|
-
getFullName() {
|
159
|
-
if (!this.middleName) {
|
160
|
-
return this.firstName + ' ' + this.lastName;
|
161
|
-
}
|
162
|
-
return this.firstName + ' ' + this.middleName.substring(0, 1) + '. '
|
163
|
-
+ this.lastName;
|
164
|
-
}
|
165
|
-
/**
|
166
|
-
* This function will provide the user's name in the form first last.
|
167
|
-
* @returns A string value for the user's name.
|
168
|
-
*/
|
169
|
-
getFirstLast() {
|
170
|
-
return this.firstName + ' ' + this.lastName;
|
171
|
-
}
|
172
|
-
/**
|
173
|
-
* This function will provide the user's name in the form last, first.
|
174
|
-
* @returns A string value for the user's name.
|
175
|
-
*/
|
176
|
-
getLastFirst() {
|
177
|
-
return this.lastName + ', ' + this.firstName;
|
178
|
-
}
|
179
|
-
/**
|
180
|
-
* This function will create a random string used as a token to reset the user's
|
181
|
-
* password when the user had forgotten it. It will be emailed to the user's
|
182
|
-
* email addresses. The token will be good for 1 hour, so an expiration date/time
|
183
|
-
* is also set.
|
184
|
-
* @returns A string value for the reset token.
|
185
|
-
*/
|
186
|
-
createResetToken() {
|
187
|
-
let result = '';
|
188
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
189
|
-
+ '0123456789';
|
190
|
-
const charLength = characters.length;
|
191
|
-
for (let i = 0; i < 16; i++) {
|
192
|
-
result += characters.charAt(Math.floor(Math.random() * charLength));
|
193
|
-
}
|
194
|
-
let now = new Date();
|
195
|
-
this.resettokenexp = new Date(now.getTime() + 3600000);
|
196
|
-
this.resettoken = result;
|
197
|
-
return result;
|
198
|
-
}
|
199
|
-
/**
|
200
|
-
* This function will verify the provided string token in comparison to that recorded
|
201
|
-
* in the user's record. The process also checks to ensure the token isn't expired.
|
202
|
-
* @param token A string value for the comparison token.
|
203
|
-
* @returns A boolean value to indicate if the token matches and not expired.
|
204
|
-
*/
|
205
|
-
checkResetToken(token) {
|
206
|
-
const now = new Date();
|
207
|
-
if (this.resettoken && this.resettokenexp) {
|
208
|
-
if (this.resettoken === token
|
209
|
-
&& now.getTime() < this.resettokenexp?.getTime()) {
|
210
|
-
return true;
|
211
|
-
}
|
212
|
-
else {
|
213
|
-
if (this.resettokenexp.getTime() < now.getTime()) {
|
214
|
-
throw new Error("Reset Token Expired");
|
215
|
-
}
|
216
|
-
throw new Error("Reset Token Error");
|
217
|
-
}
|
218
|
-
}
|
219
|
-
return false;
|
220
|
-
}
|
221
|
-
/**
|
222
|
-
* This function will add a new email address, if it isn't already in the list
|
223
|
-
* @param email The string value for the email to add.
|
224
|
-
*/
|
225
|
-
addAdditionalEmail(email) {
|
226
|
-
let found = false;
|
227
|
-
this.additionalEmails.forEach(em => {
|
228
|
-
if (em.toLowerCase() === email.toLowerCase()) {
|
229
|
-
found = true;
|
230
|
-
}
|
231
|
-
});
|
232
|
-
if (!found) {
|
233
|
-
this.additionalEmails.push(email);
|
234
|
-
this.additionalEmails.sort();
|
235
|
-
}
|
236
|
-
}
|
237
|
-
/**
|
238
|
-
* This function will remove an email address from the user's additional email
|
239
|
-
* address list.
|
240
|
-
* @param email The string value for the email to remove.
|
241
|
-
*/
|
242
|
-
deleteAdditionalEmail(email) {
|
243
|
-
let found = -1;
|
244
|
-
this.additionalEmails.forEach((em, e) => {
|
245
|
-
if (em.toLowerCase() === email.toLowerCase()) {
|
246
|
-
found = e;
|
247
|
-
}
|
248
|
-
});
|
249
|
-
if (found >= 0) {
|
250
|
-
this.additionalEmails.splice(found, 1);
|
251
|
-
}
|
252
|
-
}
|
253
|
-
}
|
254
|
-
exports.User = User;
|
package/users/web.d.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* This interface will be used to authenticate with the application through the api
|
3
|
-
* server.
|
4
|
-
*/
|
5
|
-
export interface AuthenticationRequest {
|
6
|
-
emailAddress: string;
|
7
|
-
password: string;
|
8
|
-
application?: string;
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* This interface will be used between the client and the api server to request a new
|
12
|
-
* user. All fields are required.
|
13
|
-
*/
|
14
|
-
export interface AddUserRequest {
|
15
|
-
emailAddress: string;
|
16
|
-
firstName: string;
|
17
|
-
middleName?: string;
|
18
|
-
lastName: string;
|
19
|
-
password: string;
|
20
|
-
application: string;
|
21
|
-
permissions?: string[];
|
22
|
-
}
|
package/users/web.js
DELETED