@aws-sdk/middleware-sdk-s3
Advanced tools
Comparing version 3.622.0 to 3.624.0
@@ -34,2 +34,3 @@ "use strict"; | ||
getS3ExpiresMiddlewarePlugin: () => getS3ExpiresMiddlewarePlugin, | ||
getS3ExpressHttpSigningPlugin: () => getS3ExpressHttpSigningPlugin, | ||
getS3ExpressPlugin: () => getS3ExpressPlugin, | ||
@@ -45,2 +46,4 @@ getThrow200ExceptionsPlugin: () => getThrow200ExceptionsPlugin, | ||
s3ExpiresMiddlewareOptions: () => s3ExpiresMiddlewareOptions, | ||
s3ExpressHttpSigningMiddleware: () => s3ExpressHttpSigningMiddleware, | ||
s3ExpressHttpSigningMiddlewareOptions: () => s3ExpressHttpSigningMiddlewareOptions, | ||
s3ExpressMiddleware: () => s3ExpressMiddleware, | ||
@@ -94,16 +97,30 @@ s3ExpressMiddlewareOptions: () => s3ExpressMiddlewareOptions, | ||
const regionProviderRef = config.region; | ||
let unlock = /* @__PURE__ */ __name(() => { | ||
}, "unlock"); | ||
if (context.__s3RegionRedirect) { | ||
config.region = async () => { | ||
config.region = regionProviderRef; | ||
return context.__s3RegionRedirect; | ||
}; | ||
Object.defineProperty(config, "region", { | ||
writable: false, | ||
value: async () => { | ||
return context.__s3RegionRedirect; | ||
} | ||
}); | ||
unlock = /* @__PURE__ */ __name(() => Object.defineProperty(config, "region", { | ||
writable: true, | ||
value: regionProviderRef | ||
}), "unlock"); | ||
} | ||
const result = await next(args); | ||
if (context.__s3RegionRedirect) { | ||
const region = await config.region(); | ||
if (originalRegion !== region) { | ||
throw new Error("Region was not restored following S3 region redirect."); | ||
try { | ||
const result = await next(args); | ||
if (context.__s3RegionRedirect) { | ||
unlock(); | ||
const region = await config.region(); | ||
if (originalRegion !== region) { | ||
throw new Error("Region was not restored following S3 region redirect."); | ||
} | ||
} | ||
return result; | ||
} catch (e) { | ||
unlock(); | ||
throw e; | ||
} | ||
return result; | ||
}; | ||
@@ -422,2 +439,64 @@ }, "regionRedirectEndpointMiddleware"); | ||
// src/s3-express/functions/s3ExpressHttpSigningMiddleware.ts | ||
var import_core = require("@smithy/core"); | ||
var import_util_middleware = require("@smithy/util-middleware"); | ||
// src/s3-express/functions/signS3Express.ts | ||
var signS3Express = /* @__PURE__ */ __name(async (s3ExpressIdentity, signingOptions, request, sigV4MultiRegionSigner) => { | ||
const signedRequest = await sigV4MultiRegionSigner.signWithCredentials(request, s3ExpressIdentity, {}); | ||
if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) { | ||
throw new Error("X-Amz-Security-Token must not be set for s3-express requests."); | ||
} | ||
return signedRequest; | ||
}, "signS3Express"); | ||
// src/s3-express/functions/s3ExpressHttpSigningMiddleware.ts | ||
var defaultErrorHandler = /* @__PURE__ */ __name((signingProperties) => (error) => { | ||
throw error; | ||
}, "defaultErrorHandler"); | ||
var defaultSuccessHandler = /* @__PURE__ */ __name((httpResponse, signingProperties) => { | ||
}, "defaultSuccessHandler"); | ||
var s3ExpressHttpSigningMiddlewareOptions = import_core.httpSigningMiddlewareOptions; | ||
var s3ExpressHttpSigningMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => { | ||
if (!import_protocol_http.HttpRequest.isInstance(args.request)) { | ||
return next(args); | ||
} | ||
const smithyContext = (0, import_util_middleware.getSmithyContext)(context); | ||
const scheme = smithyContext.selectedHttpAuthScheme; | ||
if (!scheme) { | ||
throw new Error(`No HttpAuthScheme was selected: unable to sign request`); | ||
} | ||
const { | ||
httpAuthOption: { signingProperties = {} }, | ||
identity, | ||
signer | ||
} = scheme; | ||
let request; | ||
if (context.s3ExpressIdentity) { | ||
request = await signS3Express( | ||
context.s3ExpressIdentity, | ||
signingProperties, | ||
args.request, | ||
await config.signer() | ||
); | ||
} else { | ||
request = await signer.sign(args.request, identity, signingProperties); | ||
} | ||
const output = await next({ | ||
...args, | ||
request | ||
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties)); | ||
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties); | ||
return output; | ||
}, "s3ExpressHttpSigningMiddleware"); | ||
var getS3ExpressHttpSigningPlugin = /* @__PURE__ */ __name((config) => ({ | ||
applyToStack: (clientStack) => { | ||
clientStack.addRelativeTo( | ||
s3ExpressHttpSigningMiddleware(config), | ||
import_core.httpSigningMiddlewareOptions | ||
); | ||
} | ||
}), "getS3ExpressHttpSigningPlugin"); | ||
// src/s3Configuration.ts | ||
@@ -596,2 +675,5 @@ var resolveS3Config = /* @__PURE__ */ __name((input, { | ||
s3ExpressMiddlewareOptions, | ||
getS3ExpressHttpSigningPlugin, | ||
s3ExpressHttpSigningMiddleware, | ||
s3ExpressHttpSigningMiddlewareOptions, | ||
resolveS3Config, | ||
@@ -598,0 +680,0 @@ throw200ExceptionsMiddleware, |
@@ -5,16 +5,30 @@ export const regionRedirectEndpointMiddleware = (config) => { | ||
const regionProviderRef = config.region; | ||
let unlock = () => { }; | ||
if (context.__s3RegionRedirect) { | ||
config.region = async () => { | ||
config.region = regionProviderRef; | ||
return context.__s3RegionRedirect; | ||
}; | ||
Object.defineProperty(config, "region", { | ||
writable: false, | ||
value: async () => { | ||
return context.__s3RegionRedirect; | ||
}, | ||
}); | ||
unlock = () => Object.defineProperty(config, "region", { | ||
writable: true, | ||
value: regionProviderRef, | ||
}); | ||
} | ||
const result = await next(args); | ||
if (context.__s3RegionRedirect) { | ||
const region = await config.region(); | ||
if (originalRegion !== region) { | ||
throw new Error("Region was not restored following S3 region redirect."); | ||
try { | ||
const result = await next(args); | ||
if (context.__s3RegionRedirect) { | ||
unlock(); | ||
const region = await config.region(); | ||
if (originalRegion !== region) { | ||
throw new Error("Region was not restored following S3 region redirect."); | ||
} | ||
} | ||
return result; | ||
} | ||
return result; | ||
catch (e) { | ||
unlock(); | ||
throw e; | ||
} | ||
}; | ||
@@ -21,0 +35,0 @@ }; |
@@ -7,1 +7,2 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache"; | ||
export { getS3ExpressPlugin, s3ExpressMiddleware, s3ExpressMiddlewareOptions } from "./functions/s3ExpressMiddleware"; | ||
export { getS3ExpressHttpSigningPlugin, s3ExpressHttpSigningMiddleware, s3ExpressHttpSigningMiddlewareOptions, } from "./functions/s3ExpressHttpSigningMiddleware"; |
@@ -7,3 +7,4 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache"; | ||
export { getS3ExpressPlugin, s3ExpressMiddleware, s3ExpressMiddlewareOptions } from "./functions/s3ExpressMiddleware"; | ||
export { getS3ExpressHttpSigningPlugin, s3ExpressHttpSigningMiddleware, s3ExpressHttpSigningMiddlewareOptions, } from "./functions/s3ExpressHttpSigningMiddleware"; | ||
export { S3ExpressIdentity } from "./interfaces/S3ExpressIdentity"; | ||
export { S3ExpressIdentityProvider } from "./interfaces/S3ExpressIdentityProvider"; |
@@ -11,3 +11,8 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache"; | ||
} from "./functions/s3ExpressMiddleware"; | ||
export { | ||
getS3ExpressHttpSigningPlugin, | ||
s3ExpressHttpSigningMiddleware, | ||
s3ExpressHttpSigningMiddlewareOptions, | ||
} from "./functions/s3ExpressHttpSigningMiddleware"; | ||
export { S3ExpressIdentity } from "./interfaces/S3ExpressIdentity"; | ||
export { S3ExpressIdentityProvider } from "./interfaces/S3ExpressIdentityProvider"; |
{ | ||
"name": "@aws-sdk/middleware-sdk-s3", | ||
"version": "3.622.0", | ||
"version": "3.624.0", | ||
"scripts": { | ||
@@ -26,4 +26,6 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@aws-sdk/core": "3.624.0", | ||
"@aws-sdk/types": "3.609.0", | ||
"@aws-sdk/util-arn-parser": "3.568.0", | ||
"@smithy/core": "^2.3.2", | ||
"@smithy/node-config-provider": "^3.1.4", | ||
@@ -35,2 +37,3 @@ "@smithy/protocol-http": "^4.1.0", | ||
"@smithy/util-config-provider": "^3.0.0", | ||
"@smithy/util-middleware": "^3.0.3", | ||
"@smithy/util-stream": "^3.1.3", | ||
@@ -37,0 +40,0 @@ "@smithy/util-utf8": "^3.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90527
64
1925
14
+ Added@aws-sdk/core@3.624.0
+ Added@smithy/core@^2.3.2
+ Added@aws-sdk/core@3.624.0(transitive)
+ Added@smithy/core@2.4.3(transitive)
+ Added@smithy/middleware-retry@3.0.18(transitive)
+ Added@smithy/service-error-classification@3.0.6(transitive)
+ Added@smithy/util-body-length-browser@3.0.0(transitive)
+ Added@smithy/util-retry@3.0.6(transitive)
+ Addedfast-xml-parser@4.4.1(transitive)
+ Addedstrnum@1.0.5(transitive)
+ Addeduuid@9.0.1(transitive)