@getjones/test-infra 4.5.28 → 4.5.29
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 +17 -17
- package/src/common/commonFlows/records/records.js +32 -8
- package/src/saas/internal-api/coi/api/coi.api.js +6 -0
- package/src/saas/internal-api/coi/api/coi.service.js +6 -1
- package/src/saas/internal-api/coi/utils/utils.js +4 -2
- package/src/saas/internal-api/outlook/api/outlook.api.js +4 -4
- package/src/saas/internal-api/outlook/api/outlook.service.js +3 -3
- package/src/saas/internal-api/requests/models/draft.request.report.model.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getjones/test-infra",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.29",
|
|
4
4
|
"description": "Providing internal and openapi interface",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,25 +10,25 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "
|
|
14
|
-
"axios-file": "
|
|
15
|
-
"chai": "
|
|
13
|
+
"axios": "1.8.1",
|
|
14
|
+
"axios-file": "1.0.17",
|
|
15
|
+
"chai": "4.3.4",
|
|
16
16
|
"dotenv": "16.5.0",
|
|
17
|
-
"enum": "
|
|
18
|
-
"form-data": "
|
|
19
|
-
"mocha": "
|
|
17
|
+
"enum": "3.0.4",
|
|
18
|
+
"form-data": "4.0.0",
|
|
19
|
+
"mocha": "8.3.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@babel/core": "
|
|
23
|
-
"@babel/eslint-parser": "
|
|
24
|
-
"@babel/preset-env": "
|
|
25
|
-
"@eslint/compat": "
|
|
26
|
-
"@eslint/eslintrc": "
|
|
27
|
-
"@eslint/js": "
|
|
28
|
-
"eslint": "
|
|
29
|
-
"eslint-plugin-import": "
|
|
30
|
-
"globals": "
|
|
31
|
-
"mocha-spec-json-output-reporter": "
|
|
22
|
+
"@babel/core": "7.26.9",
|
|
23
|
+
"@babel/eslint-parser": "7.26.8",
|
|
24
|
+
"@babel/preset-env": "7.26.9",
|
|
25
|
+
"@eslint/compat": "1.2.7",
|
|
26
|
+
"@eslint/eslintrc": "3.3.0",
|
|
27
|
+
"@eslint/js": "9.21.0",
|
|
28
|
+
"eslint": "9.21.0",
|
|
29
|
+
"eslint-plugin-import": "2.31.0",
|
|
30
|
+
"globals": "16.0.0",
|
|
31
|
+
"mocha-spec-json-output-reporter": "1.1.7"
|
|
32
32
|
},
|
|
33
33
|
"directories": {
|
|
34
34
|
"test": "tests"
|
|
@@ -209,20 +209,44 @@ const waitForOcrStatus = async function(recordId, context, { expectedStatus = oc
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
-
const waitForAiAnalysisStatus = async (recordId, context, { expectedStatus = ocrStatuses.SUCCESS } = {}) => {
|
|
212
|
+
const waitForAiAnalysisStatus = async (recordId, context, { expectedStatus = ocrStatuses.SUCCESS, isCheckPreviousCoi = false } = {}) => {
|
|
213
213
|
const timeout = expectedStatus === ocrStatuses.IN_PROGRESS ? 1 : 5;
|
|
214
|
-
let retries =
|
|
215
|
-
let
|
|
216
|
-
let isExpectedStatus;
|
|
214
|
+
let retries = 20;
|
|
215
|
+
let isExpectedStatus = false;
|
|
217
216
|
|
|
218
217
|
do {
|
|
219
218
|
await timeUtils.waitFor(timeout).seconds;
|
|
220
|
-
aiAnalysisResponse = await aiAuditApi.getAiAnalysisStatus(recordId, context);
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
const aiAnalysisResponse = await aiAuditApi.getAiAnalysisStatus(recordId, context);
|
|
220
|
+
const { status: httpStatus, data } = aiAnalysisResponse;
|
|
221
|
+
|
|
222
|
+
const isNotFoundStatus = httpStatus === httpResponseStatusCodes.NOT_FOUND;
|
|
223
|
+
const isExpectingNoAnalysis = expectedStatus === ocrStatuses.UNKNOWN;
|
|
224
|
+
|
|
225
|
+
if (isNotFoundStatus) {
|
|
226
|
+
const hasExpectedMessage = data.message?.includes('COI AI analysis status not found for record ID');
|
|
227
|
+
|
|
228
|
+
if (isExpectingNoAnalysis && hasExpectedMessage) {
|
|
229
|
+
isExpectedStatus = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
if (isExpectingNoAnalysis) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const [latestAnalysis, previousAnalysis] = data;
|
|
238
|
+
const isLatestMatch = latestAnalysis?.status === expectedStatus;
|
|
239
|
+
const isPreviousMatch = isCheckPreviousCoi ? previousAnalysis?.status === expectedStatus : true;
|
|
240
|
+
|
|
241
|
+
if (isLatestMatch && isPreviousMatch) {
|
|
242
|
+
isExpectedStatus = true;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} while (--retries);
|
|
223
247
|
|
|
224
248
|
if (!isExpectedStatus) {
|
|
225
|
-
throw new Error(`
|
|
249
|
+
throw new Error(`AI analysis status not as expected. Expected: ${expectedStatus}`);
|
|
226
250
|
}
|
|
227
251
|
};
|
|
228
252
|
|
|
@@ -11,6 +11,7 @@ const Endpoints = {
|
|
|
11
11
|
getCoiPresignedUrl: fileName => `${backendUrl}/saas/coi/${fileName}`,
|
|
12
12
|
getCoiPresignedUrlBeforeMerge: fileId => `${backendUrl}/saas/coi-file-before-merge/presigned-url/${fileId}`,
|
|
13
13
|
getCoiHashes: recordId => `${backendUrl}/jcsc/record/${recordId}/coi/hashes`,
|
|
14
|
+
getCombinedCoiByRecordId: recordId => `${backendUrl}/saas/record/${recordId}/coi/combined-coi-mapping`,
|
|
14
15
|
combineLastTwoCOIs: `${backendUrl}/saas/auditor/record/coi/merge-last-two`
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -43,6 +44,10 @@ const getCoiHashes = recordId => {
|
|
|
43
44
|
return internalRequests.getRequestHandler(Endpoints.getCoiHashes(recordId));
|
|
44
45
|
};
|
|
45
46
|
|
|
47
|
+
const getCombinedCoiByRecordId = (recordId, context) => {
|
|
48
|
+
return requests.getRequestHandler(Endpoints.getCombinedCoiByRecordId(recordId), {}, context);
|
|
49
|
+
};
|
|
50
|
+
|
|
46
51
|
const combineLastTwoCOIs = (combineLastTwoCOIsModel, context) => {
|
|
47
52
|
return requests.postRequestHandler(Endpoints.combineLastTwoCOIs, combineLastTwoCOIsModel, context);
|
|
48
53
|
};
|
|
@@ -54,5 +59,6 @@ module.exports = {
|
|
|
54
59
|
getCoiPreSignedUrl,
|
|
55
60
|
getCoiPresignedUrlBeforeMerge,
|
|
56
61
|
getCoiHashes,
|
|
62
|
+
getCombinedCoiByRecordId,
|
|
57
63
|
combineLastTwoCOIs
|
|
58
64
|
};
|
|
@@ -50,6 +50,10 @@ const combineLastTwoCOIs = async (combineLastTwoCOIsModel, auditorContext) => {
|
|
|
50
50
|
return response;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const getCombinedCoiByRecordId = (recordId, context) => {
|
|
54
|
+
return coiApi.getCombinedCoiByRecordId(recordId, context);
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
module.exports = {
|
|
54
58
|
uploadToS3,
|
|
55
59
|
submitCoi,
|
|
@@ -57,5 +61,6 @@ module.exports = {
|
|
|
57
61
|
getCoiPresignedUrlBeforeMerge,
|
|
58
62
|
completeScan,
|
|
59
63
|
getCoiHashes,
|
|
60
|
-
combineLastTwoCOIs
|
|
64
|
+
combineLastTwoCOIs,
|
|
65
|
+
getCombinedCoiByRecordId
|
|
61
66
|
};
|
|
@@ -92,7 +92,8 @@ const combineLastTwoCOIs = async ({
|
|
|
92
92
|
uploaderEmail,
|
|
93
93
|
isContractorExist,
|
|
94
94
|
icsContext,
|
|
95
|
-
auditorContext
|
|
95
|
+
auditorContext,
|
|
96
|
+
isNewCoiOnTop
|
|
96
97
|
}) => {
|
|
97
98
|
const recordResponse = await getContractorById(recordId, icsContext);
|
|
98
99
|
const recordDateModified = recordResponse.data.dateModified;
|
|
@@ -103,7 +104,8 @@ const combineLastTwoCOIs = async ({
|
|
|
103
104
|
uploadedBy,
|
|
104
105
|
uploaderEmail,
|
|
105
106
|
recordDateModified,
|
|
106
|
-
isContractorExist
|
|
107
|
+
isContractorExist,
|
|
108
|
+
isNewCoiOnTop
|
|
107
109
|
});
|
|
108
110
|
return services.combineLastTwoCOIs(combineLastTwoCOIsModel, auditorContext);
|
|
109
111
|
};
|
|
@@ -2,13 +2,13 @@ const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
|
2
2
|
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
|
-
|
|
5
|
+
getRequestIdByRecordIdBase64: base64RecordId => `${backendUrl}/secured/outlook/record/${base64RecordId}/compliance-report`
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
return requests.getRequestHandler(Endpoints.
|
|
8
|
+
const getRequestIdByRecordIdBase64 = async (base64RecordId, context) => {
|
|
9
|
+
return requests.getRequestHandler(Endpoints.getRequestIdByRecordIdBase64(base64RecordId), {}, context);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
|
-
|
|
13
|
+
getRequestIdByRecordIdBase64
|
|
14
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const vendorProfileApi = require('./outlook.api');
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
return vendorProfileApi.
|
|
3
|
+
const getRequestIdByRecordIdBase64 = async (base64RecordId, context) => {
|
|
4
|
+
return vendorProfileApi.getRequestIdByRecordIdBase64(base64RecordId, context);
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
const generateRecordIdBase64 = recordId => {
|
|
@@ -9,6 +9,6 @@ const generateRecordIdBase64 = recordId => {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
|
-
|
|
12
|
+
getRequestIdByRecordIdBase64,
|
|
13
13
|
generateRecordIdBase64
|
|
14
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class DraftRequestReportModel {
|
|
2
|
-
constructor(requestId, { emailAddress, selectedRequirementsId, additionalEmails = [], recordDateModified, overrideDateModified } = {}) {
|
|
2
|
+
constructor(requestId, { emailAddress = '', selectedRequirementsId, additionalEmails = [], recordDateModified, overrideDateModified } = {}) {
|
|
3
3
|
this.requestId = requestId;
|
|
4
4
|
this.emailAddress = emailAddress;
|
|
5
5
|
this.selectedRequirementsId = selectedRequirementsId;
|