@getjones/test-infra 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/env.js CHANGED
@@ -1,10 +1,12 @@
1
1
  let privateMembers = {
2
2
  backendUrl: null,
3
3
  openapiUrl: null,
4
+ nodeBackendUrl: null,
4
5
  credentials: null,
5
6
  environment: null,
6
7
  accountCreationSecret: null,
7
- threadSchedulerSecret: null
8
+ threadSchedulerSecret: null,
9
+ nodeBackendSecret: null
8
10
  };
9
11
 
10
12
  const init = conf => {
@@ -12,6 +14,7 @@ const init = conf => {
12
14
  requiredValidation({
13
15
  backendUrl: privateMembers.backendUrl,
14
16
  openapiUrl: privateMembers.openapiUrl,
17
+ nodeBackendUrl: privateMembers.nodeBackendUrl,
15
18
  environment: privateMembers.environment
16
19
  });
17
20
  };
@@ -0,0 +1,17 @@
1
+ const requests = require('../../../../openapi/common/requests');
2
+ const { nodeBackendUrl, nodeBackendSecret } = require('../../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ ocrToCoverage: `${nodeBackendUrl}/compliance/convert/ocr-to-coverage`,
6
+ requirement: `${nodeBackendUrl}/compliance/convert/requirement`
7
+ };
8
+
9
+ const convertOcrToCoverage = async ocrData => {
10
+ return requests.postRequestHandler(Endpoints.ocrToCoverage, nodeBackendSecret, ocrData);
11
+ };
12
+
13
+ const convertRequirement = async oldRequirement => {
14
+ return requests.postRequestHandler(Endpoints.requirement, nodeBackendSecret, oldRequirement);
15
+ };
16
+
17
+ module.exports = { convertOcrToCoverage, convertRequirement };
@@ -0,0 +1,11 @@
1
+ const convertApi = require('./convert.api');
2
+
3
+ const convertOcrToCoverage = async ocrData => {
4
+ return convertApi.convertOcrToCoverage(ocrData).then(res => res && res.data);
5
+ };
6
+
7
+ const convertRequirement = async requirement => {
8
+ return convertApi.convertRequirement(requirement).then(res => res && res.data);
9
+ };
10
+
11
+ module.exports = { convertOcrToCoverage, convertRequirement };
@@ -0,0 +1,17 @@
1
+ const requests = require('../../../common/requests');
2
+ const { nodeBackendUrl } = require('../../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ saveCoverage: `${nodeBackendUrl}/coverage`,
6
+ getCoverageByCoiId: coiId => `${nodeBackendUrl}/coverage/${coiId}`
7
+ };
8
+
9
+ const saveCoverage = async (coverage, context) => {
10
+ return requests.postRequestHandler(Endpoints.saveCoverage, coverage, context);
11
+ };
12
+
13
+ const getCoverageByCoiId = async (coiId, context) => {
14
+ return requests.getRequestHandler(Endpoints.getCoverageByCoiId(coiId), {}, context);
15
+ };
16
+
17
+ module.exports = { saveCoverage, getCoverageByCoiId };
@@ -0,0 +1,11 @@
1
+ const coverageApi = require('./coverage.api');
2
+
3
+ const saveCoverage = async (coverage, context) => {
4
+ return coverageApi.saveCoverage(coverage, context);
5
+ };
6
+
7
+ const getCoverageByCoiId = async (coiId, context) => {
8
+ return coverageApi.getCoverageByCoiId(coiId, context).then(res => res && res.data);
9
+ };
10
+
11
+ module.exports = { saveCoverage, getCoverageByCoiId };
@@ -4,7 +4,15 @@ const auditServices = require('./api/audit/audit.setup');
4
4
  const waiveModels = require('./models/waive/waive.model');
5
5
  const waiveServices = require('./api/waive/waive.setup');
6
6
 
7
+ const convertServices = require('./api/convert/convert.setup');
8
+ const coverageServices = require('./api/coverage/coverage.setup');
9
+
7
10
  const models = { audit: auditModels, waive: waiveModels };
8
- const services = { audit: auditServices, waive: waiveServices };
11
+ const services = {
12
+ audit: auditServices,
13
+ waive: waiveServices,
14
+ convert: convertServices,
15
+ coverage: coverageServices
16
+ };
9
17
 
10
18
  module.exports = { services, models };
@@ -11,10 +11,11 @@ function CreateContractorModel(requirementId, inviterEmail, vendorsInfo) {
11
11
  vendorsInfo && validateType(vendorsInfo[0], ContractorInfo);
12
12
  }
13
13
 
14
- function ContractorInfo(email, companyName) {
14
+ function ContractorInfo(email, companyName, additionalEmails) {
15
15
  this.email = email;
16
16
  this.companyName = companyName;
17
17
  this.title = email;
18
+ this.additionalEmails = additionalEmails;
18
19
  }
19
20
 
20
21
  module.exports = { CreateContractorModel, ContractorInfo };
@@ -1,11 +1,12 @@
1
1
  const { validateType } = require('../../../../common/validations/typeValidations');
2
2
 
3
- function ContractorModel(contractorId, company, emailAddress, tab, tenantRecord) {
3
+ function ContractorModel(contractorId, company, emailAddress, tab, tenantRecord, additionalEmails) {
4
4
  this.contractorId = contractorId;
5
5
  this.company = company;
6
6
  this.emailAddress = emailAddress;
7
7
  this.tab = tab;
8
8
  this.tenantRecord = tenantRecord;
9
+ this.additionalEmails = additionalEmails;
9
10
 
10
11
  validateType(tenantRecord, TenantRecordModel);
11
12
  validateType(tab, VendorTabModel);
@@ -14,9 +14,11 @@ const getTabsByProjectId = async (projectId, context) => {
14
14
  return tabsAPI.getTabsByProjectId(projectId, context);
15
15
  };
16
16
 
17
- const getTabsByName = async (projectId, tabName, context) => {
17
+ const getTabsByName = async (projectId, tabName, context,{ tabType }={}) => {
18
18
  const tabs = await tabsAPI.getTabsByProjectId(projectId, context);
19
- const requestedTab = tabs.find(tab => tab.tabName === tabName);
19
+ const requestedTab = tabType?
20
+ tabs.find(tab => tab.tabName === tabName && tab.type === tabType):
21
+ tabs.find(tab => tab.tabName === tabName);
20
22
  return requestedTab;
21
23
  };
22
24