@middy/appconfig 5.5.1 → 6.0.0-beta.0

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 +6 -6
  2. package/package.json +5 -2
package/index.js CHANGED
@@ -36,7 +36,7 @@ const appConfigMiddleware = (opts = {}) => {
36
36
  const configurationTokenCache = {}
37
37
  const configurationCache = {}
38
38
 
39
- function fetchLatestConfiguration (configToken, internalKey) {
39
+ function fetchLatestConfigurationRequest (configToken, internalKey) {
40
40
  const command = new GetLatestConfigurationCommand({
41
41
  ConfigurationToken: configToken
42
42
  })
@@ -66,7 +66,7 @@ const appConfigMiddleware = (opts = {}) => {
66
66
  })
67
67
  }
68
68
 
69
- const fetch = (request, cachedValues = {}) => {
69
+ const fetchRequest = (request, cachedValues = {}) => {
70
70
  const values = {}
71
71
  for (const internalKey of Object.keys(options.fetchData)) {
72
72
  if (cachedValues[internalKey]) continue
@@ -78,7 +78,7 @@ const appConfigMiddleware = (opts = {}) => {
78
78
  .send(command)
79
79
  .catch((e) => catchInvalidSignatureException(e, client, command))
80
80
  .then((configSessionResp) =>
81
- fetchLatestConfiguration(
81
+ fetchLatestConfigurationRequest(
82
82
  configSessionResp.InitialConfigurationToken,
83
83
  internalKey
84
84
  )
@@ -92,7 +92,7 @@ const appConfigMiddleware = (opts = {}) => {
92
92
 
93
93
  continue
94
94
  }
95
- values[internalKey] = fetchLatestConfiguration(
95
+ values[internalKey] = fetchLatestConfigurationRequest(
96
96
  configurationTokenCache[internalKey],
97
97
  internalKey
98
98
  )
@@ -102,13 +102,13 @@ const appConfigMiddleware = (opts = {}) => {
102
102
  let client
103
103
  if (canPrefetch(options)) {
104
104
  client = createPrefetchClient(options)
105
- processCache(options, fetch)
105
+ processCache(options, fetchRequest)
106
106
  }
107
107
  const appConfigMiddlewareBefore = async (request) => {
108
108
  if (!client) {
109
109
  client = await createClient(options, request)
110
110
  }
111
- const { value } = processCache(options, fetch, request)
111
+ const { value } = processCache(options, fetchRequest, request)
112
112
  Object.assign(request.internal, value)
113
113
  if (options.setToContext) {
114
114
  const data = await getInternal(Object.keys(options.fetchData), request)
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@middy/appconfig",
3
- "version": "5.5.1",
3
+ "version": "6.0.0-beta.0",
4
4
  "description": "AppConfig middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
7
- "node": ">=18"
7
+ "node": ">=20"
8
8
  },
9
9
  "engineStrict": true,
10
10
  "publishConfig": {
@@ -16,6 +16,9 @@
16
16
  "import": {
17
17
  "types": "./index.d.ts",
18
18
  "default": "./index.js"
19
+ },
20
+ "require": {
21
+ "default": "./index.js"
19
22
  }
20
23
  }
21
24
  },