@getjones/test-infra 3.1.6 → 4.0.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": "3.1.6",
3
+ "version": "4.0.0",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -8,6 +8,7 @@ const contractors = require('../../../saas/internal-api/contractors');
8
8
  const compliance = require('../../../saas/internal-api/compliance');
9
9
  const requests = require('../../../saas/internal-api/requests');
10
10
  const dbEmails = require('../../../saas/internal-api/dbEmails');
11
+ const activationStatuses = require('../../../common/consts/activationStatuses');
11
12
 
12
13
  const makeRecordNotResponsive = async function(recordId, context, { isTenant } = {}) {
13
14
  const offsetInDaysList = isTenant ?
@@ -128,6 +129,21 @@ const waitForOcrStatus = async function(recordId, context, { expectedStatus = oc
128
129
  }
129
130
  };
130
131
 
132
+ const deleteAllRequestsInProject = async function(accountId, projectId, context) {
133
+ const activationStatus = [activationStatuses.ACTIVE, activationStatuses.ARCHIVED, activationStatuses.DRAFT];
134
+ const { data: requestsInAccount } = await requests.services.getRequestsByAccountId(accountId, context, activationStatus);
135
+
136
+ for (const request of requestsInAccount) {
137
+ if (request.projectInfo.projectId === projectId) {
138
+ const response = await contractors.services.deleteByContractorId(request.record.contractorId, context);
139
+
140
+ if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
141
+ throw new Error(`Failed to delete request ${request.id}\n${response}`);
142
+ }
143
+ }
144
+ }
145
+ };
146
+
131
147
  const generateSubscriptionModelFromMail = async function(recipients) {
132
148
  const data = await dbEmails.services.getSubscriptionData(recipients);
133
149
  return contractors.services.getSubscriptionModel(data);
@@ -142,5 +158,6 @@ module.exports = {
142
158
  getHistoryEvents,
143
159
  updateLastInviteActionDate,
144
160
  waitForOcrStatus,
145
- generateSubscriptionModelFromMail
161
+ generateSubscriptionModelFromMail,
162
+ deleteAllRequestsInProject
146
163
  };
@@ -0,0 +1,9 @@
1
+ const autocompleteResultType = {
2
+ account: 'Account',
3
+ jonesGlobalCoi: 'JonesGlobalCoi',
4
+ network: 'Network'
5
+ };
6
+
7
+ module.exports = {
8
+ autocompleteResultType
9
+ };
@@ -2,11 +2,11 @@ const requests = require('../../../../../common/requests/cookieAuth/requests');
2
2
  const { backendUrl } = require('../../../../../env').getEnv();
3
3
 
4
4
  const Endpoints = {
5
- createApiKey: `${backendUrl}/saas/api-keys`,
6
- getStaticApiKeyByAccountId: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
7
- getApiKeyByKeyValue: `${backendUrl}/saas/api-keys`,
8
- removeStaticApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
9
- dynamicApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/dynamic-api-key`
5
+ createApiKey: `${backendUrl}/saas/integration-tests/api-keys`,
6
+ getStaticApiKeyByAccountId: accountId => `${backendUrl}/saas/integration-tests/accounts/${accountId}/static-api-keys`,
7
+ getApiKeyByKeyValue: `${backendUrl}/saas/integration-tests/api-keys`,
8
+ removeStaticApiKey: accountId => `${backendUrl}/saas/integration-tests/accounts/${accountId}/static-api-keys`,
9
+ dynamicApiKey: accountId => `${backendUrl}/saas/integration-tests/accounts/${accountId}/dynamic-api-key`
10
10
  };
11
11
 
12
12
  const createStaticApiKey = (data, context) => {
@@ -119,17 +119,6 @@ const updateInviteDate = (contractorId, inviteDate, context) => {
119
119
  return requests.postRequestHandler(Endpoints.updateContractorInviteDate(contractorId), data, context);
120
120
  };
121
121
 
122
- const getContractorsByTabId = async (tabId, context, activityStatus) => {
123
- const body = { tabId, activityStatus };
124
- const response = await requests.postRequestHandler(Endpoints.get, body, context);
125
- const records = {
126
- ... response,
127
- data: response.data.map(({ record }) => record)
128
- };
129
-
130
- return records;
131
- };
132
-
133
122
  const searchInAutocomplete = ({ tabId, searchWord }, context) => {
134
123
  return requests.getRequestHandler(Endpoints.searchInAutocomplete({ tabId, searchWord }), {}, context);
135
124
  };
@@ -183,7 +172,6 @@ module.exports = {
183
172
  editContractor,
184
173
  updateInviteDate,
185
174
  updateExpiryDate,
186
- getContractorsByTabId,
187
175
  searchInAutocomplete,
188
176
  updateContractorUploadDate,
189
177
  sendGaps,
@@ -62,10 +62,6 @@ const updateLastInviteActionDate = (recordId, dateOffset, context) => {
62
62
  return contractorsAPI.updateLastInviteActionDate(recordId, dateOffset, context);
63
63
  };
64
64
 
65
- const getContractorsByTabId = (tabId, context, activityStatus = 'Active') => {
66
- return contractorsAPI.getContractorsByTabId(tabId, context, activityStatus);
67
- };
68
-
69
65
  const searchInAutoComplete = ({ tabId, searchWord }, context) => {
70
66
  return contractorsAPI.searchInAutocomplete({ tabId, searchWord }, context);
71
67
  };
@@ -285,7 +281,6 @@ module.exports = {
285
281
  editContractor,
286
282
  updateInviteDate,
287
283
  updateExpiryDate,
288
- getContractorsByTabId,
289
284
  searchInAutoComplete,
290
285
  updateContractorUploadDate,
291
286
  sendGaps,
@@ -10,7 +10,8 @@ const Endpoints = {
10
10
  getGlobalRecordServiceAreas: `${backendUrl}/saas/global-record/service-areas`,
11
11
  deleteGlobalRecord: id => `${nodeBackendUrl}/global-record/id/${id}`,
12
12
  updateGlobalRecord: id => `${nodeBackendUrl}/global-record/id/${id}`,
13
- getRecordProfileDetails: id => `${nodeBackendUrl}/global-record/record-profile/id/${id}`,
13
+ getGlobalRecordProfile: id => `${nodeBackendUrl}/global-record/record-profile/id/${id}`,
14
+ getGlobalRecordProfileDetails: (recordId, projectId) => `${backendUrl}/saas/vendorProfile/data/record/${recordId}/project/${projectId}`,
14
15
  getGlobalRecordByPolicyNumber: policyNumber => `${nodeBackendUrl}/global-record/policyNumber/${policyNumber}`,
15
16
  publishGlobalRecord: `${backendUrl}/saas/global-record/publish`,
16
17
  getGlobalRecordLinkedRecords: id => `${backendUrl}/saas/global-record/${id}/linked-records`,
@@ -44,8 +45,12 @@ const getGlobalRecordServiceAreas = context => {
44
45
  return requests.getRequestHandler(Endpoints.getGlobalRecordServiceAreas, {}, context);
45
46
  };
46
47
 
47
- const getRecordProfileDetails = (id, context) => {
48
- return requests.getRequestHandler(Endpoints.getRecordProfileDetails(id), {}, context);
48
+ const getGlobalRecordProfile = (id, context) => {
49
+ return requests.getRequestHandler(Endpoints.getGlobalRecordProfile(id), {}, context);
50
+ };
51
+
52
+ const getGlobalRecordProfileDetails = (recordId, projectId, context) => {
53
+ return requests.getRequestHandler(Endpoints.getGlobalRecordProfileDetails(recordId, projectId), {}, context);
49
54
  };
50
55
 
51
56
  const publishGlobalRecord = (globalRecordDetails, context) => {
@@ -84,7 +89,8 @@ module.exports = {
84
89
  getGlobalRecordServiceAreas,
85
90
  deleteGlobalRecord,
86
91
  updateGlobalRecord,
87
- getRecordProfileDetails,
92
+ getGlobalRecordProfile,
93
+ getGlobalRecordProfileDetails,
88
94
  getGlobalRecordByPolicyNumber,
89
95
  publishGlobalRecord,
90
96
  getGlobalRecordLinkedRecords,
@@ -48,8 +48,12 @@ const updateGlobalRecord = (id, updatedGlobalRecordModel) => {
48
48
  return globalRecordAPI.updateGlobalRecord(id, updatedGlobalRecordModel);
49
49
  };
50
50
 
51
- const getRecordProfileDetails = (id, context) => {
52
- return globalRecordAPI.getRecordProfileDetails(id, context);
51
+ const getGlobalRecordProfile = (id, context) => {
52
+ return globalRecordAPI.getGlobalRecordProfile(id, context);
53
+ };
54
+
55
+ const getGlobalRecordProfileDetails = (recordId, projectId, context) => {
56
+ return globalRecordAPI.getGlobalRecordProfileDetails(recordId, projectId, context);
53
57
  };
54
58
 
55
59
  const publishGlobalRecord = (globalRecordDetails, context) => {
@@ -94,7 +98,8 @@ module.exports = {
94
98
  getGlobalRecordServiceAreas,
95
99
  deleteGlobalRecord,
96
100
  updateGlobalRecord,
97
- getRecordProfileDetails,
101
+ getGlobalRecordProfile,
102
+ getGlobalRecordProfileDetails,
98
103
  getGlobalRecordByPolicyNumber,
99
104
  publishGlobalRecord,
100
105
  getGlobalRecordLinkedRecords,
@@ -2,15 +2,15 @@ const requests = require('../../../../common/requests/cookieAuth/requests');
2
2
  const { backendUrl } = require('../../../../env').getEnv();
3
3
 
4
4
  const Endpoints = {
5
- create: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
5
+ create: `${backendUrl}/saas/contractors/notes`,
6
6
  getNotesByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
7
7
  getNotesCountByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes/count`,
8
8
  deleteByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`,
9
9
  updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
10
10
  };
11
11
 
12
- const createRecordNote = (recordId, data, context) => {
13
- return requests.postRequestHandler(Endpoints.create(recordId), data, context);
12
+ const createRecordNote = (data, context) => {
13
+ return requests.postRequestHandler(Endpoints.create, data, context);
14
14
  };
15
15
 
16
16
  const getNotesByRecordId = (recordId, context) => {
@@ -1,10 +1,10 @@
1
1
  const recordNotesAPI = require('./record.notes.api');
2
2
  const utils = require('./record.notes.utils');
3
3
 
4
- const createRecordNote = (recordId, data, context, { tagUsers, multipleParagraphs } = {}) => {
4
+ const createRecordNote = (data, context, { tagUsers, multipleParagraphs } = {}) => {
5
5
  tagUsers && (data.content = utils.getMentionedNoteContent(tagUsers, data.content, { multipleParagraphs }));
6
6
 
7
- return recordNotesAPI.createRecordNote(recordId, data, context);
7
+ return recordNotesAPI.createRecordNote(data, context);
8
8
  };
9
9
 
10
10
  const getNotesByRecordId = (recordId, context) => {