@middy/s3 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.
- package/index.cjs +9 -8
- package/index.js +3 -4
- 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: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _util = require("@middy/util");
|
|
10
|
-
const
|
|
12
|
+
const _clients3 = require("@aws-sdk/client-s3");
|
|
11
13
|
const defaults = {
|
|
12
|
-
AwsClient:
|
|
14
|
+
AwsClient: _clients3.S3Client,
|
|
13
15
|
awsClientOptions: {},
|
|
14
16
|
awsClientAssumeRole: undefined,
|
|
15
17
|
awsClientCapture: undefined,
|
|
@@ -29,7 +31,7 @@ const s3Middleware = (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
|
|
34
|
+
values[internalKey] = client.send(new _clients3.GetObjectCommand({
|
|
33
35
|
...options.fetchData[internalKey],
|
|
34
36
|
ChecksumMode: true
|
|
35
37
|
})).then(async (resp)=>{
|
|
@@ -47,22 +49,21 @@ const s3Middleware = (opts = {})=>{
|
|
|
47
49
|
}
|
|
48
50
|
return values;
|
|
49
51
|
};
|
|
50
|
-
let
|
|
52
|
+
let client;
|
|
51
53
|
if ((0, _util.canPrefetch)(options)) {
|
|
52
54
|
client = (0, _util.createPrefetchClient)(options);
|
|
53
|
-
|
|
55
|
+
(0, _util.processCache)(options, fetch);
|
|
54
56
|
}
|
|
55
57
|
const s3MiddlewareBefore = async (request)=>{
|
|
56
58
|
if (!client) {
|
|
57
59
|
client = await (0, _util.createClient)(options, request);
|
|
58
60
|
}
|
|
59
|
-
const { value } =
|
|
61
|
+
const { value } = (0, _util.processCache)(options, fetch, request);
|
|
60
62
|
Object.assign(request.internal, value);
|
|
61
63
|
if (options.setToContext) {
|
|
62
64
|
const data = await (0, _util.getInternal)(Object.keys(options.fetchData), request);
|
|
63
65
|
Object.assign(request.context, data);
|
|
64
66
|
}
|
|
65
|
-
prefetch = null;
|
|
66
67
|
};
|
|
67
68
|
return {
|
|
68
69
|
before: s3MiddlewareBefore
|
package/index.js
CHANGED
|
@@ -39,22 +39,21 @@ const s3Middleware = (opts = {})=>{
|
|
|
39
39
|
}
|
|
40
40
|
return values;
|
|
41
41
|
};
|
|
42
|
-
let
|
|
42
|
+
let client;
|
|
43
43
|
if (canPrefetch(options)) {
|
|
44
44
|
client = createPrefetchClient(options);
|
|
45
|
-
|
|
45
|
+
processCache(options, fetch);
|
|
46
46
|
}
|
|
47
47
|
const s3MiddlewareBefore = async (request)=>{
|
|
48
48
|
if (!client) {
|
|
49
49
|
client = await createClient(options, request);
|
|
50
50
|
}
|
|
51
|
-
const { value } =
|
|
51
|
+
const { value } = processCache(options, fetch, request);
|
|
52
52
|
Object.assign(request.internal, value);
|
|
53
53
|
if (options.setToContext) {
|
|
54
54
|
const data = await getInternal(Object.keys(options.fetchData), request);
|
|
55
55
|
Object.assign(request.context, data);
|
|
56
56
|
}
|
|
57
|
-
prefetch = null;
|
|
58
57
|
};
|
|
59
58
|
return {
|
|
60
59
|
before: s3MiddlewareBefore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/s3",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "S3 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.
|
|
67
|
+
"@middy/util": "4.4.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@aws-sdk/client-s3": "^3.0.0",
|
|
71
|
-
"@middy/core": "4.
|
|
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": "
|
|
75
|
+
"gitHead": "51e5c1f83483a60d9e40f5db59b03af56d2ee710"
|
|
76
76
|
}
|