@getjones/test-infra 5.2.10 → 5.2.11
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/eslint.config.mjs +156 -156
- package/package.json +43 -42
- package/src/common/commonFlows/auth/auth.js +95 -95
- package/src/common/commonFlows/index.js +5 -5
- package/src/common/commonFlows/records/records.js +448 -423
- package/src/common/commonFlows/users/users.js +15 -15
- package/src/common/consts/accountSettings.js +112 -112
- package/src/common/consts/activationStatuses.js +6 -6
- package/src/common/consts/analysisStatuses.js +7 -7
- package/src/common/consts/autocomplete.js +10 -10
- package/src/common/consts/constantsForRecordsSortingAndFilters.js +49 -49
- package/src/common/consts/dashboardCharts.js +18 -18
- package/src/common/consts/homepage/AttentionTab.js +6 -6
- package/src/common/consts/homepage/sortOptions.js +19 -19
- package/src/common/consts/projectSettings.js +28 -28
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/requirementActions.js +10 -10
- package/src/common/consts/s3FileTypes.js +12 -12
- package/src/common/consts/userRoles.js +21 -21
- package/src/common/consts/userTypes.js +16 -16
- package/src/common/errorCodes.js +12 -11
- package/src/common/httpResponseStatusCodes.json +19 -19
- package/src/common/httpResponseTypes.json +2 -2
- package/src/common/requests/apiKeyAuth/requests.js +45 -45
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/internalAuth/requests.js +48 -48
- package/src/common/requests/requestHandlers.js +112 -112
- package/src/common/utils/arrayUtils.js +19 -19
- package/src/common/utils/complianceUtil.js +114 -114
- 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 +102 -102
- package/src/common/utils/timeUtils.js +195 -195
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/attributes.js +170 -170
- package/src/defaults/configs/auditConfigs.js +129 -129
- package/src/defaults/configs/coverage.js +144 -144
- package/src/defaults/configs/polices.js +28 -28
- package/src/defaults/configs/requirement.js +218 -218
- package/src/defaults/index.js +7 -7
- package/src/env.js +58 -58
- package/src/factory/globalRecord/globalRecord.js +43 -43
- package/src/factory/index.js +8 -8
- package/src/factory/records/records.js +295 -295
- package/src/factory/users/users.js +70 -70
- package/src/index.js +114 -114
- package/src/reporters/mochaReporter.js +273 -273
- package/src/resources/agreements/agreement.pdf +0 -0
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.api.js +152 -152
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.service.js +576 -576
- package/src/saas/internal-api/accountDirectory/consts/accountDirectory.consts.js +75 -75
- package/src/saas/internal-api/accountDirectory/index.js +5 -5
- package/src/saas/internal-api/accountDirectory/models/accountDirectory.models.js +172 -172
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +48 -48
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +104 -104
- 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 +60 -60
- package/src/saas/internal-api/accounts/api/emailCustomization/consts.js +8 -8
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +54 -54
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +67 -67
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +58 -58
- package/src/saas/internal-api/accounts/consts/consts.js +8 -8
- 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 +110 -110
- package/src/saas/internal-api/accounts/utils/utils.js +60 -60
- package/src/saas/internal-api/agreement/api/agreement.api.js +39 -39
- package/src/saas/internal-api/agreement/api/agreement.service.js +121 -121
- package/src/saas/internal-api/agreement/consts/consts.js +11 -11
- package/src/saas/internal-api/agreement/index.js +12 -12
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
- package/src/saas/internal-api/agreement/models/createAgreementByAuditorModel.js +11 -11
- package/src/saas/internal-api/agreement/models/createAgreementByPMModel.js +13 -13
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +49 -49
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +121 -121
- package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +40 -40
- package/src/saas/internal-api/auditCustomerRules/index.js +7 -7
- package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +55 -55
- package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +70 -70
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +116 -116
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +32 -32
- package/src/saas/internal-api/auditorComments/api/auditor.comments.api.js +20 -20
- package/src/saas/internal-api/auditorComments/api/auditor.comments.service.js +27 -27
- package/src/saas/internal-api/auditorComments/consts/auditor.comment.js +16 -16
- package/src/saas/internal-api/auditorComments/index.js +5 -5
- package/src/saas/internal-api/auditorComments/models/auditor.comment.model.js +40 -40
- package/src/saas/internal-api/auth/api/auth.api.js +78 -78
- package/src/saas/internal-api/auth/api/auth.service.js +172 -172
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +76 -76
- package/src/saas/internal-api/coi/api/coi.service.js +104 -104
- package/src/saas/internal-api/coi/consts/duplicateHandling.js +7 -7
- package/src/saas/internal-api/coi/consts/hashes.js +5 -5
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +3 -3
- package/src/saas/internal-api/coi/index.js +16 -16
- package/src/saas/internal-api/coi/models/Combine.last.two.cois.model.js +25 -25
- package/src/saas/internal-api/coi/models/submit.coi.batch.model.js +23 -23
- package/src/saas/internal-api/coi/models/submit.coi.model.js +23 -23
- package/src/saas/internal-api/coi/utils/utils.js +185 -185
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.api.js +12 -12
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.service.js +14 -14
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.api.js +63 -63
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.service.js +99 -99
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +124 -124
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +390 -390
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.api.js +32 -32
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.service.js +73 -73
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +12 -12
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +7 -7
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +46 -46
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +86 -86
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +300 -300
- package/src/saas/internal-api/compliance/consts/audit.js +130 -130
- package/src/saas/internal-api/compliance/consts/overrideGapRequest/override.gap.request.js +7 -7
- package/src/saas/internal-api/compliance/index.js +41 -41
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +109 -109
- package/src/saas/internal-api/compliance/models/overrideGapRequest/override.gap.request.model.js +16 -16
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +112 -112
- package/src/saas/internal-api/compliance/utils/auditUtil.js +308 -308
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +45 -45
- package/src/saas/internal-api/contractors/api/contractors.service.js +482 -482
- 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 +11 -11
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +73 -73
- package/src/saas/internal-api/contractors/models/link.request.model.js +10 -10
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +29 -29
- package/src/saas/internal-api/contractors/utils.js +25 -25
- package/src/saas/internal-api/customTags/api/customTags.api.js +47 -47
- package/src/saas/internal-api/customTags/api/customTags.service.js +96 -96
- package/src/saas/internal-api/customTags/index.js +4 -4
- package/src/saas/internal-api/customTags/models/customTagsModels.js +17 -17
- 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 +178 -178
- package/src/saas/internal-api/dbEmails/consts/consts.js +66 -66
- 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/fileScan/api/file.scan.api.js +14 -14
- package/src/saas/internal-api/fileScan/api/file.scan.service.js +35 -35
- package/src/saas/internal-api/fileScan/index.js +3 -3
- package/src/saas/internal-api/fileScan/models/update.scan.status.model.js +13 -13
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +112 -112
- 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/notificationCenter/api/notification.center.api.js +32 -32
- package/src/saas/internal-api/notificationCenter/api/notification.center.service.js +49 -49
- package/src/saas/internal-api/notificationCenter/consts.js +9 -9
- package/src/saas/internal-api/notificationCenter/index.js +4 -4
- package/src/saas/internal-api/outlook/api/outlook.api.js +14 -14
- package/src/saas/internal-api/outlook/api/outlook.service.js +14 -14
- package/src/saas/internal-api/outlook/index.js +3 -3
- package/src/saas/internal-api/policyFile/api/policy.file.api.js +43 -43
- package/src/saas/internal-api/policyFile/api/policy.file.service.js +117 -117
- package/src/saas/internal-api/policyFile/consts.js +21 -21
- package/src/saas/internal-api/policyFile/index.js +11 -11
- package/src/saas/internal-api/policyFile/models/create.policy.file.model.js +11 -11
- package/src/saas/internal-api/policyFile/models/set.publish.flag.to.policy.model.js +13 -13
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +77 -77
- 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 +48 -48
- package/src/saas/internal-api/projects/utils/utils.js +159 -159
- package/src/saas/internal-api/recordHub/api/record.hub.api.js +20 -20
- package/src/saas/internal-api/recordHub/api/record.hub.service.js +86 -86
- package/src/saas/internal-api/recordHub/index.js +3 -3
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +56 -56
- 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/relatedDocs/api/related.docs.api.js +98 -98
- package/src/saas/internal-api/relatedDocs/api/related.docs.service.js +180 -180
- package/src/saas/internal-api/relatedDocs/index.js +4 -4
- package/src/saas/internal-api/relatedDocs/models/related.doc.model.js +36 -36
- package/src/saas/internal-api/reports/api/reports.api.js +56 -56
- package/src/saas/internal-api/reports/api/reports.service.js +68 -68
- package/src/saas/internal-api/reports/consts/consts.js +71 -71
- 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 +132 -132
- package/src/saas/internal-api/requests/api/requests.service.js +315 -315
- package/src/saas/internal-api/requests/index.js +21 -21
- package/src/saas/internal-api/requests/models/create.request.model.js +39 -39
- package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -18
- 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/homepageRequestCriteriaModel.js +19 -19
- 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 +16 -16
- 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/lease/lease.api.js +74 -56
- package/src/saas/internal-api/requirements/api/lease/lease.service.js +167 -123
- package/src/saas/internal-api/requirements/api/requirements.api.js +65 -65
- package/src/saas/internal-api/requirements/api/requirements.service.js +198 -198
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +8 -8
- package/src/saas/internal-api/requirements/consts/consts.js +20 -15
- package/src/saas/internal-api/requirements/index.js +22 -21
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/extraction.request.model.js +16 -16
- package/src/saas/internal-api/requirements/models/policy.model.js +35 -35
- package/src/saas/internal-api/requirements/models/tab.extraction.request.model.js +14 -0
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +129 -129
- package/src/saas/internal-api/sampleCoi/api/sample.coi.api.js +15 -15
- package/src/saas/internal-api/sampleCoi/api/sample.coi.service.js +48 -48
- package/src/saas/internal-api/sampleCoi/consts/consts.js +22 -22
- package/src/saas/internal-api/sampleCoi/index.js +4 -4
- 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/tableOfContents/api/table.of.contents.api.js +37 -37
- package/src/saas/internal-api/tableOfContents/api/table.of.contents.service.js +19 -19
- package/src/saas/internal-api/tableOfContents/index.js +3 -3
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +60 -60
- 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 +69 -69
- package/src/saas/internal-api/thread-scheduler/schedulerJobs.js +8 -8
- package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +49 -49
- package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +162 -162
- package/src/saas/internal-api/uploadFiles/consts.js +36 -36
- package/src/saas/internal-api/uploadFiles/index.js +5 -5
- package/src/saas/internal-api/uploadFiles/utils.js +34 -34
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +38 -38
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +109 -109
- package/src/saas/internal-api/users/api/users.api.js +158 -158
- package/src/saas/internal-api/users/api/users.service.js +363 -363
- package/src/saas/internal-api/users/index.js +17 -17
- 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 +14 -14
- package/src/saas/internal-api/users/models/tenant.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +43 -43
- package/src/saas/internal-api/users/utils/util.js +49 -49
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +26 -26
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +19 -19
- 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 +35 -35
- package/src/saas/openapi/coi/coi.service.js +53 -53
- package/src/saas/openapi/projects/projects.api.js +83 -83
- package/src/saas/openapi/projects/projects.service.js +71 -71
- package/src/saas/openapi/relatedDocs/related.docs.api.js +30 -30
- package/src/saas/openapi/relatedDocs/related.docs.service.js +55 -55
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +42 -42
- package/src/saas/openapi/requests/models/update.request.model.js +37 -37
- package/src/saas/openapi/requests/requests.api.js +93 -93
- package/src/saas/openapi/requests/requests.service.js +94 -94
- 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 +41 -41
- package/src/saas/openapi/requirements/requirements.service.js +55 -55
- 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 +51 -51
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
const coiApi = require('./coi.api');
|
|
2
|
-
const { SubmitCoiModel } = require('../models/submit.coi.model');
|
|
3
|
-
const { SubmitCoiBatchModel } = require('../models/submit.coi.batch.model');
|
|
4
|
-
const { CombineLastTwoCOIsModel } = require('../models/Combine.last.two.cois.model');
|
|
5
|
-
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
6
|
-
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
7
|
-
|
|
8
|
-
const uploadToS3 = async (contractorId, fileData, { shouldExpectError } = {}) => {
|
|
9
|
-
try {
|
|
10
|
-
const uploadToS3Response = await coiApi.uploadToS3(contractorId, fileData);
|
|
11
|
-
return uploadToS3Response;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
if (shouldExpectError) {
|
|
14
|
-
return error.response;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
throw new Error('Failed to upload file to S3');
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const submitCoi = submitCoiModel => {
|
|
22
|
-
validateType(submitCoiModel, SubmitCoiModel);
|
|
23
|
-
return coiApi.submitCoi(submitCoiModel);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const submitCoiByUserContext = (submitCoiModel, userContext) => {
|
|
27
|
-
validateType(submitCoiModel, SubmitCoiModel);
|
|
28
|
-
return coiApi.submitCoiByUserContext(submitCoiModel, userContext);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const submitCoiBatch = async (submitCoiBatchModel, context, { expectError } = {}) => {
|
|
32
|
-
validateType(submitCoiBatchModel, SubmitCoiBatchModel);
|
|
33
|
-
const response = await coiApi.submitCoiBatch(submitCoiBatchModel, context);
|
|
34
|
-
|
|
35
|
-
if (expectError) {
|
|
36
|
-
return response;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
40
|
-
throw Error(`Failed to submit COI batch. Status code: ${response.status}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return response.data;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
47
|
-
return coiApi.getCoiPreSignedUrl(coiFileName, context);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const getCoiPresignedUrlBeforeMerge = async (fileId, context, { expectError } = {}) => {
|
|
51
|
-
const response = await coiApi.getCoiPresignedUrlBeforeMerge(fileId, context);
|
|
52
|
-
|
|
53
|
-
if (expectError) {
|
|
54
|
-
return response;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
58
|
-
throw new Error(`Failed to get presigned url for file before merge with fileId: ${fileId}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return response.data.preSignedUrl;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const getCoiHashes = recordId => {
|
|
65
|
-
return coiApi.getCoiHashes(recordId);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const combineLastTwoCOIs = async (combineLastTwoCOIsModel, auditorContext) => {
|
|
69
|
-
validateType(combineLastTwoCOIsModel, CombineLastTwoCOIsModel);
|
|
70
|
-
const response = await coiApi.combineLastTwoCOIs(combineLastTwoCOIsModel, auditorContext);
|
|
71
|
-
|
|
72
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
73
|
-
throw new Error(`Failed to combine last two COIs for recordId ${combineLastTwoCOIsModel.contractorId}`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return response;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const getCombinedCoiByRecordId = (recordId, context) => {
|
|
80
|
-
return coiApi.getCombinedCoiByRecordId(recordId, context);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const downloadProjectCoisInBulk = async (projectId, context, { expectError } = {}) => {
|
|
84
|
-
const response = await coiApi.downloadProjectCoisInBulk(projectId, context);
|
|
85
|
-
|
|
86
|
-
if (!expectError && response.status !== httpResponseStatusCodes.ACCEPTED) {
|
|
87
|
-
throw new Error(`Failed to trigger bulk COI download for project ${projectId}. Status code: ${response.status}`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return response;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
module.exports = {
|
|
94
|
-
uploadToS3,
|
|
95
|
-
submitCoi,
|
|
96
|
-
submitCoiByUserContext,
|
|
97
|
-
submitCoiBatch,
|
|
98
|
-
getCoiPreSignedUrl,
|
|
99
|
-
getCoiPresignedUrlBeforeMerge,
|
|
100
|
-
getCoiHashes,
|
|
101
|
-
combineLastTwoCOIs,
|
|
102
|
-
getCombinedCoiByRecordId,
|
|
103
|
-
downloadProjectCoisInBulk
|
|
104
|
-
};
|
|
1
|
+
const coiApi = require('./coi.api');
|
|
2
|
+
const { SubmitCoiModel } = require('../models/submit.coi.model');
|
|
3
|
+
const { SubmitCoiBatchModel } = require('../models/submit.coi.batch.model');
|
|
4
|
+
const { CombineLastTwoCOIsModel } = require('../models/Combine.last.two.cois.model');
|
|
5
|
+
const { validateType } = require('../../../../common/validations/typeValidations');
|
|
6
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
7
|
+
|
|
8
|
+
const uploadToS3 = async (contractorId, fileData, { shouldExpectError } = {}) => {
|
|
9
|
+
try {
|
|
10
|
+
const uploadToS3Response = await coiApi.uploadToS3(contractorId, fileData);
|
|
11
|
+
return uploadToS3Response;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
if (shouldExpectError) {
|
|
14
|
+
return error.response;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
throw new Error('Failed to upload file to S3');
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const submitCoi = submitCoiModel => {
|
|
22
|
+
validateType(submitCoiModel, SubmitCoiModel);
|
|
23
|
+
return coiApi.submitCoi(submitCoiModel);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const submitCoiByUserContext = (submitCoiModel, userContext) => {
|
|
27
|
+
validateType(submitCoiModel, SubmitCoiModel);
|
|
28
|
+
return coiApi.submitCoiByUserContext(submitCoiModel, userContext);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const submitCoiBatch = async (submitCoiBatchModel, context, { expectError } = {}) => {
|
|
32
|
+
validateType(submitCoiBatchModel, SubmitCoiBatchModel);
|
|
33
|
+
const response = await coiApi.submitCoiBatch(submitCoiBatchModel, context);
|
|
34
|
+
|
|
35
|
+
if (expectError) {
|
|
36
|
+
return response;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
40
|
+
throw Error(`Failed to submit COI batch. Status code: ${response.status}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return response.data;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
47
|
+
return coiApi.getCoiPreSignedUrl(coiFileName, context);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getCoiPresignedUrlBeforeMerge = async (fileId, context, { expectError } = {}) => {
|
|
51
|
+
const response = await coiApi.getCoiPresignedUrlBeforeMerge(fileId, context);
|
|
52
|
+
|
|
53
|
+
if (expectError) {
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
58
|
+
throw new Error(`Failed to get presigned url for file before merge with fileId: ${fileId}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return response.data.preSignedUrl;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getCoiHashes = recordId => {
|
|
65
|
+
return coiApi.getCoiHashes(recordId);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const combineLastTwoCOIs = async (combineLastTwoCOIsModel, auditorContext) => {
|
|
69
|
+
validateType(combineLastTwoCOIsModel, CombineLastTwoCOIsModel);
|
|
70
|
+
const response = await coiApi.combineLastTwoCOIs(combineLastTwoCOIsModel, auditorContext);
|
|
71
|
+
|
|
72
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
73
|
+
throw new Error(`Failed to combine last two COIs for recordId ${combineLastTwoCOIsModel.contractorId}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return response;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const getCombinedCoiByRecordId = (recordId, context) => {
|
|
80
|
+
return coiApi.getCombinedCoiByRecordId(recordId, context);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const downloadProjectCoisInBulk = async (projectId, context, { expectError } = {}) => {
|
|
84
|
+
const response = await coiApi.downloadProjectCoisInBulk(projectId, context);
|
|
85
|
+
|
|
86
|
+
if (!expectError && response.status !== httpResponseStatusCodes.ACCEPTED) {
|
|
87
|
+
throw new Error(`Failed to trigger bulk COI download for project ${projectId}. Status code: ${response.status}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return response;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
module.exports = {
|
|
94
|
+
uploadToS3,
|
|
95
|
+
submitCoi,
|
|
96
|
+
submitCoiByUserContext,
|
|
97
|
+
submitCoiBatch,
|
|
98
|
+
getCoiPreSignedUrl,
|
|
99
|
+
getCoiPresignedUrlBeforeMerge,
|
|
100
|
+
getCoiHashes,
|
|
101
|
+
combineLastTwoCOIs,
|
|
102
|
+
getCombinedCoiByRecordId,
|
|
103
|
+
downloadProjectCoisInBulk
|
|
104
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const DUPLICATE_HANDLING = {
|
|
2
|
-
STRICT: 'STRICT',
|
|
3
|
-
NONE: 'NONE',
|
|
4
|
-
FILTER: 'FILTER'
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
module.exports = DUPLICATE_HANDLING;
|
|
1
|
+
const DUPLICATE_HANDLING = {
|
|
2
|
+
STRICT: 'STRICT',
|
|
3
|
+
NONE: 'NONE',
|
|
4
|
+
FILTER: 'FILTER'
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
module.exports = DUPLICATE_HANDLING;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const defaultCoiHashValue = '79c8e018c43de2d8f4c6b489dde08cc3e21abe30f3e5f3a26ee4a0bca1ca6226';
|
|
2
|
-
const realCoiHashValue = '71de8e0b212168cb513c9f38af63f6b4f6186f950412b9e1e0ea84e1e54e47ce';
|
|
3
|
-
const secondCoiHashValue = '01d359a1d4ec9336526723e6533b92569515be1dd57115d0d73da7b45b48a827';
|
|
4
|
-
|
|
5
|
-
module.exports = { defaultCoiHashValue, realCoiHashValue, secondCoiHashValue };
|
|
1
|
+
const defaultCoiHashValue = '79c8e018c43de2d8f4c6b489dde08cc3e21abe30f3e5f3a26ee4a0bca1ca6226';
|
|
2
|
+
const realCoiHashValue = '71de8e0b212168cb513c9f38af63f6b4f6186f950412b9e1e0ea84e1e54e47ce';
|
|
3
|
+
const secondCoiHashValue = '01d359a1d4ec9336526723e6533b92569515be1dd57115d0d73da7b45b48a827';
|
|
4
|
+
|
|
5
|
+
module.exports = { defaultCoiHashValue, realCoiHashValue, secondCoiHashValue };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const UPLOADER_TYPES = { ICS: 'ICS', PM: 'PM', AUDITOR: 'Auditor', VENDOR: 'Vendor' };
|
|
2
|
-
|
|
3
|
-
module.exports = UPLOADER_TYPES;
|
|
1
|
+
const UPLOADER_TYPES = { ICS: 'ICS', PM: 'PM', AUDITOR: 'Auditor', VENDOR: 'Vendor' };
|
|
2
|
+
|
|
3
|
+
module.exports = UPLOADER_TYPES;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const services = require('./api/coi.service');
|
|
2
|
-
|
|
3
|
-
const models = {
|
|
4
|
-
submit: require('./models/submit.coi.model'),
|
|
5
|
-
submitBatch: require('./models/submit.coi.batch.model')
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const utils = require('./utils/utils');
|
|
9
|
-
|
|
10
|
-
const consts = {
|
|
11
|
-
UPLOADER_TYPES: require('./consts/uploaderTypes'),
|
|
12
|
-
HASHES: require('./consts/hashes'),
|
|
13
|
-
DUPLICATE_HANDLING: require('./consts/duplicateHandling')
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
module.exports = { services, models, utils, consts };
|
|
1
|
+
const services = require('./api/coi.service');
|
|
2
|
+
|
|
3
|
+
const models = {
|
|
4
|
+
submit: require('./models/submit.coi.model'),
|
|
5
|
+
submitBatch: require('./models/submit.coi.batch.model')
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const utils = require('./utils/utils');
|
|
9
|
+
|
|
10
|
+
const consts = {
|
|
11
|
+
UPLOADER_TYPES: require('./consts/uploaderTypes'),
|
|
12
|
+
HASHES: require('./consts/hashes'),
|
|
13
|
+
DUPLICATE_HANDLING: require('./consts/duplicateHandling')
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = { services, models, utils, consts };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const { SubmitCoiModel } = require('../models/submit.coi.model');
|
|
2
|
-
|
|
3
|
-
class CombineLastTwoCOIsModel extends SubmitCoiModel {
|
|
4
|
-
constructor({
|
|
5
|
-
recordId,
|
|
6
|
-
fileIds,
|
|
7
|
-
uploadedBy,
|
|
8
|
-
uploaderEmail,
|
|
9
|
-
recordDateModified,
|
|
10
|
-
isContractorExist,
|
|
11
|
-
isNewCoiOnTop = true
|
|
12
|
-
}) {
|
|
13
|
-
super({
|
|
14
|
-
recordId,
|
|
15
|
-
fileIds,
|
|
16
|
-
uploadedBy,
|
|
17
|
-
uploaderEmail,
|
|
18
|
-
recordDateModified,
|
|
19
|
-
isContractorExist
|
|
20
|
-
});
|
|
21
|
-
this.isNewCoiOnTop = isNewCoiOnTop;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = { CombineLastTwoCOIsModel };
|
|
1
|
+
const { SubmitCoiModel } = require('../models/submit.coi.model');
|
|
2
|
+
|
|
3
|
+
class CombineLastTwoCOIsModel extends SubmitCoiModel {
|
|
4
|
+
constructor({
|
|
5
|
+
recordId,
|
|
6
|
+
fileIds,
|
|
7
|
+
uploadedBy,
|
|
8
|
+
uploaderEmail,
|
|
9
|
+
recordDateModified,
|
|
10
|
+
isContractorExist,
|
|
11
|
+
isNewCoiOnTop = true
|
|
12
|
+
}) {
|
|
13
|
+
super({
|
|
14
|
+
recordId,
|
|
15
|
+
fileIds,
|
|
16
|
+
uploadedBy,
|
|
17
|
+
uploaderEmail,
|
|
18
|
+
recordDateModified,
|
|
19
|
+
isContractorExist
|
|
20
|
+
});
|
|
21
|
+
this.isNewCoiOnTop = isNewCoiOnTop;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { CombineLastTwoCOIsModel };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const DUPLICATE_HANDLING = require('../consts/duplicateHandling');
|
|
2
|
-
|
|
3
|
-
class SubmitCoiBatchModel {
|
|
4
|
-
constructor({
|
|
5
|
-
fileIds,
|
|
6
|
-
sourceRecordId,
|
|
7
|
-
records,
|
|
8
|
-
uploadedBy,
|
|
9
|
-
uploaderEmail,
|
|
10
|
-
isContractorExist = true,
|
|
11
|
-
duplicateHandling = DUPLICATE_HANDLING.STRICT
|
|
12
|
-
}) {
|
|
13
|
-
this.chosenIds = fileIds;
|
|
14
|
-
this.sourceRecordId = sourceRecordId;
|
|
15
|
-
this.records = records;
|
|
16
|
-
this.uploadedBy = uploadedBy;
|
|
17
|
-
this.uploaderEmail = uploaderEmail;
|
|
18
|
-
this.isContractorExist = isContractorExist;
|
|
19
|
-
this.duplicateHandling = duplicateHandling;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = { SubmitCoiBatchModel };
|
|
1
|
+
const DUPLICATE_HANDLING = require('../consts/duplicateHandling');
|
|
2
|
+
|
|
3
|
+
class SubmitCoiBatchModel {
|
|
4
|
+
constructor({
|
|
5
|
+
fileIds,
|
|
6
|
+
sourceRecordId,
|
|
7
|
+
records,
|
|
8
|
+
uploadedBy,
|
|
9
|
+
uploaderEmail,
|
|
10
|
+
isContractorExist = true,
|
|
11
|
+
duplicateHandling = DUPLICATE_HANDLING.STRICT
|
|
12
|
+
}) {
|
|
13
|
+
this.chosenIds = fileIds;
|
|
14
|
+
this.sourceRecordId = sourceRecordId;
|
|
15
|
+
this.records = records;
|
|
16
|
+
this.uploadedBy = uploadedBy;
|
|
17
|
+
this.uploaderEmail = uploaderEmail;
|
|
18
|
+
this.isContractorExist = isContractorExist;
|
|
19
|
+
this.duplicateHandling = duplicateHandling;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { SubmitCoiBatchModel };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
class SubmitCoiModel {
|
|
2
|
-
constructor({
|
|
3
|
-
recordId: contractorId,
|
|
4
|
-
fileIds,
|
|
5
|
-
uploadedBy,
|
|
6
|
-
uploaderContext,
|
|
7
|
-
uploaderEmail,
|
|
8
|
-
recordDateModified,
|
|
9
|
-
isContractorExist = true,
|
|
10
|
-
duplicateHandling
|
|
11
|
-
}) {
|
|
12
|
-
this.contractorId = contractorId;
|
|
13
|
-
this.chosenIds = fileIds;
|
|
14
|
-
this.uploadedBy = uploadedBy;
|
|
15
|
-
this.uploaderContext = uploaderContext;
|
|
16
|
-
this.uploaderEmail = uploaderEmail;
|
|
17
|
-
this.isContractorExist = isContractorExist;
|
|
18
|
-
this.recordDateModified = recordDateModified;
|
|
19
|
-
this.duplicateHandling = duplicateHandling;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = { SubmitCoiModel };
|
|
1
|
+
class SubmitCoiModel {
|
|
2
|
+
constructor({
|
|
3
|
+
recordId: contractorId,
|
|
4
|
+
fileIds,
|
|
5
|
+
uploadedBy,
|
|
6
|
+
uploaderContext,
|
|
7
|
+
uploaderEmail,
|
|
8
|
+
recordDateModified,
|
|
9
|
+
isContractorExist = true,
|
|
10
|
+
duplicateHandling
|
|
11
|
+
}) {
|
|
12
|
+
this.contractorId = contractorId;
|
|
13
|
+
this.chosenIds = fileIds;
|
|
14
|
+
this.uploadedBy = uploadedBy;
|
|
15
|
+
this.uploaderContext = uploaderContext;
|
|
16
|
+
this.uploaderEmail = uploaderEmail;
|
|
17
|
+
this.isContractorExist = isContractorExist;
|
|
18
|
+
this.recordDateModified = recordDateModified;
|
|
19
|
+
this.duplicateHandling = duplicateHandling;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { SubmitCoiModel };
|