@getjones/test-infra 4.5.5 → 4.5.6

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": "4.5.5",
3
+ "version": "4.5.6",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -10,10 +10,12 @@ const recordComplianceStatuses = {
10
10
  compliant: 'COMPLIANT_STATUS',
11
11
  notCompliant: 'NOT_COMPLIANT_STATUS',
12
12
  noCOIRequired: 'NO_COI_REQUIRED',
13
+ awaitingCOI: 'EMPTY_STATUS',
13
14
  awaitingNewCOI: 'WAITING_NEW_COI_STATUS',
14
15
  waived: 'WAIVED_STATUS',
15
16
  underReview: 'UNDER_REVIEW',
16
17
  expired: 'Expired',
18
+ expiringSoon: 'ExpiringSoon',
17
19
  notResponsive: 'NotResponsive'
18
20
  };
19
21
 
@@ -8,26 +8,9 @@ const users = require('../../saas/internal-api/users');
8
8
  const { InviteUserModel } = users.models;
9
9
 
10
10
  const defaultsPassword = credentials.strongPassword;
11
- const roles = {
12
- readOnly: 'Read-only User',
13
- inviter: 'Inviter',
14
- cm: 'Compliance Manager'
15
- };
11
+ const { internalApiUserRoles: roles } = require('../../../src/common/consts/userRoles');
16
12
 
17
13
  const inviteSaasUser = async (username, role, projectIds, context, { hasCompleteAccessPermission } = {}) => {
18
- const userResponse = await users.services.getUserByEmail(username, context);
19
-
20
- if (userResponse.data && userResponse.data.id) {
21
- const { projectPermissions } = userResponse.data;
22
- const projectPermissionsIds = projectPermissions.map(projectPermission => projectPermission.projectId);
23
-
24
- projectIds = projectIds.filter(projectId => !projectPermissionsIds.includes(projectId));
25
-
26
- if (!projectIds.length) {
27
- return;
28
- }
29
- }
30
-
31
14
  const inviteUserModel = new InviteUserModel(username, role, projectIds, hasCompleteAccessPermission);
32
15
  const inviteResponse = await users.services.inviteUser([inviteUserModel], context);
33
16
 
package/src/index.js CHANGED
@@ -33,6 +33,7 @@ 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');
36
37
 
37
38
  const globalRecord = require('./saas/internal-api/globalRecord');
38
39
  const vendorProfile = require('./saas/internal-api/vendorProfile');
@@ -69,6 +70,7 @@ const getInternalAPI = () => {
69
70
  dashboard,
70
71
  accountDirectory,
71
72
  notificationCenter,
73
+ jonesNetworkTab,
72
74
  globalRecord,
73
75
  vendorProfile,
74
76
  serviceArea,
@@ -16,7 +16,8 @@ class UpdateAccountSettingsModel {
16
16
  integrations = {},
17
17
  auditSlaHours = 24,
18
18
  shouldReachOutVendors = true,
19
- isWithoutAutocompleteDistanceLimitation = false
19
+ isWithoutAutocompleteDistanceLimitation = false,
20
+ isJonesNetworkTabEnabled = false
20
21
  } = {}
21
22
  ) {
22
23
  this.accountId = accountId;
@@ -35,6 +36,7 @@ class UpdateAccountSettingsModel {
35
36
  this.auditSlaHours = auditSlaHours;
36
37
  this.shouldReachOutVendors = shouldReachOutVendors;
37
38
  this.isWithoutAutocompleteDistanceLimitation = isWithoutAutocompleteDistanceLimitation;
39
+ this.isJonesNetworkTabEnabled = isJonesNetworkTabEnabled;
38
40
  }
39
41
  }
40
42
 
@@ -9,6 +9,7 @@ const Endpoints = {
9
9
  submitCoi: `${backendUrl}/coi/merge`,
10
10
  completeScan: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/complete-scan`,
11
11
  getCoiPresignedUrl: fileName => `${backendUrl}/saas/coi/${fileName}`,
12
+ getCoiPresignedUrlBeforeMerge: fileId => `${backendUrl}/saas/coi-file-before-merge/presigned-url/${fileId}`,
12
13
  getCoiHashes: recordId => `${backendUrl}/jcsc/record/${recordId}/coi/hashes`,
13
14
  combineLastTwoCOIs: `${backendUrl}/saas/auditor/record/coi/merge-last-two`
14
15
  };
@@ -34,6 +35,10 @@ const getCoiPreSignedUrl = (coiFileName, context) => {
34
35
  return requests.getRequestHandler(Endpoints.getCoiPresignedUrl(coiFileName), {}, context);
35
36
  };
36
37
 
38
+ const getCoiPresignedUrlBeforeMerge = (fileId, context) => {
39
+ return requests.getRequestHandler(Endpoints.getCoiPresignedUrlBeforeMerge(fileId), {}, context);
40
+ };
41
+
37
42
  const getCoiHashes = recordId => {
38
43
  return internalRequests.getRequestHandler(Endpoints.getCoiHashes(recordId));
39
44
  };
@@ -42,4 +47,12 @@ const combineLastTwoCOIs = (combineLastTwoCOIsModel, context) => {
42
47
  return requests.postRequestHandler(Endpoints.combineLastTwoCOIs, combineLastTwoCOIsModel, context);
43
48
  };
44
49
 
45
- module.exports = { uploadToS3, submitCoi, completeScan, getCoiPreSignedUrl, getCoiHashes, combineLastTwoCOIs };
50
+ module.exports = {
51
+ uploadToS3,
52
+ submitCoi,
53
+ completeScan,
54
+ getCoiPreSignedUrl,
55
+ getCoiPresignedUrlBeforeMerge,
56
+ getCoiHashes,
57
+ combineLastTwoCOIs
58
+ };
@@ -21,6 +21,20 @@ const getCoiPreSignedUrl = (coiFileName, context) => {
21
21
  return coiApi.getCoiPreSignedUrl(coiFileName, context);
22
22
  };
23
23
 
24
+ const getCoiPresignedUrlBeforeMerge = async (fileId, context, { expectError } = {}) => {
25
+ const response = await coiApi.getCoiPresignedUrlBeforeMerge(fileId, context);
26
+
27
+ if (expectError) {
28
+ return response;
29
+ }
30
+
31
+ if (response.status !== httpResponseStatusCodes.OK) {
32
+ throw new Error(`Failed to get presigned url for file before merge with fileId: ${fileId}`);
33
+ }
34
+
35
+ return response.data.preSignedUrl;
36
+ };
37
+
24
38
  const getCoiHashes = recordId => {
25
39
  return coiApi.getCoiHashes(recordId);
26
40
  };
@@ -36,4 +50,12 @@ const combineLastTwoCOIs = async (combineLastTwoCOIsModel, auditorContext) => {
36
50
  return response;
37
51
  };
38
52
 
39
- module.exports = { uploadToS3, submitCoi, getCoiPreSignedUrl, completeScan, getCoiHashes, combineLastTwoCOIs };
53
+ module.exports = {
54
+ uploadToS3,
55
+ submitCoi,
56
+ getCoiPreSignedUrl,
57
+ getCoiPresignedUrlBeforeMerge,
58
+ completeScan,
59
+ getCoiHashes,
60
+ combineLastTwoCOIs
61
+ };
@@ -1,4 +1,5 @@
1
1
  const defaultCoiHashValue = '79c8e018c43de2d8f4c6b489dde08cc3e21abe30f3e5f3a26ee4a0bca1ca6226';
2
2
  const realCoiHashValue = '71de8e0b212168cb513c9f38af63f6b4f6186f950412b9e1e0ea84e1e54e47ce';
3
+ const secondCoiHashValue = '01d359a1d4ec9336526723e6533b92569515be1dd57115d0d73da7b45b48a827';
3
4
 
4
- module.exports = { defaultCoiHashValue, realCoiHashValue };
5
+ module.exports = { defaultCoiHashValue, realCoiHashValue, secondCoiHashValue };
@@ -93,7 +93,7 @@ const getWaiveModelByGap = (
93
93
  return getWaiveModel(record, policyName, attributeName, reason, note, { userId, userRole, auditId });
94
94
  };
95
95
 
96
- const getRetractModel = (record, policyName, attributeName, { isAttributeMultipleComments } = {}) => {
96
+ const getRetractModel = (record, policyName, attributeName) => {
97
97
  const auditIds = getPolicyAuditIdsFromRecord(record, policyName, auditUtil.getAttributeKey(attributeName));
98
98
  const userId = env.getSystemUserIdentity(credentials.superUser).id;
99
99
  const userRole = userTypes.ICS;
@@ -108,7 +108,7 @@ const getRetractModel = (record, policyName, attributeName, { isAttributeMultipl
108
108
  });
109
109
  retractModels.push(model);
110
110
  }
111
- return isAttributeMultipleComments ? retractModels : retractModels[0];
111
+ return retractModels.length > 1 ? retractModels : retractModels[0];
112
112
  };
113
113
 
114
114
  const getPolicyAuditIdsFromRecord = (record, policyName, attributeName) => {
@@ -0,0 +1,14 @@
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
+ };
@@ -0,0 +1,16 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ const services = require('./api/jones.network.tab.service');
2
+
3
+ module.exports = { services };
Binary file