@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "4.5.28",
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": "^1.8.1",
14
- "axios-file": "^1.0.17",
15
- "chai": "^4.3.4",
13
+ "axios": "1.8.1",
14
+ "axios-file": "1.0.17",
15
+ "chai": "4.3.4",
16
16
  "dotenv": "16.5.0",
17
- "enum": "^3.0.4",
18
- "form-data": "^4.0.0",
19
- "mocha": "^8.3.2"
17
+ "enum": "3.0.4",
18
+ "form-data": "4.0.0",
19
+ "mocha": "8.3.2"
20
20
  },
21
21
  "devDependencies": {
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"
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 = 15;
215
- let aiAnalysisResponse;
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
- isExpectedStatus = aiAnalysisResponse.status === httpResponseStatusCodes.OK && aiAnalysisResponse.data.status === expectedStatus;
222
- } while (!isExpectedStatus && retries--);
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(`Record Ai Analysis status not is as expected. Expected: ${expectedStatus}, Actual: ${aiAnalysisResponse?.data?.status}`);
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
- getRecordReportByRecordIdBase64: base64RecordId => `${backendUrl}/secured/outlook/record/${base64RecordId}/compliance-report`
5
+ getRequestIdByRecordIdBase64: base64RecordId => `${backendUrl}/secured/outlook/record/${base64RecordId}/compliance-report`
6
6
  };
7
7
 
8
- const getRecordReportByRecordIdBase64 = async (base64RecordId, context) => {
9
- return requests.getRequestHandler(Endpoints.getRecordReportByRecordIdBase64(base64RecordId), {}, context);
8
+ const getRequestIdByRecordIdBase64 = async (base64RecordId, context) => {
9
+ return requests.getRequestHandler(Endpoints.getRequestIdByRecordIdBase64(base64RecordId), {}, context);
10
10
  };
11
11
 
12
12
  module.exports = {
13
- getRecordReportByRecordIdBase64
13
+ getRequestIdByRecordIdBase64
14
14
  };
@@ -1,7 +1,7 @@
1
1
  const vendorProfileApi = require('./outlook.api');
2
2
 
3
- const getRecordReportByRecordIdBase64 = async (base64RecordId, context) => {
4
- return vendorProfileApi.getRecordReportByRecordIdBase64(base64RecordId, context);
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
- getRecordReportByRecordIdBase64,
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;