@getjones/test-infra 2.7.8 → 2.7.9
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 +1 -1
- package/src/defaults/configs/auditConfigs.js +3 -1
- package/src/factory/records/records.js +1 -1
- package/src/saas/internal-api/compliance/api/{waive/waive.api.js → overrideGap/override.gap.api.js} +14 -2
- package/src/saas/internal-api/compliance/api/{waive/waive.service.js → overrideGap/override.gap.service.js} +16 -4
- package/src/saas/internal-api/compliance/index.js +8 -3
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +3 -2
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +1 -19
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +26 -30
- package/src/saas/internal-api/projects/utils/utils.js +1 -75
package/package.json
CHANGED
|
@@ -4,7 +4,9 @@ const { getOneWeekAgoDate, getOneWeekAheadDate } = require('../../common/utils/t
|
|
|
4
4
|
|
|
5
5
|
const DEFAULT_POLICY_DATE = '24/05/2030';
|
|
6
6
|
const DEFAULT_AM_SCORE = 'A';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
//Excluded from creating global record: 'ABC-12345-XYZ', 'ABC-123-XYZ', 'ABC-123'. When GR is needed - use different GL number.
|
|
9
|
+
const DEFAULT_POLICY_NUMBER = 'ABC-12345-XYZ';
|
|
8
10
|
|
|
9
11
|
const {
|
|
10
12
|
certificateIssueDate,
|
|
@@ -113,7 +113,7 @@ const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requiremen
|
|
|
113
113
|
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.notCompliant, tabId, requirementId, context);
|
|
114
114
|
|
|
115
115
|
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
116
|
-
await compliance.services.
|
|
116
|
+
await compliance.services.overrideGap.waiveAll(record, context);
|
|
117
117
|
|
|
118
118
|
return recordId;
|
|
119
119
|
};
|
package/src/saas/internal-api/compliance/api/{waive/waive.api.js → overrideGap/override.gap.api.js}
RENAMED
|
@@ -3,7 +3,9 @@ const { backendUrl } = require('../../../../../env').getEnv();
|
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
waive: contractorId => `${backendUrl}/saas/contractors/${contractorId}/waiver`,
|
|
6
|
-
retract: contractorId => `${backendUrl}/saas/contractors/${contractorId}/waiver
|
|
6
|
+
retract: contractorId => `${backendUrl}/saas/contractors/${contractorId}/waiver`,
|
|
7
|
+
overrideGap: `${backendUrl}/saas/record/override-gap`,
|
|
8
|
+
retractOverride: `${backendUrl}/saas/record/retract-override`
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
const waive = async (contractorId, waiveRequestModel, context) => {
|
|
@@ -18,4 +20,14 @@ const retract = async (contractorId, retractRequestModel, context) => {
|
|
|
18
20
|
return requests.postRequestHandler(Endpoints.retract(contractorId), retractRequestModel, context, {}, { status });
|
|
19
21
|
};
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
const overrideGap = (waiveRequestModel, isTestingBackwardCompatibility, context) => {
|
|
24
|
+
const headers = {};
|
|
25
|
+
const params = { isTestingBackwardCompatibility };
|
|
26
|
+
return requests.postRequestHandler(Endpoints.overrideGap, waiveRequestModel, context, headers, params);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const retractOverride = (retractRequestModel, context) => {
|
|
30
|
+
return requests.postRequestHandler(Endpoints.retractOverride, retractRequestModel, context);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
module.exports = { waive, retract, overrideGap, retractOverride };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const env = require('../../../../../env');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const overrideGapApi = require('./override.gap.api');
|
|
4
4
|
const { WaiveRequestModel, RetractRequestModel, WAIVER_REASONS } = require('../../models/waive/waive.model');
|
|
5
5
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
6
6
|
const auditUtil = require('../../utils/auditUtil');
|
|
@@ -11,12 +11,22 @@ const userTypes = require('../../../../../common/consts/userTypes');
|
|
|
11
11
|
|
|
12
12
|
const waive = (waiveRequestModel, context) => {
|
|
13
13
|
validateType(waiveRequestModel, WaiveRequestModel);
|
|
14
|
-
return
|
|
14
|
+
return overrideGapApi.waive(waiveRequestModel.contractorId, waiveRequestModel, context);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const retract = (retractRequestModel, context) => {
|
|
18
18
|
validateType(retractRequestModel, RetractRequestModel);
|
|
19
|
-
return
|
|
19
|
+
return overrideGapApi.retract(retractRequestModel.contractorId, retractRequestModel, context);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const overrideGap = ({ waiveRequestModel, isTestingBackwardCompatibility = false, context }) => {
|
|
23
|
+
validateType(waiveRequestModel, WaiveRequestModel);
|
|
24
|
+
return overrideGapApi.overrideGap(waiveRequestModel, isTestingBackwardCompatibility, context);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const retractOverride = (retractRequestModel, context) => {
|
|
28
|
+
validateType(retractRequestModel, RetractRequestModel);
|
|
29
|
+
return overrideGapApi.retractOverride(retractRequestModel, context);
|
|
20
30
|
};
|
|
21
31
|
|
|
22
32
|
const getWaiveModel = (
|
|
@@ -111,5 +121,7 @@ module.exports = {
|
|
|
111
121
|
retract,
|
|
112
122
|
getWaiveModel,
|
|
113
123
|
getRetractModel,
|
|
114
|
-
getWaiveModelByGap
|
|
124
|
+
getWaiveModelByGap,
|
|
125
|
+
overrideGap,
|
|
126
|
+
retractOverride
|
|
115
127
|
};
|
|
@@ -2,12 +2,13 @@ const auditModels = require('./models/audit/audit.model');
|
|
|
2
2
|
const auditServices = require('./api/audit/audit.service');
|
|
3
3
|
|
|
4
4
|
const waiveModels = require('./models/waive/waive.model');
|
|
5
|
-
const
|
|
5
|
+
const overrideGapServices = require('./api/overrideGap/override.gap.service');
|
|
6
6
|
|
|
7
7
|
const convertServices = require('./api/convert/convert.service');
|
|
8
8
|
const coverageServices = require('./api/coverage/coverage.service');
|
|
9
9
|
|
|
10
10
|
const auditConsts = require('./consts/audit');
|
|
11
|
+
const auditUtils = require('./utils/auditUtil');
|
|
11
12
|
|
|
12
13
|
const models = {
|
|
13
14
|
audit: auditModels,
|
|
@@ -18,11 +19,15 @@ const consts = {
|
|
|
18
19
|
audit: auditConsts
|
|
19
20
|
};
|
|
20
21
|
|
|
22
|
+
const utils = {
|
|
23
|
+
audit: auditUtils
|
|
24
|
+
};
|
|
25
|
+
|
|
21
26
|
const services = {
|
|
22
27
|
audit: auditServices,
|
|
23
|
-
|
|
28
|
+
overrideGap: overrideGapServices,
|
|
24
29
|
convert: convertServices,
|
|
25
30
|
coverage: coverageServices
|
|
26
31
|
};
|
|
27
32
|
|
|
28
|
-
module.exports = { services, models, consts };
|
|
33
|
+
module.exports = { services, models, consts, utils };
|
|
@@ -5,8 +5,9 @@ const WAIVE_ACTIONS = {
|
|
|
5
5
|
|
|
6
6
|
const WAIVER_REASONS = {
|
|
7
7
|
BUSINESS_DECISION: 'Business Decision',
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
EXECUTIVE_APPROVAL: 'Executive Approval',
|
|
9
|
+
ACCEPT_NO_EXPOSURE: 'Accept / No Exposure',
|
|
10
|
+
NO_EXPOSURE: 'No Exposure' // DEPRECATED - BACKWARD COMPATIBILITY
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
function WaiveRequestModel({
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const { getProjectSettingsByProjectId, updateProjectSettingsByProjectId } = require('./project.settings.api');
|
|
2
2
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
3
|
const UpdateProjectSettingsModel = require('../../models/settings/update.project.settings.model');
|
|
4
|
-
const util = require('../../utils/utils');
|
|
5
|
-
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
6
4
|
|
|
7
5
|
const updateProjectSettings = (updateProjectSettingsModel, context) => {
|
|
8
6
|
validateType(updateProjectSettingsModel, UpdateProjectSettingsModel);
|
|
@@ -13,23 +11,7 @@ const getProjectSettings = (projectId, context) => {
|
|
|
13
11
|
return getProjectSettingsByProjectId(projectId, context);
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
const setProjectSettings = async (projectId, settings, context) => {
|
|
17
|
-
const isUIConfig = util.isUIConfig(settings);
|
|
18
|
-
|
|
19
|
-
const settingsConfig = isUIConfig ? util.parseProjectSettingsConfig(projectId, settings) : settings;
|
|
20
|
-
const settingsModel = new UpdateProjectSettingsModel(settingsConfig);
|
|
21
|
-
|
|
22
|
-
const updateResponse = await updateProjectSettings(settingsModel, context);
|
|
23
|
-
|
|
24
|
-
if (updateResponse.status !== httpResponseStatusCodes.OK) {
|
|
25
|
-
throw new Error(`Failed to set project: ${projectId} settings\n${updateResponse.statusText}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return updateResponse;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
14
|
module.exports = {
|
|
32
15
|
updateProjectSettings,
|
|
33
|
-
getProjectSettings
|
|
34
|
-
setProjectSettings
|
|
16
|
+
getProjectSettings
|
|
35
17
|
};
|
|
@@ -1,43 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.qrEnabled = qrEnabled;
|
|
22
|
-
this.tenantSolution = tenantSolution;
|
|
23
|
-
this.autocompleteSettings = { ... DEFAULT_AUTOCOMPLETE_ADD_VENDORS, ... autocompleteSettings };
|
|
24
|
-
}
|
|
1
|
+
function UpdateProjectSettingsModel({
|
|
2
|
+
autoGaps = defaultAutoGaps,
|
|
3
|
+
autoRenewals = false,
|
|
4
|
+
marketplace = defaultMarketplace,
|
|
5
|
+
ocrEnabled = false,
|
|
6
|
+
onboardingPhase = false,
|
|
7
|
+
projectId = null,
|
|
8
|
+
qrEnabled = false,
|
|
9
|
+
tenantSolution = false,
|
|
10
|
+
autocompleteAddVendors = defaultAutocompleteAddVendors
|
|
11
|
+
}) {
|
|
12
|
+
this.autoGaps = autoGaps;
|
|
13
|
+
this.autoRenewals = autoRenewals;
|
|
14
|
+
this.marketplace = marketplace;
|
|
15
|
+
this.ocrEnabled = ocrEnabled;
|
|
16
|
+
this.onboardingPhase = onboardingPhase;
|
|
17
|
+
this.projectId = projectId;
|
|
18
|
+
this.qrEnabled = qrEnabled;
|
|
19
|
+
this.tenantSolution = tenantSolution;
|
|
20
|
+
this.autocompleteAddVendors = autocompleteAddVendors;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
module.exports = UpdateProjectSettingsModel;
|
|
28
24
|
|
|
29
|
-
const
|
|
25
|
+
const defaultMarketplace = {
|
|
30
26
|
marketplaceEnabled: false,
|
|
31
27
|
marketplacePreApproved: false,
|
|
32
28
|
marketplaceOnboardedVendors: false,
|
|
33
29
|
marketplaceCompliantVendorQuotationEnabled: false
|
|
34
30
|
};
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const defaultAutoGaps = {
|
|
32
|
+
Guests: false,
|
|
33
|
+
Tenants: false,
|
|
34
|
+
Vendors: false
|
|
39
35
|
};
|
|
40
|
-
const
|
|
36
|
+
const defaultAutocompleteAddVendors = {
|
|
41
37
|
autocompleteAddVendorsForPm: false,
|
|
42
38
|
autocompleteAddVendorsForTenants: false
|
|
43
39
|
};
|
|
@@ -72,85 +72,11 @@ const deleteProjectByName = (accounId, projectName, context) => {
|
|
|
72
72
|
return services.deleteProjectByName(accounId, projectName, context);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
const isUIConfig = config => {
|
|
76
|
-
const allKeysSettings = { ... attributesConvertor, ... marketplaceAttributesConvertor, ... autoGapsConvertor, ... autocompleteAttributesConvertor };
|
|
77
|
-
const convectorKeys = Object.keys(allKeysSettings);
|
|
78
|
-
const configKeys = Object.keys(config);
|
|
79
|
-
|
|
80
|
-
return convectorKeys.some(key => configKeys.includes(key));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const assignNewSettingFormat = (target, soursKey, soursValue, dictionaryObject) => {
|
|
84
|
-
const attributeKey = dictionaryObject[soursKey];
|
|
85
|
-
const attributeValue = JSON.parse(soursValue);
|
|
86
|
-
Object.assign(target, { [attributeKey]: attributeValue });
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const marketplaceParser = (settings, soursKey, soursValue, dictionary) => {
|
|
90
|
-
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
91
|
-
|
|
92
|
-
assignNewSettingFormat(settings.marketplaceSettings, soursKey, soursValue, dictionary);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const autoGapsParser = (settings, soursKey, soursValue, dictionary) => {
|
|
96
|
-
settings.autoGaps = settings.autoGaps || {};
|
|
97
|
-
|
|
98
|
-
assignNewSettingFormat(settings.autoGaps, soursKey, soursValue, dictionary);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const autocompleteParser = (settings, soursKey, soursValue, dictionary) => {
|
|
102
|
-
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
103
|
-
|
|
104
|
-
assignNewSettingFormat(settings.autocompleteSettings, soursKey, soursValue, dictionary);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const parseProjectSettingsConfig = (projectId, settingsConfig) => {
|
|
108
|
-
const settings = { projectId };
|
|
109
|
-
|
|
110
|
-
for (const setting in settingsConfig) {
|
|
111
|
-
marketplaceAttributesConvertor[setting] && marketplaceParser(settings, setting, settingsConfig[setting], marketplaceAttributesConvertor);
|
|
112
|
-
|
|
113
|
-
autocompleteAttributesConvertor[setting] && autocompleteParser(settings, setting, settingsConfig[setting], autocompleteAttributesConvertor);
|
|
114
|
-
|
|
115
|
-
attributesConvertor[setting] && assignNewSettingFormat(settings, setting, settingsConfig[setting], attributesConvertor);
|
|
116
|
-
|
|
117
|
-
autoGapsConvertor[setting] && autoGapsParser(settings, setting, settingsConfig[setting], autoGapsConvertor);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return settings;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
75
|
module.exports = {
|
|
124
76
|
getProjectConfig,
|
|
125
77
|
getOrCreateProject,
|
|
126
78
|
getDefaultProjectId,
|
|
127
79
|
getCreateProjectModel,
|
|
128
80
|
getUpdateProjectModel,
|
|
129
|
-
deleteProjectByName
|
|
130
|
-
parseProjectSettingsConfig,
|
|
131
|
-
isUIConfig
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const attributesConvertor = {
|
|
135
|
-
'Automatic Renewal': 'autoRenewals',
|
|
136
|
-
'Onboarding Phase Enabled': 'onboardingPhase',
|
|
137
|
-
'Tenant App': 'tenantSolution'
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const marketplaceAttributesConvertor = {
|
|
141
|
-
'Vendor Network Onboarding': 'marketplaceEnabled',
|
|
142
|
-
'Vendor Network - Show Onboarded Vendors': 'marketplaceOnboardedVendors',
|
|
143
|
-
'Pre-Approved Tab': 'marketplacePreApproved',
|
|
144
|
-
'Compliant Vendor Quotation': 'marketplaceCompliantVendorQuotationEnabled'
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const autocompleteAttributesConvertor = {
|
|
148
|
-
'For PM': 'autocompleteAddVendorsForPm',
|
|
149
|
-
'For Tenants': 'autocompleteAddVendorsForTenants'
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const autoGapsConvertor = {
|
|
153
|
-
'Guests': 'isAutoGapsEnabledForGuests',
|
|
154
|
-
'Tenants': 'isAutoGapsEnabledForTenants',
|
|
155
|
-
'Vendors': 'isAutoGapsEnabledForVendors'
|
|
81
|
+
deleteProjectByName
|
|
156
82
|
};
|