@getjones/test-infra 1.0.8 → 1.0.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/index.js +7 -3
- package/src/internal-api/accounts/{accounts.api.js → core/accounts.core.api.js} +2 -2
- package/src/internal-api/accounts/{accounts.setup.js → core/accounts.core.setup.js} +3 -3
- package/src/internal-api/accounts/openapi/accounts.openapi.api.js +12 -0
- package/src/internal-api/accounts/openapi/accounts.openapi.setup.js +27 -0
- package/src/internal-api/projects/projects.setup.js +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -5,11 +5,15 @@ const init = conf => {
|
|
|
5
5
|
|
|
6
6
|
const auth = require('./internal-api/auth/auth.setup');
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const accountsCore = require('./internal-api/accounts/core/accounts.core.setup');
|
|
9
|
+
const accountsSettings = require('./internal-api/accounts/settings/settings.setup');
|
|
10
|
+
const accountsOpenAPI = require('./internal-api/accounts/openapi/accounts.openapi.setup');
|
|
11
|
+
|
|
10
12
|
const projects = require('./internal-api/projects/projects.setup');
|
|
11
13
|
|
|
12
|
-
const
|
|
14
|
+
const accounts = { accountsCore, accountsSettings, accountsOpenAPI, ...accountsCore };
|
|
15
|
+
|
|
16
|
+
const internalAPI = { auth, accounts, projects };
|
|
13
17
|
return { internalAPI };
|
|
14
18
|
};
|
|
15
19
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const requests = require('
|
|
2
|
-
const { backendUrl } = require('
|
|
1
|
+
const requests = require('../../common/requests');
|
|
2
|
+
const { backendUrl } = require('../../../env').getEnv();
|
|
3
3
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
getAccount: `${backendUrl}/saas/accounts`,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const env = require('
|
|
2
|
-
const accountsAPI = require('./accounts.api');
|
|
1
|
+
const env = require('../../../env');
|
|
2
|
+
const accountsAPI = require('./accounts.core.api');
|
|
3
3
|
|
|
4
4
|
const { credentials, accountCreationSecret } = env.getEnv();
|
|
5
|
-
const { NotFoundError } = require('
|
|
5
|
+
const { NotFoundError } = require('../../../exceptions/notFoundError');
|
|
6
6
|
const PROPERTY_TYPE = 'Property Management';
|
|
7
7
|
|
|
8
8
|
const createAccount = async (email, accountName, context,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const requests = require('../../common/requests');
|
|
2
|
+
const { backendUrl } = require('../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
assignApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/api-keys`,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const assignApiKey = async (accountId, data, context) => {
|
|
9
|
+
return requests.postRequestHandler(Endpoints.assignApiKey(accountId), data, context).then(res => res.data);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = { assignApiKey };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const accountsAPI = require('./accounts.openapi.api');
|
|
2
|
+
const { apiKey } = require('../../../../../../src/accounts/openapi/test.config');
|
|
3
|
+
|
|
4
|
+
const assignApiKey = async (accountId, apiKey, context) => {
|
|
5
|
+
const data = { 'apiKey': apiKey };
|
|
6
|
+
return accountsAPI.assignApiKey(accountId, data, context);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getApiKeyByAccountId = async (accountId, context) => {
|
|
10
|
+
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const removeApiKey = async (accountId, context) => {
|
|
14
|
+
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getOrAssignApiKey = async (accountId, apiKey, context) => {
|
|
18
|
+
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
assignApiKey,
|
|
23
|
+
getApiKeyByAccountId,
|
|
24
|
+
removeApiKey,
|
|
25
|
+
getOrAssignApiKey
|
|
26
|
+
};
|
|
27
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const projectsApi = require('./projects.api');
|
|
2
|
-
const accounts = require('../accounts/accounts.setup');
|
|
2
|
+
const accounts = require('../accounts/core/accounts.core.setup');
|
|
3
3
|
|
|
4
4
|
const getProjectsByAccountName = async (accountName, context) => {
|
|
5
5
|
const accountId = accounts.getAccountId(accountName, context);
|