@getjones/test-infra 4.5.4 → 4.5.6
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/common/consts/constantsForRecordsSortingAndFilters.js +2 -0
- package/src/factory/users/users.js +1 -18
- package/src/index.js +2 -0
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +3 -1
- package/src/saas/internal-api/coi/api/coi.api.js +14 -1
- package/src/saas/internal-api/coi/api/coi.service.js +23 -1
- package/src/saas/internal-api/coi/consts/hashes.js +2 -1
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +16 -13
- package/src/saas/internal-api/compliance/utils/auditUtil.js +4 -22
- package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.api.js +14 -0
- package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.service.js +16 -0
- package/src/saas/internal-api/jonesNetworkTab/index.js +3 -0
package/package.json
CHANGED
|
@@ -10,10 +10,12 @@ const recordComplianceStatuses = {
|
|
|
10
10
|
compliant: 'COMPLIANT_STATUS',
|
|
11
11
|
notCompliant: 'NOT_COMPLIANT_STATUS',
|
|
12
12
|
noCOIRequired: 'NO_COI_REQUIRED',
|
|
13
|
+
awaitingCOI: 'EMPTY_STATUS',
|
|
13
14
|
awaitingNewCOI: 'WAITING_NEW_COI_STATUS',
|
|
14
15
|
waived: 'WAIVED_STATUS',
|
|
15
16
|
underReview: 'UNDER_REVIEW',
|
|
16
17
|
expired: 'Expired',
|
|
18
|
+
expiringSoon: 'ExpiringSoon',
|
|
17
19
|
notResponsive: 'NotResponsive'
|
|
18
20
|
};
|
|
19
21
|
|
|
@@ -8,26 +8,9 @@ const users = require('../../saas/internal-api/users');
|
|
|
8
8
|
const { InviteUserModel } = users.models;
|
|
9
9
|
|
|
10
10
|
const defaultsPassword = credentials.strongPassword;
|
|
11
|
-
const roles =
|
|
12
|
-
readOnly: 'Read-only User',
|
|
13
|
-
inviter: 'Inviter',
|
|
14
|
-
cm: 'Compliance Manager'
|
|
15
|
-
};
|
|
11
|
+
const { internalApiUserRoles: roles } = require('../../../src/common/consts/userRoles');
|
|
16
12
|
|
|
17
13
|
const inviteSaasUser = async (username, role, projectIds, context, { hasCompleteAccessPermission } = {}) => {
|
|
18
|
-
const userResponse = await users.services.getUserByEmail(username, context);
|
|
19
|
-
|
|
20
|
-
if (userResponse.data && userResponse.data.id) {
|
|
21
|
-
const { projectPermissions } = userResponse.data;
|
|
22
|
-
const projectPermissionsIds = projectPermissions.map(projectPermission => projectPermission.projectId);
|
|
23
|
-
|
|
24
|
-
projectIds = projectIds.filter(projectId => !projectPermissionsIds.includes(projectId));
|
|
25
|
-
|
|
26
|
-
if (!projectIds.length) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
14
|
const inviteUserModel = new InviteUserModel(username, role, projectIds, hasCompleteAccessPermission);
|
|
32
15
|
const inviteResponse = await users.services.inviteUser([inviteUserModel], context);
|
|
33
16
|
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,7 @@ const getInternalAPI = () => {
|
|
|
33
33
|
const dashboard = require('./saas/internal-api/dashboard');
|
|
34
34
|
const accountDirectory = require('./saas/internal-api/accountDirectory');
|
|
35
35
|
const notificationCenter = require('./saas/internal-api/notificationCenter');
|
|
36
|
+
const jonesNetworkTab = require('./saas/internal-api/jonesNetworkTab');
|
|
36
37
|
|
|
37
38
|
const globalRecord = require('./saas/internal-api/globalRecord');
|
|
38
39
|
const vendorProfile = require('./saas/internal-api/vendorProfile');
|
|
@@ -69,6 +70,7 @@ const getInternalAPI = () => {
|
|
|
69
70
|
dashboard,
|
|
70
71
|
accountDirectory,
|
|
71
72
|
notificationCenter,
|
|
73
|
+
jonesNetworkTab,
|
|
72
74
|
globalRecord,
|
|
73
75
|
vendorProfile,
|
|
74
76
|
serviceArea,
|
|
@@ -16,7 +16,8 @@ class UpdateAccountSettingsModel {
|
|
|
16
16
|
integrations = {},
|
|
17
17
|
auditSlaHours = 24,
|
|
18
18
|
shouldReachOutVendors = true,
|
|
19
|
-
isWithoutAutocompleteDistanceLimitation = false
|
|
19
|
+
isWithoutAutocompleteDistanceLimitation = false,
|
|
20
|
+
isJonesNetworkTabEnabled = false
|
|
20
21
|
} = {}
|
|
21
22
|
) {
|
|
22
23
|
this.accountId = accountId;
|
|
@@ -35,6 +36,7 @@ class UpdateAccountSettingsModel {
|
|
|
35
36
|
this.auditSlaHours = auditSlaHours;
|
|
36
37
|
this.shouldReachOutVendors = shouldReachOutVendors;
|
|
37
38
|
this.isWithoutAutocompleteDistanceLimitation = isWithoutAutocompleteDistanceLimitation;
|
|
39
|
+
this.isJonesNetworkTabEnabled = isJonesNetworkTabEnabled;
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -9,6 +9,7 @@ const Endpoints = {
|
|
|
9
9
|
submitCoi: `${backendUrl}/coi/merge`,
|
|
10
10
|
completeScan: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/complete-scan`,
|
|
11
11
|
getCoiPresignedUrl: fileName => `${backendUrl}/saas/coi/${fileName}`,
|
|
12
|
+
getCoiPresignedUrlBeforeMerge: fileId => `${backendUrl}/saas/coi-file-before-merge/presigned-url/${fileId}`,
|
|
12
13
|
getCoiHashes: recordId => `${backendUrl}/jcsc/record/${recordId}/coi/hashes`,
|
|
13
14
|
combineLastTwoCOIs: `${backendUrl}/saas/auditor/record/coi/merge-last-two`
|
|
14
15
|
};
|
|
@@ -34,6 +35,10 @@ const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
|
34
35
|
return requests.getRequestHandler(Endpoints.getCoiPresignedUrl(coiFileName), {}, context);
|
|
35
36
|
};
|
|
36
37
|
|
|
38
|
+
const getCoiPresignedUrlBeforeMerge = (fileId, context) => {
|
|
39
|
+
return requests.getRequestHandler(Endpoints.getCoiPresignedUrlBeforeMerge(fileId), {}, context);
|
|
40
|
+
};
|
|
41
|
+
|
|
37
42
|
const getCoiHashes = recordId => {
|
|
38
43
|
return internalRequests.getRequestHandler(Endpoints.getCoiHashes(recordId));
|
|
39
44
|
};
|
|
@@ -42,4 +47,12 @@ const combineLastTwoCOIs = (combineLastTwoCOIsModel, context) => {
|
|
|
42
47
|
return requests.postRequestHandler(Endpoints.combineLastTwoCOIs, combineLastTwoCOIsModel, context);
|
|
43
48
|
};
|
|
44
49
|
|
|
45
|
-
module.exports = {
|
|
50
|
+
module.exports = {
|
|
51
|
+
uploadToS3,
|
|
52
|
+
submitCoi,
|
|
53
|
+
completeScan,
|
|
54
|
+
getCoiPreSignedUrl,
|
|
55
|
+
getCoiPresignedUrlBeforeMerge,
|
|
56
|
+
getCoiHashes,
|
|
57
|
+
combineLastTwoCOIs
|
|
58
|
+
};
|
|
@@ -21,6 +21,20 @@ const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
|
21
21
|
return coiApi.getCoiPreSignedUrl(coiFileName, context);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const getCoiPresignedUrlBeforeMerge = async (fileId, context, { expectError } = {}) => {
|
|
25
|
+
const response = await coiApi.getCoiPresignedUrlBeforeMerge(fileId, context);
|
|
26
|
+
|
|
27
|
+
if (expectError) {
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
32
|
+
throw new Error(`Failed to get presigned url for file before merge with fileId: ${fileId}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return response.data.preSignedUrl;
|
|
36
|
+
};
|
|
37
|
+
|
|
24
38
|
const getCoiHashes = recordId => {
|
|
25
39
|
return coiApi.getCoiHashes(recordId);
|
|
26
40
|
};
|
|
@@ -36,4 +50,12 @@ const combineLastTwoCOIs = async (combineLastTwoCOIsModel, auditorContext) => {
|
|
|
36
50
|
return response;
|
|
37
51
|
};
|
|
38
52
|
|
|
39
|
-
module.exports = {
|
|
53
|
+
module.exports = {
|
|
54
|
+
uploadToS3,
|
|
55
|
+
submitCoi,
|
|
56
|
+
getCoiPreSignedUrl,
|
|
57
|
+
getCoiPresignedUrlBeforeMerge,
|
|
58
|
+
completeScan,
|
|
59
|
+
getCoiHashes,
|
|
60
|
+
combineLastTwoCOIs
|
|
61
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const defaultCoiHashValue = '79c8e018c43de2d8f4c6b489dde08cc3e21abe30f3e5f3a26ee4a0bca1ca6226';
|
|
2
2
|
const realCoiHashValue = '71de8e0b212168cb513c9f38af63f6b4f6186f950412b9e1e0ea84e1e54e47ce';
|
|
3
|
+
const secondCoiHashValue = '01d359a1d4ec9336526723e6533b92569515be1dd57115d0d73da7b45b48a827';
|
|
3
4
|
|
|
4
|
-
module.exports = { defaultCoiHashValue, realCoiHashValue };
|
|
5
|
+
module.exports = { defaultCoiHashValue, realCoiHashValue, secondCoiHashValue };
|
|
@@ -40,7 +40,7 @@ const getAllWaiveModels = (
|
|
|
40
40
|
userRole,
|
|
41
41
|
auditId
|
|
42
42
|
} = {}) => {
|
|
43
|
-
const auditIds = [auditId]
|
|
43
|
+
const auditIds = auditId ? [auditId] : getPolicyAuditIdsFromRecord(record, policyName, auditUtil.getAttributeKey(attributeName));
|
|
44
44
|
userId = userId || env.getSystemUserIdentity(credentials.superUser).id;
|
|
45
45
|
userRole = userRole || userTypes.ICS;
|
|
46
46
|
|
|
@@ -77,6 +77,7 @@ const getWaiveModel = (
|
|
|
77
77
|
return getAllWaiveModels(record, policyName, attributeName, waiverReason, remarks, { userId, userRole, auditId })[0];
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
// used by automation. has to return a single model
|
|
80
81
|
const getWaiveModelByGap = (
|
|
81
82
|
record,
|
|
82
83
|
policyName,
|
|
@@ -87,25 +88,27 @@ const getWaiveModelByGap = (
|
|
|
87
88
|
userId,
|
|
88
89
|
userRole
|
|
89
90
|
} = {}) => {
|
|
90
|
-
const attributeName = auditUtil.
|
|
91
|
-
const auditorContractorId = auditUtil.getAuditorContractorIdByGap(record, policyName, gap);
|
|
91
|
+
const { attributeName, auditId } = auditUtil.getAttributeNameAndAuditIdByGap(record, policyName, gap);
|
|
92
92
|
|
|
93
|
-
return getWaiveModel(record, policyName, attributeName, reason, note, { userId, userRole, auditId
|
|
93
|
+
return getWaiveModel(record, policyName, attributeName, reason, note, { userId, userRole, auditId });
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
const getRetractModel = (record, policyName, attributeName) => {
|
|
97
|
-
const
|
|
97
|
+
const auditIds = getPolicyAuditIdsFromRecord(record, policyName, auditUtil.getAttributeKey(attributeName));
|
|
98
98
|
const userId = env.getSystemUserIdentity(credentials.superUser).id;
|
|
99
99
|
const userRole = userTypes.ICS;
|
|
100
100
|
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
const retractModels = [];
|
|
102
|
+
for (const auditId of auditIds) {
|
|
103
|
+
const model = new RetractRequestModel({
|
|
104
|
+
contractorId: record.id,
|
|
105
|
+
auditId,
|
|
106
|
+
userId,
|
|
107
|
+
userRole
|
|
108
|
+
});
|
|
109
|
+
retractModels.push(model);
|
|
110
|
+
}
|
|
111
|
+
return retractModels.length > 1 ? retractModels : retractModels[0];
|
|
109
112
|
};
|
|
110
113
|
|
|
111
114
|
const getPolicyAuditIdsFromRecord = (record, policyName, attributeName) => {
|
|
@@ -26,7 +26,7 @@ const getWaiveReason = reason => {
|
|
|
26
26
|
return waiveReasons[reason] || reason;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const getAttributeNameAndAuditIdByGap = function(record, policyName, gap) {
|
|
30
30
|
const policy = record.reviewbyAuditor.find(contractorCoverage =>
|
|
31
31
|
contractorCoverage.insuranceName === policyName);
|
|
32
32
|
|
|
@@ -40,24 +40,7 @@ const getAttributeNameByGap = function(record, policyName, gap) {
|
|
|
40
40
|
throw new Error(`Gap ${gap} don't exist in record`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return attribute.
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const getAuditorContractorIdByGap = function(record, policyName, gap) {
|
|
47
|
-
const policy = record.reviewbyAuditor.find(contractorCoverage =>
|
|
48
|
-
contractorCoverage.insuranceName === policyName);
|
|
49
|
-
|
|
50
|
-
if (!policy) {
|
|
51
|
-
throw new Error(`Policy name ${policyName} don't exist in record`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const attribute = policy.errorList.find(error => error.errorHeadline === gap);
|
|
55
|
-
|
|
56
|
-
if (!attribute) {
|
|
57
|
-
throw new Error(`Gap ${gap} don't exist in record`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return attribute.auditId;
|
|
43
|
+
return { attributeName: attribute.limitName, auditId: attribute.auditId };
|
|
61
44
|
};
|
|
62
45
|
|
|
63
46
|
const getAllWaivablePolicies = function(record) {
|
|
@@ -230,10 +213,9 @@ module.exports = {
|
|
|
230
213
|
getPolicyId,
|
|
231
214
|
createAuditEntity,
|
|
232
215
|
getAttributeKey,
|
|
233
|
-
|
|
216
|
+
getAttributeNameAndAuditIdByGap,
|
|
234
217
|
getWaiveReason,
|
|
235
|
-
getAllWaivablePolicies
|
|
236
|
-
getAuditorContractorIdByGap
|
|
218
|
+
getAllWaivablePolicies
|
|
237
219
|
};
|
|
238
220
|
|
|
239
221
|
const certificateEndorsementsList = [
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
isNetworkTabEnabledForUser: `${backendUrl}/saas/account/user/jones-network-enabled/setting`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const isNetworkTabEnabledForUser = async context => {
|
|
9
|
+
return requests.getRequestHandler(Endpoints.isNetworkTabEnabledForUser, { }, context);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
isNetworkTabEnabledForUser
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const networkTabApi = require('./jones.network.tab.api');
|
|
2
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
|
|
4
|
+
const isNetworkTabEnabledForUser = async context => {
|
|
5
|
+
const notificationPageResponse = await networkTabApi.isNetworkTabEnabledForUser(context);
|
|
6
|
+
|
|
7
|
+
if (notificationPageResponse.status !== httpResponseStatusCodes.OK) {
|
|
8
|
+
throw new Error(`Failed to get network tab enable settings status, cause by: ${notificationPageResponse.message}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return notificationPageResponse.data;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
isNetworkTabEnabledForUser
|
|
16
|
+
};
|