@getjones/test-infra 2.9.1 → 2.9.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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 datesOffset = isTenant ?
11
- timeUtils.getInviteActionDatesOffsetForNotResponsiveTenant() :
12
- timeUtils.getInviteActionDatesOffsetForNotResponsiveVendor();
10
+ const offsetInDaysList = isTenant ?
11
+ timeUtils.getInviteActionOffsetInDaysForNotResponsiveTenant() :
12
+ timeUtils.getInviteActionOffsetInDaysForNotResponsiveVendor();
13
13
 
14
- for (const dateOffset of datesOffset) {
15
- await updateLastInviteActionDate(recordId, dateOffset, context);
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, dateOffset, context) {
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, dateOffset, context);
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, dateOffset, context);
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}`);
@@ -54,6 +54,7 @@ const getAuditMetadata = async (
54
54
  contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
55
55
  contractCreateDate: recordDetails.contractCreateDate
56
56
  };
57
+ metadata.auditId = recordDetails.auditId;
57
58
 
58
59
  metadata.auditorId = await getAuditorId();
59
60
 
@@ -94,7 +94,7 @@ const getInvitationDatesForNotResponsiveVendor = function() {
94
94
  return [twoDaysAgoUtc, fiveDaysAgoUtc, eightDaysAgoUtc];
95
95
  };
96
96
 
97
- const getInviteActionDatesOffsetForNotResponsiveVendor = function() {
97
+ const getInviteActionOffsetInDaysForNotResponsiveVendor = function() {
98
98
  return [inviteActionDateOffset.twoDays, inviteActionDateOffset.fiveDays, inviteActionDateOffset.eightDays];
99
99
  };
100
100
 
@@ -106,7 +106,7 @@ const getInvitationDatesForNotResponsiveTenant = function() {
106
106
  return [fiveDaysAgoUtc, tenDaysAgoUtc, fifteenDaysAgoUtc];
107
107
  };
108
108
 
109
- const getInviteActionDatesOffsetForNotResponsiveTenant = function() {
109
+ const getInviteActionOffsetInDaysForNotResponsiveTenant = function() {
110
110
  return [inviteActionDateOffset.fiveDays, inviteActionDateOffset.tenDays, inviteActionDateOffset.fifteenDays];
111
111
  };
112
112
 
@@ -156,9 +156,9 @@ module.exports = {
156
156
  getDateinTwentyNineDays,
157
157
  getDateInTwoMonths,
158
158
  getInvitationDatesForNotResponsiveVendor,
159
- getInviteActionDatesOffsetForNotResponsiveVendor,
159
+ getInviteActionOffsetInDaysForNotResponsiveVendor,
160
160
  getInvitationDatesForNotResponsiveTenant,
161
- getInviteActionDatesOffsetForNotResponsiveTenant,
161
+ getInviteActionOffsetInDaysForNotResponsiveTenant,
162
162
  getAutomaticRenewalsExpirationDates,
163
163
  getLogTimestamp,
164
164
  getDayInMilliseconds,
Binary file
@@ -13,7 +13,7 @@ const Endpoints = {
13
13
  revertCoi: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/revert`,
14
14
  wrongCoi: `${backendUrl}/saas/coi/wrong-coi`,
15
15
  getAudit: recordId => `${backendUrl}/saas/audit/${recordId}`,
16
- updateComplianceAuditActionsDate: recordId => `${backendUrl}/saas/automation/audit/record/${recordId}/compliance-audit-actions/date`
16
+ updateComplianceAuditActionsDate: recordId => `${backendUrl}/saas/automation/record/${recordId}/update-audit-actions-date`
17
17
  };
18
18
 
19
19
  const audit = async (contractorId, auditRequestModel, context) => {
@@ -59,7 +59,7 @@ const wrongCoi = (recordId, context) => {
59
59
  };
60
60
 
61
61
  const updateComplianceAuditActionsDate = (recordId, dateOffset, context) => {
62
- const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?complianceAuditActionsDateOffset=${dateOffset}`;
62
+ const url = `${Endpoints.updateComplianceAuditActionsDate(recordId)}?offsetInDays=${dateOffset}`;
63
63
  return requests.putRequestHandler(url, {}, context);
64
64
  };
65
65
 
@@ -97,7 +97,8 @@ const getAuditRequestModel = (metaData, auditEntities) => {
97
97
  isReaudit = false,
98
98
  isProjectOnboarding = false,
99
99
  shouldSendNotificationToPM = false,
100
- auditDates = {}
100
+ auditDates = {},
101
+ auditId = null
101
102
  } = metaData;
102
103
 
103
104
  const auditDatesModel = new AuditDatesModel(
@@ -120,7 +121,8 @@ const getAuditRequestModel = (metaData, auditEntities) => {
120
121
  isProjectOnboarding,
121
122
  shouldSendNotificationToPM,
122
123
  auditDatesModel,
123
- auditStatus
124
+ auditStatus,
125
+ auditId
124
126
  );
125
127
 
126
128
  return auditRequestModel;
@@ -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/invite/record/${recordId}/last-invite-action/date`,
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, dateOffset, context) => {
132
- const url = `${Endpoints.updateLastInviteActionDate(recordId)}?actionDateOffset=${dateOffset}`;
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