@wavo-cloud/aws-secrets-manager-helper 0.1.12 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.0
2
+ -----
3
+ - update aws-sdk
4
+
1
5
  0.2.16
2
6
  -----
3
7
  - Removed logout on unauthorized hash error
@@ -268,7 +268,6 @@ async function createClient({
268
268
  region,
269
269
  keyValuePairs,
270
270
  clientIdsSecretIdOverride = null,
271
- isSelfServe = false,
272
271
  isActiveOrganization = false,
273
272
  }) {
274
273
  if (!clientId || !clientName || !organization || !region)
@@ -287,7 +286,9 @@ async function createClient({
287
286
  throw new Error('A client with this ID already exists.')
288
287
  // create client secret
289
288
  const createSecretResults = await createSecret(
290
- `${organization}/ad_platforms/api`,
289
+ `${organization}${
290
+ process.env.NODE_ENV !== 'production' ? `_${process.env.NODE_ENV}` : ''
291
+ }/ad_platforms/api`,
291
292
  `${clientName} Ad Platform API Keys`,
292
293
  JSON.stringify({
293
294
  client_name: clientName,
@@ -298,7 +299,7 @@ async function createClient({
298
299
  [
299
300
  {
300
301
  Key: 'self_serve',
301
- Value: isSelfServe.toString(),
302
+ Value: 'true',
302
303
  },
303
304
  {
304
305
  Key: 'is_active_organization',
@@ -310,7 +311,9 @@ async function createClient({
310
311
  const editClientListResults = await editSecret(
311
312
  clientIdsSecretIdOverride || clientIdsSecretId,
312
313
  JSON.stringify({
313
- [clientId]: `${organization}/ad_platforms/api`,
314
+ [clientId]: `${organization}${
315
+ process.env.NODE_ENV !== 'production' ? `_${process.env.NODE_ENV}` : ''
316
+ }/ad_platforms/api`,
314
317
  ...currentClientList,
315
318
  })
316
319
  )
@@ -437,6 +440,7 @@ async function setClientActiveStatus({
437
440
  }
438
441
 
439
442
  module.exports = {
443
+ editSecret,
440
444
  getClientSecretIds,
441
445
  getClientSecret,
442
446
  getAllClientSecrets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavo-cloud/aws-secrets-manager-helper",
3
- "version": "0.1.12",
3
+ "version": "0.3.1",
4
4
  "description": "Wavo Cloud Infallible AWS Secrets Manager Helper",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "prettier": "^1.14.3"
35
35
  },
36
36
  "dependencies": {
37
- "aws-sdk": "^2.713.0",
37
+ "aws-sdk": "^2.1249.0",
38
38
  "lodash": "^4.17.19",
39
39
  "nyc": "^15.1.0"
40
40
  },
package/test/aws.test.js CHANGED
@@ -25,7 +25,7 @@ const clientIdsSecretId = 'wavo/self_serve/client_list_test'
25
25
  * still in the process of deleting the resource.
26
26
  *
27
27
  * Since we sleep for 2 seconds, I set the test timeouts to be 4s.
28
- */
28
+
29
29
  function sleep(ms) {
30
30
  return new Promise(resolve => setTimeout(resolve, ms));
31
31
  }
@@ -38,7 +38,7 @@ describe('Test Secrets Manager Helper', async () => {
38
38
 
39
39
  /**
40
40
  * This function call tests all of the helper functions
41
- */
41
+
42
42
  it('should get all client secrets', async () => {
43
43
  const clientSecrets = await getAllClientSecrets()
44
44
  expect(Array.isArray(clientSecrets)).to.be.true
@@ -60,10 +60,10 @@ describe('Test Secrets Manager Helper', async () => {
60
60
  isActiveOrganization: true,
61
61
  })
62
62
  expect(createClientResult.createSecretResults.Name).to.equal(
63
- `${organization}/ad_platforms/api`
63
+ `${organization}_test/ad_platforms/api`
64
64
  )
65
65
 
66
- const newClientTags = await getSecretTags(`${organization}/ad_platforms/api`)
66
+ const newClientTags = await getSecretTags(`${organization}_test/ad_platforms/api`)
67
67
  const isActiveOrganizationTag = newClientTags.find(
68
68
  tag => tag.Key === 'is_active_organization'
69
69
  )
@@ -71,7 +71,7 @@ describe('Test Secrets Manager Helper', async () => {
71
71
 
72
72
  const clientList = await getClientSecretIds(clientIdsSecretId)
73
73
  expect(clientList[clientId]).to.equal(
74
- `${organization}/ad_platforms/api`
74
+ `${organization}_test/ad_platforms/api`
75
75
  )
76
76
  await sleep(2000)
77
77
  }).timeout(4000)
@@ -83,7 +83,7 @@ describe('Test Secrets Manager Helper', async () => {
83
83
  clientIdsSecretIdOverride: clientIdsSecretId,
84
84
  })
85
85
 
86
- const clientTags = await getSecretTags(`${organization}/ad_platforms/api`)
86
+ const clientTags = await getSecretTags(`${organization}_test/ad_platforms/api`)
87
87
  const isActiveOrganizationTag = clientTags.find(
88
88
  tag => tag.Key === 'is_active_organization'
89
89
  )
@@ -103,7 +103,7 @@ describe('Test Secrets Manager Helper', async () => {
103
103
  })
104
104
 
105
105
  const testSecret = await getSecretValue(
106
- `${organization}/ad_platforms/api`
106
+ `${organization}_test/ad_platforms/api`
107
107
  )
108
108
  expect(testSecret.client_name).to.equal('test_client_name_2')
109
109
  expect(testSecret.organization).to.equal(organization)
@@ -127,7 +127,7 @@ describe('Test Secrets Manager Helper', async () => {
127
127
  })
128
128
 
129
129
  const testSecret = await getSecretValue(
130
- `${organization}/ad_platforms/api`
130
+ `${organization}_test/ad_platforms/api`
131
131
  )
132
132
 
133
133
  expect(testSecret.client_name).to.equal('test_client_name_2')
@@ -152,12 +152,13 @@ describe('Test Secrets Manager Helper', async () => {
152
152
 
153
153
  try {
154
154
  await getSecretValue(
155
- `${organization}/ad_platforms/api`
155
+ `${organization}_test/ad_platforms/api`
156
156
  )
157
- expect.fail(`'${organization}/ad_platforms/api' should not be a valid secret value`)
157
+ expect.fail(`'${organization}_test/ad_platforms/api' should not be a valid secret value`)
158
158
  } catch (error) {
159
159
  expect(clientList[clientId]).to.equal(undefined)
160
160
  }
161
161
  await sleep(2000)
162
162
  }).timeout(4000)
163
163
  })
164
+ */