@middy/appconfig 5.2.0 → 5.2.2

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.
Files changed (2) hide show
  1. package/index.js +12 -9
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -6,7 +6,8 @@ import {
6
6
  getInternal,
7
7
  processCache,
8
8
  modifyCache,
9
- jsonSafeParse
9
+ jsonSafeParse,
10
+ catchInvalidSignatureException
10
11
  } from '@middy/util'
11
12
  import {
12
13
  StartConfigurationSessionCommand,
@@ -36,12 +37,12 @@ const appConfigMiddleware = (opts = {}) => {
36
37
  const configurationCache = {}
37
38
 
38
39
  function fetchLatestConfiguration (configToken, internalKey) {
40
+ const command = new GetLatestConfigurationCommand({
41
+ ConfigurationToken: configToken
42
+ })
39
43
  return client
40
- .send(
41
- new GetLatestConfigurationCommand({
42
- ConfigurationToken: configToken
43
- })
44
- )
44
+ .send(command)
45
+ .catch((e) => catchInvalidSignatureException(e, client, command))
45
46
  .then((configResp) => {
46
47
  configurationTokenCache[internalKey] =
47
48
  configResp.NextPollConfigurationToken
@@ -70,10 +71,12 @@ const appConfigMiddleware = (opts = {}) => {
70
71
  for (const internalKey of Object.keys(options.fetchData)) {
71
72
  if (cachedValues[internalKey]) continue
72
73
  if (configurationTokenCache[internalKey] == null) {
74
+ const command = new StartConfigurationSessionCommand(
75
+ options.fetchData[internalKey]
76
+ )
73
77
  values[internalKey] = client
74
- .send(
75
- new StartConfigurationSessionCommand(options.fetchData[internalKey])
76
- )
78
+ .send(command)
79
+ .catch((e) => catchInvalidSignatureException(e, client, command))
77
80
  .then((configSessionResp) =>
78
81
  fetchLatestConfiguration(
79
82
  configSessionResp.InitialConfigurationToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/appconfig",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "AppConfig middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -58,13 +58,13 @@
58
58
  "url": "https://github.com/sponsors/willfarrell"
59
59
  },
60
60
  "dependencies": {
61
- "@middy/util": "5.2.0"
61
+ "@middy/util": "5.2.2"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@aws-sdk/client-appconfigdata": "^3.0.0",
65
- "@middy/core": "5.2.0",
65
+ "@middy/core": "5.2.2",
66
66
  "@types/aws-lambda": "^8.10.101",
67
67
  "aws-xray-sdk": "^3.3.3"
68
68
  },
69
- "gitHead": "2d9096a49cd8fb62359517be96d6c93609df41f0"
69
+ "gitHead": "dbfe56d5dfc783fae1e19c7dddd074c0d18d5073"
70
70
  }