@middy/appconfig 4.3.1 → 4.4.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.
Files changed (3) hide show
  1. package/index.cjs +9 -8
  2. package/index.js +3 -4
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(module, "exports", {
6
6
  enumerable: true,
7
- get: ()=>_default
7
+ get: function() {
8
+ return _default;
9
+ }
8
10
  });
9
11
  const _util = require("@middy/util");
10
- const _clientAppconfig = require("@aws-sdk/client-appconfig");
12
+ const _clientappconfig = require("@aws-sdk/client-appconfig");
11
13
  const defaults = {
12
- AwsClient: _clientAppconfig.AppConfigClient,
14
+ AwsClient: _clientappconfig.AppConfigClient,
13
15
  awsClientOptions: {},
14
16
  awsClientAssumeRole: undefined,
15
17
  awsClientCapture: undefined,
@@ -29,7 +31,7 @@ const appConfigMiddleware = (opts = {})=>{
29
31
  const values = {};
30
32
  for (const internalKey of Object.keys(options.fetchData)){
31
33
  if (cachedValues[internalKey]) continue;
32
- values[internalKey] = client.send(new _clientAppconfig.GetConfigurationCommand(options.fetchData[internalKey])).then((resp)=>{
34
+ values[internalKey] = client.send(new _clientappconfig.GetConfigurationCommand(options.fetchData[internalKey])).then((resp)=>{
33
35
  let value = String.fromCharCode.apply(null, resp.Content);
34
36
  if (contentTypePattern.test(resp.ContentType)) {
35
37
  value = (0, _util.jsonSafeParse)(value);
@@ -44,22 +46,21 @@ const appConfigMiddleware = (opts = {})=>{
44
46
  }
45
47
  return values;
46
48
  };
47
- let prefetch, client;
49
+ let client;
48
50
  if ((0, _util.canPrefetch)(options)) {
49
51
  client = (0, _util.createPrefetchClient)(options);
50
- prefetch = (0, _util.processCache)(options, fetch);
52
+ (0, _util.processCache)(options, fetch);
51
53
  }
52
54
  const appConfigMiddlewareBefore = async (request)=>{
53
55
  if (!client) {
54
56
  client = await (0, _util.createClient)(options, request);
55
57
  }
56
- const { value } = prefetch ?? (0, _util.processCache)(options, fetch, request);
58
+ const { value } = (0, _util.processCache)(options, fetch, request);
57
59
  Object.assign(request.internal, value);
58
60
  if (options.setToContext) {
59
61
  const data = await (0, _util.getInternal)(Object.keys(options.fetchData), request);
60
62
  Object.assign(request.context, data);
61
63
  }
62
- prefetch = null;
63
64
  };
64
65
  return {
65
66
  before: appConfigMiddlewareBefore
package/index.js CHANGED
@@ -36,22 +36,21 @@ const appConfigMiddleware = (opts = {})=>{
36
36
  }
37
37
  return values;
38
38
  };
39
- let prefetch, client;
39
+ let client;
40
40
  if (canPrefetch(options)) {
41
41
  client = createPrefetchClient(options);
42
- prefetch = processCache(options, fetch);
42
+ processCache(options, fetch);
43
43
  }
44
44
  const appConfigMiddlewareBefore = async (request)=>{
45
45
  if (!client) {
46
46
  client = await createClient(options, request);
47
47
  }
48
- const { value } = prefetch ?? processCache(options, fetch, request);
48
+ const { value } = processCache(options, fetch, request);
49
49
  Object.assign(request.internal, value);
50
50
  if (options.setToContext) {
51
51
  const data = await getInternal(Object.keys(options.fetchData), request);
52
52
  Object.assign(request.context, data);
53
53
  }
54
- prefetch = null;
55
54
  };
56
55
  return {
57
56
  before: appConfigMiddlewareBefore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/appconfig",
3
- "version": "4.3.1",
3
+ "version": "4.4.1",
4
4
  "description": "AppConfig middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -64,13 +64,13 @@
64
64
  "url": "https://github.com/sponsors/willfarrell"
65
65
  },
66
66
  "dependencies": {
67
- "@middy/util": "4.3.1"
67
+ "@middy/util": "4.4.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@aws-sdk/client-appconfig": "^3.0.0",
71
- "@middy/core": "4.3.1",
71
+ "@middy/core": "4.4.1",
72
72
  "@types/aws-lambda": "^8.10.101",
73
73
  "aws-xray-sdk": "^3.3.3"
74
74
  },
75
- "gitHead": "e7576b56f165591acc427fd567b6cba8d4874340"
75
+ "gitHead": "51e5c1f83483a60d9e40f5db59b03af56d2ee710"
76
76
  }