@getjones/test-infra 1.8.0 → 1.9.0
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 +1 -1
- package/src/index.js +2 -0
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +7 -1
- package/src/saas/internal-api/contractors/api/contractors.api.js +44 -0
- package/src/saas/internal-api/contractors/api/contractors.service.js +40 -0
- package/src/saas/internal-api/requests/api/requests.api.js +21 -0
- package/src/saas/internal-api/requests/api/requests.service.js +14 -0
- package/src/saas/internal-api/requests/index.js +3 -0
- package/src/saas/internal-api/users/api/users.api.js +7 -1
- package/src/saas/internal-api/users/api/users.service.js +12 -1
- package/src/saas/internal-api/users/index.js +1 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const getInternalAPI = () => {
|
|
|
17
17
|
|
|
18
18
|
const requirements = require('./saas/internal-api/requirements');
|
|
19
19
|
const contractors = require('./saas/internal-api/contractors');
|
|
20
|
+
const requests = require('./saas/internal-api/requests');
|
|
20
21
|
|
|
21
22
|
const coi = require('./saas/internal-api/coi');
|
|
22
23
|
const compliance = require('./saas/internal-api/compliance');
|
|
@@ -38,6 +39,7 @@ const getInternalAPI = () => {
|
|
|
38
39
|
tabs,
|
|
39
40
|
requirements,
|
|
40
41
|
contractors,
|
|
42
|
+
requests,
|
|
41
43
|
coi,
|
|
42
44
|
compliance,
|
|
43
45
|
reports,
|
|
@@ -38,7 +38,13 @@ const getOrCreateAccount = async (createAccountModel, context) => {
|
|
|
38
38
|
return existingAccount;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const response = await accountsAPI.create(createAccountModel, context);
|
|
42
|
+
|
|
43
|
+
if (!response.data) {
|
|
44
|
+
throw new Error(`Account by the name ${createAccountModel.companyName} did not crate`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return response.data;
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
const getAccountId = async (accountName, context) => {
|
|
@@ -5,17 +5,25 @@ const Endpoints = {
|
|
|
5
5
|
create: `${backendUrl}/saas/contractors/invite`,
|
|
6
6
|
get: `${backendUrl}/saas/contractors`,
|
|
7
7
|
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
8
|
+
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
8
9
|
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
9
10
|
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
10
11
|
restore: contractorId => `${backendUrl}/saas/contractor/${contractorId}/restore`,
|
|
11
12
|
edit: contractorId => `${backendUrl}/saas/contractors/${contractorId}/update`,
|
|
13
|
+
sendGaps: `${backendUrl}/saas/contractor/compliance/status`,
|
|
14
|
+
requestNewCoiAboutToExpire: `${backendUrl}/saas/coi/about-to-expire`,
|
|
15
|
+
requestNewCoiExpired: `${backendUrl}/saas/coi/expired`,
|
|
16
|
+
resendInvitation: contractorId => `${backendUrl}/saas/contractor/${contractorId}/reminders/reset`,
|
|
12
17
|
muteNotifications: `${backendUrl}/saas/record/notifications/mute`,
|
|
13
18
|
unmuteNotifications: `${backendUrl}/saas/record/notifications/unmute`,
|
|
14
19
|
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
15
20
|
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
21
|
+
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
16
22
|
assignMptToProperties: (accountId, tenantId) => `${backendUrl}/saas/account/${accountId}/multi-properties/${tenantId}`,
|
|
17
23
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
18
24
|
`${backendUrl}/saas/contractors/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
25
|
+
requestsGlobalSearch: (projectId, searchWord) =>
|
|
26
|
+
`${backendUrl}/saas/contractors/search?&projectId=${projectId}&searchWord=${searchWord}`,
|
|
19
27
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
20
28
|
publicLinkInvite: `${backendUrl}/_saas/contractors/publicinvite`
|
|
21
29
|
};
|
|
@@ -32,6 +40,10 @@ const getContractorById = (contractorId, context) => {
|
|
|
32
40
|
return requests.getRequestHandler(Endpoints.getContractorById(contractorId), {}, context);
|
|
33
41
|
};
|
|
34
42
|
|
|
43
|
+
const getRecordHistory = (contractorId, context) => {
|
|
44
|
+
return requests.getRequestHandler(Endpoints.getRecordHistory(contractorId), {}, context);
|
|
45
|
+
};
|
|
46
|
+
|
|
35
47
|
const deleteByContractorId = (contractorId, context) => {
|
|
36
48
|
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
37
49
|
};
|
|
@@ -61,11 +73,32 @@ const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
|
61
73
|
return requests.putRequestHandler(Endpoints.changeRequirement, recordModifyDateVerificationModel, context);
|
|
62
74
|
};
|
|
63
75
|
|
|
76
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
77
|
+
return requests.postRequestHandler(Endpoints.sendGaps, recordModifyDateVerificationModel, context);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
81
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiAboutToExpire, recordModifyDateVerificationModel, context);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
85
|
+
return requests.postRequestHandler(Endpoints.requestNewCoiExpired, recordModifyDateVerificationModel, context);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
89
|
+
return requests.postRequestHandler(Endpoints.resendInvitation, recordModifyDateVerificationModel, context);
|
|
90
|
+
};
|
|
91
|
+
|
|
64
92
|
const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
65
93
|
const data = { [policyName]: expiryDate };
|
|
66
94
|
return requests.postRequestHandler(Endpoints.updateVendorExpiryDate(contractorId), data);
|
|
67
95
|
};
|
|
68
96
|
|
|
97
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
98
|
+
const data = { date: inviteDate };
|
|
99
|
+
return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
|
|
100
|
+
};
|
|
101
|
+
|
|
69
102
|
const assignMptToProperties = (assignToMptModel, context) => {
|
|
70
103
|
const params = { updateInfoUser: 'EditVendor' };
|
|
71
104
|
return requests.postRequestHandler(
|
|
@@ -92,6 +125,10 @@ const searchInAutocomplete = ({ tabId, searchWord }, context) => {
|
|
|
92
125
|
return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
|
|
93
126
|
};
|
|
94
127
|
|
|
128
|
+
const searchInGlobalSearch = (projectId, searchWord, context) => {
|
|
129
|
+
return requests.getRequestHandler(Endpoints.requestsGlobalSearch(projectId, searchWord), {}, context);
|
|
130
|
+
};
|
|
131
|
+
|
|
95
132
|
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
96
133
|
const url = `${Endpoints.automationUpdateContractorUploadDate(contractorId) }?uploadDate=${uploadDate.toISOString()}`;
|
|
97
134
|
return requests.patchRequestHandler(url, context);
|
|
@@ -106,16 +143,23 @@ module.exports = {
|
|
|
106
143
|
changeRequirement,
|
|
107
144
|
getContractorsByAccountId,
|
|
108
145
|
getContractorById,
|
|
146
|
+
getRecordHistory,
|
|
109
147
|
deleteByContractorId,
|
|
110
148
|
archiveByContractorId,
|
|
111
149
|
restoreContractor,
|
|
112
150
|
editContractor,
|
|
151
|
+
updateInviteDate,
|
|
113
152
|
updateExpiryDate,
|
|
114
153
|
assignMptToProperties,
|
|
115
154
|
getContractorsByTabId,
|
|
116
155
|
searchInAutocomplete,
|
|
156
|
+
searchInGlobalSearch,
|
|
117
157
|
updateContractorUploadDate,
|
|
118
158
|
inviteContractorViaPublicLink,
|
|
159
|
+
sendGaps,
|
|
160
|
+
requestNewCoiAboutToExpire,
|
|
161
|
+
requestNewCoiExpired,
|
|
162
|
+
resendInvitation,
|
|
119
163
|
muteNotifications,
|
|
120
164
|
unmuteNotifications
|
|
121
165
|
};
|
|
@@ -21,6 +21,10 @@ const getContractorById = (contractorId, context) => {
|
|
|
21
21
|
return contractorsAPI.getContractorById(contractorId, context);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const getRecordHistory = (contractorId, context) => {
|
|
25
|
+
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
26
|
+
};
|
|
27
|
+
|
|
24
28
|
const deleteByContractorId = (contractorId, context) => {
|
|
25
29
|
return contractorsAPI.deleteByContractorId(contractorId, context);
|
|
26
30
|
};
|
|
@@ -43,6 +47,11 @@ const updateExpiryDate = (contractorId, expiryDate, policyName) => {
|
|
|
43
47
|
return contractorsAPI.updateExpiryDate(contractorId, expiryDate, policyName);
|
|
44
48
|
};
|
|
45
49
|
|
|
50
|
+
const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
51
|
+
validateType(inviteDate, Date);
|
|
52
|
+
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
53
|
+
};
|
|
54
|
+
|
|
46
55
|
const getContractorsByTabId = (tabId, context, activityStatus = 'ACTIVE') => {
|
|
47
56
|
return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
|
|
48
57
|
};
|
|
@@ -56,6 +65,10 @@ const searchInAutoComplete = ({ tabId, searchWord }, context) => {
|
|
|
56
65
|
return contractorsAPI.searchInAutocomplete({ tabId, searchWord }, context);
|
|
57
66
|
};
|
|
58
67
|
|
|
68
|
+
const searchInGlobalSearch = (projectId, searchWord, context) => {
|
|
69
|
+
return contractorsAPI.searchInGlobalSearch(projectId, searchWord, context);
|
|
70
|
+
};
|
|
71
|
+
|
|
59
72
|
const updateContractorUploadDate = (contractorId, uploadDate, context) => {
|
|
60
73
|
validateType(uploadDate, Date);
|
|
61
74
|
return contractorsAPI.updateContractorUploadDate(contractorId, uploadDate, context);
|
|
@@ -71,6 +84,26 @@ const changeRequirement = (recordModifyDateVerificationModel, context) => {
|
|
|
71
84
|
return contractorsAPI.changeRequirement(recordModifyDateVerificationModel, context);
|
|
72
85
|
};
|
|
73
86
|
|
|
87
|
+
const sendGaps = (recordModifyDateVerificationModel, context) => {
|
|
88
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
89
|
+
return contractorsAPI.sendGaps(recordModifyDateVerificationModel, context);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const requestNewCoiAboutToExpire = (recordModifyDateVerificationModel, context) => {
|
|
93
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
94
|
+
return contractorsAPI.requestNewCoiAboutToExpire(recordModifyDateVerificationModel, context);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const requestNewCoiExpired = (recordModifyDateVerificationModel, context) => {
|
|
98
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
99
|
+
return contractorsAPI.requestNewCoiExpired(recordModifyDateVerificationModel, context);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const resendInvitation = (recordModifyDateVerificationModel, context) => {
|
|
103
|
+
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
104
|
+
return contractorsAPI.resendInvitation(recordModifyDateVerificationModel, context);
|
|
105
|
+
};
|
|
106
|
+
|
|
74
107
|
const muteNotifications = (recordModifyDateVerificationModel, context) => {
|
|
75
108
|
validateType(recordModifyDateVerificationModel, RecordModifyDateVerificationModel);
|
|
76
109
|
return contractorsAPI.muteNotifications(recordModifyDateVerificationModel, context);
|
|
@@ -86,16 +119,23 @@ module.exports = {
|
|
|
86
119
|
changeRequirement,
|
|
87
120
|
getContractorsByAccountId,
|
|
88
121
|
getContractorById,
|
|
122
|
+
getRecordHistory,
|
|
89
123
|
deleteByContractorId,
|
|
90
124
|
archiveByContractorId,
|
|
91
125
|
restoreContractor,
|
|
92
126
|
editContractor,
|
|
127
|
+
updateInviteDate,
|
|
93
128
|
updateExpiryDate,
|
|
94
129
|
getContractorsByTabId,
|
|
95
130
|
assignMptToProperties,
|
|
96
131
|
searchInAutoComplete,
|
|
132
|
+
searchInGlobalSearch,
|
|
97
133
|
updateContractorUploadDate,
|
|
98
134
|
inviteContractorViaPublicLink,
|
|
135
|
+
sendGaps,
|
|
136
|
+
requestNewCoiAboutToExpire,
|
|
137
|
+
requestNewCoiExpired,
|
|
138
|
+
resendInvitation,
|
|
99
139
|
muteNotifications,
|
|
100
140
|
unmuteNotifications
|
|
101
141
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
getById: requestId => `${backendUrl}/saas/request/${requestId}`,
|
|
6
|
+
getByTabId: `${backendUrl}/saas/contractors`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getReqeustById = (requestId, context) => {
|
|
10
|
+
return requests.getRequestHandler(Endpoints.getById(requestId), {}, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getRequestsByTabId = (tabId, context, activityStatus) => {
|
|
14
|
+
const body = { tabId, activityStatus };
|
|
15
|
+
return requests.postRequestHandler(Endpoints.getByTabId, body, context);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
getReqeustById,
|
|
20
|
+
getRequestsByTabId
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const requestsAPI = require('./requests.api');
|
|
2
|
+
|
|
3
|
+
const getRequestsByTabId = (tabId, context, activityStatus = 'ACTIVE') => {
|
|
4
|
+
return requestsAPI.getRequestsByTabId(tabId, context, activityStatus);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const getReqeustById = (requestId, context) => {
|
|
8
|
+
return requestsAPI.getReqeustById(requestId, context);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
getRequestsByTabId,
|
|
13
|
+
getReqeustById
|
|
14
|
+
};
|
|
@@ -12,7 +12,8 @@ const Endpoints = {
|
|
|
12
12
|
deleteSingleProject: (userId, projectId) => `${backendUrl}/saas/project/${projectId}/sub-account/${userId}`,
|
|
13
13
|
reinvite: `${backendUrl}/saas/project/team-member/reinvite`,
|
|
14
14
|
getUserEncryptedData: (email, userRole) => `${backendUrl}/saas/team-member/email/${email}/role/${userRole}/signup-data`,
|
|
15
|
-
signupUser: `${backendUrl}/_saas/guests/signup
|
|
15
|
+
signupUser: `${backendUrl}/_saas/guests/signup`,
|
|
16
|
+
removeAllUserTraceFromDb: userId => `${backendUrl}/saas/user/automation/${userId}`
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const invite = (invitedUser, context) => {
|
|
@@ -53,6 +54,10 @@ const deleteUserFromSingleProject = (userId, projectId, context) => {
|
|
|
53
54
|
return requests.deleteRequestHandler(Endpoints.deleteSingleProject(userId, projectId), context);
|
|
54
55
|
};
|
|
55
56
|
|
|
57
|
+
const removeAllUserTraceFromDb = (userId, context) => {
|
|
58
|
+
return requests.deleteRequestHandler(Endpoints.removeAllUserTraceFromDb(userId), context);
|
|
59
|
+
};
|
|
60
|
+
|
|
56
61
|
const reinviteUser = (userId, context) => {
|
|
57
62
|
const params = { id: userId };
|
|
58
63
|
return requests.postRequestHandler(Endpoints.reinvite, {}, context, {}, params);
|
|
@@ -66,6 +71,7 @@ module.exports = {
|
|
|
66
71
|
getUserEncryptedData,
|
|
67
72
|
deleteUser,
|
|
68
73
|
deleteUserFromSingleProject,
|
|
74
|
+
removeAllUserTraceFromDb,
|
|
69
75
|
editUserRole,
|
|
70
76
|
editUserProjects,
|
|
71
77
|
reinviteUser
|
|
@@ -35,7 +35,7 @@ const getUserByEmail = async (email, context) => {
|
|
|
35
35
|
const getOrCreateUser = async (email, role, projectsIds, context, { fullName = role, password = credentials.strongPassword } = {}) => {
|
|
36
36
|
let userResponse = await getUserByEmail(email, context);
|
|
37
37
|
|
|
38
|
-
if (userResponse.data.subuserId) {
|
|
38
|
+
if (userResponse.data && userResponse.data.subuserId && userResponse.data.isVerified) {
|
|
39
39
|
return userResponse.data;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -72,6 +72,15 @@ const deleteUserFromSingleProject = (userId, projectId, context) => {
|
|
|
72
72
|
return userAPI.deleteUserFromSingleProject(userId, projectId, context);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const removeAllUserTraceFromDb = (userId, context) => {
|
|
76
|
+
return userAPI.removeAllUserTraceFromDb(userId, context);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const deleteUserByEmail = async (userEmail, context) => {
|
|
80
|
+
const { data: user } = await getUserByEmail(userEmail, context);
|
|
81
|
+
return deleteUser(user.subuserId, context);
|
|
82
|
+
};
|
|
83
|
+
|
|
75
84
|
const reinviteUser = (userId, context) => {
|
|
76
85
|
return userAPI.reinviteUser(userId, context);
|
|
77
86
|
};
|
|
@@ -84,6 +93,8 @@ module.exports = {
|
|
|
84
93
|
getOrCreateUser,
|
|
85
94
|
deleteUser,
|
|
86
95
|
deleteUserFromSingleProject,
|
|
96
|
+
deleteUserByEmail,
|
|
97
|
+
removeAllUserTraceFromDb,
|
|
87
98
|
editUserRole,
|
|
88
99
|
editUserProjects,
|
|
89
100
|
reinviteUser
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const coreModels = { EditUserModel };
|
|
3
|
-
|
|
4
|
-
const models = { core: coreModels };
|
|
5
|
-
|
|
1
|
+
const models = require('./models/users.model');
|
|
6
2
|
const services = require('./api/users.service');
|
|
7
3
|
|
|
8
4
|
module.exports = { services, models };
|