@getjones/test-infra 2.9.0 → 2.9.2
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/commonFlows/records/records.js +8 -8
- package/src/common/utils/complianceUtil.js +8 -8
- package/src/common/utils/timeUtils.js +18 -0
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +13 -7
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +14 -8
- package/src/saas/internal-api/compliance/consts/audit.js +20 -1
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +2 -0
- package/src/saas/internal-api/contractors/api/contractors.api.js +3 -3
- package/src/saas/internal-api/contractors/api/contractors.service.js +2 -3
package/package.json
CHANGED
|
@@ -7,12 +7,12 @@ const contractors = require('../../../saas/internal-api/contractors');
|
|
|
7
7
|
const compliance = require('../../../saas/internal-api/compliance');
|
|
8
8
|
|
|
9
9
|
const makeRecordNotResponsive = async function(recordId, context, { isTenant } = {}) {
|
|
10
|
-
const
|
|
11
|
-
timeUtils.
|
|
12
|
-
timeUtils.
|
|
10
|
+
const offsetInDaysList = isTenant ?
|
|
11
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveTenant() :
|
|
12
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveVendor();
|
|
13
13
|
|
|
14
|
-
for (const
|
|
15
|
-
await updateLastInviteActionDate(recordId,
|
|
14
|
+
for (const offsetInDays of offsetInDaysList) {
|
|
15
|
+
await updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -33,20 +33,20 @@ const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
|
33
33
|
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const updateLastInviteActionDate = async function(recordId,
|
|
36
|
+
const updateLastInviteActionDate = async function(recordId, offsetInDays, context) {
|
|
37
37
|
await timeUtils.waitFor(1).seconds;
|
|
38
38
|
/*
|
|
39
39
|
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
40
40
|
Since the thread scheduler will trigger the logic of the reminders mails
|
|
41
41
|
only if last invite action date will be equal or after compliance audit actions date
|
|
42
42
|
*/
|
|
43
|
-
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId,
|
|
43
|
+
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, offsetInDays, context);
|
|
44
44
|
|
|
45
45
|
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
46
46
|
throw new Error(`Compliance audit date could not be updated\n${updateComplianceAuditResponse}`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId,
|
|
49
|
+
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
50
50
|
|
|
51
51
|
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
52
52
|
throw new Error(`Record invite date could not be updated\n${updateLastInviteActionResponse}`);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
const { getEnv, getSystemUserIdentity } = require('../../env');
|
|
2
|
+
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
2
3
|
const auditConfigs = require('../../defaults/configs/auditConfigs');
|
|
3
4
|
|
|
4
5
|
const { credentials } = getEnv();
|
|
5
6
|
|
|
6
|
-
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
7
|
-
|
|
8
7
|
const complianceStatuses = {
|
|
9
8
|
complaint: 'complaint',
|
|
10
9
|
notCompliant: 'notCompliant',
|
|
@@ -44,17 +43,18 @@ const getAuditMetadata = async (
|
|
|
44
43
|
const isReauditResponse = await isReaudit(recordId, auditorContext);
|
|
45
44
|
metadata.isReaudit = isReauditResponse.data.isReaudit;
|
|
46
45
|
|
|
47
|
-
const recordDetailsResponse = await auditApi.
|
|
48
|
-
const
|
|
46
|
+
const recordDetailsResponse = await auditApi.getAuditRecordModel(recordId, auditorContext);
|
|
47
|
+
const recordDetails = recordDetailsResponse.data;
|
|
49
48
|
|
|
50
|
-
metadata.certificateId =
|
|
49
|
+
metadata.certificateId = recordDetails.certificateDetails.certificateuploadId;
|
|
51
50
|
metadata.auditDates = {
|
|
52
51
|
contractorId: recordId,
|
|
53
|
-
contractorDateModified:
|
|
52
|
+
contractorDateModified: recordDetails.dateModified,
|
|
54
53
|
dateStartedAudit: recordDetailsResponse.dateStartedAudit,
|
|
55
|
-
contractorOverrideDateModified:
|
|
56
|
-
contractCreateDate:
|
|
54
|
+
contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
|
|
55
|
+
contractCreateDate: recordDetails.contractCreateDate
|
|
57
56
|
};
|
|
57
|
+
metadata.auditId = recordDetails.auditId;
|
|
58
58
|
|
|
59
59
|
metadata.auditorId = await getAuditorId();
|
|
60
60
|
|
|
@@ -24,6 +24,14 @@ const peroids = {
|
|
|
24
24
|
years: 'years'
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const inviteActionDateOffset = {
|
|
28
|
+
twoDays: 2,
|
|
29
|
+
fiveDays: 5,
|
|
30
|
+
eightDays: 8,
|
|
31
|
+
tenDays: 10,
|
|
32
|
+
fifteenDays: 15
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
const getOneYearAgoDate = format => moment().utc().subtract(1, peroids.years).format(format || formats.threadScheduler);
|
|
28
36
|
const getTwoHundredDaysAgoDate = format => moment().utc().subtract(200, peroids.days).format(format || formats.threadScheduler);
|
|
29
37
|
const getSixMonthAgoDate = format => moment().utc().subtract(6, peroids.months).format(format || formats.threadScheduler);
|
|
@@ -86,6 +94,10 @@ const getInvitationDatesForNotResponsiveVendor = function() {
|
|
|
86
94
|
return [twoDaysAgoUtc, fiveDaysAgoUtc, eightDaysAgoUtc];
|
|
87
95
|
};
|
|
88
96
|
|
|
97
|
+
const getInviteActionOffsetInDaysForNotResponsiveVendor = function() {
|
|
98
|
+
return [inviteActionDateOffset.twoDays, inviteActionDateOffset.fiveDays, inviteActionDateOffset.eightDays];
|
|
99
|
+
};
|
|
100
|
+
|
|
89
101
|
const getInvitationDatesForNotResponsiveTenant = function() {
|
|
90
102
|
const fiveDaysAgoUtc = getFiveDaysAgoDate();
|
|
91
103
|
const tenDaysAgoUtc = getTenDaysAgoDate();
|
|
@@ -94,6 +106,10 @@ const getInvitationDatesForNotResponsiveTenant = function() {
|
|
|
94
106
|
return [fiveDaysAgoUtc, tenDaysAgoUtc, fifteenDaysAgoUtc];
|
|
95
107
|
};
|
|
96
108
|
|
|
109
|
+
const getInviteActionOffsetInDaysForNotResponsiveTenant = function() {
|
|
110
|
+
return [inviteActionDateOffset.fiveDays, inviteActionDateOffset.tenDays, inviteActionDateOffset.fifteenDays];
|
|
111
|
+
};
|
|
112
|
+
|
|
97
113
|
const isDateAfterOther = (date, other) => {
|
|
98
114
|
return moment(date).isAfter(other);
|
|
99
115
|
};
|
|
@@ -140,7 +156,9 @@ module.exports = {
|
|
|
140
156
|
getDateinTwentyNineDays,
|
|
141
157
|
getDateInTwoMonths,
|
|
142
158
|
getInvitationDatesForNotResponsiveVendor,
|
|
159
|
+
getInviteActionOffsetInDaysForNotResponsiveVendor,
|
|
143
160
|
getInvitationDatesForNotResponsiveTenant,
|
|
161
|
+
getInviteActionOffsetInDaysForNotResponsiveTenant,
|
|
144
162
|
getAutomaticRenewalsExpirationDates,
|
|
145
163
|
getLogTimestamp,
|
|
146
164
|
getDayInMilliseconds,
|
|
Binary file
|
|
@@ -6,7 +6,8 @@ const { convertDateStringFormatToISOString } = require('../../../../../common/ut
|
|
|
6
6
|
const Endpoints = {
|
|
7
7
|
auditorContractorList: `${backendUrl}/saas/auditor/contractors`,
|
|
8
8
|
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
9
|
-
|
|
9
|
+
enterAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
10
|
+
getAuditRecordModelByRecordId: recordId => `${backendUrl}/saas/auditor/record/${recordId}/audit-record`,
|
|
10
11
|
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement`,
|
|
11
12
|
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/isreaudit`,
|
|
12
13
|
revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
|
|
@@ -16,7 +17,7 @@ const Endpoints = {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
19
|
-
await
|
|
20
|
+
await enterAudit(contractorId, {}, context);
|
|
20
21
|
return submitAudit(auditRequestModel, context);
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -36,8 +37,12 @@ const getAuditorContractorList = (auditListParametersModel, context) => {
|
|
|
36
37
|
return requests.postRequestHandler(Endpoints.auditorContractorList, auditListParametersModel, context);
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
-
return requests.getRequestHandler(Endpoints.
|
|
40
|
+
const enterAudit = (contractorId, context) => {
|
|
41
|
+
return requests.getRequestHandler(Endpoints.enterAudit(contractorId), {}, context);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getAuditRecordModel = (recordId, context) => {
|
|
45
|
+
return requests.getRequestHandler(Endpoints.getAuditRecordModelByRecordId(recordId), {}, context);
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
@@ -53,8 +58,8 @@ const wrongCoi = (recordId, context) => {
|
|
|
53
58
|
return requests.getRequestHandler(Endpoints.wrongCoi, params, context);
|
|
54
59
|
};
|
|
55
60
|
|
|
56
|
-
const updateComplianceAuditActionsDate = (recordId,
|
|
57
|
-
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?
|
|
61
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
62
|
+
const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?complianceAuditActionsDateOffset=${dateOffset}`;
|
|
58
63
|
return requests.putRequestHandler(url, {}, context);
|
|
59
64
|
};
|
|
60
65
|
|
|
@@ -65,7 +70,8 @@ module.exports = {
|
|
|
65
70
|
wrongCoi,
|
|
66
71
|
isReaudit,
|
|
67
72
|
getAuditorContractorList,
|
|
68
|
-
|
|
73
|
+
enterAudit,
|
|
74
|
+
getAuditRecordModel,
|
|
69
75
|
getRequirementDetailsForAudit,
|
|
70
76
|
getAuditByRecordId,
|
|
71
77
|
updateComplianceAuditActionsDate
|
|
@@ -34,8 +34,12 @@ const getAuditorContractorList = (auditListParametersModel, context) => {
|
|
|
34
34
|
return auditApi.getAuditorContractorList(auditListParametersModel, context);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
return auditApi.
|
|
37
|
+
const enterAudit = (contractorId, context) => {
|
|
38
|
+
return auditApi.enterAudit(contractorId, context);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getAuditRecordModel = (recordId, context) => {
|
|
42
|
+
return auditApi.getAuditRecordModel(recordId, context);
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
@@ -93,7 +97,8 @@ const getAuditRequestModel = (metaData, auditEntities) => {
|
|
|
93
97
|
isReaudit = false,
|
|
94
98
|
isProjectOnboarding = false,
|
|
95
99
|
shouldSendNotificationToPM = false,
|
|
96
|
-
auditDates = {}
|
|
100
|
+
auditDates = {},
|
|
101
|
+
auditId = null
|
|
97
102
|
} = metaData;
|
|
98
103
|
|
|
99
104
|
const auditDatesModel = new AuditDatesModel(
|
|
@@ -116,7 +121,8 @@ const getAuditRequestModel = (metaData, auditEntities) => {
|
|
|
116
121
|
isProjectOnboarding,
|
|
117
122
|
shouldSendNotificationToPM,
|
|
118
123
|
auditDatesModel,
|
|
119
|
-
auditStatus
|
|
124
|
+
auditStatus,
|
|
125
|
+
auditId
|
|
120
126
|
);
|
|
121
127
|
|
|
122
128
|
return auditRequestModel;
|
|
@@ -144,9 +150,8 @@ const auditRecord = async function(
|
|
|
144
150
|
return auditResponse;
|
|
145
151
|
};
|
|
146
152
|
|
|
147
|
-
const updateComplianceAuditActionsDate = (recordId,
|
|
148
|
-
|
|
149
|
-
return auditApi.updateComplianceAuditActionsDate(recordId, customLastInviteActionDate, context);
|
|
153
|
+
const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
|
|
154
|
+
return auditApi.updateComplianceAuditActionsDate(recordId, dateOffset, context);
|
|
150
155
|
};
|
|
151
156
|
|
|
152
157
|
module.exports = {
|
|
@@ -156,8 +161,9 @@ module.exports = {
|
|
|
156
161
|
isReaudit,
|
|
157
162
|
wrongCoi,
|
|
158
163
|
getAuditorContractorList,
|
|
159
|
-
|
|
164
|
+
enterAudit,
|
|
160
165
|
getRequirementDetailsForAudit,
|
|
166
|
+
getAuditRecordModel,
|
|
161
167
|
getAuditEntities,
|
|
162
168
|
getAuditMetadata,
|
|
163
169
|
getAuditByRecordId,
|
|
@@ -60,6 +60,23 @@ const ATTRIBUTE_NAMES_MAP = {
|
|
|
60
60
|
signature: 'signature'
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const auditTriggerType = {
|
|
64
|
+
newAudit: 'NEW_AUDIT',
|
|
65
|
+
changeRequirements: 'CHANGE_REQUIREMENTS',
|
|
66
|
+
updateRequirements: 'UPDATE_REQUIREMENTS',
|
|
67
|
+
updateRequirementsWithNotifications: 'ENTITY_CHANGED',
|
|
68
|
+
gaps: 'GAPS',
|
|
69
|
+
renewal: 'RENEWAL'
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const auditStatus = {
|
|
73
|
+
pending: 'PENDING',
|
|
74
|
+
inProgress: 'IN_PROGRESS',
|
|
75
|
+
onHold: 'ON_HOLD',
|
|
76
|
+
done: 'DONE',
|
|
77
|
+
canceled: 'CANCELED'
|
|
78
|
+
};
|
|
79
|
+
|
|
63
80
|
module.exports = {
|
|
64
81
|
DEFAULT_POLICY_ID,
|
|
65
82
|
POLICY_NAMES_MAP,
|
|
@@ -67,5 +84,7 @@ module.exports = {
|
|
|
67
84
|
COI_AUDIT_STATUSES,
|
|
68
85
|
AUDITOR_ROLE,
|
|
69
86
|
AUDIT_ENTITY_STATUSES,
|
|
70
|
-
VALID_SCORES
|
|
87
|
+
VALID_SCORES,
|
|
88
|
+
auditTriggerType,
|
|
89
|
+
auditStatus
|
|
71
90
|
};
|
|
@@ -15,6 +15,7 @@ class AuditRequestModel {
|
|
|
15
15
|
shouldSendNotificationToPM = true,
|
|
16
16
|
auditDates = {},
|
|
17
17
|
auditStatus = null,
|
|
18
|
+
auditId = null,
|
|
18
19
|
auditorRole = AUDITOR_ROLE
|
|
19
20
|
) {
|
|
20
21
|
const auditData = {
|
|
@@ -36,6 +37,7 @@ class AuditRequestModel {
|
|
|
36
37
|
validateType(auditDates, AuditDatesModel);
|
|
37
38
|
this.auditData = auditData;
|
|
38
39
|
this.auditDates = auditDates;
|
|
40
|
+
this.auditId = auditId;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -20,7 +20,7 @@ const Endpoints = {
|
|
|
20
20
|
changeRequirement: `${backendUrl}/saas/contractor/requirement`,
|
|
21
21
|
updateVendorExpiryDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/expiry-date`,
|
|
22
22
|
updateContractorInviteDate: contractorId => `${backendUrl}/_saas/automation/contractor/${contractorId}/invite-date`,
|
|
23
|
-
updateLastInviteActionDate: recordId => `${backendUrl}/saas/automation/
|
|
23
|
+
updateLastInviteActionDate: recordId => `${backendUrl}/saas/automation/record/${recordId}/update-emails-date`,
|
|
24
24
|
searchInAutocomplete: ({ tabId, searchWord }) =>
|
|
25
25
|
`${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
|
|
26
26
|
automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
|
|
@@ -128,8 +128,8 @@ const getLinkedProjectsCount = async (recordId, context) => {
|
|
|
128
128
|
return await requests.getRequestHandler(Endpoints.linkedProjectsCount(recordId), {}, context);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
const updateLastInviteActionDate = (recordId,
|
|
132
|
-
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?
|
|
131
|
+
const updateLastInviteActionDate = (recordId, offsetInDays, context) => {
|
|
132
|
+
const url = `${Endpoints.updateLastInviteActionDate(recordId)}?offsetInDays=${offsetInDays}`;
|
|
133
133
|
return requests.putRequestHandler(url, {}, context);
|
|
134
134
|
};
|
|
135
135
|
|
|
@@ -54,9 +54,8 @@ const updateInviteDate = (contractorId, inviteDate, context) => {
|
|
|
54
54
|
return contractorsAPI.updateInviteDate(contractorId, inviteDate, context);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const updateLastInviteActionDate = (recordId,
|
|
58
|
-
|
|
59
|
-
return contractorsAPI.updateLastInviteActionDate(recordId, customLastInviteActionDate, context);
|
|
57
|
+
const updateLastInviteActionDate = (recordId, dateOffset, context) => {
|
|
58
|
+
return contractorsAPI.updateLastInviteActionDate(recordId, dateOffset, context);
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
|