@getjones/test-infra 1.2.6 → 1.2.8
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/index.js +18 -21
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +6 -6
- package/src/saas/internal-api/accounts/api/core/accounts.core.setup.js +6 -6
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +14 -14
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.setup.js +7 -7
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +17 -6
- package/src/saas/internal-api/compliance/api/audit/audit.setup.js +11 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,27 +9,25 @@ const init = conf => {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const getInternalAPI = () => {
|
|
12
|
-
const
|
|
12
|
+
const auth = require('./saas/internal-api/auth');
|
|
13
|
+
const accounts = require('./saas/internal-api/accounts');
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const projects = require('./saas/internal-api/projects');
|
|
16
|
+
const tabs = require('./saas/internal-api/tabs');
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const requirements = require('./saas/internal-api/requirements');
|
|
19
|
+
const contractors = require('./saas/internal-api/contractors');
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
-
const
|
|
21
|
+
const coi = require('./saas/internal-api/coi');
|
|
22
|
+
const compliance = require('./saas/internal-api/compliance');
|
|
23
|
+
const users = require('./saas/internal-api/users');
|
|
22
24
|
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const users = require(`${internalApiPath}/users`);
|
|
25
|
+
const reports = require('./saas/internal-api/reports');
|
|
26
|
+
const charts = require('./saas/internal-api/homepageCharts');
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
const charts = require(`${internalApiPath}/homepageCharts`);
|
|
28
|
+
const globalRecord = require('./saas/internal-api/globalRecord');
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const threadScheduler = require(`${internalApiPath}/thread-scheduler/runner`);
|
|
30
|
+
const threadScheduler = require('./saas/internal-api/thread-scheduler/runner');
|
|
33
31
|
|
|
34
32
|
const internalAPI = {
|
|
35
33
|
auth,
|
|
@@ -51,12 +49,11 @@ const getInternalAPI = () => {
|
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
const getOpenAPI = () => {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const requirements = require(`${openApiPath}/requirements`);
|
|
52
|
+
const accounts = require('./saas/openapi/accounts/accounts.setup');
|
|
53
|
+
const tabs = require('./saas/openapi/tabs/tabs.setup');
|
|
54
|
+
const contractors = require('./saas/openapi/contractors/contractors.setup');
|
|
55
|
+
const projects = require('./saas/openapi/projects/projects.setup');
|
|
56
|
+
const requirements = require('./saas/openapi/requirements');
|
|
60
57
|
const openAPI = { accounts, tabs, contractors, projects, requirements };
|
|
61
58
|
return openAPI;
|
|
62
59
|
};
|
|
@@ -8,21 +8,21 @@ const Endpoints = {
|
|
|
8
8
|
edit: accountId => `${backendUrl}/saas/account/${accountId}/settings`
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const create =
|
|
12
|
-
return requests.postRequestHandler(Endpoints.create, account, context)
|
|
11
|
+
const create = (account, context) => {
|
|
12
|
+
return requests.postRequestHandler(Endpoints.create, account, context);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const deleteAccount =
|
|
15
|
+
const deleteAccount = (accountId, context) => {
|
|
16
16
|
return requests.deleteRequestHandler(Endpoints.delete, context, {}, { 'userId': accountId });
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const updateAccountSettings =
|
|
19
|
+
const updateAccountSettings = (accountId, settings, context) => {
|
|
20
20
|
return requests.putRequestHandler(Endpoints.edit(accountId), { accountId, ... settings }, context);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const getByName =
|
|
23
|
+
const getByName = (accountName, context) => {
|
|
24
24
|
const params = { name: accountName };
|
|
25
|
-
return requests.getRequestHandler(Endpoints.getAccount, params, context)
|
|
25
|
+
return requests.getRequestHandler(Endpoints.getAccount, params, context);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
module.exports = { create, getByName, deleteAccount, updateAccountSettings };
|
|
@@ -13,21 +13,21 @@ const createAccount = async (createAccountModel, context) => {
|
|
|
13
13
|
'credentials.strongPassword': createAccountModel.password
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
return
|
|
16
|
+
return accountsAPI.create(createAccountModel, context);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const getAccount = async (accountName, context) => {
|
|
20
|
-
const
|
|
20
|
+
const response = await accountsAPI.getByName(accountName, context);
|
|
21
21
|
|
|
22
|
-
if (!
|
|
22
|
+
if (!response.data || !response.data.length) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
if (
|
|
26
|
+
if (response.data.length > 1) {
|
|
27
27
|
throw new Error(`Got more than one account with the name: ${accountName}. IDs: ${existingAccounts.map(item => item.userId).join(', ')}`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
return
|
|
30
|
+
return response.data[0];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const getOrCreateAccount = async (createAccountModel, context) => {
|
|
@@ -38,7 +38,7 @@ const getOrCreateAccount = async (createAccountModel, context) => {
|
|
|
38
38
|
return existingAccount;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return createAccount(createAccountModel, context);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const getAccountId = async (accountName, context) => {
|
|
@@ -9,32 +9,32 @@ const Endpoints = {
|
|
|
9
9
|
dynamicApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/dynamic-api-key`
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const createStaticApiKey =
|
|
13
|
-
return requests.postRequestHandler(Endpoints.createApiKey, data, context)
|
|
12
|
+
const createStaticApiKey = (data, context) => {
|
|
13
|
+
return requests.postRequestHandler(Endpoints.createApiKey, data, context);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const createGeneratorApiKey =
|
|
17
|
-
return requests.postRequestHandler(Endpoints.createApiKey, data, context)
|
|
16
|
+
const createGeneratorApiKey = (data, context) => {
|
|
17
|
+
return requests.postRequestHandler(Endpoints.createApiKey, data, context);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const getStaticApiKeyByAccountId =
|
|
21
|
-
return requests.getRequestHandler(Endpoints.getStaticApiKeyByAccountId(accountId), {}, context)
|
|
20
|
+
const getStaticApiKeyByAccountId = (accountId, context) => {
|
|
21
|
+
return requests.getRequestHandler(Endpoints.getStaticApiKeyByAccountId(accountId), {}, context);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const getApiKeyDetails =
|
|
25
|
-
return requests.getRequestHandler(Endpoints.getApiKeyByKeyValue, { apiKeyValue }, context)
|
|
24
|
+
const getApiKeyDetails = (apiKeyValue, context) => {
|
|
25
|
+
return requests.getRequestHandler(Endpoints.getApiKeyByKeyValue, { apiKeyValue }, context);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const deleteStaticApiKey =
|
|
29
|
-
return requests.deleteRequestHandler(Endpoints.removeStaticApiKey(accountId), context)
|
|
28
|
+
const deleteStaticApiKey = (accountId, context) => {
|
|
29
|
+
return requests.deleteRequestHandler(Endpoints.removeStaticApiKey(accountId), context);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const deleteDynamicApiKey =
|
|
33
|
-
return requests.deleteRequestHandler(Endpoints.dynamicApiKey(accountId), context)
|
|
32
|
+
const deleteDynamicApiKey = (accountId, context) => {
|
|
33
|
+
return requests.deleteRequestHandler(Endpoints.dynamicApiKey(accountId), context);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const makeDynamicApiKeyExpired =
|
|
37
|
-
return requests.patchRequestHandler(Endpoints.dynamicApiKey(accountId), context, {})
|
|
36
|
+
const makeDynamicApiKeyExpired = (accountId, context) => {
|
|
37
|
+
return requests.patchRequestHandler(Endpoints.dynamicApiKey(accountId), context, {});
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
module.exports = {
|
|
@@ -28,19 +28,19 @@ const deleteStaticApiKey = async (accountId, context) => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const getOrCreateStaticApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'ACCOUNT_STATIC', apiKeyName = null } = {}) => {
|
|
31
|
-
let
|
|
31
|
+
let response = await getStaticApiKeyByAccountId(accountId, context);
|
|
32
32
|
|
|
33
|
-
if (
|
|
34
|
-
return
|
|
33
|
+
if (response.data.apiKeyValue) {
|
|
34
|
+
return response.data;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
response = await getApiKeyDetails(apiKeyValue, context);
|
|
38
38
|
|
|
39
|
-
if (!
|
|
40
|
-
|
|
39
|
+
if (!response.data.apiKeyValue) {
|
|
40
|
+
response = await createStaticApiKey(accountId, apiKeyValue, context, { apiKeyType, apiKeyName });
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return
|
|
43
|
+
return response.data;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const getOrCreateGeneratorApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'GENERATOR', apiKeyName = null } = {}) => {
|
|
@@ -6,24 +6,35 @@ const Endpoints = {
|
|
|
6
6
|
preAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
7
7
|
audit: `${backendUrl}/saas/auditor/contractors/submit/audits`,
|
|
8
8
|
contractorDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/master-audit`,
|
|
9
|
-
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement
|
|
9
|
+
requirementDetailsForAudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/requirement`,
|
|
10
|
+
isReaudit: contractorId => `${backendUrl}/saas/auditor/contractor/${contractorId}/isreaudit`
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
const getAuditorContractorList = (page, accountId, context) => {
|
|
13
|
-
return requests.getRequestHandler(Endpoints.auditorContractorList, { page, accountId }, context)
|
|
14
|
+
return requests.getRequestHandler(Endpoints.auditorContractorList, { page, accountId }, context);
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const audit = async (contractorId, auditRequestModel, context) => {
|
|
17
18
|
await requests.getRequestHandler(Endpoints.preAudit(contractorId), {}, context);
|
|
18
|
-
return requests.postRequestHandler(Endpoints.audit, auditRequestModel, context)
|
|
19
|
+
return requests.postRequestHandler(Endpoints.audit, auditRequestModel, context);
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const getContractorDetailsForAudit = (contractorId, context) => {
|
|
22
|
-
return requests.getRequestHandler(Endpoints.contractorDetailsForAudit(contractorId), {}, context)
|
|
23
|
+
return requests.getRequestHandler(Endpoints.contractorDetailsForAudit(contractorId), {}, context);
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const getRequirementDetailsForAudit = (contractorId, context) => {
|
|
26
|
-
return requests.getRequestHandler(Endpoints.requirementDetailsForAudit(contractorId), {}, context)
|
|
27
|
+
return requests.getRequestHandler(Endpoints.requirementDetailsForAudit(contractorId), {}, context);
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
const isReaudit = (contractorId, context) => {
|
|
31
|
+
return requests.getRequestHandler(Endpoints.isReaudit(contractorId), {}, context);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
audit,
|
|
36
|
+
isReaudit,
|
|
37
|
+
getAuditorContractorList,
|
|
38
|
+
getContractorDetailsForAudit,
|
|
39
|
+
getRequirementDetailsForAudit
|
|
40
|
+
};
|
|
@@ -19,4 +19,14 @@ const getRequirementDetailsForAudit = async (contractorId, context) => {
|
|
|
19
19
|
return await auditApi.getRequirementDetailsForAudit(contractorId, context);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const isReaudit = (contractorId, context) => {
|
|
23
|
+
return auditApi.isReaudit(contractorId, context);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
audit,
|
|
28
|
+
isReaudit,
|
|
29
|
+
getAuditorContractorList,
|
|
30
|
+
getContractorDetailsForAudit,
|
|
31
|
+
getRequirementDetailsForAudit
|
|
32
|
+
};
|