@getjones/test-infra 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
const env = require('../../../../env');
|
|
2
|
-
const { internalAPI } = require('../../../../../../../packages/test-infra')(env);
|
|
3
1
|
const FormData = require('form-data');
|
|
4
2
|
const fs = require('fs');
|
|
5
3
|
const path = require('path');
|
|
6
|
-
const { auth } = internalAPI;
|
|
7
4
|
const uploadFileApi = require('../../../internal-api/uploadFiles/api/upload.file.api');
|
|
8
5
|
const agreementAPI = require('./agreement.api');
|
|
9
6
|
const { CreateAgreementByPMModel } = require('../models/createAgreementByPMModel');
|
|
@@ -11,7 +8,7 @@ const { validateType } = require('../../../../common/validations/typeValidations
|
|
|
11
8
|
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
12
9
|
const { CONTRACT, TEMP_DOCUMENTS } = require('../../../../common/consts/s3FileTypes');
|
|
13
10
|
const { CreateAgreementByAuditorModel } = require('../models/createAgreementByAuditorModel');
|
|
14
|
-
const { COI_FOLDER_PATH, DEFAULT_COI_FILENAME } = require('
|
|
11
|
+
const { COI_FOLDER_PATH, DEFAULT_COI_FILENAME } = require('../consts/consts');
|
|
15
12
|
|
|
16
13
|
const createAgreement = (createAgreementByPMModel, context) => {
|
|
17
14
|
validateType(createAgreementByPMModel, CreateAgreementByPMModel);
|
|
@@ -85,10 +82,10 @@ const uploadAgreementByPM = async (
|
|
|
85
82
|
|
|
86
83
|
const uploadAgreementByAuditor = async (
|
|
87
84
|
recordId,
|
|
85
|
+
context,
|
|
88
86
|
filePath = `${COI_FOLDER_PATH}${DEFAULT_COI_FILENAME}`
|
|
89
87
|
) => {
|
|
90
|
-
const
|
|
91
|
-
const { data: { preSignedUrl, fileName: fullFilePath } } = await getAgreementPreSignedUrl(recordId, auditorContext, { filePath });
|
|
88
|
+
const { data: { preSignedUrl, fileName: fullFilePath } } = await getAgreementPreSignedUrl(recordId, context, { filePath });
|
|
92
89
|
|
|
93
90
|
const uploadResults = await uploadAgreementToTempBucket(preSignedUrl, filePath);
|
|
94
91
|
validateResponse(uploadResults, recordId);
|
|
@@ -97,7 +94,7 @@ const uploadAgreementByAuditor = async (
|
|
|
97
94
|
contractorId: recordId, fileName: fullFilePath
|
|
98
95
|
});
|
|
99
96
|
|
|
100
|
-
const createResponse = await createAgreementByAuditor(createAgreementModel,
|
|
97
|
+
const createResponse = await createAgreementByAuditor(createAgreementModel, context);
|
|
101
98
|
|
|
102
99
|
if (createResponse.status !== httpResponseStatusCodes.OK) {
|
|
103
100
|
throw new Error(`Failed to upload agreement for record ${recordId}`);
|
|
@@ -4,5 +4,7 @@ const UPLOADER_TYPE = {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
const DEFAULT_AGREEMENT_TEMPLATE = 'tpl_C3sgbpYx7LHyRNdtM7';
|
|
7
|
+
const COI_FOLDER_PATH = 'packages/test-infra/src/resources/coi/';
|
|
8
|
+
const DEFAULT_COI_FILENAME = 'coi.pdf';
|
|
7
9
|
|
|
8
|
-
module.exports = { UPLOADER_TYPE, DEFAULT_AGREEMENT_TEMPLATE };
|
|
10
|
+
module.exports = { UPLOADER_TYPE, DEFAULT_AGREEMENT_TEMPLATE, COI_FOLDER_PATH, DEFAULT_COI_FILENAME };
|
|
Binary file
|