@getjones/test-infra 3.1.4 → 3.1.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": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,5 +2,16 @@ module.exports = {
2
2
  tenantSolution: {
3
3
  on: { tenantSolution: true },
4
4
  off: { tenantSolution: false }
5
+ },
6
+ autoRenewals: {
7
+ on: { autoRenewals: true },
8
+ off: { autoRenewals: false }
9
+ },
10
+ autoGaps: {
11
+ onForAll: { autoGaps: { isAutoGapsEnabledForTenants: true, isAutoGapsEnabledForGuests: true, isAutoGapsEnabledForVendors: true } },
12
+ offForAll: { autoGaps: { isAutoGapsEnabledForTenants: false, isAutoGapsEnabledForGuests: false, isAutoGapsEnabledForVendors: false } },
13
+ onForVendors: { autoGaps: { isAutoGapsEnabledForTenants: false, isAutoGapsEnabledForGuests: false, isAutoGapsEnabledForVendors: true } },
14
+ onForTenants: { autoGaps: { isAutoGapsEnabledForTenants: true, isAutoGapsEnabledForGuests: false, isAutoGapsEnabledForVendors: false } },
15
+ onForGuests: { autoGaps: { isAutoGapsEnabledForTenants: false, isAutoGapsEnabledForGuests: true, isAutoGapsEnabledForVendors: false } }
5
16
  }
6
17
  };
@@ -58,7 +58,9 @@ const attributeNames = {
58
58
  followsForm: 'Follows Form',
59
59
  followFormEndorsement: 'Follow-Form Endorsement',
60
60
  waiverOfSubrogation: 'Waiver of Subrogation',
61
- waiverOfSubrogationEndorsement: 'Waiver of Subrogation Endorsement'
61
+ waiverOfSubrogationEndorsement: 'Waiver of Subrogation Endorsement',
62
+ amBestRating: 'AM Best Rating',
63
+ amBestFinancialSizeCategory: 'AM Best Financial Size Category'
62
64
  };
63
65
 
64
66
  module.exports = {
@@ -138,7 +138,7 @@ const parseAuditConfig = function(config) {
138
138
  }
139
139
 
140
140
  const selection = { attributeName: getAttributeKey(field) };
141
- certificateEndorsmentsList.includes(field) && (selection.policyName = field);
141
+ certificateEndorsementsList.includes(field) && (selection.policyName = field);
142
142
 
143
143
  if (isArray(config[field])) {
144
144
  selection.status = AUDIT_ENTITY_STATUSES[(config[field][0]).toUpperCase()];
@@ -180,7 +180,7 @@ module.exports = {
180
180
  getAllWaivablePolicies
181
181
  };
182
182
 
183
- const certificateEndorsmentsList = [
183
+ const certificateEndorsementsList = [
184
184
  'Waiver Of Subrogation',
185
185
  'Certificate Holder',
186
186
  'Additional Information',
@@ -48,7 +48,8 @@ const EMAIL_SUBJECT = {
48
48
  requestNewCoi: ({ recordCompanyName, requesterName, isExpired }) => `${recordCompanyName}'s COI is ${isExpired ? 'expired' : 'about to expire'} - ${requesterName}`,
49
49
  malwareCoiFound: 'COI upload failed to pass security scan',
50
50
  thankYou: 'Thank you for submitting your COI',
51
- teamNoteMention: ({ taggingUserFullName, recordCompanyName }) => `${taggingUserFullName} mentioned you in a team note for ${recordCompanyName}`
51
+ teamNoteMention: ({ taggingUserFullName, recordCompanyName }) => `${taggingUserFullName} mentioned you in a team note for ${recordCompanyName}`,
52
+ reportSentSingleProject: ({ accountName, projectName }) => `Jones - Report for ${accountName}: ${projectName}`
52
53
  };
53
54
 
54
55
  module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT, tenantUserExtension };
@@ -32,6 +32,10 @@ const deleteProjectByName = async (accountId, projectName, context) => {
32
32
  );
33
33
  };
34
34
 
35
+ const deleteProjectById = async (projectId, context) => {
36
+ return projectsApi.deleteProjectById(projectId, context);
37
+ };
38
+
35
39
  const createProject = (createProjectModel, context) => {
36
40
  validateType(createProjectModel, CreateProjectModel);
37
41
  return projectsApi.create(createProjectModel, context);
@@ -61,5 +65,6 @@ module.exports = {
61
65
  createProject,
62
66
  deleteProjectByName,
63
67
  updateProject,
64
- getProjectServiceArea
68
+ getProjectServiceArea,
69
+ deleteProjectById
65
70
  };
@@ -1,7 +1,9 @@
1
1
  {
2
- "endorsment": "ENDORSMENT",
2
+ "endorsement": "ENDORSEMENT",
3
3
  "limit": "LIMIT",
4
4
  "boolean": "BOOLEAN",
5
5
  "multiple": "MULTIPLE",
6
- "numeric": "NUMERIC"
6
+ "numeric": "NUMERIC",
7
+ "amBestRating": "AM_BEST_RATING",
8
+ "amBestFinancialSizeCategory": "AM_BEST_FINANCIAL_SIZE_CATEGORY"
7
9
  }
@@ -23,11 +23,13 @@ class AttributeModel {
23
23
  }
24
24
 
25
25
  const AttributeTypes = new Enum({
26
- 'ENDORSMENT': 'endorsment',
26
+ 'ENDORSEMENT': 'endorsment', //typo in BE
27
27
  'LIMIT': 'limit',
28
28
  'BOOLEAN': 'boolean',
29
29
  'NUMERIC': 'numeric',
30
- 'MULTIPLE': 'multiple'
30
+ 'MULTIPLE': 'multiple',
31
+ 'AM_BEST_RATING': 'amBestRating',
32
+ 'AM_BEST_FINANCIAL_SIZE_CATEGORY': 'amBestFinancialSizeCategory'
31
33
  }, { name: 'AttributeTypes' });
32
34
 
33
35
  module.exports = { PolicyModel, AttributeModel, AttributeTypes };
@@ -7,8 +7,11 @@ const { CreateRequirementModel } = require('../models/create.requirement.model')
7
7
  const customAttributes = {
8
8
  Including: 'multiple' //because attributeTypes.multiple => 'Multiple' with capital M
9
9
  };
10
-
11
10
  const numericAttributes = ['Indemnity Period', 'Notice of Cancellation', 'Notice of Cancellation Endorsement'];
11
+ const amBestAttributes = {
12
+ amBestRating: 'AM Best Rating',
13
+ amBestFinancialSizeCategory: 'AM Best Financial Size Category'
14
+ };
12
15
 
13
16
  const convertNumericValuesToNumberType = function(value, attributeName) {
14
17
  if (dataTypeUtils.isString(value) && value.startsWith('$')) {
@@ -35,15 +38,25 @@ const preparePolicyAttributesTypes = function(value, attributeName) {
35
38
  return AttributeTypes.get(attributeTypes.boolean);
36
39
  }
37
40
 
41
+ if (dataTypeUtils.isString(attributesValue)) {
42
+ if (attributeName === amBestAttributes.amBestRating) {
43
+ return AttributeTypes.get(attributeTypes.amBestRating);
44
+ }
45
+
46
+ if (attributeName === amBestAttributes.amBestFinancialSizeCategory) {
47
+ return AttributeTypes.get(attributeTypes.amBestFinancialSizeCategory);
48
+ }
49
+ }
50
+
38
51
  return AttributeTypes.get(attributeTypes.multiple);
39
52
  };
40
53
 
41
- const prepareEndorsmentAttributesTypes = function(value) {
54
+ const prepareEndorsementAttributesTypes = function(value) {
42
55
  if (dataTypeUtils.isBoolean(value)) {
43
56
  return AttributeTypes.get(attributeTypes.boolean);
44
57
  }
45
58
 
46
- return AttributeTypes.get(attributeTypes.endorsment);
59
+ return AttributeTypes.get(attributeTypes.endorsement);
47
60
  };
48
61
 
49
62
  const parseRequirementConfig = function(config) {
@@ -63,7 +76,7 @@ const parseRequirementConfig = function(config) {
63
76
  attributes.push({
64
77
  name: attributeName,
65
78
  type: preparePolicyAttributesTypes(config[policy][attribute], attributeName),
66
- values: attributeName === customAttributes.Including ?
79
+ values: attributeName === customAttributes.Including ? //Including attributes in Automobile Liability
67
80
  config[policy][attribute].split(', ') :
68
81
  [convertNumericValuesToNumberType(config[policy][attribute], attributeName)]
69
82
  });
@@ -71,7 +84,7 @@ const parseRequirementConfig = function(config) {
71
84
  } else {
72
85
  attributes.push({
73
86
  name: policy,
74
- type: prepareEndorsmentAttributesTypes(config[policy]),
87
+ type: prepareEndorsementAttributesTypes(config[policy]),
75
88
  values: [config[policy]]
76
89
  });
77
90
  }
@@ -4,6 +4,7 @@ const { backendUrl } = require('../../../../../env').getEnv();
4
4
  const Endpoints = {
5
5
  invite: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
6
6
  getTenantsByProjectId: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
7
+ getTenantsByAccountId: accountId => `${backendUrl}/saas/account/${accountId}/tenants`,
7
8
  signupUser: `${backendUrl}/_saas/guests/signup`,
8
9
  removeTenantUser: (projectId, userId) => `${backendUrl}/saas/project/${projectId}/tenant/${userId}`
9
10
  };
@@ -16,6 +17,10 @@ const getTenantUsersByProjectId = (projectId, context) => {
16
17
  return requests.getRequestHandler(Endpoints.getTenantsByProjectId(projectId), {}, context, {});
17
18
  };
18
19
 
20
+ const getTenantsByAccountId = (accountId, context) => {
21
+ return requests.getRequestHandler(Endpoints.getTenantsByAccountId(accountId), {}, context, {});
22
+ };
23
+
19
24
  const signupUser = (signupUserModel, context) => {
20
25
  return requests.postRequestHandler(Endpoints.signupUser, signupUserModel, context, {}, {});
21
26
  };
@@ -28,5 +33,6 @@ module.exports = {
28
33
  invite,
29
34
  getTenantUsersByProjectId,
30
35
  signupUser,
31
- removeTenantUser
36
+ removeTenantUser,
37
+ getTenantsByAccountId
32
38
  };
@@ -34,6 +34,16 @@ const getTenantUsersByProjectId = async (projectId, context) => {
34
34
  return tenantResponse.data;
35
35
  };
36
36
 
37
+ const getTenantsByAccountId = async (accountId, context) => {
38
+ const tenantResponse = await tenantAPI.getTenantsByAccountId(accountId, context);
39
+
40
+ if (tenantResponse.status !== httpResponseStatusCodes.OK) {
41
+ throw new Error(`Failed to retrieve tenants users from tenant account, accountId - ${accountId} response status - \n${tenantResponse.status}`);
42
+ }
43
+
44
+ return tenantResponse.data;
45
+ };
46
+
37
47
  const getTenantUserByEmail = async (projectId, email, context) => {
38
48
  const allTenants = await getTenantUsersByProjectId(projectId, context);
39
49
 
@@ -92,6 +102,7 @@ module.exports = {
92
102
  inviteTenantUser,
93
103
  getTenantUsersByProjectId,
94
104
  getOrCreateTenantUser,
105
+ getTenantsByAccountId,
95
106
  removeTenantUser,
96
107
  removeAllTenantUsersFromProject
97
108
  };
@@ -9,6 +9,7 @@ const Endpoints = {
9
9
  getByProjectId: projectId =>
10
10
  `${backendUrl}/saas/project/${projectId}/team-members`,
11
11
  getByEmail: email => `${backendUrl}/saas/team-member/by-email/${email}`,
12
+ getEnabledAndDisabledByEmail: email => `${backendUrl}/saas/user/automation/email/${email}`,
12
13
  delete: userId => `${backendUrl}/saas/users/${userId}`,
13
14
  getUserListByRecordId: recordId => `${backendUrl}/saas/users/record/${recordId}`,
14
15
  deleteSingleProject: (userId, projectId) => `${backendUrl}/saas/project/${projectId}/sub-account/${userId}`,
@@ -47,6 +48,10 @@ const getUserByEmail = (email, context) => {
47
48
  return requests.getRequestHandler(Endpoints.getByEmail(email), null, context);
48
49
  };
49
50
 
51
+ const getEnabledAndDisabledByEmail = (email, context) => {
52
+ return requests.getRequestHandler(Endpoints.getEnabledAndDisabledByEmail(email), null, context);
53
+ };
54
+
50
55
  const getUserEncryptedData = (email, role, context) => {
51
56
  return requests.getRequestHandler(Endpoints.getUserEncryptedData(email, role), null, context);
52
57
  };
@@ -98,6 +103,7 @@ module.exports = {
98
103
  invite,
99
104
  signupUser,
100
105
  getUsersByProjectId,
106
+ getEnabledAndDisabledByEmail,
101
107
  getUserByEmail,
102
108
  getUserEncryptedData,
103
109
  getUserListByRecordId,
@@ -36,6 +36,16 @@ const getUserByEmail = async (email, context) => {
36
36
  return userAPI.getUserByEmail(email, context);
37
37
  };
38
38
 
39
+ const getEnabledAndDisabledByEmail = async (email, context) => {
40
+ const response = await userAPI.getEnabledAndDisabledByEmail(email, context);
41
+
42
+ if (response.status !== httpResponseStatusCodes.OK) {
43
+ throw new Error(`Failed to get user by email ${email}`);
44
+ }
45
+
46
+ return response.data;
47
+ };
48
+
39
49
  const getOrCreateUser = async (email, role, projectsIds, context, { fullName = role, password = credentials.strongPassword } = {}) => {
40
50
  let userResponse = await getUserByEmail(email, context);
41
51
 
@@ -185,6 +195,7 @@ module.exports = {
185
195
  signupUser,
186
196
  getUsersByProjectId,
187
197
  getUserByEmail,
198
+ getEnabledAndDisabledByEmail,
188
199
  getOrCreateUser,
189
200
  deleteUser,
190
201
  deleteUserFromSingleProject,