@aws-sdk/middleware-sdk-s3
Advanced tools
Comparing version 3.716.0 to 3.723.0
@@ -62,3 +62,2 @@ "use strict"; | ||
return (next, context) => async (args) => { | ||
var _a; | ||
const { request } = args; | ||
@@ -68,3 +67,3 @@ if (import_protocol_http.HttpRequest.isInstance(request)) { | ||
const message = `Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.`; | ||
if (typeof ((_a = context == null ? void 0 : context.logger) == null ? void 0 : _a.warn) === "function" && !(context.logger instanceof import_smithy_client.NoOpLogger)) { | ||
if (typeof context?.logger?.warn === "function" && !(context.logger instanceof import_smithy_client.NoOpLogger)) { | ||
context.logger.warn(message); | ||
@@ -138,3 +137,2 @@ } else { | ||
return (next, context) => async (args) => { | ||
var _a, _b, _c; | ||
try { | ||
@@ -144,7 +142,7 @@ return await next(args); | ||
if (clientConfig.followRegionRedirects) { | ||
if (((_a = err == null ? void 0 : err.$metadata) == null ? void 0 : _a.httpStatusCode) === 301 || // err.name === "PermanentRedirect" && --> removing the error name check, as that allows for HEAD operations (which have the 301 status code, but not the same error name) to be covered for region redirection as well | ||
((_b = err == null ? void 0 : err.$metadata) == null ? void 0 : _b.httpStatusCode) === 400 && (err == null ? void 0 : err.name) === "IllegalLocationConstraintException") { | ||
if (err?.$metadata?.httpStatusCode === 301 || // err.name === "PermanentRedirect" && --> removing the error name check, as that allows for HEAD operations (which have the 301 status code, but not the same error name) to be covered for region redirection as well | ||
err?.$metadata?.httpStatusCode === 400 && err?.name === "IllegalLocationConstraintException") { | ||
try { | ||
const actualRegion = err.$response.headers["x-amz-bucket-region"]; | ||
(_c = context.logger) == null ? void 0 : _c.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`); | ||
context.logger?.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`); | ||
context.__s3RegionRedirect = actualRegion; | ||
@@ -180,3 +178,2 @@ } catch (e) { | ||
return (next, context) => async (args) => { | ||
var _a; | ||
const result = await next(args); | ||
@@ -190,3 +187,3 @@ const { response } = result; | ||
} catch (e) { | ||
(_a = context.logger) == null ? void 0 : _a.warn( | ||
context.logger?.warn( | ||
`AWS SDK Warning for ${context.clientName}::${context.commandName} response parsing (${response.headers.expires}): ${e}` | ||
@@ -215,7 +212,11 @@ ); | ||
// src/s3-express/classes/S3ExpressIdentityCache.ts | ||
var _S3ExpressIdentityCache = class _S3ExpressIdentityCache { | ||
var S3ExpressIdentityCache = class _S3ExpressIdentityCache { | ||
constructor(data = {}) { | ||
this.data = data; | ||
this.lastPurgeTime = Date.now(); | ||
} | ||
static { | ||
__name(this, "S3ExpressIdentityCache"); | ||
} | ||
lastPurgeTime = Date.now(); | ||
static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 3e4; | ||
get(key) { | ||
@@ -253,8 +254,5 @@ const entry = this.data[key]; | ||
}; | ||
__name(_S3ExpressIdentityCache, "S3ExpressIdentityCache"); | ||
_S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 3e4; | ||
var S3ExpressIdentityCache = _S3ExpressIdentityCache; | ||
// src/s3-express/classes/S3ExpressIdentityCacheEntry.ts | ||
var _S3ExpressIdentityCacheEntry = class _S3ExpressIdentityCacheEntry { | ||
var S3ExpressIdentityCacheEntry = class { | ||
/** | ||
@@ -270,2 +268,5 @@ * @param identity - stored identity. | ||
} | ||
static { | ||
__name(this, "S3ExpressIdentityCacheEntry"); | ||
} | ||
get identity() { | ||
@@ -276,7 +277,5 @@ this.accessed = Date.now(); | ||
}; | ||
__name(_S3ExpressIdentityCacheEntry, "S3ExpressIdentityCacheEntry"); | ||
var S3ExpressIdentityCacheEntry = _S3ExpressIdentityCacheEntry; | ||
// src/s3-express/classes/S3ExpressIdentityProviderImpl.ts | ||
var _S3ExpressIdentityProviderImpl = class _S3ExpressIdentityProviderImpl { | ||
var S3ExpressIdentityProviderImpl = class _S3ExpressIdentityProviderImpl { | ||
constructor(createSessionFn, cache = new S3ExpressIdentityCache()) { | ||
@@ -286,2 +285,6 @@ this.createSessionFn = createSessionFn; | ||
} | ||
static { | ||
__name(this, "S3ExpressIdentityProviderImpl"); | ||
} | ||
static REFRESH_WINDOW_MS = 6e4; | ||
async getS3ExpressIdentity(awsIdentity, identityProperties) { | ||
@@ -293,8 +296,7 @@ const key = identityProperties.Bucket; | ||
return entry.identity.then((identity) => { | ||
var _a, _b; | ||
const isExpired = (((_a = identity.expiration) == null ? void 0 : _a.getTime()) ?? 0) < Date.now(); | ||
const isExpired = (identity.expiration?.getTime() ?? 0) < Date.now(); | ||
if (isExpired) { | ||
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity; | ||
} | ||
const isExpiringSoon = (((_b = identity.expiration) == null ? void 0 : _b.getTime()) ?? 0) < Date.now() + _S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS; | ||
const isExpiringSoon = (identity.expiration?.getTime() ?? 0) < Date.now() + _S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS; | ||
if (isExpiringSoon && !entry.isRefreshing) { | ||
@@ -312,3 +314,2 @@ entry.isRefreshing = true; | ||
async getIdentity(key) { | ||
var _a, _b; | ||
await this.cache.purgeExpired().catch((error) => { | ||
@@ -318,3 +319,3 @@ console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n" + error); | ||
const session = await this.createSessionFn(key); | ||
if (!((_a = session.Credentials) == null ? void 0 : _a.AccessKeyId) || !((_b = session.Credentials) == null ? void 0 : _b.SecretAccessKey)) { | ||
if (!session.Credentials?.AccessKeyId || !session.Credentials?.SecretAccessKey) { | ||
throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey."); | ||
@@ -331,5 +332,2 @@ } | ||
}; | ||
__name(_S3ExpressIdentityProviderImpl, "S3ExpressIdentityProviderImpl"); | ||
_S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS = 6e4; | ||
var S3ExpressIdentityProviderImpl = _S3ExpressIdentityProviderImpl; | ||
@@ -355,3 +353,6 @@ // src/s3-express/classes/SignatureV4S3Express.ts | ||
// src/s3-express/classes/SignatureV4S3Express.ts | ||
var _SignatureV4S3Express = class _SignatureV4S3Express extends import_signature_v4.SignatureV4 { | ||
var SignatureV4S3Express = class extends import_signature_v4.SignatureV4 { | ||
static { | ||
__name(this, "SignatureV4S3Express"); | ||
} | ||
/** | ||
@@ -385,4 +386,2 @@ * Signs with alternate provided credentials instead of those provided in the | ||
}; | ||
__name(_SignatureV4S3Express, "SignatureV4S3Express"); | ||
var SignatureV4S3Express = _SignatureV4S3Express; | ||
function getCredentialsWithoutSessionToken(credentials) { | ||
@@ -416,7 +415,6 @@ const credentialsWithoutSessionToken = { | ||
return (next, context) => async (args) => { | ||
var _a, _b, _c, _d, _e; | ||
if (context.endpointV2) { | ||
const endpoint = context.endpointV2; | ||
const isS3ExpressAuth = ((_c = (_b = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes) == null ? void 0 : _b[0]) == null ? void 0 : _c.name) === S3_EXPRESS_AUTH_SCHEME; | ||
const isS3ExpressBucket = ((_d = endpoint.properties) == null ? void 0 : _d.backend) === S3_EXPRESS_BACKEND || ((_e = endpoint.properties) == null ? void 0 : _e.bucketType) === S3_EXPRESS_BUCKET_TYPE; | ||
const isS3ExpressAuth = endpoint.properties?.authSchemes?.[0]?.name === S3_EXPRESS_AUTH_SCHEME; | ||
const isS3ExpressBucket = endpoint.properties?.backend === S3_EXPRESS_BACKEND || endpoint.properties?.bucketType === S3_EXPRESS_BUCKET_TYPE; | ||
if (isS3ExpressBucket) { | ||
@@ -561,3 +559,3 @@ (0, import_core.setFeature)(context, "S3_EXPRESS_BUCKET", "J"); | ||
} | ||
const isSplittableStream = typeof (sourceBody == null ? void 0 : sourceBody.stream) === "function" || typeof (sourceBody == null ? void 0 : sourceBody.pipe) === "function" || typeof (sourceBody == null ? void 0 : sourceBody.tee) === "function"; | ||
const isSplittableStream = typeof sourceBody?.stream === "function" || typeof sourceBody?.pipe === "function" || typeof sourceBody?.tee === "function"; | ||
if (!isSplittableStream) { | ||
@@ -577,3 +575,3 @@ return result; | ||
}); | ||
if (typeof (bodyCopy == null ? void 0 : bodyCopy.destroy) === "function") { | ||
if (typeof bodyCopy?.destroy === "function") { | ||
bodyCopy.destroy(); | ||
@@ -617,3 +615,2 @@ } | ||
return (next, context) => async (args) => { | ||
var _a, _b, _c, _d; | ||
if (options.bucketEndpoint) { | ||
@@ -632,6 +629,6 @@ const endpoint = context.endpointV2; | ||
const warning = `@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${bucket} could not be parsed as URL.`; | ||
if (((_b = (_a = context.logger) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "NoOpLogger") { | ||
if (context.logger?.constructor?.name === "NoOpLogger") { | ||
console.warn(warning); | ||
} else { | ||
(_d = (_c = context.logger) == null ? void 0 : _c.warn) == null ? void 0 : _d.call(_c, warning); | ||
context.logger?.warn?.(warning); | ||
} | ||
@@ -638,0 +635,0 @@ throw e; |
export class S3ExpressIdentityCache { | ||
data; | ||
lastPurgeTime = Date.now(); | ||
static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 30000; | ||
constructor(data = {}) { | ||
this.data = data; | ||
this.lastPurgeTime = Date.now(); | ||
} | ||
@@ -38,2 +40,1 @@ get(key) { | ||
} | ||
S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 30000; |
export class S3ExpressIdentityCacheEntry { | ||
_identity; | ||
isRefreshing; | ||
accessed; | ||
constructor(_identity, isRefreshing = false, accessed = Date.now()) { | ||
@@ -3,0 +6,0 @@ this._identity = _identity; |
import { S3ExpressIdentityCache } from "./S3ExpressIdentityCache"; | ||
import { S3ExpressIdentityCacheEntry } from "./S3ExpressIdentityCacheEntry"; | ||
export class S3ExpressIdentityProviderImpl { | ||
createSessionFn; | ||
cache; | ||
static REFRESH_WINDOW_MS = 60000; | ||
constructor(createSessionFn, cache = new S3ExpressIdentityCache()) { | ||
@@ -47,2 +50,1 @@ this.createSessionFn = createSessionFn; | ||
} | ||
S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS = 60000; |
{ | ||
"name": "@aws-sdk/middleware-sdk-s3", | ||
"version": "3.716.0", | ||
"version": "3.723.0", | ||
"scripts": { | ||
@@ -30,15 +30,15 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@aws-sdk/core": "3.716.0", | ||
"@aws-sdk/types": "3.714.0", | ||
"@aws-sdk/util-arn-parser": "3.693.0", | ||
"@smithy/core": "^2.5.5", | ||
"@smithy/node-config-provider": "^3.1.12", | ||
"@smithy/protocol-http": "^4.1.8", | ||
"@smithy/signature-v4": "^4.2.4", | ||
"@smithy/smithy-client": "^3.5.1", | ||
"@smithy/types": "^3.7.2", | ||
"@smithy/util-config-provider": "^3.0.0", | ||
"@smithy/util-middleware": "^3.0.11", | ||
"@smithy/util-stream": "^3.3.2", | ||
"@smithy/util-utf8": "^3.0.0", | ||
"@aws-sdk/core": "3.723.0", | ||
"@aws-sdk/types": "3.723.0", | ||
"@aws-sdk/util-arn-parser": "3.723.0", | ||
"@smithy/core": "^3.0.0", | ||
"@smithy/node-config-provider": "^4.0.0", | ||
"@smithy/protocol-http": "^5.0.0", | ||
"@smithy/signature-v4": "^5.0.0", | ||
"@smithy/smithy-client": "^4.0.0", | ||
"@smithy/types": "^4.0.0", | ||
"@smithy/util-config-provider": "^4.0.0", | ||
"@smithy/util-middleware": "^4.0.0", | ||
"@smithy/util-stream": "^4.0.0", | ||
"@smithy/util-utf8": "^4.0.0", | ||
"tslib": "^2.6.2" | ||
@@ -51,6 +51,6 @@ }, | ||
"rimraf": "3.0.2", | ||
"typescript": "~4.9.5" | ||
"typescript": "~5.2.2" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -57,0 +57,0 @@ "typesVersions": { |
1949
90938
+ Added@aws-sdk/core@3.723.0(transitive)
+ Added@aws-sdk/types@3.723.0(transitive)
+ Added@aws-sdk/util-arn-parser@3.723.0(transitive)
+ Added@smithy/abort-controller@4.0.1(transitive)
+ Added@smithy/core@3.1.2(transitive)
+ Added@smithy/fetch-http-handler@5.0.1(transitive)
+ Added@smithy/is-array-buffer@4.0.0(transitive)
+ Added@smithy/middleware-endpoint@4.0.3(transitive)
+ Added@smithy/middleware-serde@4.0.2(transitive)
+ Added@smithy/middleware-stack@4.0.1(transitive)
+ Added@smithy/node-config-provider@4.0.1(transitive)
+ Added@smithy/node-http-handler@4.0.2(transitive)
+ Added@smithy/property-provider@4.0.1(transitive)
+ Added@smithy/protocol-http@5.0.1(transitive)
+ Added@smithy/querystring-builder@4.0.1(transitive)
+ Added@smithy/querystring-parser@4.0.1(transitive)
+ Added@smithy/shared-ini-file-loader@4.0.1(transitive)
+ Added@smithy/signature-v4@5.0.1(transitive)
+ Added@smithy/smithy-client@4.1.3(transitive)
+ Added@smithy/types@4.1.0(transitive)
+ Added@smithy/url-parser@4.0.1(transitive)
+ Added@smithy/util-base64@4.0.0(transitive)
+ Added@smithy/util-body-length-browser@4.0.0(transitive)
+ Added@smithy/util-buffer-from@4.0.0(transitive)
+ Added@smithy/util-config-provider@4.0.0(transitive)
+ Added@smithy/util-hex-encoding@4.0.0(transitive)
+ Added@smithy/util-middleware@4.0.1(transitive)
+ Added@smithy/util-stream@4.0.2(transitive)
+ Added@smithy/util-uri-escape@4.0.0(transitive)
+ Added@smithy/util-utf8@4.0.0(transitive)
- Removed@aws-sdk/core@3.716.0(transitive)
- Removed@aws-sdk/types@3.714.0(transitive)
- Removed@aws-sdk/util-arn-parser@3.693.0(transitive)
- Removed@smithy/abort-controller@3.1.9(transitive)
- Removed@smithy/core@2.5.7(transitive)
- Removed@smithy/fetch-http-handler@4.1.3(transitive)
- Removed@smithy/is-array-buffer@3.0.0(transitive)
- Removed@smithy/middleware-endpoint@3.2.8(transitive)
- Removed@smithy/middleware-serde@3.0.11(transitive)
- Removed@smithy/middleware-stack@3.0.11(transitive)
- Removed@smithy/node-config-provider@3.1.12(transitive)
- Removed@smithy/node-http-handler@3.3.3(transitive)
- Removed@smithy/property-provider@3.1.11(transitive)
- Removed@smithy/protocol-http@4.1.8(transitive)
- Removed@smithy/querystring-builder@3.0.11(transitive)
- Removed@smithy/querystring-parser@3.0.11(transitive)
- Removed@smithy/shared-ini-file-loader@3.1.12(transitive)
- Removed@smithy/signature-v4@4.2.4(transitive)
- Removed@smithy/smithy-client@3.7.0(transitive)
- Removed@smithy/types@3.7.2(transitive)
- Removed@smithy/url-parser@3.0.11(transitive)
- Removed@smithy/util-base64@3.0.0(transitive)
- Removed@smithy/util-body-length-browser@3.0.0(transitive)
- Removed@smithy/util-buffer-from@3.0.0(transitive)
- Removed@smithy/util-config-provider@3.0.0(transitive)
- Removed@smithy/util-hex-encoding@3.0.0(transitive)
- Removed@smithy/util-middleware@3.0.11(transitive)
- Removed@smithy/util-stream@3.3.4(transitive)
- Removed@smithy/util-uri-escape@3.0.0(transitive)
- Removed@smithy/util-utf8@3.0.0(transitive)
Updated@aws-sdk/core@3.723.0
Updated@aws-sdk/types@3.723.0
Updated@smithy/core@^3.0.0
Updated@smithy/protocol-http@^5.0.0
Updated@smithy/signature-v4@^5.0.0
Updated@smithy/smithy-client@^4.0.0
Updated@smithy/types@^4.0.0
Updated@smithy/util-stream@^4.0.0
Updated@smithy/util-utf8@^4.0.0