@getjones/test-infra 3.0.1 → 3.0.2
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 +30 -30
- package/src/common/commonFlows/auth/auth.js +40 -40
- package/src/common/commonFlows/index.js +4 -4
- package/src/common/commonFlows/records/records.js +123 -102
- package/src/common/consts/activationStatuses.js +6 -6
- package/src/common/consts/constantsForRecordsSortingAndFilters.js +40 -0
- package/src/common/consts/dashboardCharts.js +18 -18
- package/src/common/consts/projectSettings.js +6 -6
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/s3FileTypes.js +12 -12
- package/src/common/consts/userTypes.js +8 -8
- package/src/common/errorCodes.js +3 -3
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +44 -44
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/internalAuth/requests.js +48 -48
- package/src/common/requests/requestHandlers.js +78 -78
- package/src/common/utils/complianceUtil.js +83 -83
- package/src/common/utils/configsUtil.js +22 -22
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +7 -7
- package/src/common/utils/timeUtils.js +177 -177
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +91 -91
- package/src/defaults/configs/coverage.js +227 -227
- package/src/defaults/configs/polices.js +64 -64
- package/src/defaults/configs/requirement.js +32 -32
- package/src/defaults/index.js +6 -6
- package/src/env.js +57 -57
- package/src/factory/globalRecord/globalRecord.js +70 -70
- package/src/factory/index.js +8 -8
- package/src/factory/records/records.js +169 -183
- package/src/factory/users/users.js +77 -77
- package/src/index.js +91 -91
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +35 -35
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +93 -93
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +61 -61
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
- package/src/saas/internal-api/accounts/consts/consts.js +6 -6
- package/src/saas/internal-api/accounts/index.js +22 -22
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +38 -38
- package/src/saas/internal-api/accounts/utils/utils.js +58 -58
- package/src/saas/internal-api/agreement/api/agreement.api.js +35 -35
- package/src/saas/internal-api/agreement/api/agreement.service.js +81 -81
- package/src/saas/internal-api/agreement/consts/consts.js +8 -8
- package/src/saas/internal-api/agreement/index.js +11 -11
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +43 -43
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +105 -105
- package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +11 -11
- package/src/saas/internal-api/auditCustomerRules/index.js +6 -6
- package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +46 -46
- package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +19 -19
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
- package/src/saas/internal-api/auth/api/auth.api.js +27 -27
- package/src/saas/internal-api/auth/api/auth.service.js +90 -90
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +40 -40
- package/src/saas/internal-api/coi/api/coi.service.js +26 -26
- package/src/saas/internal-api/coi/consts/hashes.js +4 -0
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
- package/src/saas/internal-api/coi/index.js +14 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +100 -100
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +242 -230
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +48 -48
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +33 -33
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +141 -141
- package/src/saas/internal-api/compliance/consts/audit.js +103 -103
- package/src/saas/internal-api/compliance/index.js +33 -33
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +94 -94
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
- package/src/saas/internal-api/compliance/utils/auditUtil.js +222 -222
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +40 -40
- package/src/saas/internal-api/contractors/api/contractors.api.js +185 -179
- package/src/saas/internal-api/contractors/api/contractors.service.js +259 -247
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +62 -60
- package/src/saas/internal-api/contractors/models/link.request.model.js +10 -0
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- package/src/saas/internal-api/contractors/utils.js +25 -25
- package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +147 -147
- package/src/saas/internal-api/dbEmails/consts/consts.js +54 -54
- package/src/saas/internal-api/dbEmails/index.js +6 -6
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
- package/src/saas/internal-api/dbEmails/utils/util.js +82 -82
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
- package/src/saas/internal-api/emailCustomization/index.js +3 -3
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +105 -105
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
- package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +41 -41
- package/src/saas/internal-api/projects/utils/utils.js +156 -156
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +47 -47
- package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +65 -64
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +120 -96
- package/src/saas/internal-api/requests/api/requests.service.js +272 -220
- package/src/saas/internal-api/requests/index.js +20 -18
- package/src/saas/internal-api/requests/models/create.request.model.js +33 -34
- package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -0
- package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/requestListCriteriaModel.js +17 -17
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +8 -8
- package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/requirements.api.js +51 -51
- package/src/saas/internal-api/requirements/api/requirements.service.js +153 -153
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +6 -6
- package/src/saas/internal-api/requirements/consts/consts.js +6 -6
- package/src/saas/internal-api/requirements/index.js +10 -10
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/policy.model.js +33 -33
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +116 -116
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
- package/src/saas/internal-api/thread-scheduler/runner.js +39 -39
- package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +31 -31
- package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +42 -42
- package/src/saas/internal-api/uploadFiles/consts.js +12 -12
- package/src/saas/internal-api/uploadFiles/index.js +3 -3
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +32 -32
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +97 -97
- package/src/saas/internal-api/users/api/users.api.js +115 -115
- package/src/saas/internal-api/users/api/users.service.js +203 -203
- package/src/saas/internal-api/users/index.js +16 -16
- package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
- package/src/saas/internal-api/users/models/notification.settings.model.js +12 -12
- package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +41 -41
- package/src/saas/internal-api/users/utils/util.js +39 -39
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/coi/coi.api.js +20 -20
- package/src/saas/openapi/coi/coi.service.js +13 -13
- package/src/saas/openapi/projects/projects.api.js +83 -83
- package/src/saas/openapi/projects/projects.service.js +64 -64
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
- package/src/saas/openapi/requests/models/update.request.model.js +35 -35
- package/src/saas/openapi/requests/requests.api.js +82 -82
- package/src/saas/openapi/requests/requests.service.js +70 -70
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +32 -32
- package/src/saas/openapi/requirements/requirements.service.js +37 -37
- package/src/saas/openapi/tabs/index.js +6 -6
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
- package/src/saas/openapi/tabs/tabs.api.js +27 -27
- package/src/saas/openapi/tabs/tabs.service.js +19 -19
- package/src/saas/openapi/users/user.model.js +10 -10
- package/src/saas/openapi/users/users.api.js +33 -33
- package/src/saas/openapi/users/users.service.js +41 -41
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
- package/.npmrc.bak +0 -2
- package/package.json.bak +0 -30
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
const requestHandler = require('./../requestHandlers');
|
|
2
|
-
|
|
3
|
-
const getRequestHandler = (url, apiKey, params = {}, headers = {}) => {
|
|
4
|
-
enrichApiKey(headers, apiKey);
|
|
5
|
-
return requestHandler.getRequestHandler(url, headers, params);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const postRequestHandler = (url, apiKey, body, headers = {}, params = {}) => {
|
|
9
|
-
enrichApiKey(headers, apiKey);
|
|
10
|
-
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const putRequestHandler = (url, apiKey, body, headers = {}, params = {}) => {
|
|
14
|
-
enrichApiKey(headers, apiKey);
|
|
15
|
-
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const putFileRequestHandler = (url, apiKey, fileData, headers = {}) => {
|
|
19
|
-
enrichApiKey(headers, apiKey);
|
|
20
|
-
return requestHandler.putFileRequestHandler(url, fileData, headers);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const patchRequestHandler = (url, apiKey, body, headers = {}) => {
|
|
24
|
-
enrichApiKey(headers, apiKey);
|
|
25
|
-
return requestHandler.patchRequestHandler(url, body, headers);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const deleteRequestHandler = (url, apiKey, headers = {}, params = {}, data = {}) => {
|
|
29
|
-
enrichApiKey(headers, apiKey);
|
|
30
|
-
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const enrichApiKey = (headers, apiKey) => {
|
|
34
|
-
headers['x-api-key'] = apiKey;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
module.exports = {
|
|
38
|
-
getRequestHandler,
|
|
39
|
-
postRequestHandler,
|
|
40
|
-
putRequestHandler,
|
|
41
|
-
putFileRequestHandler,
|
|
42
|
-
patchRequestHandler,
|
|
43
|
-
deleteRequestHandler
|
|
44
|
-
};
|
|
1
|
+
const requestHandler = require('./../requestHandlers');
|
|
2
|
+
|
|
3
|
+
const getRequestHandler = (url, apiKey, params = {}, headers = {}) => {
|
|
4
|
+
enrichApiKey(headers, apiKey);
|
|
5
|
+
return requestHandler.getRequestHandler(url, headers, params);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const postRequestHandler = (url, apiKey, body, headers = {}, params = {}) => {
|
|
9
|
+
enrichApiKey(headers, apiKey);
|
|
10
|
+
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const putRequestHandler = (url, apiKey, body, headers = {}, params = {}) => {
|
|
14
|
+
enrichApiKey(headers, apiKey);
|
|
15
|
+
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const putFileRequestHandler = (url, apiKey, fileData, headers = {}) => {
|
|
19
|
+
enrichApiKey(headers, apiKey);
|
|
20
|
+
return requestHandler.putFileRequestHandler(url, fileData, headers);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const patchRequestHandler = (url, apiKey, body, headers = {}) => {
|
|
24
|
+
enrichApiKey(headers, apiKey);
|
|
25
|
+
return requestHandler.patchRequestHandler(url, body, headers);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const deleteRequestHandler = (url, apiKey, headers = {}, params = {}, data = {}) => {
|
|
29
|
+
enrichApiKey(headers, apiKey);
|
|
30
|
+
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const enrichApiKey = (headers, apiKey) => {
|
|
34
|
+
headers['x-api-key'] = apiKey;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
getRequestHandler,
|
|
39
|
+
postRequestHandler,
|
|
40
|
+
putRequestHandler,
|
|
41
|
+
putFileRequestHandler,
|
|
42
|
+
patchRequestHandler,
|
|
43
|
+
deleteRequestHandler
|
|
44
|
+
};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
const requestHandler = require('./../requestHandlers');
|
|
2
|
-
|
|
3
|
-
const getRequestHandler = (url, params = {}, context = null, headers = {}) => {
|
|
4
|
-
enrichCookie(headers, context);
|
|
5
|
-
return requestHandler.getRequestHandler(url, headers, params);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const postRequestHandler = (url, body, context = null, headers = {}, params = {}) => {
|
|
9
|
-
enrichCookie(headers, context);
|
|
10
|
-
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const putRequestHandler = (url, body, context = null, headers = {}, params = {}) => {
|
|
14
|
-
enrichCookie(headers, context);
|
|
15
|
-
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const patchRequestHandler = (url, context, body, headers = {}) => {
|
|
19
|
-
enrichCookie(headers, context);
|
|
20
|
-
return requestHandler.patchRequestHandler(url, body, headers);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const deleteRequestHandler = (url, context = null, headers = {}, params = {}, data = {}) => {
|
|
24
|
-
enrichCookie(headers, context);
|
|
25
|
-
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const enrichCookie = (headers, context) => {
|
|
29
|
-
if (context) {
|
|
30
|
-
headers.Cookie = context;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
getRequestHandler,
|
|
36
|
-
postRequestHandler,
|
|
37
|
-
putRequestHandler,
|
|
38
|
-
patchRequestHandler,
|
|
39
|
-
deleteRequestHandler
|
|
40
|
-
};
|
|
1
|
+
const requestHandler = require('./../requestHandlers');
|
|
2
|
+
|
|
3
|
+
const getRequestHandler = (url, params = {}, context = null, headers = {}) => {
|
|
4
|
+
enrichCookie(headers, context);
|
|
5
|
+
return requestHandler.getRequestHandler(url, headers, params);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const postRequestHandler = (url, body, context = null, headers = {}, params = {}) => {
|
|
9
|
+
enrichCookie(headers, context);
|
|
10
|
+
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const putRequestHandler = (url, body, context = null, headers = {}, params = {}) => {
|
|
14
|
+
enrichCookie(headers, context);
|
|
15
|
+
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const patchRequestHandler = (url, context, body, headers = {}) => {
|
|
19
|
+
enrichCookie(headers, context);
|
|
20
|
+
return requestHandler.patchRequestHandler(url, body, headers);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const deleteRequestHandler = (url, context = null, headers = {}, params = {}, data = {}) => {
|
|
24
|
+
enrichCookie(headers, context);
|
|
25
|
+
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const enrichCookie = (headers, context) => {
|
|
29
|
+
if (context) {
|
|
30
|
+
headers.Cookie = context;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
getRequestHandler,
|
|
36
|
+
postRequestHandler,
|
|
37
|
+
putRequestHandler,
|
|
38
|
+
patchRequestHandler,
|
|
39
|
+
deleteRequestHandler
|
|
40
|
+
};
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
const requestHandler = require('../requestHandlers');
|
|
2
|
-
const env = require('../../../env');
|
|
3
|
-
const { crossServiceCommunicationAuthKey } = env.getEnv();
|
|
4
|
-
|
|
5
|
-
const defaultApiKey = crossServiceCommunicationAuthKey;
|
|
6
|
-
|
|
7
|
-
const getRequestHandler = (url, params = {}, headers = {}) => {
|
|
8
|
-
enrichAuthKey(headers);
|
|
9
|
-
return requestHandler.getRequestHandler(url, headers, params);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const postRequestHandler = (url, body, headers = {}, params = {}) => {
|
|
13
|
-
enrichAuthKey(headers);
|
|
14
|
-
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const putRequestHandler = (url, body, headers = {}, params = {}) => {
|
|
18
|
-
enrichAuthKey(headers, defaultApiKey);
|
|
19
|
-
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const putFileRequestHandler = (url, fileData, headers = {}) => {
|
|
23
|
-
enrichAuthKey(headers);
|
|
24
|
-
return requestHandler.putFileRequestHandler(url, fileData, headers);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const patchRequestHandler = (url, body, headers = {}) => {
|
|
28
|
-
enrichAuthKey(headers);
|
|
29
|
-
return requestHandler.patchRequestHandler(url, body, headers);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const deleteRequestHandler = (url, headers = {}, params = {}, data = {}) => {
|
|
33
|
-
enrichAuthKey(headers);
|
|
34
|
-
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const enrichAuthKey = headers => {
|
|
38
|
-
headers['x-jcsc-auth'] = defaultApiKey;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
module.exports = {
|
|
42
|
-
getRequestHandler,
|
|
43
|
-
postRequestHandler,
|
|
44
|
-
putRequestHandler,
|
|
45
|
-
putFileRequestHandler,
|
|
46
|
-
patchRequestHandler,
|
|
47
|
-
deleteRequestHandler
|
|
48
|
-
};
|
|
1
|
+
const requestHandler = require('../requestHandlers');
|
|
2
|
+
const env = require('../../../env');
|
|
3
|
+
const { crossServiceCommunicationAuthKey } = env.getEnv();
|
|
4
|
+
|
|
5
|
+
const defaultApiKey = crossServiceCommunicationAuthKey;
|
|
6
|
+
|
|
7
|
+
const getRequestHandler = (url, params = {}, headers = {}) => {
|
|
8
|
+
enrichAuthKey(headers);
|
|
9
|
+
return requestHandler.getRequestHandler(url, headers, params);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const postRequestHandler = (url, body, headers = {}, params = {}) => {
|
|
13
|
+
enrichAuthKey(headers);
|
|
14
|
+
return requestHandler.postRequestHandler(url, body, headers, params);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const putRequestHandler = (url, body, headers = {}, params = {}) => {
|
|
18
|
+
enrichAuthKey(headers, defaultApiKey);
|
|
19
|
+
return requestHandler.putRequestHandler(url, body, headers, params);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const putFileRequestHandler = (url, fileData, headers = {}) => {
|
|
23
|
+
enrichAuthKey(headers);
|
|
24
|
+
return requestHandler.putFileRequestHandler(url, fileData, headers);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const patchRequestHandler = (url, body, headers = {}) => {
|
|
28
|
+
enrichAuthKey(headers);
|
|
29
|
+
return requestHandler.patchRequestHandler(url, body, headers);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const deleteRequestHandler = (url, headers = {}, params = {}, data = {}) => {
|
|
33
|
+
enrichAuthKey(headers);
|
|
34
|
+
return requestHandler.deleteRequestHandler(url, headers, params, data);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const enrichAuthKey = headers => {
|
|
38
|
+
headers['x-jcsc-auth'] = defaultApiKey;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
getRequestHandler,
|
|
43
|
+
postRequestHandler,
|
|
44
|
+
putRequestHandler,
|
|
45
|
+
putFileRequestHandler,
|
|
46
|
+
patchRequestHandler,
|
|
47
|
+
deleteRequestHandler
|
|
48
|
+
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
const axios = require('axios');
|
|
2
|
-
const axiosFile = require('axios-file');
|
|
3
|
-
|
|
4
|
-
const errorValidation = require('../validations/errorValidation');
|
|
5
|
-
|
|
6
|
-
const getRequestHandler = async (url, headers = {}, params = {}) => {
|
|
7
|
-
try {
|
|
8
|
-
const response = await axios.get(url, { params, headers });
|
|
9
|
-
return response;
|
|
10
|
-
} catch (error) {
|
|
11
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
12
|
-
return error.response;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const postRequestHandler = async (url, body, headers = {}, params = {}) => {
|
|
17
|
-
try {
|
|
18
|
-
const response = await axios.post(url, body, { headers, params });
|
|
19
|
-
return response;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
22
|
-
return error.response;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const putRequestHandler = async (url, body, headers = {}, params = {}) => {
|
|
27
|
-
try {
|
|
28
|
-
const response = await axios.put(url, body, { headers, params });
|
|
29
|
-
return response;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
32
|
-
return error.response;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const putFileRequestHandler = async (url, fileData, headers = {}) => {
|
|
37
|
-
try {
|
|
38
|
-
const response = await axiosFile({
|
|
39
|
-
url,
|
|
40
|
-
method: 'put',
|
|
41
|
-
headers,
|
|
42
|
-
data: { file: fileData }
|
|
43
|
-
});
|
|
44
|
-
return response;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
47
|
-
return error.response;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const patchRequestHandler = async (url, body, headers = {}) => {
|
|
52
|
-
try {
|
|
53
|
-
const response = await axios.patch(url, body, { headers });
|
|
54
|
-
return response;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
57
|
-
return error.response;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const deleteRequestHandler = async (url, headers = {}, params = {}, data = {}) => {
|
|
62
|
-
try {
|
|
63
|
-
const response = await axios.delete(url, { params, headers, data });
|
|
64
|
-
return response;
|
|
65
|
-
} catch (error) {
|
|
66
|
-
errorValidation.validateClientErrorResponseStatus(error);
|
|
67
|
-
return error.response;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
getRequestHandler,
|
|
73
|
-
postRequestHandler,
|
|
74
|
-
putRequestHandler,
|
|
75
|
-
putFileRequestHandler,
|
|
76
|
-
patchRequestHandler,
|
|
77
|
-
deleteRequestHandler
|
|
78
|
-
};
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
const axiosFile = require('axios-file');
|
|
3
|
+
|
|
4
|
+
const errorValidation = require('../validations/errorValidation');
|
|
5
|
+
|
|
6
|
+
const getRequestHandler = async (url, headers = {}, params = {}) => {
|
|
7
|
+
try {
|
|
8
|
+
const response = await axios.get(url, { params, headers });
|
|
9
|
+
return response;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
12
|
+
return error.response;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const postRequestHandler = async (url, body, headers = {}, params = {}) => {
|
|
17
|
+
try {
|
|
18
|
+
const response = await axios.post(url, body, { headers, params });
|
|
19
|
+
return response;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
22
|
+
return error.response;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const putRequestHandler = async (url, body, headers = {}, params = {}) => {
|
|
27
|
+
try {
|
|
28
|
+
const response = await axios.put(url, body, { headers, params });
|
|
29
|
+
return response;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
32
|
+
return error.response;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const putFileRequestHandler = async (url, fileData, headers = {}) => {
|
|
37
|
+
try {
|
|
38
|
+
const response = await axiosFile({
|
|
39
|
+
url,
|
|
40
|
+
method: 'put',
|
|
41
|
+
headers,
|
|
42
|
+
data: { file: fileData }
|
|
43
|
+
});
|
|
44
|
+
return response;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
47
|
+
return error.response;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const patchRequestHandler = async (url, body, headers = {}) => {
|
|
52
|
+
try {
|
|
53
|
+
const response = await axios.patch(url, body, { headers });
|
|
54
|
+
return response;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
57
|
+
return error.response;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const deleteRequestHandler = async (url, headers = {}, params = {}, data = {}) => {
|
|
62
|
+
try {
|
|
63
|
+
const response = await axios.delete(url, { params, headers, data });
|
|
64
|
+
return response;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
errorValidation.validateClientErrorResponseStatus(error);
|
|
67
|
+
return error.response;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
getRequestHandler,
|
|
73
|
+
postRequestHandler,
|
|
74
|
+
putRequestHandler,
|
|
75
|
+
putFileRequestHandler,
|
|
76
|
+
patchRequestHandler,
|
|
77
|
+
deleteRequestHandler
|
|
78
|
+
};
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
const { getEnv, getSystemUserIdentity } = require('../../env');
|
|
2
|
-
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
3
|
-
const auditConfigs = require('../../defaults/configs/auditConfigs');
|
|
4
|
-
|
|
5
|
-
const { credentials } = getEnv();
|
|
6
|
-
|
|
7
|
-
const complianceStatuses = {
|
|
8
|
-
complaint: 'complaint',
|
|
9
|
-
notCompliant: 'notCompliant',
|
|
10
|
-
expired: 'expired',
|
|
11
|
-
aboutToExpired: 'aboutToExpired',
|
|
12
|
-
awaitingNewCoi: 'awaitingNewCoi'
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const isReaudit = (contractorId, context) => {
|
|
16
|
-
return auditApi.isReaudit(contractorId, context);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getAuditorId = () => {
|
|
20
|
-
const auditorIdentity = getSystemUserIdentity(credentials.auditorUser);
|
|
21
|
-
return auditorIdentity.id;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const getAuditMetadata = async (
|
|
25
|
-
auditorContext,
|
|
26
|
-
accountId,
|
|
27
|
-
projectId,
|
|
28
|
-
requirementId,
|
|
29
|
-
recordId,
|
|
30
|
-
{
|
|
31
|
-
isProjectOnboarding = false,
|
|
32
|
-
shouldSendNotificationToPM = false
|
|
33
|
-
} = {}) => {
|
|
34
|
-
const metadata = {
|
|
35
|
-
accountId,
|
|
36
|
-
projectId,
|
|
37
|
-
requirementId,
|
|
38
|
-
contractorId: recordId,
|
|
39
|
-
isProjectOnboarding,
|
|
40
|
-
shouldSendNotificationToPM
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const isReauditResponse = await isReaudit(recordId, auditorContext);
|
|
44
|
-
metadata.isReaudit = isReauditResponse.data.isReaudit;
|
|
45
|
-
|
|
46
|
-
const recordDetailsResponse = await auditApi.getAuditRecordModel(recordId, auditorContext);
|
|
47
|
-
const recordDetails = recordDetailsResponse.data;
|
|
48
|
-
|
|
49
|
-
metadata.certificateId = recordDetails.certificateDetails.certificateuploadId;
|
|
50
|
-
metadata.auditDates = {
|
|
51
|
-
contractorId: recordId,
|
|
52
|
-
contractorDateModified: recordDetails.dateModified,
|
|
53
|
-
dateStartedAudit: recordDetailsResponse.dateStartedAudit,
|
|
54
|
-
contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
|
|
55
|
-
contractCreateDate: recordDetails.contractCreateDate
|
|
56
|
-
};
|
|
57
|
-
metadata.auditId = recordDetails.auditId;
|
|
58
|
-
|
|
59
|
-
metadata.auditorId = await getAuditorId();
|
|
60
|
-
|
|
61
|
-
return metadata;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const getAuditConfigByStatus = (status, { glPolicyNumber } = {}) => {
|
|
65
|
-
switch (status) {
|
|
66
|
-
case complianceStatuses.notCompliant:
|
|
67
|
-
case complianceStatuses.awaitingNewCoi:
|
|
68
|
-
return auditConfigs.getNotCompliantConfig({ glPolicyNumber });
|
|
69
|
-
case complianceStatuses.expired:
|
|
70
|
-
return auditConfigs.getExpiredConfig({ glPolicyNumber });
|
|
71
|
-
case complianceStatuses.aboutToExpired:
|
|
72
|
-
return auditConfigs.getAboutExpiredConfig({ glPolicyNumber });
|
|
73
|
-
default:
|
|
74
|
-
return auditConfigs.getCompliantAuditConfig({ glPolicyNumber });
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
module.exports = {
|
|
79
|
-
getAuditMetadata,
|
|
80
|
-
isReaudit,
|
|
81
|
-
getAuditConfigByStatus,
|
|
82
|
-
complianceStatuses
|
|
83
|
-
};
|
|
1
|
+
const { getEnv, getSystemUserIdentity } = require('../../env');
|
|
2
|
+
const auditApi = require('../../saas/internal-api/compliance/api/audit/audit.api');
|
|
3
|
+
const auditConfigs = require('../../defaults/configs/auditConfigs');
|
|
4
|
+
|
|
5
|
+
const { credentials } = getEnv();
|
|
6
|
+
|
|
7
|
+
const complianceStatuses = {
|
|
8
|
+
complaint: 'complaint',
|
|
9
|
+
notCompliant: 'notCompliant',
|
|
10
|
+
expired: 'expired',
|
|
11
|
+
aboutToExpired: 'aboutToExpired',
|
|
12
|
+
awaitingNewCoi: 'awaitingNewCoi'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const isReaudit = (contractorId, context) => {
|
|
16
|
+
return auditApi.isReaudit(contractorId, context);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getAuditorId = () => {
|
|
20
|
+
const auditorIdentity = getSystemUserIdentity(credentials.auditorUser);
|
|
21
|
+
return auditorIdentity.id;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getAuditMetadata = async (
|
|
25
|
+
auditorContext,
|
|
26
|
+
accountId,
|
|
27
|
+
projectId,
|
|
28
|
+
requirementId,
|
|
29
|
+
recordId,
|
|
30
|
+
{
|
|
31
|
+
isProjectOnboarding = false,
|
|
32
|
+
shouldSendNotificationToPM = false
|
|
33
|
+
} = {}) => {
|
|
34
|
+
const metadata = {
|
|
35
|
+
accountId,
|
|
36
|
+
projectId,
|
|
37
|
+
requirementId,
|
|
38
|
+
contractorId: recordId,
|
|
39
|
+
isProjectOnboarding,
|
|
40
|
+
shouldSendNotificationToPM
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const isReauditResponse = await isReaudit(recordId, auditorContext);
|
|
44
|
+
metadata.isReaudit = isReauditResponse.data.isReaudit;
|
|
45
|
+
|
|
46
|
+
const recordDetailsResponse = await auditApi.getAuditRecordModel(recordId, auditorContext);
|
|
47
|
+
const recordDetails = recordDetailsResponse.data;
|
|
48
|
+
|
|
49
|
+
metadata.certificateId = recordDetails.certificateDetails.certificateuploadId;
|
|
50
|
+
metadata.auditDates = {
|
|
51
|
+
contractorId: recordId,
|
|
52
|
+
contractorDateModified: recordDetails.dateModified,
|
|
53
|
+
dateStartedAudit: recordDetailsResponse.dateStartedAudit,
|
|
54
|
+
contractorOverrideDateModified: recordDetails.contractorOverrideDateModified,
|
|
55
|
+
contractCreateDate: recordDetails.contractCreateDate
|
|
56
|
+
};
|
|
57
|
+
metadata.auditId = recordDetails.auditId;
|
|
58
|
+
|
|
59
|
+
metadata.auditorId = await getAuditorId();
|
|
60
|
+
|
|
61
|
+
return metadata;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getAuditConfigByStatus = (status, { glPolicyNumber } = {}) => {
|
|
65
|
+
switch (status) {
|
|
66
|
+
case complianceStatuses.notCompliant:
|
|
67
|
+
case complianceStatuses.awaitingNewCoi:
|
|
68
|
+
return auditConfigs.getNotCompliantConfig({ glPolicyNumber });
|
|
69
|
+
case complianceStatuses.expired:
|
|
70
|
+
return auditConfigs.getExpiredConfig({ glPolicyNumber });
|
|
71
|
+
case complianceStatuses.aboutToExpired:
|
|
72
|
+
return auditConfigs.getAboutExpiredConfig({ glPolicyNumber });
|
|
73
|
+
default:
|
|
74
|
+
return auditConfigs.getCompliantAuditConfig({ glPolicyNumber });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
module.exports = {
|
|
79
|
+
getAuditMetadata,
|
|
80
|
+
isReaudit,
|
|
81
|
+
getAuditConfigByStatus,
|
|
82
|
+
complianceStatuses
|
|
83
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const isUIConfig = (config, attributesConvertor) => {
|
|
2
|
-
const converterKeys = Object.keys(attributesConvertor);
|
|
3
|
-
const configKeys = Object.keys(config);
|
|
4
|
-
|
|
5
|
-
return converterKeys.some(key => configKeys.includes(key));
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const objectConvertor = (config, attributesConvertor) => {
|
|
9
|
-
const covertConfig = {};
|
|
10
|
-
|
|
11
|
-
for (const field in config) {
|
|
12
|
-
const attributes = attributesConvertor[field];
|
|
13
|
-
covertConfig[attributes] = JSON.parse(config[field]);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return covertConfig;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
isUIConfig,
|
|
21
|
-
objectConvertor
|
|
22
|
-
};
|
|
1
|
+
const isUIConfig = (config, attributesConvertor) => {
|
|
2
|
+
const converterKeys = Object.keys(attributesConvertor);
|
|
3
|
+
const configKeys = Object.keys(config);
|
|
4
|
+
|
|
5
|
+
return converterKeys.some(key => configKeys.includes(key));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const objectConvertor = (config, attributesConvertor) => {
|
|
9
|
+
const covertConfig = {};
|
|
10
|
+
|
|
11
|
+
for (const field in config) {
|
|
12
|
+
const attributes = attributesConvertor[field];
|
|
13
|
+
covertConfig[attributes] = JSON.parse(config[field]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return covertConfig;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
isUIConfig,
|
|
21
|
+
objectConvertor
|
|
22
|
+
};
|