@getjones/test-infra 1.0.13 → 1.0.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,14 +2,19 @@ const requests = require('../../common/requests');
2
2
  const { backendUrl } = require('../../../env').getEnv();
3
3
 
4
4
  const Endpoints = {
5
- assignApiKey: `${backendUrl}/saas/api-keys`,
5
+ createApiKey: `${backendUrl}/saas/api-keys`,
6
+ initializeApiKeyOnAws: `${backendUrl}/saas/api-keys/aws`,
6
7
  getApiKeyByAccountId: accountId => `${backendUrl}/saas/accounts/${accountId}/api-keys`,
7
8
  getApiKeyDetails: `${backendUrl}/saas/api-keys`,
8
9
  removeApiKey: `${backendUrl}/saas/api-keys`
9
10
  };
10
11
 
11
- const assignApiKey = async (data, context) => {
12
- return requests.postRequestHandler(Endpoints.assignApiKey, data, context).then(res => res.data);
12
+ const createApiKey = async (data, context) => {
13
+ return requests.postRequestHandler(Endpoints.createApiKey, data, context).then(res => res.data);
14
+ };
15
+
16
+ const initializeApiKeyOnAws = async (data, context) => {
17
+ return requests.postRequestHandler(Endpoints.initializeApiKeyOnAws, data, context).then(res => res.data);
13
18
  };
14
19
 
15
20
  const getApiKeyByAccountId = async (accountId, context) => {
@@ -24,4 +29,4 @@ const deleteApiKey = async (data, context) => {
24
29
  return requests.deleteRequestHandler(Endpoints.removeApiKey, context, {}, {}, data);
25
30
  };
26
31
 
27
- module.exports = { assignApiKey, getApiKeyByAccountId, getApiKeyDetails, deleteApiKey };
32
+ module.exports = { createApiKey, getApiKeyByAccountId, getApiKeyDetails, deleteApiKey, initializeApiKeyOnAws };
@@ -1,8 +1,13 @@
1
1
  const accountsAPI = require('./accounts.openapi.api');
2
2
 
3
- const assignApiKey = async (accountId, apiKeyValue, context) => {
3
+ const createApiKey = async (accountId, apiKeyValue, context) => {
4
4
  const data = { apiKeyValue, accountId };
5
- return accountsAPI.assignApiKey(data, context);
5
+ return accountsAPI.createApiKey(data, context);
6
+ };
7
+
8
+ const initializeApiKeyOnAws = async (accountId, apiKeyValue, context) => {
9
+ const data = { apiKeyValue, accountId };
10
+ return accountsAPI.initializeApiKeyOnAws(data, context);
6
11
  };
7
12
 
8
13
  const getApiKeyByAccountId = async (accountId, context) => {
@@ -18,20 +23,21 @@ const deleteApiKey = async (apiKeyValue, context) => {
18
23
  return accountsAPI.deleteApiKey(data, context);
19
24
  };
20
25
 
21
- const getOrAssignApiKey = async (accountId, apiKey, context) => {
26
+ const getOrCreateApiKey = async (accountId, apiKey, context) => {
22
27
  const existingApiKey = await getApiKeyByAccountId(accountId, context);
23
28
 
24
- if (!existingApiKey.apiKey) {
25
- return assignApiKey(accountId, apiKey, context);
29
+ if (!existingApiKey.apiKeyValue) {
30
+ return createApiKey(accountId, apiKey, context);
26
31
  }
27
32
 
28
33
  return existingApiKey;
29
34
  };
30
35
 
31
36
  module.exports = {
32
- assignApiKey,
37
+ createApiKey,
33
38
  getApiKeyByAccountId,
34
39
  getApiKeyDetails,
35
40
  deleteApiKey,
36
- getOrAssignApiKey
41
+ getOrCreateApiKey,
42
+ initializeApiKeyOnAws
37
43
  };