@aws-sdk/middleware-sdk-s3 3.972.24 → 3.972.26
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/dist-cjs/index.js +27 -0
- package/dist-es/index.js +1 -0
- package/dist-es/protocol/S3RestXmlProtocol.js +25 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/protocol/S3RestXmlProtocol.d.ts +20 -0
- package/dist-types/ts3.4/index.d.ts +1 -0
- package/dist-types/ts3.4/protocol/S3RestXmlProtocol.d.ts +15 -0
- package/package.json +2 -2
package/dist-cjs/index.js
CHANGED
|
@@ -4,6 +4,8 @@ var protocolHttp = require('@smithy/protocol-http');
|
|
|
4
4
|
var smithyClient = require('@smithy/smithy-client');
|
|
5
5
|
var utilStream = require('@smithy/util-stream');
|
|
6
6
|
var utilArnParser = require('@aws-sdk/util-arn-parser');
|
|
7
|
+
var protocols = require('@aws-sdk/core/protocols');
|
|
8
|
+
var schema = require('@smithy/core/schema');
|
|
7
9
|
var signatureV4 = require('@smithy/signature-v4');
|
|
8
10
|
var utilConfigProvider = require('@smithy/util-config-provider');
|
|
9
11
|
var core = require('@aws-sdk/core');
|
|
@@ -539,10 +541,35 @@ const getValidateBucketNamePlugin = (options) => ({
|
|
|
539
541
|
},
|
|
540
542
|
});
|
|
541
543
|
|
|
544
|
+
class S3RestXmlProtocol extends protocols.AwsRestXmlProtocol {
|
|
545
|
+
async serializeRequest(operationSchema, input, context) {
|
|
546
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
547
|
+
const ns = schema.NormalizedSchema.of(operationSchema.input);
|
|
548
|
+
const staticStructureSchema = ns.getSchema();
|
|
549
|
+
let bucketMemberIndex = 0;
|
|
550
|
+
const requiredMemberCount = staticStructureSchema[6] ?? 0;
|
|
551
|
+
if (input && typeof input === "object") {
|
|
552
|
+
for (const [memberName, memberNs] of ns.structIterator()) {
|
|
553
|
+
if (++bucketMemberIndex > requiredMemberCount) {
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
if (memberName === "Bucket") {
|
|
557
|
+
if (!input.Bucket && memberNs.getMergedTraits().httpLabel) {
|
|
558
|
+
throw new Error(`No value provided for input HTTP label: Bucket.`);
|
|
559
|
+
}
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return request;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
542
568
|
exports.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS;
|
|
543
569
|
exports.S3ExpressIdentityCache = S3ExpressIdentityCache;
|
|
544
570
|
exports.S3ExpressIdentityCacheEntry = S3ExpressIdentityCacheEntry;
|
|
545
571
|
exports.S3ExpressIdentityProviderImpl = S3ExpressIdentityProviderImpl;
|
|
572
|
+
exports.S3RestXmlProtocol = S3RestXmlProtocol;
|
|
546
573
|
exports.SignatureV4S3Express = SignatureV4S3Express;
|
|
547
574
|
exports.checkContentLengthHeader = checkContentLengthHeader;
|
|
548
575
|
exports.checkContentLengthHeaderMiddlewareOptions = checkContentLengthHeaderMiddlewareOptions;
|
package/dist-es/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AwsRestXmlProtocol } from "@aws-sdk/core/protocols";
|
|
2
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
|
+
export class S3RestXmlProtocol extends AwsRestXmlProtocol {
|
|
4
|
+
async serializeRequest(operationSchema, input, context) {
|
|
5
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
6
|
+
const ns = NormalizedSchema.of(operationSchema.input);
|
|
7
|
+
const staticStructureSchema = ns.getSchema();
|
|
8
|
+
let bucketMemberIndex = 0;
|
|
9
|
+
const requiredMemberCount = staticStructureSchema[6] ?? 0;
|
|
10
|
+
if (input && typeof input === "object") {
|
|
11
|
+
for (const [memberName, memberNs] of ns.structIterator()) {
|
|
12
|
+
if (++bucketMemberIndex > requiredMemberCount) {
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
if (memberName === "Bucket") {
|
|
16
|
+
if (!input.Bucket && memberNs.getMergedTraits().httpLabel) {
|
|
17
|
+
throw new Error(`No value provided for input HTTP label: Bucket.`);
|
|
18
|
+
}
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return request;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/dist-types/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AwsRestXmlProtocol } from "@aws-sdk/core/protocols";
|
|
2
|
+
import type { EndpointBearer, HandlerExecutionContext, HttpRequest, OperationSchema, SerdeFunctions } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* Customization for S3 backwards compatibility.
|
|
5
|
+
*
|
|
6
|
+
* In the S3 model, Bucket is considered an HTTP label, and we normally perform http label client
|
|
7
|
+
* side validation. However, the standard validation is that the http label appears in
|
|
8
|
+
* the request path. Bucket is unique in that it is an endpoint context param. It appears
|
|
9
|
+
* where the endpoint resolver decides, rather than in the URL path (although sometimes it does appear there).
|
|
10
|
+
*
|
|
11
|
+
* For consistency with older code generated clients, we throw the HTTP label validation
|
|
12
|
+
* error when the Bucket input is missing, if-and-only-if it is an httpLabel and is a required top level member.
|
|
13
|
+
*
|
|
14
|
+
* This does not apply to S3 Control.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare class S3RestXmlProtocol extends AwsRestXmlProtocol {
|
|
19
|
+
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<HttpRequest>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AwsRestXmlProtocol } from "@aws-sdk/core/protocols";
|
|
2
|
+
import {
|
|
3
|
+
EndpointBearer,
|
|
4
|
+
HandlerExecutionContext,
|
|
5
|
+
HttpRequest,
|
|
6
|
+
OperationSchema,
|
|
7
|
+
SerdeFunctions,
|
|
8
|
+
} from "@smithy/types";
|
|
9
|
+
export declare class S3RestXmlProtocol extends AwsRestXmlProtocol {
|
|
10
|
+
serializeRequest<Input extends object>(
|
|
11
|
+
operationSchema: OperationSchema,
|
|
12
|
+
input: Input,
|
|
13
|
+
context: HandlerExecutionContext & SerdeFunctions & EndpointBearer
|
|
14
|
+
): Promise<HttpRequest>;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.26",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-sdk-s3",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aws-sdk/core": "^3.973.
|
|
31
|
+
"@aws-sdk/core": "^3.973.25",
|
|
32
32
|
"@aws-sdk/types": "^3.973.6",
|
|
33
33
|
"@aws-sdk/util-arn-parser": "^3.972.3",
|
|
34
34
|
"@smithy/core": "^3.23.12",
|