@aws-sdk/middleware-sdk-s3-control 3.224.0 → 3.231.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.
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deduplicateHostPrefix = void 0;
4
+ const deduplicateHostPrefix = (hostname) => {
5
+ const [prefix1, prefix2, ...rest] = hostname.split(".");
6
+ if (prefix1 === prefix2) {
7
+ return [prefix1, ...rest].join(".");
8
+ }
9
+ return hostname;
10
+ };
11
+ exports.deduplicateHostPrefix = deduplicateHostPrefix;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHostPrefixDeduplicationPlugin = exports.hostPrefixDeduplicationMiddlewareOptions = exports.hostPrefixDeduplicationMiddleware = void 0;
4
+ const deduplicateHostPrefix_1 = require("./deduplicateHostPrefix");
5
+ const hostPrefixDeduplicationMiddleware = () => {
6
+ return (next, context) => async (args) => {
7
+ var _a;
8
+ const httpRequest = ((_a = args.request) !== null && _a !== void 0 ? _a : {});
9
+ if (httpRequest === null || httpRequest === void 0 ? void 0 : httpRequest.hostname) {
10
+ httpRequest.hostname = (0, deduplicateHostPrefix_1.deduplicateHostPrefix)(httpRequest.hostname);
11
+ }
12
+ return next(args);
13
+ };
14
+ };
15
+ exports.hostPrefixDeduplicationMiddleware = hostPrefixDeduplicationMiddleware;
16
+ exports.hostPrefixDeduplicationMiddlewareOptions = {
17
+ tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
18
+ toMiddleware: "serializerMiddleware",
19
+ relation: "after",
20
+ name: "hostPrefixDeduplicationMiddleware",
21
+ override: true,
22
+ };
23
+ const getHostPrefixDeduplicationPlugin = (config) => ({
24
+ applyToStack: (clientStack) => {
25
+ clientStack.addRelativeTo((0, exports.hostPrefixDeduplicationMiddleware)(), exports.hostPrefixDeduplicationMiddlewareOptions);
26
+ },
27
+ });
28
+ exports.getHostPrefixDeduplicationPlugin = getHostPrefixDeduplicationPlugin;
package/dist-cjs/index.js CHANGED
@@ -9,4 +9,5 @@ Object.defineProperty(exports, "parseOutpostArnablesMiddleawareOptions", { enume
9
9
  Object.defineProperty(exports, "updateArnablesRequestMiddleware", { enumerable: true, get: function () { return process_arnables_plugin_1.updateArnablesRequestMiddleware; } });
10
10
  Object.defineProperty(exports, "updateArnablesRequestMiddlewareOptions", { enumerable: true, get: function () { return process_arnables_plugin_1.updateArnablesRequestMiddlewareOptions; } });
11
11
  Object.defineProperty(exports, "getProcessArnablesPlugin", { enumerable: true, get: function () { return process_arnables_plugin_1.getProcessArnablesPlugin; } });
12
+ tslib_1.__exportStar(require("./host-prefix-deduplication/hostPrefixDeduplicationMiddleware"), exports);
12
13
  tslib_1.__exportStar(require("./redirect-from-postid"), exports);
@@ -0,0 +1,7 @@
1
+ export const deduplicateHostPrefix = (hostname) => {
2
+ const [prefix1, prefix2, ...rest] = hostname.split(".");
3
+ if (prefix1 === prefix2) {
4
+ return [prefix1, ...rest].join(".");
5
+ }
6
+ return hostname;
7
+ };
@@ -0,0 +1,22 @@
1
+ import { deduplicateHostPrefix } from "./deduplicateHostPrefix";
2
+ export const hostPrefixDeduplicationMiddleware = () => {
3
+ return (next, context) => async (args) => {
4
+ const httpRequest = (args.request ?? {});
5
+ if (httpRequest?.hostname) {
6
+ httpRequest.hostname = deduplicateHostPrefix(httpRequest.hostname);
7
+ }
8
+ return next(args);
9
+ };
10
+ };
11
+ export const hostPrefixDeduplicationMiddlewareOptions = {
12
+ tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
13
+ toMiddleware: "serializerMiddleware",
14
+ relation: "after",
15
+ name: "hostPrefixDeduplicationMiddleware",
16
+ override: true,
17
+ };
18
+ export const getHostPrefixDeduplicationPlugin = (config) => ({
19
+ applyToStack: (clientStack) => {
20
+ clientStack.addRelativeTo(hostPrefixDeduplicationMiddleware(), hostPrefixDeduplicationMiddlewareOptions);
21
+ },
22
+ });
package/dist-es/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./configurations";
2
2
  export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, } from "./process-arnables-plugin";
3
+ export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
3
4
  export * from "./redirect-from-postid";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @example
3
+ * 12345.12345.____.com should become 12345.____.com.
4
+ */
5
+ export declare const deduplicateHostPrefix: (hostname: string) => string;
@@ -0,0 +1,17 @@
1
+ import { Pluggable, RelativeMiddlewareOptions, SerializeMiddleware } from "@aws-sdk/types";
2
+ /**
3
+ * @internal
4
+ * This customization handles an edge case where
5
+ * a hostprefix may be duplicated in the endpoint ruleset resolution
6
+ * and hostPrefix serialization via the pre-endpoints 2.0 trait,
7
+ * and which cannot be reconciled automatically.
8
+ */
9
+ export declare const hostPrefixDeduplicationMiddleware: () => SerializeMiddleware<any, any>;
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare const hostPrefixDeduplicationMiddlewareOptions: RelativeMiddlewareOptions;
14
+ /**
15
+ * @internal
16
+ */
17
+ export declare const getHostPrefixDeduplicationPlugin: <T>(config: T) => Pluggable<any, any>;
@@ -1,3 +1,4 @@
1
1
  export * from "./configurations";
2
2
  export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, } from "./process-arnables-plugin";
3
+ export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
3
4
  export * from "./redirect-from-postid";
@@ -0,0 +1 @@
1
+ export declare const deduplicateHostPrefix: (hostname: string) => string;
@@ -0,0 +1,13 @@
1
+ import {
2
+ Pluggable,
3
+ RelativeMiddlewareOptions,
4
+ SerializeMiddleware,
5
+ } from "@aws-sdk/types";
6
+ export declare const hostPrefixDeduplicationMiddleware: () => SerializeMiddleware<
7
+ any,
8
+ any
9
+ >;
10
+ export declare const hostPrefixDeduplicationMiddlewareOptions: RelativeMiddlewareOptions;
11
+ export declare const getHostPrefixDeduplicationPlugin: <T>(
12
+ config: T
13
+ ) => Pluggable<any, any>;
@@ -6,4 +6,5 @@ export {
6
6
  updateArnablesRequestMiddlewareOptions,
7
7
  getProcessArnablesPlugin,
8
8
  } from "./process-arnables-plugin";
9
+ export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
9
10
  export * from "./redirect-from-postid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-s3-control",
3
- "version": "3.224.0",
3
+ "version": "3.231.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,14 +20,14 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/middleware-bucket-endpoint": "3.224.0",
24
- "@aws-sdk/protocol-http": "3.224.0",
25
- "@aws-sdk/types": "3.224.0",
23
+ "@aws-sdk/middleware-bucket-endpoint": "3.226.0",
24
+ "@aws-sdk/protocol-http": "3.226.0",
25
+ "@aws-sdk/types": "3.226.0",
26
26
  "@aws-sdk/util-arn-parser": "3.208.0",
27
27
  "tslib": "^2.3.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@aws-sdk/middleware-stack": "3.224.0",
30
+ "@aws-sdk/middleware-stack": "3.226.0",
31
31
  "@tsconfig/recommended": "1.0.1",
32
32
  "concurrently": "7.0.0",
33
33
  "downlevel-dts": "0.10.1",