@getjones/test-infra 2.8.2 → 2.8.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 +29 -29
- package/src/common/commonFlows/auth/auth.js +40 -40
- package/src/common/commonFlows/index.js +4 -4
- package/src/common/commonFlows/records/records.js +72 -72
- package/src/common/consts/dashboardCharts.js +17 -17
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/userTypes.js +5 -5
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +44 -44
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/requestHandlers.js +78 -78
- package/src/common/utils/complianceUtil.js +56 -56
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +7 -7
- package/src/common/utils/timeUtils.js +175 -175
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +91 -91
- package/src/defaults/configs/coverage.js +227 -227
- package/src/defaults/configs/polices.js +49 -49
- package/src/defaults/configs/requirement.js +32 -32
- package/src/defaults/index.js +6 -6
- package/src/env.js +57 -57
- package/src/factory/index.js +7 -7
- package/src/factory/records/records.js +142 -141
- package/src/factory/users/users.js +79 -79
- package/src/index.js +81 -81
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +77 -77
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
- package/src/saas/internal-api/accounts/consts/consts.js +6 -6
- package/src/saas/internal-api/accounts/index.js +21 -21
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +38 -36
- package/src/saas/internal-api/accounts/utils/utils.js +66 -66
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
- package/src/saas/internal-api/auth/api/auth.api.js +27 -27
- package/src/saas/internal-api/auth/api/auth.service.js +90 -90
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +34 -34
- package/src/saas/internal-api/coi/api/coi.service.js +22 -22
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
- package/src/saas/internal-api/coi/index.js +13 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +46 -46
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +143 -143
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +48 -48
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +33 -33
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +127 -127
- package/src/saas/internal-api/compliance/consts/audit.js +71 -71
- package/src/saas/internal-api/compliance/index.js +33 -33
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +84 -84
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
- package/src/saas/internal-api/compliance/utils/auditUtil.js +222 -222
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +40 -40
- package/src/saas/internal-api/contractors/api/contractors.api.js +153 -153
- package/src/saas/internal-api/contractors/api/contractors.service.js +169 -169
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +9 -9
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +60 -60
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +127 -127
- package/src/saas/internal-api/dbEmails/consts/consts.js +37 -37
- package/src/saas/internal-api/dbEmails/index.js +5 -5
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -21
- package/src/saas/internal-api/dbEmails/utils/util.js +68 -68
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +82 -82
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +95 -95
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +43 -43
- package/src/saas/internal-api/globalRecord/utils/util.js +148 -148
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +41 -41
- package/src/saas/internal-api/projects/utils/utils.js +156 -156
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +63 -63
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +72 -72
- package/src/saas/internal-api/requests/api/requests.service.js +122 -114
- package/src/saas/internal-api/requests/index.js +14 -14
- package/src/saas/internal-api/requests/models/create.request.model.js +33 -33
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +8 -8
- package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/requirements.api.js +45 -45
- package/src/saas/internal-api/requirements/api/requirements.service.js +134 -134
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +5 -5
- package/src/saas/internal-api/requirements/consts/consts.js +6 -6
- package/src/saas/internal-api/requirements/index.js +9 -9
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/policy.model.js +32 -32
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +102 -102
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +18 -18
- package/src/saas/internal-api/thread-scheduler/runner.js +39 -39
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +32 -32
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +78 -78
- package/src/saas/internal-api/users/api/users.api.js +77 -77
- package/src/saas/internal-api/users/api/users.service.js +101 -101
- package/src/saas/internal-api/users/index.js +11 -11
- package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +31 -31
- package/src/saas/internal-api/users/utils/util.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/coi/coi.api.js +20 -20
- package/src/saas/openapi/coi/coi.service.js +13 -13
- package/src/saas/openapi/projects/projects.api.js +59 -59
- package/src/saas/openapi/projects/projects.service.js +44 -44
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
- package/src/saas/openapi/requests/models/update.request.model.js +35 -35
- package/src/saas/openapi/requests/requests.api.js +76 -76
- package/src/saas/openapi/requests/requests.service.js +65 -65
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +26 -26
- package/src/saas/openapi/requirements/requirements.service.js +32 -32
- package/src/saas/openapi/tabs/index.js +6 -0
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -0
- package/src/saas/openapi/tabs/tabs.api.js +18 -13
- package/src/saas/openapi/tabs/tabs.service.js +11 -7
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
coordinates: (city, state) => `${backendUrl}/saas/coordinates?city=${city}&state=${state}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const getCoordinatesByAddress = (city, state, context) => {
|
|
9
|
-
return requests.getRequestHandler(Endpoints.coordinates(city, state), {}, context);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
module.exports = { getCoordinatesByAddress };
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
coordinates: (city, state) => `${backendUrl}/saas/coordinates?city=${city}&state=${state}`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const getCoordinatesByAddress = (city, state, context) => {
|
|
9
|
+
return requests.getRequestHandler(Endpoints.coordinates(city, state), {}, context);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = { getCoordinatesByAddress };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const coordinates = require('./coordinates.api');
|
|
2
|
-
|
|
3
|
-
const getCoordinatesByAddress = (city, state, context) => {
|
|
4
|
-
return coordinates.getCoordinatesByAddress(city, state, context);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
module.exports = { getCoordinatesByAddress };
|
|
1
|
+
const coordinates = require('./coordinates.api');
|
|
2
|
+
|
|
3
|
+
const getCoordinatesByAddress = (city, state, context) => {
|
|
4
|
+
return coordinates.getCoordinatesByAddress(city, state, context);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
module.exports = { getCoordinatesByAddress };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const services = require('./api/coordinates.service');
|
|
2
|
-
const utils = require('./utils/utils');
|
|
3
|
-
|
|
4
|
-
module.exports = { services, utils };
|
|
1
|
+
const services = require('./api/coordinates.service');
|
|
2
|
+
const utils = require('./utils/utils');
|
|
3
|
+
|
|
4
|
+
module.exports = { services, utils };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const service = require('../api/coordinates.service');
|
|
2
|
-
|
|
3
|
-
const getCoordinatesByAddress = async (city, state, context) => {
|
|
4
|
-
const response = await service.getCoordinatesByAddress(city, state, context);
|
|
5
|
-
return response.data;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
module.exports = { getCoordinatesByAddress };
|
|
1
|
+
const service = require('../api/coordinates.service');
|
|
2
|
+
|
|
3
|
+
const getCoordinatesByAddress = async (city, state, context) => {
|
|
4
|
+
const response = await service.getCoordinatesByAddress(city, state, context);
|
|
5
|
+
return response.data;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
module.exports = { getCoordinatesByAddress };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
getTabsByProjectId: `${backendUrl}/saas/vendortab`,
|
|
6
|
-
getTabsByTabId: `${backendUrl}/saas/vendortab`,
|
|
7
|
-
create: `${backendUrl}/saas/vendortab`,
|
|
8
|
-
update: `${backendUrl}/saas/vendortab`,
|
|
9
|
-
delete: `${backendUrl}/saas/vendortab`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const getTabByTabId = (tabId, context) => {
|
|
13
|
-
return requests.getRequestHandler(Endpoints.getTabsByTabId, { tabId }, context);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getTabsByProjectId = (projectId, context) => {
|
|
17
|
-
return requests.getRequestHandler(Endpoints.getTabsByProjectId, { projectId }, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const createTab = (tabModel, context) => {
|
|
21
|
-
return requests.postRequestHandler(Endpoints.create, tabModel, context);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const updateTab = (tabModel, context) => {
|
|
25
|
-
return requests.putRequestHandler(Endpoints.update, tabModel, context);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const deleteTab = (tabId, context) => {
|
|
29
|
-
return requests.deleteRequestHandler(Endpoints.delete, context, {}, { tabId });
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = { getTabByTabId, getTabsByProjectId, createTab, updateTab, deleteTab };
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
getTabsByProjectId: `${backendUrl}/saas/vendortab`,
|
|
6
|
+
getTabsByTabId: `${backendUrl}/saas/vendortab`,
|
|
7
|
+
create: `${backendUrl}/saas/vendortab`,
|
|
8
|
+
update: `${backendUrl}/saas/vendortab`,
|
|
9
|
+
delete: `${backendUrl}/saas/vendortab`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const getTabByTabId = (tabId, context) => {
|
|
13
|
+
return requests.getRequestHandler(Endpoints.getTabsByTabId, { tabId }, context);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getTabsByProjectId = (projectId, context) => {
|
|
17
|
+
return requests.getRequestHandler(Endpoints.getTabsByProjectId, { projectId }, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const createTab = (tabModel, context) => {
|
|
21
|
+
return requests.postRequestHandler(Endpoints.create, tabModel, context);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const updateTab = (tabModel, context) => {
|
|
25
|
+
return requests.putRequestHandler(Endpoints.update, tabModel, context);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const deleteTab = (tabId, context) => {
|
|
29
|
+
return requests.deleteRequestHandler(Endpoints.delete, context, {}, { tabId });
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
module.exports = { getTabByTabId, getTabsByProjectId, createTab, updateTab, deleteTab };
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
const tabsAPI = require('./tabs.api');
|
|
2
|
-
const { CreateTabModel, UpdateTabModel } = require('../models/tabs.model');
|
|
3
|
-
|
|
4
|
-
const createTab = async (projectId, tabName, tabType, context) => {
|
|
5
|
-
const tabModel = new CreateTabModel(projectId, tabName, tabType);
|
|
6
|
-
return tabsAPI.createTab(tabModel, context);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const getTabById = async (tabId, context) => {
|
|
10
|
-
return tabsAPI.getTabByTabId(tabId, context);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const getTabsByProjectId = async (projectId, context) => {
|
|
14
|
-
return tabsAPI.getTabsByProjectId(projectId, context);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getTabsByName = async (projectId, tabName, context, { tabType } = {}) => {
|
|
18
|
-
const { data: tabs } = await getTabsByProjectId(projectId, context);
|
|
19
|
-
const requestedTab = tabType ?
|
|
20
|
-
tabs.find(tab => tab.tabName === tabName && tab.type === tabType) :
|
|
21
|
-
tabs.find(tab => tab.tabName === tabName);
|
|
22
|
-
return requestedTab;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const getOrCreateTab = async (projectId, tabName, tabType, context) => {
|
|
26
|
-
const { data: tabs } = await getTabsByProjectId(projectId, context);
|
|
27
|
-
const existingTab = tabs.find(tab => tab.tabName === tabName && tab.type === tabType);
|
|
28
|
-
|
|
29
|
-
if (existingTab) {
|
|
30
|
-
return existingTab;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const createResponse = await createTab(projectId, tabName, tabType, context);
|
|
34
|
-
return createResponse.data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const updateTab = async (projectId, tabName, tabType, tabId, context) => {
|
|
38
|
-
const tabModel = new UpdateTabModel(projectId, tabName, tabType, tabId);
|
|
39
|
-
return tabsAPI.updateTab(tabModel, context);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const deleteTabById = async (tabId, context) => {
|
|
43
|
-
return tabsAPI.deleteTab(tabId, context);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
module.exports = {
|
|
47
|
-
createTab,
|
|
48
|
-
getTabById,
|
|
49
|
-
getTabsByProjectId,
|
|
50
|
-
getTabsByName,
|
|
51
|
-
getOrCreateTab,
|
|
52
|
-
updateTab,
|
|
53
|
-
deleteTabById
|
|
54
|
-
};
|
|
1
|
+
const tabsAPI = require('./tabs.api');
|
|
2
|
+
const { CreateTabModel, UpdateTabModel } = require('../models/tabs.model');
|
|
3
|
+
|
|
4
|
+
const createTab = async (projectId, tabName, tabType, context) => {
|
|
5
|
+
const tabModel = new CreateTabModel(projectId, tabName, tabType);
|
|
6
|
+
return tabsAPI.createTab(tabModel, context);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getTabById = async (tabId, context) => {
|
|
10
|
+
return tabsAPI.getTabByTabId(tabId, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getTabsByProjectId = async (projectId, context) => {
|
|
14
|
+
return tabsAPI.getTabsByProjectId(projectId, context);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getTabsByName = async (projectId, tabName, context, { tabType } = {}) => {
|
|
18
|
+
const { data: tabs } = await getTabsByProjectId(projectId, context);
|
|
19
|
+
const requestedTab = tabType ?
|
|
20
|
+
tabs.find(tab => tab.tabName === tabName && tab.type === tabType) :
|
|
21
|
+
tabs.find(tab => tab.tabName === tabName);
|
|
22
|
+
return requestedTab;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getOrCreateTab = async (projectId, tabName, tabType, context) => {
|
|
26
|
+
const { data: tabs } = await getTabsByProjectId(projectId, context);
|
|
27
|
+
const existingTab = tabs.find(tab => tab.tabName === tabName && tab.type === tabType);
|
|
28
|
+
|
|
29
|
+
if (existingTab) {
|
|
30
|
+
return existingTab;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const createResponse = await createTab(projectId, tabName, tabType, context);
|
|
34
|
+
return createResponse.data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const updateTab = async (projectId, tabName, tabType, tabId, context) => {
|
|
38
|
+
const tabModel = new UpdateTabModel(projectId, tabName, tabType, tabId);
|
|
39
|
+
return tabsAPI.updateTab(tabModel, context);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const deleteTabById = async (tabId, context) => {
|
|
43
|
+
return tabsAPI.deleteTab(tabId, context);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
createTab,
|
|
48
|
+
getTabById,
|
|
49
|
+
getTabsByProjectId,
|
|
50
|
+
getTabsByName,
|
|
51
|
+
getOrCreateTab,
|
|
52
|
+
updateTab,
|
|
53
|
+
deleteTabById
|
|
54
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const services = require('./api/tabs.service');
|
|
2
|
-
|
|
3
|
-
module.exports = { services };
|
|
1
|
+
const services = require('./api/tabs.service');
|
|
2
|
+
|
|
3
|
+
module.exports = { services };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
class CreateTabModel {
|
|
2
|
-
constructor(projectId, tabName, tabType) {
|
|
3
|
-
this.projectId = projectId;
|
|
4
|
-
this.tabName = tabName;
|
|
5
|
-
this.type = tabType;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
class UpdateTabModel {
|
|
10
|
-
constructor(projectId, tabName, tabType, tabId) {
|
|
11
|
-
this.projectId = projectId;
|
|
12
|
-
this.tabName = tabName;
|
|
13
|
-
this.type = tabType;
|
|
14
|
-
this.tabId = tabId;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = { CreateTabModel, UpdateTabModel };
|
|
1
|
+
class CreateTabModel {
|
|
2
|
+
constructor(projectId, tabName, tabType) {
|
|
3
|
+
this.projectId = projectId;
|
|
4
|
+
this.tabName = tabName;
|
|
5
|
+
this.type = tabType;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class UpdateTabModel {
|
|
10
|
+
constructor(projectId, tabName, tabType, tabId) {
|
|
11
|
+
this.projectId = projectId;
|
|
12
|
+
this.tabName = tabName;
|
|
13
|
+
this.type = tabType;
|
|
14
|
+
this.tabId = tabId;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = { CreateTabModel, UpdateTabModel };
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
const requests = require('../../internal-api/../../common/requests/cookieAuth/requests');
|
|
2
|
-
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
3
|
-
const timeUtils = require('../../../common/utils/timeUtils');
|
|
4
|
-
|
|
5
|
-
const { backendUrl, threadSchedulerSecret } = require('../../../env').getEnv();
|
|
6
|
-
|
|
7
|
-
const Endpoints = {
|
|
8
|
-
run: `${backendUrl}/threadSchedular/${threadSchedulerSecret}`
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const runThreadScheduler = async ({ contractorIds = [], scheduledReportsIds = [], retries = 10 } = {}) => {
|
|
12
|
-
const params = { contractorIdsList: contractorIds.toString(), scheduledReportsIds: scheduledReportsIds.toString() };
|
|
13
|
-
|
|
14
|
-
let response;
|
|
15
|
-
while (!response || isOverloadError(response.status) && retries--) {
|
|
16
|
-
response = await requests.getRequestHandler(Endpoints.run, params);
|
|
17
|
-
await timeUtils.waitFor(1.5).seconds;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (response.status !== httpResponseStatusCodes.OK) {
|
|
21
|
-
throw new Error(`Thread scheduler has failed to run\n${response}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return response;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
runForRecords: function(contractorIds) {
|
|
29
|
-
return runThreadScheduler({ contractorIds });
|
|
30
|
-
},
|
|
31
|
-
runForReports: function(scheduledReportsIds) {
|
|
32
|
-
return runThreadScheduler({ scheduledReportsIds });
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function isOverloadError(errorCode) {
|
|
37
|
-
const overloadResponseErrors = [httpResponseStatusCodes.TOO_MANY_REQUESTS, httpResponseStatusCodes.CONFLICT];
|
|
38
|
-
return overloadResponseErrors.includes(errorCode);
|
|
39
|
-
}
|
|
1
|
+
const requests = require('../../internal-api/../../common/requests/cookieAuth/requests');
|
|
2
|
+
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
const timeUtils = require('../../../common/utils/timeUtils');
|
|
4
|
+
|
|
5
|
+
const { backendUrl, threadSchedulerSecret } = require('../../../env').getEnv();
|
|
6
|
+
|
|
7
|
+
const Endpoints = {
|
|
8
|
+
run: `${backendUrl}/threadSchedular/${threadSchedulerSecret}`
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const runThreadScheduler = async ({ contractorIds = [], scheduledReportsIds = [], retries = 10 } = {}) => {
|
|
12
|
+
const params = { contractorIdsList: contractorIds.toString(), scheduledReportsIds: scheduledReportsIds.toString() };
|
|
13
|
+
|
|
14
|
+
let response;
|
|
15
|
+
while (!response || isOverloadError(response.status) && retries--) {
|
|
16
|
+
response = await requests.getRequestHandler(Endpoints.run, params);
|
|
17
|
+
await timeUtils.waitFor(1.5).seconds;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (response.status !== httpResponseStatusCodes.OK) {
|
|
21
|
+
throw new Error(`Thread scheduler has failed to run\n${response}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return response;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
runForRecords: function(contractorIds) {
|
|
29
|
+
return runThreadScheduler({ contractorIds });
|
|
30
|
+
},
|
|
31
|
+
runForReports: function(scheduledReportsIds) {
|
|
32
|
+
return runThreadScheduler({ scheduledReportsIds });
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function isOverloadError(errorCode) {
|
|
37
|
+
const overloadResponseErrors = [httpResponseStatusCodes.TOO_MANY_REQUESTS, httpResponseStatusCodes.CONFLICT];
|
|
38
|
+
return overloadResponseErrors.includes(errorCode);
|
|
39
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
invite: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
6
|
-
getTenantsByProjectId: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
7
|
-
signupUser: `${backendUrl}/_saas/guests/signup`,
|
|
8
|
-
removeTenantUser: (projectId, userId) => `${backendUrl}/saas/project/${projectId}/tenant/${userId}`
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const invite = (projectId, invitedTenantUser, context) => {
|
|
12
|
-
return requests.putRequestHandler(Endpoints.invite(projectId), invitedTenantUser, context, {});
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getTenantUsersByProjectId = (projectId, context) => {
|
|
16
|
-
return requests.getRequestHandler(Endpoints.getTenantsByProjectId(projectId), {}, context, {});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const signupUser = (signupUserModel, context) => {
|
|
20
|
-
return requests.postRequestHandler(Endpoints.signupUser, signupUserModel, context, {}, {});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const removeTenantUser = (projectId, tenantId, context) => {
|
|
24
|
-
return requests.deleteRequestHandler(Endpoints.removeTenantUser(projectId, tenantId), context);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
invite,
|
|
29
|
-
getTenantUsersByProjectId,
|
|
30
|
-
signupUser,
|
|
31
|
-
removeTenantUser
|
|
32
|
-
};
|
|
1
|
+
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
invite: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
6
|
+
getTenantsByProjectId: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
7
|
+
signupUser: `${backendUrl}/_saas/guests/signup`,
|
|
8
|
+
removeTenantUser: (projectId, userId) => `${backendUrl}/saas/project/${projectId}/tenant/${userId}`
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const invite = (projectId, invitedTenantUser, context) => {
|
|
12
|
+
return requests.putRequestHandler(Endpoints.invite(projectId), invitedTenantUser, context, {});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getTenantUsersByProjectId = (projectId, context) => {
|
|
16
|
+
return requests.getRequestHandler(Endpoints.getTenantsByProjectId(projectId), {}, context, {});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const signupUser = (signupUserModel, context) => {
|
|
20
|
+
return requests.postRequestHandler(Endpoints.signupUser, signupUserModel, context, {}, {});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const removeTenantUser = (projectId, tenantId, context) => {
|
|
24
|
+
return requests.deleteRequestHandler(Endpoints.removeTenantUser(projectId, tenantId), context);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
invite,
|
|
29
|
+
getTenantUsersByProjectId,
|
|
30
|
+
signupUser,
|
|
31
|
+
removeTenantUser
|
|
32
|
+
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
const { getEnv } = require('../../../../../env');
|
|
2
|
-
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
3
|
-
|
|
4
|
-
const { credentials } = getEnv();
|
|
5
|
-
|
|
6
|
-
const { InviteTenantUserModel } = require('../../models/tenent.user.model');
|
|
7
|
-
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
8
|
-
const tenantAPI = require('./tenant.app.api');
|
|
9
|
-
const util = require('../../utils/util');
|
|
10
|
-
|
|
11
|
-
const inviteTenantUser = (projectId, invitedTenantUser, context) => {
|
|
12
|
-
validateType(invitedTenantUser, InviteTenantUserModel);
|
|
13
|
-
return tenantAPI.invite(projectId, invitedTenantUser, context);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const signupUser = (signupUserModel, context) => {
|
|
17
|
-
return tenantAPI.signupUser(signupUserModel, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const removeTenantUser = (projectId, tenantId, context) => {
|
|
21
|
-
return tenantAPI.removeTenantUser(projectId, tenantId, context);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const getTenantUsersByProjectId = async (projectId, context) => {
|
|
25
|
-
const tenantResponse = await tenantAPI.getTenantUsersByProjectId(projectId, context);
|
|
26
|
-
|
|
27
|
-
if (tenantResponse.status !== httpResponseStatusCodes.OK) {
|
|
28
|
-
throw new Error(`Failed to retrieve tenants users from project\n${tenantResponse.status}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return tenantResponse.data;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const getTenantUserByEmail = async (projectId, email, context) => {
|
|
35
|
-
const allTenants = await getTenantUsersByProjectId(projectId, context);
|
|
36
|
-
|
|
37
|
-
const tenant = allTenants.find(tenant => tenant.email === email);
|
|
38
|
-
return tenant;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const getOrCreateTenantUser = async (projectId, email, company, requestId, context, { fullName = 'Tenant User', password = credentials.strongPassword, toSignUp = true } = {}) => {
|
|
42
|
-
let tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
43
|
-
|
|
44
|
-
if (tenantUser && tenantUser.subuserId && tenantUser.isVerified) {
|
|
45
|
-
return tenantUser;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const inviteUserModel = new InviteTenantUserModel(email, company, requestId);
|
|
49
|
-
const inviteResponse = await inviteTenantUser(projectId, inviteUserModel, context);
|
|
50
|
-
|
|
51
|
-
if (inviteResponse.status !== httpResponseStatusCodes.OK) {
|
|
52
|
-
throw new Error(`Failed to invite tenant user with email: ${email}\n${inviteResponse}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
56
|
-
|
|
57
|
-
//Already signup tenant user or pending user needed
|
|
58
|
-
if (tenantUser.isVerified || !toSignUp) {
|
|
59
|
-
return tenantUser;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const signupUserModel = await util.getSignupUserModel(email, 'Admin', fullName, password, context);
|
|
63
|
-
const signupResponse = await signupUser(signupUserModel, context);
|
|
64
|
-
|
|
65
|
-
if (signupResponse.status !== httpResponseStatusCodes.OK) {
|
|
66
|
-
throw new Error(`Failed to signup tenant user with email: ${email}\n${signupResponse}`);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
70
|
-
return tenantUser;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
module.exports = {
|
|
74
|
-
inviteTenantUser,
|
|
75
|
-
getTenantUsersByProjectId,
|
|
76
|
-
getOrCreateTenantUser,
|
|
77
|
-
removeTenantUser
|
|
78
|
-
};
|
|
1
|
+
const { getEnv } = require('../../../../../env');
|
|
2
|
+
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
|
|
4
|
+
const { credentials } = getEnv();
|
|
5
|
+
|
|
6
|
+
const { InviteTenantUserModel } = require('../../models/tenent.user.model');
|
|
7
|
+
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
8
|
+
const tenantAPI = require('./tenant.app.api');
|
|
9
|
+
const util = require('../../utils/util');
|
|
10
|
+
|
|
11
|
+
const inviteTenantUser = (projectId, invitedTenantUser, context) => {
|
|
12
|
+
validateType(invitedTenantUser, InviteTenantUserModel);
|
|
13
|
+
return tenantAPI.invite(projectId, invitedTenantUser, context);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const signupUser = (signupUserModel, context) => {
|
|
17
|
+
return tenantAPI.signupUser(signupUserModel, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const removeTenantUser = (projectId, tenantId, context) => {
|
|
21
|
+
return tenantAPI.removeTenantUser(projectId, tenantId, context);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getTenantUsersByProjectId = async (projectId, context) => {
|
|
25
|
+
const tenantResponse = await tenantAPI.getTenantUsersByProjectId(projectId, context);
|
|
26
|
+
|
|
27
|
+
if (tenantResponse.status !== httpResponseStatusCodes.OK) {
|
|
28
|
+
throw new Error(`Failed to retrieve tenants users from project\n${tenantResponse.status}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return tenantResponse.data;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getTenantUserByEmail = async (projectId, email, context) => {
|
|
35
|
+
const allTenants = await getTenantUsersByProjectId(projectId, context);
|
|
36
|
+
|
|
37
|
+
const tenant = allTenants.find(tenant => tenant.email === email);
|
|
38
|
+
return tenant;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getOrCreateTenantUser = async (projectId, email, company, requestId, context, { fullName = 'Tenant User', password = credentials.strongPassword, toSignUp = true } = {}) => {
|
|
42
|
+
let tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
43
|
+
|
|
44
|
+
if (tenantUser && tenantUser.subuserId && tenantUser.isVerified) {
|
|
45
|
+
return tenantUser;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const inviteUserModel = new InviteTenantUserModel(email, company, requestId);
|
|
49
|
+
const inviteResponse = await inviteTenantUser(projectId, inviteUserModel, context);
|
|
50
|
+
|
|
51
|
+
if (inviteResponse.status !== httpResponseStatusCodes.OK) {
|
|
52
|
+
throw new Error(`Failed to invite tenant user with email: ${email}\n${inviteResponse}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
56
|
+
|
|
57
|
+
//Already signup tenant user or pending user needed
|
|
58
|
+
if (tenantUser.isVerified || !toSignUp) {
|
|
59
|
+
return tenantUser;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const signupUserModel = await util.getSignupUserModel(email, 'Admin', fullName, password, context);
|
|
63
|
+
const signupResponse = await signupUser(signupUserModel, context);
|
|
64
|
+
|
|
65
|
+
if (signupResponse.status !== httpResponseStatusCodes.OK) {
|
|
66
|
+
throw new Error(`Failed to signup tenant user with email: ${email}\n${signupResponse}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
tenantUser = await getTenantUserByEmail(projectId, email, context);
|
|
70
|
+
return tenantUser;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
module.exports = {
|
|
74
|
+
inviteTenantUser,
|
|
75
|
+
getTenantUsersByProjectId,
|
|
76
|
+
getOrCreateTenantUser,
|
|
77
|
+
removeTenantUser
|
|
78
|
+
};
|