@getjones/test-infra 4.5.29 → 4.5.30
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/accountSettings.js +4 -0
- package/src/common/utils/arrayUtils.js +6 -0
- package/src/factory/records/records.js +9 -9
- package/src/index.js +0 -2
- package/src/resources/coi/realCoiWatermarked.pdf +0 -0
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.api.js +6 -6
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.service.js +5 -4
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +9 -1
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.api.js +32 -0
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.service.js +73 -0
- package/src/saas/internal-api/compliance/index.js +3 -2
- package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.api.js +0 -14
- package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.service.js +0 -16
- package/src/saas/internal-api/jonesNetworkTab/index.js +0 -3
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@ module.exports = {
|
|
|
15
15
|
on: { isAuditingAiEnabled: true },
|
|
16
16
|
off: { isAuditingAiEnabled: false }
|
|
17
17
|
},
|
|
18
|
+
isComplianceSnapshotAiEnabled: {
|
|
19
|
+
on: { isComplianceSnapshotAiEnabled: true },
|
|
20
|
+
off: { isComplianceSnapshotAiEnabled: false }
|
|
21
|
+
},
|
|
18
22
|
externalIntegrations: {
|
|
19
23
|
vendorsAndTenantsON: {
|
|
20
24
|
integrations: {
|
|
@@ -14,9 +14,9 @@ const timeUtils = require('../../common/utils/timeUtils');
|
|
|
14
14
|
const recordFlows = require('../../common/commonFlows/records/records');
|
|
15
15
|
const auditConfigs = require('../../defaults/configs/auditConfigs');
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const defaultCoiPath = path.join(__dirname, '../../resources/coi/coi.pdf');
|
|
18
18
|
|
|
19
|
-
const prepareRecord = async (recordCompany, recordEmail, status, tabId, requirementId, context, { inviterEmail = credentials.superUser, expiryStatus, shouldSendNotificationToPM = false, recordConfig, glPolicyNumber, policyOwnerRecordId } = {}) => {
|
|
19
|
+
const prepareRecord = async (recordCompany, recordEmail, status, tabId, requirementId, context, { inviterEmail = credentials.superUser, expiryStatus, shouldSendNotificationToPM = false, recordConfig, glPolicyNumber, policyOwnerRecordId, coiFilePath } = {}) => {
|
|
20
20
|
validateInsuranceAndExpiryStatus(status, expiryStatus);
|
|
21
21
|
|
|
22
22
|
const requestData = await requests.services.getOrCreateRequest(
|
|
@@ -48,7 +48,7 @@ const prepareRecord = async (recordCompany, recordEmail, status, tabId, requirem
|
|
|
48
48
|
return recordId;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
await uploadCoiByRecordId(recordId);
|
|
51
|
+
await uploadCoiByRecordId(recordId, { coiFilePath });
|
|
52
52
|
|
|
53
53
|
if (complianceStatuses.underReview === status) {
|
|
54
54
|
return recordId;
|
|
@@ -125,8 +125,8 @@ const prepareNoCoiRequireRecord = async (recordCompany, recordEmail, tabId, cont
|
|
|
125
125
|
return prepareRecord(recordCompany, recordEmail, complianceStatuses.noCoiRequire, tabId, null, context, { inviterEmail, recordConfig });
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
const prepareUnderReviewRecord = (recordCompany, recordEmail, tabId, requirementId, context, { inviterEmail, recordConfig, policyOwnerRecordId } = {}) => {
|
|
129
|
-
return prepareRecord(recordCompany, recordEmail, complianceStatuses.underReview, tabId, requirementId, context, { inviterEmail, recordConfig, policyOwnerRecordId });
|
|
128
|
+
const prepareUnderReviewRecord = (recordCompany, recordEmail, tabId, requirementId, context, { inviterEmail, recordConfig, policyOwnerRecordId, coiFilePath } = {}) => {
|
|
129
|
+
return prepareRecord(recordCompany, recordEmail, complianceStatuses.underReview, tabId, requirementId, context, { inviterEmail, recordConfig, policyOwnerRecordId, coiFilePath });
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
const sendGaps = async (recordId, tabId, context) => {
|
|
@@ -173,7 +173,7 @@ const validateInsuranceAndExpiryStatus = async (insuranceStatus, expiryStatus) =
|
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
const prepareDraftRecord = async (recordCompany, tabId, context, { recordEmail, requirementId, uploadCoi, recordConfig } = {}) => {
|
|
176
|
+
const prepareDraftRecord = async (recordCompany, tabId, context, { recordEmail, requirementId, uploadCoi, recordConfig, coiFilePath } = {}) => {
|
|
177
177
|
const requestData = await requests.services.getOrCreateRequest(
|
|
178
178
|
context,
|
|
179
179
|
tabId,
|
|
@@ -194,7 +194,7 @@ const prepareDraftRecord = async (recordCompany, tabId, context, { recordEmail,
|
|
|
194
194
|
|
|
195
195
|
if (uploadCoi) {
|
|
196
196
|
const recordId = requestData.record.contractorId;
|
|
197
|
-
await uploadCoiByRecordId(recordId);
|
|
197
|
+
await uploadCoiByRecordId(recordId, { coiFilePath });
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
return requestData;
|
|
@@ -254,10 +254,10 @@ const prepareRecordForAutocomplete = async (
|
|
|
254
254
|
return updatedRequest;
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
-
const uploadCoiByRecordId = async recordId => {
|
|
257
|
+
const uploadCoiByRecordId = async (recordId, { coiFilePath } = {}) => {
|
|
258
258
|
const coiUpload = await coi.utils.uploadCoi(
|
|
259
259
|
recordId,
|
|
260
|
-
|
|
260
|
+
coiFilePath || defaultCoiPath,
|
|
261
261
|
uploaderType = coi.consts.UPLOADER_TYPES.ICS,
|
|
262
262
|
uploaderEmail = credentials.superUser
|
|
263
263
|
);
|
package/src/index.js
CHANGED
|
@@ -33,7 +33,6 @@ const getInternalAPI = () => {
|
|
|
33
33
|
const dashboard = require('./saas/internal-api/dashboard');
|
|
34
34
|
const accountDirectory = require('./saas/internal-api/accountDirectory');
|
|
35
35
|
const notificationCenter = require('./saas/internal-api/notificationCenter');
|
|
36
|
-
const jonesNetworkTab = require('./saas/internal-api/jonesNetworkTab');
|
|
37
36
|
|
|
38
37
|
const globalRecord = require('./saas/internal-api/globalRecord');
|
|
39
38
|
const vendorProfile = require('./saas/internal-api/vendorProfile');
|
|
@@ -71,7 +70,6 @@ const getInternalAPI = () => {
|
|
|
71
70
|
dashboard,
|
|
72
71
|
accountDirectory,
|
|
73
72
|
notificationCenter,
|
|
74
|
-
jonesNetworkTab,
|
|
75
73
|
globalRecord,
|
|
76
74
|
vendorProfile,
|
|
77
75
|
serviceArea,
|
|
Binary file
|
|
@@ -3,16 +3,16 @@ const requests = require('../../../../../../common/requests/cookieAuth/requests'
|
|
|
3
3
|
const { nodeBackendUrl, backendUrl } = require('../../../../../../env').getEnv();
|
|
4
4
|
|
|
5
5
|
const Endpoints = {
|
|
6
|
-
getAiAnalysisResult:
|
|
6
|
+
getAiAnalysisResult: `${nodeBackendUrl}/compliance/ai/analysis-results`,
|
|
7
7
|
getComparisonAlgorithmResultsIos: `${nodeBackendUrl}/compliance/comparison-algorithm-results`,
|
|
8
8
|
getAiAnalysisStatus: recordId => `${backendUrl}/saas/record/${recordId}/coi/ai-analysis-status`,
|
|
9
|
-
getAcord25ByAiAnalysis:
|
|
9
|
+
getAcord25ByAiAnalysis: `${nodeBackendUrl}/compliance/ai/analysis/acord25`,
|
|
10
10
|
getAuxiliaryDataByAiAnalysis: uniqueCoiId => `${nodeBackendUrl}/compliance/auxiliary-data/from/coi-analysis/${uniqueCoiId}`,
|
|
11
11
|
getOcrByRecordIdAiAnalysis: recordId => `${backendUrl}/jcsc/record/${recordId}/ocr`
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const getAiAnalysisResult = (
|
|
15
|
-
return internalRequests.
|
|
14
|
+
const getAiAnalysisResult = (uniqueCoiIds, requirementsId) => {
|
|
15
|
+
return internalRequests.postRequestHandler(Endpoints.getAiAnalysisResult, { uniqueCoiIds, requirementsId });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const getComparisonAlgorithmResultsIos = (data, context) => {
|
|
@@ -23,8 +23,8 @@ const getAiAnalysisStatus = (recordId, context) => {
|
|
|
23
23
|
return requests.getRequestHandler(Endpoints.getAiAnalysisStatus(recordId), {}, context);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const getAcord25ByAiAnalysis =
|
|
27
|
-
return internalRequests.
|
|
26
|
+
const getAcord25ByAiAnalysis = uniqueCoiIds => {
|
|
27
|
+
return internalRequests.postRequestHandler(Endpoints.getAcord25ByAiAnalysis, { uniqueCoiIds });
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const getAuxiliaryDataByAiAnalysis = uniqueCoiId => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const aiAuditApi = require('./aiAudit.api');
|
|
2
2
|
const httpResponseStatusCodes = require('../../../../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
const { formatToStringList } = require('../../../../../../common/utils/arrayUtils');
|
|
3
4
|
|
|
4
|
-
const getAiAnalysisResult = async (
|
|
5
|
-
const response = await aiAuditApi.getAiAnalysisResult(
|
|
5
|
+
const getAiAnalysisResult = async (uniqueCoiIds, requirementsId) => {
|
|
6
|
+
const response = await aiAuditApi.getAiAnalysisResult(uniqueCoiIds, requirementsId);
|
|
6
7
|
|
|
7
8
|
if (response.status !== httpResponseStatusCodes.OK) {
|
|
8
9
|
throw Error(`Failed to get AI analysis result with code: ${response.status}`);
|
|
@@ -31,8 +32,8 @@ const getAiAnalysisStatus = async (recordId, context) => {
|
|
|
31
32
|
return response.data;
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
const getAcord25ByAiAnalysis = async
|
|
35
|
-
const response = await aiAuditApi.getAcord25ByAiAnalysis(
|
|
35
|
+
const getAcord25ByAiAnalysis = async uniqueCoiIds => {
|
|
36
|
+
const response = await aiAuditApi.getAcord25ByAiAnalysis(uniqueCoiIds);
|
|
36
37
|
|
|
37
38
|
if (response.status !== httpResponseStatusCodes.OK) {
|
|
38
39
|
throw Error(`Failed to get Acord 25 using Ai with code: ${response.status}`);
|
|
@@ -149,7 +149,11 @@ const auditRecord = async function(
|
|
|
149
149
|
requirementId,
|
|
150
150
|
recordId,
|
|
151
151
|
auditConfig,
|
|
152
|
-
{
|
|
152
|
+
{
|
|
153
|
+
shouldSendNotificationToPM = false,
|
|
154
|
+
expectError,
|
|
155
|
+
shouldGetComplianceJson = false
|
|
156
|
+
} = {}
|
|
153
157
|
) {
|
|
154
158
|
const apiAuditConfig = dataTypeUtils.isObject(auditConfig) ?
|
|
155
159
|
auditUtil.parseAuditConfig(cloneObject(auditConfig)) :
|
|
@@ -157,6 +161,10 @@ const auditRecord = async function(
|
|
|
157
161
|
|
|
158
162
|
const auditRequestModel = await enterAudit(recordId, auditorContext, { shouldSendNotificationToPM, shouldGetAuditRequestModelAfterEnterAudit: true, auditConfig: apiAuditConfig, accountId, projectId, requirementId });
|
|
159
163
|
|
|
164
|
+
if (shouldGetComplianceJson) {
|
|
165
|
+
await getComplianceJson(recordId, auditorContext, false, true);
|
|
166
|
+
}
|
|
167
|
+
|
|
160
168
|
return submitAudit(auditRequestModel, auditorContext, { expectError });
|
|
161
169
|
};
|
|
162
170
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
validatePermission: recordId => `${backendUrl}/saas/ai-compliance-snapshot/record/${recordId}/validate`,
|
|
6
|
+
initiateSnapshotAiAnalysis: `${backendUrl}/saas/ai-compliance-snapshot/initialize-analysis`,
|
|
7
|
+
getSnapshotAiAnalysisStatus: recordId => `${backendUrl}/saas/ai-analysis-status/record/${recordId}`,
|
|
8
|
+
getSnapshotAiReport: recordId => `${backendUrl}/saas/ai-compliance-snapshot/report/record/${recordId}`
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const validatePermission = (recordId, context) => {
|
|
12
|
+
return requests.getRequestHandler(Endpoints.validatePermission(recordId), {}, context);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const initiateSnapshotAiAnalysis = (recordId, context) => {
|
|
16
|
+
return requests.postRequestHandler(Endpoints.initiateSnapshotAiAnalysis, { recordId }, context);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getSnapshotAiAnalysisStatus = (recordId, context) => {
|
|
20
|
+
return requests.getRequestHandler(Endpoints.getSnapshotAiAnalysisStatus(recordId), {}, context);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const getSnapshotAiReport = (recordId, context) => {
|
|
24
|
+
return requests.getRequestHandler(Endpoints.getSnapshotAiReport(recordId), {}, context);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
validatePermission,
|
|
29
|
+
initiateSnapshotAiAnalysis,
|
|
30
|
+
getSnapshotAiAnalysisStatus,
|
|
31
|
+
getSnapshotAiReport
|
|
32
|
+
};
|
package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.service.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const complianceSnapshotApi = require('./compliance.snapshot.api');
|
|
2
|
+
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
const aiAnalysisStatuses = require('../../../../../common/consts/ocrStatuses');
|
|
4
|
+
const timeUtils = require('../../../../../common/utils/timeUtils');
|
|
5
|
+
|
|
6
|
+
const validatePermission = async (recordId, context, { expectError } = {}) => {
|
|
7
|
+
const response = await complianceSnapshotApi.validatePermission(recordId, context);
|
|
8
|
+
|
|
9
|
+
if (!expectError && response.status !== httpResponseStatusCodes.OK) {
|
|
10
|
+
throw new Error(`Validate permission has failed. ${response.statusText}`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return response;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const initiateSnapshotAiAnalysis = async (recordId, context, { expectError } = {}) => {
|
|
17
|
+
const response = await complianceSnapshotApi.initiateSnapshotAiAnalysis(recordId, context);
|
|
18
|
+
|
|
19
|
+
if (!expectError && response.status !== httpResponseStatusCodes.OK) {
|
|
20
|
+
throw new Error(`Initiate snapshot ai analysis has failed. ${response.statusText}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getSnapshotAiAnalysisStatus = async (recordId, context, { expectError } = {}) => {
|
|
27
|
+
const response = await complianceSnapshotApi.getSnapshotAiAnalysisStatus(recordId, context);
|
|
28
|
+
|
|
29
|
+
if (!expectError && response.status !== httpResponseStatusCodes.OK) {
|
|
30
|
+
throw new Error(`Get snapshot ai analysis status has failed. ${response.statusText}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return response;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const getSnapshotAiReport = async (recordId, context, { expectError } = {}) => {
|
|
37
|
+
const response = await complianceSnapshotApi.getSnapshotAiReport(recordId, context);
|
|
38
|
+
|
|
39
|
+
if (!expectError && response.status !== httpResponseStatusCodes.OK) {
|
|
40
|
+
throw new Error(`Get snapshot ai report has failed. ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return response;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const waitUntilSnapshotAiAnalysisIsSuccessful = async (recordId, context, { retries = 15 } = {}) => {
|
|
47
|
+
let { data: aiAnalysisStatus } = await getSnapshotAiAnalysisStatus(recordId, context);
|
|
48
|
+
|
|
49
|
+
while (aiAnalysisStatus !== aiAnalysisStatuses.SUCCESS && retries > 0) {
|
|
50
|
+
await timeUtils.waitFor(5).seconds;
|
|
51
|
+
console.log(`Waiting for snapshot ai analysis to be successful, retries left: ${retries}`);
|
|
52
|
+
const aiAnalysisStatusResponse = await getSnapshotAiAnalysisStatus(recordId, context);
|
|
53
|
+
aiAnalysisStatus = aiAnalysisStatusResponse.data;
|
|
54
|
+
|
|
55
|
+
if (aiAnalysisStatus === aiAnalysisStatuses.UNKNOWN || aiAnalysisStatus === aiAnalysisStatuses.FAILED) {
|
|
56
|
+
throw new Error(`Snapshot ai analysis is not successful: status is ${aiAnalysisStatus}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
retries--;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (aiAnalysisStatus !== aiAnalysisStatuses.SUCCESS) {
|
|
63
|
+
throw new Error(`Snapshot ai analysis is not completed successfully after all retries: status is ${aiAnalysisStatus}`);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
validatePermission,
|
|
69
|
+
initiateSnapshotAiAnalysis,
|
|
70
|
+
getSnapshotAiAnalysisStatus,
|
|
71
|
+
getSnapshotAiReport,
|
|
72
|
+
waitUntilSnapshotAiAnalysisIsSuccessful
|
|
73
|
+
};
|
|
@@ -7,7 +7,7 @@ const overrideGapServices = require('./api/overrideGap/override.gap.service');
|
|
|
7
7
|
|
|
8
8
|
const convertServices = require('./api/convert/convert.service');
|
|
9
9
|
const coverageServices = require('./api/coverage/coverage.service');
|
|
10
|
-
|
|
10
|
+
const complianceSnapshotServices = require('./api/complianceSnapshot/compliance.snapshot.service');
|
|
11
11
|
const amBestRatingServices = require('./api/amBestRating/am.best.rating.service');
|
|
12
12
|
|
|
13
13
|
const auditConsts = require('./consts/audit');
|
|
@@ -32,7 +32,8 @@ const services = {
|
|
|
32
32
|
overrideGap: overrideGapServices,
|
|
33
33
|
convert: convertServices,
|
|
34
34
|
coverage: coverageServices,
|
|
35
|
-
amBestRating: amBestRatingServices
|
|
35
|
+
amBestRating: amBestRatingServices,
|
|
36
|
+
complianceSnapshot: complianceSnapshotServices
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
module.exports = { services, models, consts, utils };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
isNetworkTabEnabledForUser: `${backendUrl}/saas/account/user/jones-network-enabled/setting`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const isNetworkTabEnabledForUser = async context => {
|
|
9
|
-
return requests.getRequestHandler(Endpoints.isNetworkTabEnabledForUser, { }, context);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
isNetworkTabEnabledForUser
|
|
14
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const networkTabApi = require('./jones.network.tab.api');
|
|
2
|
-
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
3
|
-
|
|
4
|
-
const isNetworkTabEnabledForUser = async context => {
|
|
5
|
-
const notificationPageResponse = await networkTabApi.isNetworkTabEnabledForUser(context);
|
|
6
|
-
|
|
7
|
-
if (notificationPageResponse.status !== httpResponseStatusCodes.OK) {
|
|
8
|
-
throw new Error(`Failed to get network tab enable settings status, cause by: ${notificationPageResponse.message}`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return notificationPageResponse.data;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
isNetworkTabEnabledForUser
|
|
16
|
-
};
|