@getjones/test-infra 2.9.111 → 2.10.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "2.09.111",
3
+ "version": "2.10.0",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -13,6 +13,8 @@ const roles = {
13
13
  cm: 'Compliance Manager'
14
14
  };
15
15
 
16
+ const generateFullName = role => `${role} User`;
17
+
16
18
  const inviteSaasUser = async (username, role, projectIds, context) => {
17
19
  const userResponse = await users.services.getUserByEmail(username, context);
18
20
 
@@ -36,7 +38,7 @@ const signupSaasUser = async (username, role, context) => {
36
38
  return;
37
39
  }
38
40
 
39
- const signupUserModel = await users.util.getSignupUserModel(username, role, role, defaultsPassword, context);
41
+ const signupUserModel = await users.util.getSignupUserModel(username, role, generateFullName(role), defaultsPassword, context);
40
42
  const signupResponse = await users.services.signupUser(signupUserModel, context);
41
43
 
42
44
  if (signupResponse.status !== httpResponseStatusCodes.OK) {
package/src/index.js CHANGED
@@ -41,8 +41,6 @@ const getInternalAPI = () => {
41
41
  const agreement = require('./saas/internal-api/agreement/index');
42
42
  const uploadFile = require('./saas/internal-api/uploadFiles/index');
43
43
 
44
- const emailCustomization = require('./saas/internal-api/emailCustomization');
45
-
46
44
  const internalAPI = {
47
45
  defaults,
48
46
  auth,
@@ -65,7 +63,6 @@ const getInternalAPI = () => {
65
63
  requestsTable,
66
64
  threadScheduler,
67
65
  dbEmails,
68
- emailCustomization,
69
66
  factory,
70
67
  agreement,
71
68
  uploadFile
Binary file
@@ -167,7 +167,7 @@ const putAuditOnHold = async function(auditId, onHoldReason, context) {
167
167
  const onHoldResponse = await auditApi.putAuditOnHold(onHoldModel, context);
168
168
 
169
169
  if (onHoldResponse.status !== httpResponseStatusCodes.OK) {
170
- throw Error(`Failed to put audit on hold\n${onHoldResponse.data.message}`);
170
+ throw Error(`Failed to put audit on hold\n${onHoldResponse}`);
171
171
  }
172
172
 
173
173
  return onHoldResponse.data;
@@ -177,7 +177,7 @@ const resumeAudit = async function(onHoldId, context) {
177
177
  const resumeAuditResponse = await auditApi.resumeAudit(onHoldId, context);
178
178
 
179
179
  if (resumeAuditResponse.status !== httpResponseStatusCodes.OK) {
180
- throw Error(`Failed to resume audit\n${resumeAuditResponse.data.message}`);
180
+ throw Error(`Failed to resume audit\n${resumeAuditResponse}`);
181
181
  }
182
182
 
183
183
  return resumeAuditResponse.data;
@@ -25,8 +25,7 @@ const Endpoints = {
25
25
  `${backendUrl}/saas/requests/search/audited?&tabId=${tabId}&searchWord=${searchWord}`,
26
26
  automationUpdateContractorUploadDate: contractorId => `${backendUrl}/saas/automation/contractor/${contractorId}/upload-date`,
27
27
  assignRequirement: requestId => `${backendUrl}/saas/contractor/${requestId}/assign-requirement`,
28
- linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`,
29
- verifyInviteLink: encryptedData => `${backendUrl}/vendor-app/verify-link?data=${encryptedData}`
28
+ linkedProjectsCount: recordId => `${backendUrl}/saas/record/count/${recordId}/linked-projects`
30
29
  };
31
30
 
32
31
  const createContractor = (createContractorModel, context) => {
@@ -134,10 +133,6 @@ const updateLastInviteActionDate = (recordId, offsetInDays, context) => {
134
133
  return requests.putRequestHandler(url, {}, context);
135
134
  };
136
135
 
137
- const getInviteLinkStatus = (encryptedData, context) => {
138
- return requests.getRequestHandler(Endpoints.verifyInviteLink(encryptedData), {}, context, {});
139
- };
140
-
141
136
  module.exports = {
142
137
  createContractor,
143
138
  changeRequirement,
@@ -161,6 +156,5 @@ module.exports = {
161
156
  muteNotifications,
162
157
  unmuteNotifications,
163
158
  getLinkedProjectsCount,
164
- updateLastInviteActionDate,
165
- getInviteLinkStatus
159
+ updateLastInviteActionDate
166
160
  };
@@ -162,10 +162,6 @@ const restoreByRecordId = async (recordId, context) => {
162
162
  return restoreResponse;
163
163
  };
164
164
 
165
- const getInviteLinkStatus = (encryptedData, context) => {
166
- return contractorsAPI.getInviteLinkStatus(encryptedData, context);
167
- };
168
-
169
165
  module.exports = {
170
166
  createContractor,
171
167
  changeRequirement,
@@ -193,6 +189,5 @@ module.exports = {
193
189
  getAssignRequirementModel,
194
190
  getLinkedProjectsCount,
195
191
  restoreByRecordId,
196
- updateLastInviteActionDate,
197
- getInviteLinkStatus
192
+ updateLastInviteActionDate
198
193
  };
@@ -1,9 +1,6 @@
1
1
  const DEFAULT_EMAIL_SENDER = 'hellogetjonestest@gmail.com';
2
2
 
3
- const tenantUserExtension = externalCompanyName => ` and ${externalCompanyName}`;
4
-
5
3
  const EMAIL_TYPES = {
6
- INVITE: 'invite',
7
4
  COMPLIANT: 'compliant',
8
5
  NOT_COMPLIANT: 'notCompliant',
9
6
  SEND_GAPS: 'sendGaps',
@@ -23,7 +20,6 @@ const EMAIL_TYPES = {
23
20
  };
24
21
 
25
22
  const EMAIL_SUBJECT = {
26
- invite: 'Your Insurance Docs are needed for',
27
23
  compliant: ({ recordCompanyName }) => `Compliant COI - ${recordCompanyName}`,
28
24
  sendGaps: ({ requesterName }) => `New Insurance Docs Required for ${requesterName} - `, //For this email type, guest is the same as vendor
29
25
  sendGapsForTenant: ({ requesterName }) => `New Insurance Docs Required for leased space at ${requesterName} - `,
@@ -50,4 +46,4 @@ const EMAIL_SUBJECT = {
50
46
  thankYou: 'Thank you for submitting your COI'
51
47
  };
52
48
 
53
- module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT, tenantUserExtension };
49
+ module.exports = { DEFAULT_EMAIL_SENDER, EMAIL_TYPES, EMAIL_SUBJECT };
@@ -62,21 +62,10 @@ const getEmailTextInSubject = (recordCompanyName, emailType, isAfterUpdateRequir
62
62
  return isAfterUpdateRequirements ? `Updated Requirements - ${subject}` : subject;
63
63
  };
64
64
 
65
- const getMailActionButtonUrlRegex = () => {
66
- return /(https:\/\/[a-zA-Z0-9.].*[a-zA-Z.]+\/CheckCustomersInviteLinkJSON\?data=[^"]+)/g;
67
- };
68
-
69
- const getEncryptedDataFromLink = link => {
70
- const encryptedData = link.split('data=').pop();
71
- return encryptedData.slice(0, -2);
72
- };
73
-
74
65
  module.exports = {
75
66
  recipientsMatchVerification,
76
67
  regexVerification,
77
68
  extractEmailFromNameAndEmailFormat,
78
69
  logRetrievedEmailInfo,
79
- getEmailTextInSubject,
80
- getMailActionButtonUrlRegex,
81
- getEncryptedDataFromLink
70
+ getEmailTextInSubject
82
71
  };
@@ -3,24 +3,18 @@ const { backendUrl } = require('../../../../env').getEnv();
3
3
 
4
4
  const Endpoints = {
5
5
  getCustomizationsByAccountId: accountId => `${backendUrl}/saas/email-customizations?accountId=${accountId}`,
6
- restoreDefaultById: id => `${backendUrl}/saas/email-customization/${id}/restore?version=DEFAULT`,
7
- deletePermanentlyById: id => `${backendUrl}/saas/email-customization/${id}/permanently`
6
+ deleteById: id => `${backendUrl}/saas/email-customization/${id}/permanently`
8
7
  };
9
8
 
10
9
  const getEmailCustomizationsByAccountId = (accountId, context) => {
11
10
  return requests.getRequestHandler(Endpoints.getCustomizationsByAccountId(accountId), {}, context);
12
11
  };
13
12
 
14
- const restoreDefaultById = (id, context) => {
15
- return requests.postRequestHandler(Endpoints.restoreDefaultById(id), {}, context);
16
- };
17
-
18
- const deleteEmailCustomizationPermanentlyById = (id, context) => {
19
- return requests.deleteRequestHandler(Endpoints.deletePermanentlyById(id), context);
13
+ const deleteEmailCustomizationById = (id, context) => {
14
+ return requests.deleteRequestHandler(Endpoints.deleteById(id), context);
20
15
  };
21
16
 
22
17
  module.exports = {
23
18
  getEmailCustomizationsByAccountId,
24
- restoreDefaultById,
25
- deleteEmailCustomizationPermanentlyById
19
+ deleteEmailCustomizationById
26
20
  };
@@ -3,48 +3,37 @@ const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCo
3
3
  const emailCustomizationApi = require('./email.customization.api');
4
4
 
5
5
  const getEmailCustomizationsByAccountId = async (accountId, context) => {
6
- const response = await emailCustomizationApi.getEmailCustomizationsByAccountId(accountId, context);
6
+ const resp = await emailCustomizationApi.getEmailCustomizationsByAccountId(accountId, context);
7
7
 
8
- if (response.status !== httpResponseStatusCodes.OK) {
8
+ if (resp.status !== httpResponseStatusCodes.OK) {
9
9
  throw new Error(`Failed to get email customization by account id ${accountId}`);
10
10
  }
11
11
 
12
- return response.data;
12
+ return resp.data;
13
13
  };
14
14
 
15
- const restoreDefaultById = async (id, context) => {
16
- const response = await emailCustomizationApi.restoreDefaultById(id, context);
15
+ const deleteEmailCustomizationById = async (id, context) => {
16
+ const resp = await emailCustomizationApi.deleteEmailCustomizationById(id, context);
17
17
 
18
- if (response.status !== httpResponseStatusCodes.OK) {
18
+ if (resp.status !== httpResponseStatusCodes.OK) {
19
19
  throw new Error(`Failed to delete email customization by id ${id}`);
20
20
  }
21
21
 
22
- return response;
22
+ return resp;
23
23
  };
24
24
 
25
- const deleteEmailCustomizationPermanentlyById = async (id, context) => {
26
- const response = await emailCustomizationApi.deleteEmailCustomizationPermanentlyById(id, context);
27
-
28
- if (response.status !== httpResponseStatusCodes.OK) {
29
- throw new Error(`Failed to delete email customization by id ${id}`);
30
- }
31
-
32
- return response;
33
- };
34
-
35
- const restoreAllEmailCustomizationsInAccount = async (accountId, context) => {
25
+ const deleteAllEmailCustomizationsInAccount = async (accountId, context) => {
36
26
  const customizationList = await getEmailCustomizationsByAccountId(accountId, context);
37
27
 
38
28
  for (const customization of customizationList) {
39
29
  if (customization.id) {
40
- await restoreDefaultById(customization.id, context);
30
+ await deleteEmailCustomizationById(customization.id, context);
41
31
  }
42
32
  }
43
33
  };
44
34
 
45
35
  module.exports = {
46
36
  getEmailCustomizationsByAccountId,
47
- restoreDefaultById,
48
- deleteEmailCustomizationPermanentlyById,
49
- restoreAllEmailCustomizationsInAccount
37
+ deleteEmailCustomizationById,
38
+ deleteAllEmailCustomizationsInAccount
50
39
  };
@@ -3,8 +3,7 @@ const updateModel = require('./models/update.requirement.model');
3
3
  const policyModel = require('./models/policy.model');
4
4
  const services = require('./api/requirements.service');
5
5
  const consts = require('./consts/consts');
6
- const utils = require('./utils/utils');
7
6
 
8
7
  const models = { create: createModel, update: updateModel, policy: policyModel };
9
8
 
10
- module.exports = { services, models, consts, utils };
9
+ module.exports = { services, models, consts };