@getjones/test-infra 2.8.9 → 2.8.10
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/dashboardCharts.js +2 -1
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +16 -2
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +18 -1
- package/src/saas/internal-api/dbEmails/consts/consts.js +2 -0
- package/src/saas/internal-api/requests/api/requests.api.js +8 -2
- package/src/saas/internal-api/requests/api/requests.service.js +14 -1
- package/src/saas/internal-api/requests/index.js +3 -1
- package/src/saas/internal-api/requests/models/inner.page.request.criteria.model.js +17 -0
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const chartTypes = {
|
|
2
2
|
requiringAttention: 'requiringAttention',
|
|
3
3
|
expirationDatePerMonth: 'expirationDatePerMonth',
|
|
4
|
-
waivedByRequirement: 'waivedByRequirement'
|
|
4
|
+
waivedByRequirement: 'waivedByRequirement',
|
|
5
|
+
notCompliantForRequirement: 'notCompliantForRequirement'
|
|
5
6
|
};
|
|
6
7
|
const sortBy = {
|
|
7
8
|
companyName: 'SORT_BY_COMPANYNAME',
|
|
Binary file
|
|
@@ -102,12 +102,13 @@ const getPolicyAuditIdFromRecord = (record, policyName, attributeName) => {
|
|
|
102
102
|
return attribute.auditId;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
// private method - please refer to waiveAll / acceptAll
|
|
106
|
+
const overrideAll = async (record, reason, context, { note = 'OVERRIDDEN AUTOMATICALLY' } = {}) => {
|
|
106
107
|
const allWaivablePolicies = auditUtil.getAllWaivablePolicies(record, context);
|
|
107
108
|
|
|
108
109
|
for (const waivable of allWaivablePolicies) {
|
|
109
110
|
const waiveModel = getWaiveModel(record, waivable.policyName, waivable.attributeName, reason, note);
|
|
110
|
-
const waiveResponse = await
|
|
111
|
+
const waiveResponse = await overrideGap({ waiveRequestModel: waiveModel, context });
|
|
111
112
|
|
|
112
113
|
if (waiveResponse.status !== httpResponseStatusCodes.OK) {
|
|
113
114
|
throw Error(`Failed to waive ${waivable.policyName} - ${waivable.attributeName} for ${record.company}`);
|
|
@@ -115,9 +116,22 @@ const waiveAll = async (record, context, { reason = WAIVER_REASONS.BUSINESS_DECI
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
|
|
119
|
+
const waiveAll = async (record, context, { reason = WAIVER_REASONS.BUSINESS_DECISION, note = 'WAIVED AUTOMATICALLY' } = {}) => {
|
|
120
|
+
if (reason === WAIVER_REASONS.ACCEPT_NO_EXPOSURE) {
|
|
121
|
+
throw Error('Invalid override gap reason to waive');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
await overrideAll(record, reason, context, { note });
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const acceptAll = async (record, context, { note = 'ACCEPTED AUTOMATICALLY' } = {}) => {
|
|
128
|
+
await overrideAll(record, WAIVER_REASONS.ACCEPT_NO_EXPOSURE, context, { note });
|
|
129
|
+
};
|
|
130
|
+
|
|
118
131
|
module.exports = {
|
|
119
132
|
waive,
|
|
120
133
|
waiveAll,
|
|
134
|
+
acceptAll,
|
|
121
135
|
retract,
|
|
122
136
|
getWaiveModel,
|
|
123
137
|
getRetractModel,
|
|
@@ -119,9 +119,26 @@ const getLastMessage = async (
|
|
|
119
119
|
return newestResult;
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
+
const waitForMail = async (emailModel, maxSecondToWait) => {
|
|
123
|
+
let isNotSend = true;
|
|
124
|
+
const oneSecondInMilliseconds = 1000;
|
|
125
|
+
let timeFromTheStart = 0;
|
|
126
|
+
const started = new Date();
|
|
127
|
+
let sendMails;
|
|
128
|
+
|
|
129
|
+
while (isNotSend && timeFromTheStart < maxSecondToWait) {
|
|
130
|
+
({ data: sendMails } = await getAllMessages(emailModel));
|
|
131
|
+
isNotSend = sendMails.length === 0;
|
|
132
|
+
const now = new Date();
|
|
133
|
+
timeFromTheStart = (now - started) / oneSecondInMilliseconds;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return sendMails;
|
|
137
|
+
};
|
|
138
|
+
|
|
122
139
|
module.exports = {
|
|
123
140
|
util,
|
|
124
|
-
|
|
141
|
+
waitForMail,
|
|
125
142
|
getAllMessages,
|
|
126
143
|
getLastMessage,
|
|
127
144
|
deleteMultipleMessages,
|
|
@@ -37,6 +37,8 @@ const EMAIL_SUBJECT = {
|
|
|
37
37
|
sameDayExpirationPMAutoRenewal: ({ recordCompanyName }) => `COI expired for ${recordCompanyName} at`,
|
|
38
38
|
requirementsUpdatedNotification: ({ requesterName }) => `Updated Requirements - Your Insurance Docs are needed for ${requesterName}`,
|
|
39
39
|
updatedRequirementsSubjectPrefix: () => 'Updated Requirements - ',
|
|
40
|
+
requestNewCoi: ({ recordCompanyName, requesterName, isExpired }) => `${recordCompanyName}'s COI is ${isExpired ? 'expired' : 'about to expire'} - ${requesterName}`,
|
|
41
|
+
malwareCoiFound: 'COI upload failed to pass security scan',
|
|
40
42
|
thankYou: 'Thank you for submitting your COI'
|
|
41
43
|
};
|
|
42
44
|
|
|
@@ -12,7 +12,8 @@ const Endpoints = {
|
|
|
12
12
|
requestsGlobalSearch: (projectId, searchWord) =>
|
|
13
13
|
`${backendUrl}/saas/requests/search?&projectId=${projectId}&searchWord=${searchWord}`,
|
|
14
14
|
getAutocompleteAutoSelect: `${backendUrl}/saas/request/auto/selection`,
|
|
15
|
-
getTabTenantRequestsInProject: projectId => `${backendUrl}/saas/project/${projectId}/tenants/companies
|
|
15
|
+
getTabTenantRequestsInProject: projectId => `${backendUrl}/saas/project/${projectId}/tenants/companies`,
|
|
16
|
+
innerPageRequests: `${backendUrl}/saas/requests/chart-filter`
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const createRequest = (createRequestModel, context) => {
|
|
@@ -58,6 +59,10 @@ const getTabTenantRequestsInProject = (projectId, context) => {
|
|
|
58
59
|
return requests.getRequestHandler(Endpoints.getTabTenantRequestsInProject(projectId), {}, context);
|
|
59
60
|
};
|
|
60
61
|
|
|
62
|
+
const getInnerPageRequests = (innerPageRequestCriteriaModel, context) => {
|
|
63
|
+
return requests.postRequestHandler(Endpoints.innerPageRequests, innerPageRequestCriteriaModel, context);
|
|
64
|
+
};
|
|
65
|
+
|
|
61
66
|
module.exports = {
|
|
62
67
|
createRequest,
|
|
63
68
|
addRequestToRecord,
|
|
@@ -68,5 +73,6 @@ module.exports = {
|
|
|
68
73
|
getRequestsByTabId,
|
|
69
74
|
requestsGlobalSearch,
|
|
70
75
|
getAutocompleteAutoSelect,
|
|
71
|
-
getTabTenantRequestsInProject
|
|
76
|
+
getTabTenantRequestsInProject,
|
|
77
|
+
getInnerPageRequests
|
|
72
78
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const requestsAPI = require('./requests.api');
|
|
2
2
|
const { CreateRequestModel, ContractorInfo } = require('../models/create.request.model');
|
|
3
|
+
const { InnerPageRequestCriteriaModel } = require('../models/inner.page.request.criteria.model');
|
|
3
4
|
const { RequestModel } = require('../models/edit.request.model');
|
|
4
5
|
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
5
6
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
@@ -105,6 +106,17 @@ const getRequestFromTabByRecordId = async (recordId, tabId, context) => {
|
|
|
105
106
|
return request;
|
|
106
107
|
};
|
|
107
108
|
|
|
109
|
+
const getInnerPageRequests = async (innerPageRequestCriteriaModel, context) => {
|
|
110
|
+
validateType(innerPageRequestCriteriaModel, InnerPageRequestCriteriaModel);
|
|
111
|
+
const response = await requestsAPI.getInnerPageRequests(innerPageRequestCriteriaModel, context);
|
|
112
|
+
|
|
113
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
114
|
+
throw Error(`Get requests inner page has fail\n${response}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return response.data;
|
|
118
|
+
};
|
|
119
|
+
|
|
108
120
|
module.exports = {
|
|
109
121
|
createRequest,
|
|
110
122
|
getAutocompleteAutoSelect,
|
|
@@ -118,5 +130,6 @@ module.exports = {
|
|
|
118
130
|
getCreateRequestModel,
|
|
119
131
|
requestsGlobalSearch,
|
|
120
132
|
getTabTenantRequestsInProject,
|
|
121
|
-
getRequestFromTabByRecordId
|
|
133
|
+
getRequestFromTabByRecordId,
|
|
134
|
+
getInnerPageRequests
|
|
122
135
|
};
|
|
@@ -2,13 +2,15 @@ const services = require('./api/requests.service');
|
|
|
2
2
|
|
|
3
3
|
const { TenantRequestModel, RequestModel, TabModel } = require('./models/edit.request.model');
|
|
4
4
|
const { CreateRequestModel, ContractorInfo } = require('./models/create.request.model');
|
|
5
|
+
const { InnerPageRequestCriteriaModel } = require('./models/inner.page.request.criteria.model');
|
|
5
6
|
|
|
6
7
|
const models = {
|
|
7
8
|
TenantRequestModel,
|
|
8
9
|
RequestModel,
|
|
9
10
|
TabModel,
|
|
10
11
|
CreateRequestModel,
|
|
11
|
-
ContractorInfo
|
|
12
|
+
ContractorInfo,
|
|
13
|
+
InnerPageRequestCriteriaModel
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
module.exports = { services, models };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class InnerPageRequestCriteriaModel {
|
|
2
|
+
constructor({
|
|
3
|
+
projectIds = [],
|
|
4
|
+
recordTypes = [],
|
|
5
|
+
sortBy = '',
|
|
6
|
+
pageNo = 1
|
|
7
|
+
} = {}) {
|
|
8
|
+
this.projectIds = projectIds,
|
|
9
|
+
this.recordTypes = recordTypes,
|
|
10
|
+
this.sortBy = sortBy,
|
|
11
|
+
this.pageNo = pageNo;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
InnerPageRequestCriteriaModel
|
|
17
|
+
};
|