@getjones/test-infra 2.7.9 → 2.7.10
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/factory/records/records.js +1 -1
- package/src/factory/users/users.js +1 -1
- package/src/saas/internal-api/compliance/api/{overrideGap/override.gap.api.js → waive/waive.api.js} +2 -4
- package/src/saas/internal-api/compliance/api/{overrideGap/override.gap.service.js → waive/waive.service.js} +6 -6
- package/src/saas/internal-api/compliance/index.js +2 -2
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +19 -1
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +28 -26
- package/src/saas/internal-api/projects/utils/utils.js +77 -3
package/package.json
CHANGED
|
@@ -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.waive.waiveAll(record, context);
|
|
117
117
|
|
|
118
118
|
return recordId;
|
|
119
119
|
};
|
package/src/saas/internal-api/compliance/api/{overrideGap/override.gap.api.js → waive/waive.api.js}
RENAMED
|
@@ -20,10 +20,8 @@ const retract = async (contractorId, retractRequestModel, context) => {
|
|
|
20
20
|
return requests.postRequestHandler(Endpoints.retract(contractorId), retractRequestModel, context, {}, { status });
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const overrideGap = (waiveRequestModel,
|
|
24
|
-
|
|
25
|
-
const params = { isTestingBackwardCompatibility };
|
|
26
|
-
return requests.postRequestHandler(Endpoints.overrideGap, waiveRequestModel, context, headers, params);
|
|
23
|
+
const overrideGap = (waiveRequestModel, context) => {
|
|
24
|
+
return requests.postRequestHandler(Endpoints.overrideGap, waiveRequestModel, context);
|
|
27
25
|
};
|
|
28
26
|
|
|
29
27
|
const retractOverride = (retractRequestModel, context) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const env = require('../../../../../env');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const waiveApi = require('./waive.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,22 +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 waiveApi.waive(waiveRequestModel.contractorId, waiveRequestModel, context);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const retract = (retractRequestModel, context) => {
|
|
18
18
|
validateType(retractRequestModel, RetractRequestModel);
|
|
19
|
-
return
|
|
19
|
+
return waiveApi.retract(retractRequestModel.contractorId, retractRequestModel, context);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const overrideGap = (
|
|
22
|
+
const overrideGap = (waiveRequestModel, context) => {
|
|
23
23
|
validateType(waiveRequestModel, WaiveRequestModel);
|
|
24
|
-
return
|
|
24
|
+
return waiveApi.overrideGap(waiveRequestModel, context);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const retractOverride = (retractRequestModel, context) => {
|
|
28
28
|
validateType(retractRequestModel, RetractRequestModel);
|
|
29
|
-
return
|
|
29
|
+
return waiveApi.retractOverride(retractRequestModel, context);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const getWaiveModel = (
|
|
@@ -2,7 +2,7 @@ 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 waiveServices = require('./api/waive/waive.service');
|
|
6
6
|
|
|
7
7
|
const convertServices = require('./api/convert/convert.service');
|
|
8
8
|
const coverageServices = require('./api/coverage/coverage.service');
|
|
@@ -25,7 +25,7 @@ const utils = {
|
|
|
25
25
|
|
|
26
26
|
const services = {
|
|
27
27
|
audit: auditServices,
|
|
28
|
-
|
|
28
|
+
waive: waiveServices,
|
|
29
29
|
convert: convertServices,
|
|
30
30
|
coverage: coverageServices
|
|
31
31
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
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');
|
|
4
6
|
|
|
5
7
|
const updateProjectSettings = (updateProjectSettingsModel, context) => {
|
|
6
8
|
validateType(updateProjectSettingsModel, UpdateProjectSettingsModel);
|
|
@@ -11,7 +13,23 @@ const getProjectSettings = (projectId, context) => {
|
|
|
11
13
|
return getProjectSettingsByProjectId(projectId, context);
|
|
12
14
|
};
|
|
13
15
|
|
|
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
|
+
|
|
14
31
|
module.exports = {
|
|
15
32
|
updateProjectSettings,
|
|
16
|
-
getProjectSettings
|
|
33
|
+
getProjectSettings,
|
|
34
|
+
setProjectSettings
|
|
17
35
|
};
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
class UpdateProjectSettingsModel {
|
|
2
|
+
constructor(
|
|
3
|
+
{
|
|
4
|
+
autoGaps = {},
|
|
5
|
+
autoRenewals = false,
|
|
6
|
+
marketplaceSettings = {},
|
|
7
|
+
ocrEnabled = false,
|
|
8
|
+
onboardingPhase = false,
|
|
9
|
+
projectId = null,
|
|
10
|
+
tenantSolution = false,
|
|
11
|
+
autocompleteSettings = {}
|
|
12
|
+
} = {}
|
|
13
|
+
) {
|
|
14
|
+
this.autoGaps = { ... DEFAULT_AUTOGAPS, ... autoGaps };
|
|
15
|
+
this.autoRenewals = autoRenewals;
|
|
16
|
+
this.marketplaceSettings = { ... DEFAULT_MARKETPLACE, ... marketplaceSettings };
|
|
17
|
+
this.ocrEnabled = ocrEnabled;
|
|
18
|
+
this.onboardingPhase = onboardingPhase;
|
|
19
|
+
this.projectId = projectId;
|
|
20
|
+
this.tenantSolution = tenantSolution;
|
|
21
|
+
this.autocompleteSettings = { ... DEFAULT_AUTOCOMPLETE_ADD_VENDORS, ... autocompleteSettings };
|
|
22
|
+
}
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
module.exports = UpdateProjectSettingsModel;
|
|
24
26
|
|
|
25
|
-
const
|
|
27
|
+
const DEFAULT_MARKETPLACE = {
|
|
26
28
|
marketplaceEnabled: false,
|
|
27
29
|
marketplacePreApproved: false,
|
|
28
30
|
marketplaceOnboardedVendors: false,
|
|
29
31
|
marketplaceCompliantVendorQuotationEnabled: false
|
|
30
32
|
};
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const DEFAULT_AUTOGAPS = {
|
|
34
|
+
isAutoGapsEnabledForGuests: false,
|
|
35
|
+
isAutoGapsEnabledForTenants: false,
|
|
36
|
+
isAutoGapsEnabledForVendors: false
|
|
35
37
|
};
|
|
36
|
-
const
|
|
38
|
+
const DEFAULT_AUTOCOMPLETE_ADD_VENDORS = {
|
|
37
39
|
autocompleteAddVendorsForPm: false,
|
|
38
40
|
autocompleteAddVendorsForTenants: false
|
|
39
41
|
};
|
|
@@ -68,8 +68,56 @@ const getProjectConfig = (projectName, { city, state, accountName, projectNumber
|
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const deleteProjectByName = (
|
|
72
|
-
return services.deleteProjectByName(
|
|
71
|
+
const deleteProjectByName = (accountId, projectName, context) => {
|
|
72
|
+
return services.deleteProjectByName(accountId, projectName, context);
|
|
73
|
+
};
|
|
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, sourceKey, sourceValue, dictionaryObject) => {
|
|
84
|
+
const attributeKey = dictionaryObject[sourceKey];
|
|
85
|
+
const attributeValue = JSON.parse(sourceValue);
|
|
86
|
+
Object.assign(target, { [attributeKey]: attributeValue });
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const marketplaceParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
90
|
+
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
91
|
+
|
|
92
|
+
assignNewSettingFormat(settings.marketplaceSettings, sourceKey, sourceValue, dictionary);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const autoGapsParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
96
|
+
settings.autoGaps = settings.autoGaps || {};
|
|
97
|
+
|
|
98
|
+
assignNewSettingFormat(settings.autoGaps, sourceKey, sourceValue, dictionary);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const autocompleteParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
102
|
+
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
103
|
+
|
|
104
|
+
assignNewSettingFormat(settings.autocompleteSettings, sourceKey, sourceValue, 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;
|
|
73
121
|
};
|
|
74
122
|
|
|
75
123
|
module.exports = {
|
|
@@ -78,5 +126,31 @@ module.exports = {
|
|
|
78
126
|
getDefaultProjectId,
|
|
79
127
|
getCreateProjectModel,
|
|
80
128
|
getUpdateProjectModel,
|
|
81
|
-
deleteProjectByName
|
|
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'
|
|
82
156
|
};
|