@aws-sdk/middleware-location-constraint 3.901.0 → 3.913.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.
package/dist-cjs/index.js CHANGED
@@ -1,64 +1,30 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
20
2
 
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- getLocationConstraintPlugin: () => getLocationConstraintPlugin,
25
- locationConstraintMiddleware: () => locationConstraintMiddleware,
26
- locationConstraintMiddlewareOptions: () => locationConstraintMiddlewareOptions
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
3
  function locationConstraintMiddleware(options) {
30
- return (next) => async (args) => {
31
- const { CreateBucketConfiguration } = args.input;
32
- const region = await options.region();
33
- if (!CreateBucketConfiguration?.LocationConstraint && !CreateBucketConfiguration?.Location) {
34
- args = {
35
- ...args,
36
- input: {
37
- ...args.input,
38
- CreateBucketConfiguration: region === "us-east-1" ? void 0 : { LocationConstraint: region }
4
+ return (next) => async (args) => {
5
+ const { CreateBucketConfiguration } = args.input;
6
+ const region = await options.region();
7
+ if (!CreateBucketConfiguration?.LocationConstraint && !CreateBucketConfiguration?.Location) {
8
+ if (region !== "us-east-1") {
9
+ args.input.CreateBucketConfiguration = args.input.CreateBucketConfiguration ?? {};
10
+ args.input.CreateBucketConfiguration.LocationConstraint = region;
11
+ }
39
12
  }
40
- };
41
- }
42
- return next(args);
43
- };
13
+ return next(args);
14
+ };
44
15
  }
45
- __name(locationConstraintMiddleware, "locationConstraintMiddleware");
46
- var locationConstraintMiddlewareOptions = {
47
- step: "initialize",
48
- tags: ["LOCATION_CONSTRAINT", "CREATE_BUCKET_CONFIGURATION"],
49
- name: "locationConstraintMiddleware",
50
- override: true
16
+ const locationConstraintMiddlewareOptions = {
17
+ step: "initialize",
18
+ tags: ["LOCATION_CONSTRAINT", "CREATE_BUCKET_CONFIGURATION"],
19
+ name: "locationConstraintMiddleware",
20
+ override: true,
51
21
  };
52
- var getLocationConstraintPlugin = /* @__PURE__ */ __name((config) => ({
53
- applyToStack: /* @__PURE__ */ __name((clientStack) => {
54
- clientStack.add(locationConstraintMiddleware(config), locationConstraintMiddlewareOptions);
55
- }, "applyToStack")
56
- }), "getLocationConstraintPlugin");
57
- // Annotate the CommonJS export names for ESM import in node:
58
-
59
- 0 && (module.exports = {
60
- locationConstraintMiddlewareOptions,
61
- getLocationConstraintPlugin,
62
- locationConstraintMiddleware
22
+ const getLocationConstraintPlugin = (config) => ({
23
+ applyToStack: (clientStack) => {
24
+ clientStack.add(locationConstraintMiddleware(config), locationConstraintMiddlewareOptions);
25
+ },
63
26
  });
64
27
 
28
+ exports.getLocationConstraintPlugin = getLocationConstraintPlugin;
29
+ exports.locationConstraintMiddleware = locationConstraintMiddleware;
30
+ exports.locationConstraintMiddlewareOptions = locationConstraintMiddlewareOptions;
package/dist-es/index.js CHANGED
@@ -3,13 +3,10 @@ export function locationConstraintMiddleware(options) {
3
3
  const { CreateBucketConfiguration } = args.input;
4
4
  const region = await options.region();
5
5
  if (!CreateBucketConfiguration?.LocationConstraint && !CreateBucketConfiguration?.Location) {
6
- args = {
7
- ...args,
8
- input: {
9
- ...args.input,
10
- CreateBucketConfiguration: region === "us-east-1" ? undefined : { LocationConstraint: region },
11
- },
12
- };
6
+ if (region !== "us-east-1") {
7
+ args.input.CreateBucketConfiguration = args.input.CreateBucketConfiguration ?? {};
8
+ args.input.CreateBucketConfiguration.LocationConstraint = region;
9
+ }
13
10
  }
14
11
  return next(args);
15
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-location-constraint",
3
- "version": "3.901.0",
3
+ "version": "3.913.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-location-constraint",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@aws-sdk/types": "3.901.0",
28
- "@smithy/types": "^4.6.0",
27
+ "@aws-sdk/types": "3.910.0",
28
+ "@smithy/types": "^4.7.1",
29
29
  "tslib": "^2.6.2"
30
30
  },
31
31
  "engines": {