@aws-sdk/middleware-sdk-s3-control 3.821.0 → 3.830.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
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(index_exports);
40
40
  // src/configurations.ts
41
41
  var import_middleware_bucket_endpoint = require("@aws-sdk/middleware-bucket-endpoint");
42
42
  function resolveS3ControlConfig(input) {
43
- const { useArnRegion = false } = input;
43
+ const { useArnRegion } = input;
44
44
  return Object.assign(input, {
45
45
  useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion)
46
46
  });
@@ -106,37 +106,21 @@ var parseOutpostArnablesMiddleaware = /* @__PURE__ */ __name((options) => (next,
106
106
  context[CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
107
107
  if (!input.AccountId) {
108
108
  input.AccountId = arn.accountId;
109
- } else if (input.AccountId !== arn.accountId) {
110
- throw new Error(`AccountId is incompatible with account id inferred from ${parameter}`);
111
109
  }
112
110
  if (useArnRegion) context[CONTEXT_ARN_REGION] = arn.region;
113
111
  return next(args);
114
112
  }, "parseOutpostArnablesMiddleaware");
115
113
  var parseOutpostArnablesMiddleawareOptions = {
116
- step: "initialize",
114
+ toMiddleware: "serializerMiddleware",
115
+ relation: "before",
117
116
  tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
118
117
  name: "parseOutpostArnablesMiddleaware"
119
118
  };
120
- var validateOutpostsArn = /* @__PURE__ */ __name((arn, {
121
- clientRegion,
122
- signingRegion,
123
- clientPartition,
124
- useArnRegion,
125
- useFipsEndpoint,
126
- useDualstackEndpoint
127
- }) => {
119
+ var validateOutpostsArn = /* @__PURE__ */ __name((arn, { clientPartition }) => {
128
120
  const { service, partition: partition2, accountId, region } = arn;
129
121
  (0, import_middleware_bucket_endpoint.validateOutpostService)(service);
130
122
  (0, import_middleware_bucket_endpoint.validatePartition)(partition2, { clientPartition });
131
123
  (0, import_middleware_bucket_endpoint.validateAccountId)(accountId);
132
- (0, import_middleware_bucket_endpoint.validateRegion)(region, {
133
- useArnRegion,
134
- clientRegion,
135
- clientSigningRegion: signingRegion,
136
- useFipsEndpoint,
137
- allowFipsRegion: true
138
- });
139
- (0, import_middleware_bucket_endpoint.validateNoDualstack)(useDualstackEndpoint);
140
124
  }, "validateOutpostsArn");
141
125
  var parseOutpostsAccessPointArnResource = /* @__PURE__ */ __name((resource) => {
142
126
  const { outpostId, accesspointName } = (0, import_middleware_bucket_endpoint.getArnResources)(resource);
@@ -190,8 +174,12 @@ var ACCOUNT_ID_HEADER = "x-amz-account-id";
190
174
  var OUTPOST_ID_HEADER = "x-amz-outpost-id";
191
175
  var updateArnablesRequestMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => {
192
176
  const { request } = args;
193
- if (!import_protocol_http.HttpRequest.isInstance(request)) return next(args);
194
- if (context[CONTEXT_ACCOUNT_ID]) request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
177
+ if (!import_protocol_http.HttpRequest.isInstance(request)) {
178
+ return next(args);
179
+ }
180
+ if (context[CONTEXT_ACCOUNT_ID]) {
181
+ request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
182
+ }
195
183
  if (context[CONTEXT_OUTPOST_ID]) {
196
184
  const { isCustomEndpoint } = config;
197
185
  const useFipsEndpoint = await config.useFipsEndpoint();
@@ -205,7 +193,8 @@ var updateArnablesRequestMiddleware = /* @__PURE__ */ __name((config) => (next,
205
193
  return next(args);
206
194
  }, "updateArnablesRequestMiddleware");
207
195
  var updateArnablesRequestMiddlewareOptions = {
208
- step: "build",
196
+ toMiddleware: "serializerMiddleware",
197
+ relation: "after",
209
198
  name: "updateArnablesRequestMiddleware",
210
199
  tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"]
211
200
  };
@@ -213,8 +202,8 @@ var updateArnablesRequestMiddlewareOptions = {
213
202
  // src/process-arnables-plugin/getProcessArnablesPlugin.ts
214
203
  var getProcessArnablesPlugin = /* @__PURE__ */ __name((options) => ({
215
204
  applyToStack: /* @__PURE__ */ __name((clientStack) => {
216
- clientStack.add(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
217
- clientStack.add(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
205
+ clientStack.addRelativeTo(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
206
+ clientStack.addRelativeTo(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
218
207
  }, "applyToStack")
219
208
  }), "getProcessArnablesPlugin");
220
209
 
@@ -1,6 +1,6 @@
1
1
  export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
2
2
  export function resolveS3ControlConfig(input) {
3
- const { useArnRegion = false } = input;
3
+ const { useArnRegion } = input;
4
4
  return Object.assign(input, {
5
5
  useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
6
6
  });
@@ -2,7 +2,7 @@ import { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions
2
2
  import { updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions } from "./update-arnables-request";
3
3
  export const getProcessArnablesPlugin = (options) => ({
4
4
  applyToStack: (clientStack) => {
5
- clientStack.add(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
6
- clientStack.add(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
5
+ clientStack.addRelativeTo(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
6
+ clientStack.addRelativeTo(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
7
7
  },
8
8
  });
@@ -1,4 +1,4 @@
1
- import { getArnResources as getS3AccesspointArnResources, validateAccountId, validateNoDualstack, validateOutpostService, validatePartition, validateRegion, } from "@aws-sdk/middleware-bucket-endpoint";
1
+ import { getArnResources as getS3AccesspointArnResources, validateAccountId, validateOutpostService, validatePartition, } from "@aws-sdk/middleware-bucket-endpoint";
2
2
  import { parse as parseArn, validate as validateArn } from "@aws-sdk/util-arn-parser";
3
3
  import { partition } from "@aws-sdk/util-endpoints";
4
4
  import { CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID, CONTEXT_SIGNING_REGION, CONTEXT_SIGNING_SERVICE } from "../constants";
@@ -52,31 +52,21 @@ export const parseOutpostArnablesMiddleaware = (options) => (next, context) => a
52
52
  if (!input.AccountId) {
53
53
  input.AccountId = arn.accountId;
54
54
  }
55
- else if (input.AccountId !== arn.accountId) {
56
- throw new Error(`AccountId is incompatible with account id inferred from ${parameter}`);
57
- }
58
55
  if (useArnRegion)
59
56
  context[CONTEXT_ARN_REGION] = arn.region;
60
57
  return next(args);
61
58
  };
62
59
  export const parseOutpostArnablesMiddleawareOptions = {
63
- step: "initialize",
60
+ toMiddleware: "serializerMiddleware",
61
+ relation: "before",
64
62
  tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
65
63
  name: "parseOutpostArnablesMiddleaware",
66
64
  };
67
- const validateOutpostsArn = (arn, { clientRegion, signingRegion, clientPartition, useArnRegion, useFipsEndpoint, useDualstackEndpoint, }) => {
65
+ const validateOutpostsArn = (arn, { clientPartition }) => {
68
66
  const { service, partition, accountId, region } = arn;
69
67
  validateOutpostService(service);
70
68
  validatePartition(partition, { clientPartition });
71
69
  validateAccountId(accountId);
72
- validateRegion(region, {
73
- useArnRegion,
74
- clientRegion,
75
- clientSigningRegion: signingRegion,
76
- useFipsEndpoint,
77
- allowFipsRegion: true,
78
- });
79
- validateNoDualstack(useDualstackEndpoint);
80
70
  };
81
71
  const parseOutpostsAccessPointArnResource = (resource) => {
82
72
  const { outpostId, accesspointName } = getS3AccesspointArnResources(resource);
@@ -5,10 +5,12 @@ const ACCOUNT_ID_HEADER = "x-amz-account-id";
5
5
  const OUTPOST_ID_HEADER = "x-amz-outpost-id";
6
6
  export const updateArnablesRequestMiddleware = (config) => (next, context) => async (args) => {
7
7
  const { request } = args;
8
- if (!HttpRequest.isInstance(request))
8
+ if (!HttpRequest.isInstance(request)) {
9
9
  return next(args);
10
- if (context[CONTEXT_ACCOUNT_ID])
10
+ }
11
+ if (context[CONTEXT_ACCOUNT_ID]) {
11
12
  request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
13
+ }
12
14
  if (context[CONTEXT_OUTPOST_ID]) {
13
15
  const { isCustomEndpoint } = config;
14
16
  const useFipsEndpoint = await config.useFipsEndpoint();
@@ -22,7 +24,8 @@ export const updateArnablesRequestMiddleware = (config) => (next, context) => as
22
24
  return next(args);
23
25
  };
24
26
  export const updateArnablesRequestMiddlewareOptions = {
25
- step: "build",
27
+ toMiddleware: "serializerMiddleware",
28
+ relation: "after",
26
29
  name: "updateArnablesRequestMiddleware",
27
30
  tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"],
28
31
  };
@@ -7,7 +7,7 @@ export interface S3ControlInputConfig {
7
7
  /**
8
8
  * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
9
9
  */
10
- useArnRegion?: boolean | Provider<boolean>;
10
+ useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
11
11
  }
12
12
  interface PreviouslyResolved {
13
13
  isCustomEndpoint?: boolean;
@@ -33,7 +33,7 @@ export interface S3ControlResolvedConfig {
33
33
  /**
34
34
  * Resolved value for input config {@link S3ControlInputConfig.useArnRegion}
35
35
  */
36
- useArnRegion: Provider<boolean>;
36
+ useArnRegion: Provider<boolean | undefined>;
37
37
  /**
38
38
  * Resolved value for input config {@link RegionInputConfig.region}
39
39
  */
@@ -1,5 +1,8 @@
1
- import { InitializeHandlerOptions, InitializeMiddleware } from "@smithy/types";
1
+ import { RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
2
  import { S3ControlResolvedConfig } from "../configurations";
3
+ /**
4
+ * @internal
5
+ */
3
6
  type ArnableInput = {
4
7
  Name?: string;
5
8
  Bucket?: string;
@@ -9,7 +12,16 @@ type ArnableInput = {
9
12
  * Validate input `Name` or `Bucket` parameter is acceptable ARN format. If so, modify the input ARN to inferred
10
13
  * resource identifier, notify later middleware to redirect request to Outpost endpoint, signing service and signing
11
14
  * region.
15
+ * @internal
16
+ */
17
+ export declare const parseOutpostArnablesMiddleaware: (options: S3ControlResolvedConfig) => SerializeMiddleware<ArnableInput, any>;
18
+ /**
19
+ * This middleware must go after endpoint resolution and before serialization.
20
+ * The transform applied to the input.Bucket or input.Name ARN must not have occurred
21
+ * by the time endpoint resolution happens, but must have completed by the time serialization
22
+ * happens.
23
+ *
24
+ * @internal
12
25
  */
13
- export declare const parseOutpostArnablesMiddleaware: (options: S3ControlResolvedConfig) => InitializeMiddleware<ArnableInput, any>;
14
- export declare const parseOutpostArnablesMiddleawareOptions: InitializeHandlerOptions;
26
+ export declare const parseOutpostArnablesMiddleawareOptions: RelativeMiddlewareOptions;
15
27
  export {};
@@ -1,4 +1,7 @@
1
- import { BuildHandlerOptions, BuildMiddleware, Provider } from "@smithy/types";
1
+ import { Provider, RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ */
2
5
  export interface UpdateArnablesRequestMiddlewareConfig {
3
6
  isCustomEndpoint?: boolean;
4
7
  useFipsEndpoint: Provider<boolean>;
@@ -6,6 +9,11 @@ export interface UpdateArnablesRequestMiddlewareConfig {
6
9
  /**
7
10
  * After outpost request is constructed, redirect request to outpost endpoint and set `x-amz-account-id` and
8
11
  * `x-amz-outpost-id` headers.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const updateArnablesRequestMiddleware: (config: UpdateArnablesRequestMiddlewareConfig) => SerializeMiddleware<any, any>;
16
+ /**
17
+ * @internal
9
18
  */
10
- export declare const updateArnablesRequestMiddleware: (config: UpdateArnablesRequestMiddlewareConfig) => BuildMiddleware<any, any>;
11
- export declare const updateArnablesRequestMiddlewareOptions: BuildHandlerOptions;
19
+ export declare const updateArnablesRequestMiddlewareOptions: RelativeMiddlewareOptions;
@@ -1,7 +1,7 @@
1
1
  import { Provider, RegionInfoProvider } from "@smithy/types";
2
2
  export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
3
3
  export interface S3ControlInputConfig {
4
- useArnRegion?: boolean | Provider<boolean>;
4
+ useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
5
5
  }
6
6
  interface PreviouslyResolved {
7
7
  isCustomEndpoint?: boolean;
@@ -14,7 +14,7 @@ export interface S3ControlResolvedConfig {
14
14
  isCustomEndpoint?: boolean;
15
15
  useFipsEndpoint: Provider<boolean>;
16
16
  useDualstackEndpoint: Provider<boolean>;
17
- useArnRegion: Provider<boolean>;
17
+ useArnRegion: Provider<boolean | undefined>;
18
18
  region: Provider<string>;
19
19
  regionInfoProvider?: RegionInfoProvider;
20
20
  }
@@ -1,4 +1,4 @@
1
- import { InitializeHandlerOptions, InitializeMiddleware } from "@smithy/types";
1
+ import { RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
2
  import { S3ControlResolvedConfig } from "../configurations";
3
3
  type ArnableInput = {
4
4
  Name?: string;
@@ -7,6 +7,6 @@ type ArnableInput = {
7
7
  };
8
8
  export declare const parseOutpostArnablesMiddleaware: (
9
9
  options: S3ControlResolvedConfig
10
- ) => InitializeMiddleware<ArnableInput, any>;
11
- export declare const parseOutpostArnablesMiddleawareOptions: InitializeHandlerOptions;
10
+ ) => SerializeMiddleware<ArnableInput, any>;
11
+ export declare const parseOutpostArnablesMiddleawareOptions: RelativeMiddlewareOptions;
12
12
  export {};
@@ -1,9 +1,13 @@
1
- import { BuildHandlerOptions, BuildMiddleware, Provider } from "@smithy/types";
1
+ import {
2
+ Provider,
3
+ RelativeMiddlewareOptions,
4
+ SerializeMiddleware,
5
+ } from "@smithy/types";
2
6
  export interface UpdateArnablesRequestMiddlewareConfig {
3
7
  isCustomEndpoint?: boolean;
4
8
  useFipsEndpoint: Provider<boolean>;
5
9
  }
6
10
  export declare const updateArnablesRequestMiddleware: (
7
11
  config: UpdateArnablesRequestMiddlewareConfig
8
- ) => BuildMiddleware<any, any>;
9
- export declare const updateArnablesRequestMiddlewareOptions: BuildHandlerOptions;
12
+ ) => SerializeMiddleware<any, any>;
13
+ export declare const updateArnablesRequestMiddlewareOptions: RelativeMiddlewareOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-s3-control",
3
- "version": "3.821.0",
3
+ "version": "3.830.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-sdk-s3-control",
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@aws-sdk/middleware-bucket-endpoint": "3.821.0",
27
+ "@aws-sdk/middleware-bucket-endpoint": "3.830.0",
28
28
  "@aws-sdk/types": "3.821.0",
29
29
  "@aws-sdk/util-arn-parser": "3.804.0",
30
- "@aws-sdk/util-endpoints": "3.821.0",
30
+ "@aws-sdk/util-endpoints": "3.828.0",
31
31
  "@smithy/protocol-http": "^5.1.2",
32
32
  "@smithy/types": "^4.3.1",
33
33
  "@smithy/util-endpoints": "^3.0.6",