Initial
This commit is contained in:
201
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/LICENSE
generated
vendored
Normal file
201
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/bucket-endpoint-middleware.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/bucket-endpoint-middleware.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/check-content-length-header.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/check-content-length-header.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
580
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js
generated
vendored
Normal file
580
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS: () => NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,
|
||||
S3ExpressIdentityCache: () => S3ExpressIdentityCache,
|
||||
S3ExpressIdentityCacheEntry: () => S3ExpressIdentityCacheEntry,
|
||||
S3ExpressIdentityProviderImpl: () => S3ExpressIdentityProviderImpl,
|
||||
SignatureV4S3Express: () => SignatureV4S3Express,
|
||||
checkContentLengthHeader: () => checkContentLengthHeader,
|
||||
checkContentLengthHeaderMiddlewareOptions: () => checkContentLengthHeaderMiddlewareOptions,
|
||||
getCheckContentLengthHeaderPlugin: () => getCheckContentLengthHeaderPlugin,
|
||||
getRegionRedirectMiddlewarePlugin: () => getRegionRedirectMiddlewarePlugin,
|
||||
getS3ExpiresMiddlewarePlugin: () => getS3ExpiresMiddlewarePlugin,
|
||||
getS3ExpressPlugin: () => getS3ExpressPlugin,
|
||||
getThrow200ExceptionsPlugin: () => getThrow200ExceptionsPlugin,
|
||||
getValidateBucketNamePlugin: () => getValidateBucketNamePlugin,
|
||||
regionRedirectEndpointMiddleware: () => regionRedirectEndpointMiddleware,
|
||||
regionRedirectEndpointMiddlewareOptions: () => regionRedirectEndpointMiddlewareOptions,
|
||||
regionRedirectMiddleware: () => regionRedirectMiddleware,
|
||||
regionRedirectMiddlewareOptions: () => regionRedirectMiddlewareOptions,
|
||||
resolveS3Config: () => resolveS3Config,
|
||||
s3ExpiresMiddleware: () => s3ExpiresMiddleware,
|
||||
s3ExpiresMiddlewareOptions: () => s3ExpiresMiddlewareOptions,
|
||||
s3ExpressMiddleware: () => s3ExpressMiddleware,
|
||||
s3ExpressMiddlewareOptions: () => s3ExpressMiddlewareOptions,
|
||||
throw200ExceptionsMiddleware: () => throw200ExceptionsMiddleware,
|
||||
throw200ExceptionsMiddlewareOptions: () => throw200ExceptionsMiddlewareOptions,
|
||||
validateBucketNameMiddleware: () => validateBucketNameMiddleware,
|
||||
validateBucketNameMiddlewareOptions: () => validateBucketNameMiddlewareOptions
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/check-content-length-header.ts
|
||||
var import_protocol_http = require("@smithy/protocol-http");
|
||||
var import_smithy_client = require("@smithy/smithy-client");
|
||||
var CONTENT_LENGTH_HEADER = "content-length";
|
||||
function checkContentLengthHeader() {
|
||||
return (next, context) => async (args) => {
|
||||
var _a;
|
||||
const { request } = args;
|
||||
if (import_protocol_http.HttpRequest.isInstance(request)) {
|
||||
if (!(CONTENT_LENGTH_HEADER in request.headers)) {
|
||||
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)) {
|
||||
context.logger.warn(message);
|
||||
} else {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return next({ ...args });
|
||||
};
|
||||
}
|
||||
__name(checkContentLengthHeader, "checkContentLengthHeader");
|
||||
var checkContentLengthHeaderMiddlewareOptions = {
|
||||
step: "finalizeRequest",
|
||||
tags: ["CHECK_CONTENT_LENGTH_HEADER"],
|
||||
name: "getCheckContentLengthHeaderPlugin",
|
||||
override: true
|
||||
};
|
||||
var getCheckContentLengthHeaderPlugin = /* @__PURE__ */ __name((unused) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(checkContentLengthHeader(), checkContentLengthHeaderMiddlewareOptions);
|
||||
}
|
||||
}), "getCheckContentLengthHeaderPlugin");
|
||||
|
||||
// src/region-redirect-endpoint-middleware.ts
|
||||
var regionRedirectEndpointMiddleware = /* @__PURE__ */ __name((config) => {
|
||||
return (next, context) => async (args) => {
|
||||
const originalRegion = await config.region();
|
||||
const regionProviderRef = config.region;
|
||||
if (context.__s3RegionRedirect) {
|
||||
config.region = async () => {
|
||||
config.region = regionProviderRef;
|
||||
return context.__s3RegionRedirect;
|
||||
};
|
||||
}
|
||||
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.");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}, "regionRedirectEndpointMiddleware");
|
||||
var regionRedirectEndpointMiddlewareOptions = {
|
||||
tags: ["REGION_REDIRECT", "S3"],
|
||||
name: "regionRedirectEndpointMiddleware",
|
||||
override: true,
|
||||
relation: "before",
|
||||
toMiddleware: "endpointV2Middleware"
|
||||
};
|
||||
|
||||
// src/region-redirect-middleware.ts
|
||||
function regionRedirectMiddleware(clientConfig) {
|
||||
return (next, context) => async (args) => {
|
||||
var _a, _b;
|
||||
try {
|
||||
return await next(args);
|
||||
} catch (err) {
|
||||
if (clientConfig.followRegionRedirects && // 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
|
||||
((_a = err == null ? void 0 : err.$metadata) == null ? void 0 : _a.httpStatusCode) === 301) {
|
||||
try {
|
||||
const actualRegion = err.$response.headers["x-amz-bucket-region"];
|
||||
(_b = context.logger) == null ? void 0 : _b.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`);
|
||||
context.__s3RegionRedirect = actualRegion;
|
||||
} catch (e) {
|
||||
throw new Error("Region redirect failed: " + e);
|
||||
}
|
||||
return next(args);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
__name(regionRedirectMiddleware, "regionRedirectMiddleware");
|
||||
var regionRedirectMiddlewareOptions = {
|
||||
step: "initialize",
|
||||
tags: ["REGION_REDIRECT", "S3"],
|
||||
name: "regionRedirectMiddleware",
|
||||
override: true
|
||||
};
|
||||
var getRegionRedirectMiddlewarePlugin = /* @__PURE__ */ __name((clientConfig) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(regionRedirectMiddleware(clientConfig), regionRedirectMiddlewareOptions);
|
||||
clientStack.addRelativeTo(regionRedirectEndpointMiddleware(clientConfig), regionRedirectEndpointMiddlewareOptions);
|
||||
}
|
||||
}), "getRegionRedirectMiddlewarePlugin");
|
||||
|
||||
// src/s3-expires-middleware.ts
|
||||
|
||||
|
||||
var s3ExpiresMiddleware = /* @__PURE__ */ __name((config) => {
|
||||
return (next, context) => async (args) => {
|
||||
var _a;
|
||||
const result = await next(args);
|
||||
const { response } = result;
|
||||
if (import_protocol_http.HttpResponse.isInstance(response)) {
|
||||
if (response.headers.expires) {
|
||||
response.headers.expiresstring = response.headers.expires;
|
||||
try {
|
||||
(0, import_smithy_client.parseRfc7231DateTime)(response.headers.expires);
|
||||
} catch (e) {
|
||||
(_a = context.logger) == null ? void 0 : _a.warn(
|
||||
`AWS SDK Warning for ${context.clientName}::${context.commandName} response parsing (${response.headers.expires}): ${e}`
|
||||
);
|
||||
delete response.headers.expires;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}, "s3ExpiresMiddleware");
|
||||
var s3ExpiresMiddlewareOptions = {
|
||||
tags: ["S3"],
|
||||
name: "s3ExpiresMiddleware",
|
||||
override: true,
|
||||
relation: "after",
|
||||
toMiddleware: "deserializerMiddleware"
|
||||
};
|
||||
var getS3ExpiresMiddlewarePlugin = /* @__PURE__ */ __name((clientConfig) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.addRelativeTo(s3ExpiresMiddleware(clientConfig), s3ExpiresMiddlewareOptions);
|
||||
}
|
||||
}), "getS3ExpiresMiddlewarePlugin");
|
||||
|
||||
// src/s3-express/classes/S3ExpressIdentityCache.ts
|
||||
var _S3ExpressIdentityCache = class _S3ExpressIdentityCache {
|
||||
constructor(data = {}) {
|
||||
this.data = data;
|
||||
this.lastPurgeTime = Date.now();
|
||||
}
|
||||
get(key) {
|
||||
const entry = this.data[key];
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
set(key, entry) {
|
||||
this.data[key] = entry;
|
||||
return entry;
|
||||
}
|
||||
delete(key) {
|
||||
delete this.data[key];
|
||||
}
|
||||
async purgeExpired() {
|
||||
const now = Date.now();
|
||||
if (this.lastPurgeTime + _S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS > now) {
|
||||
return;
|
||||
}
|
||||
for (const key in this.data) {
|
||||
const entry = this.data[key];
|
||||
if (!entry.isRefreshing) {
|
||||
const credential = await entry.identity;
|
||||
if (credential.expiration) {
|
||||
if (credential.expiration.getTime() < now) {
|
||||
delete 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 {
|
||||
/**
|
||||
* @param identity - stored identity.
|
||||
* @param accessed - timestamp of last access in epoch ms.
|
||||
* @param isRefreshing - this key is currently in the process of being refreshed (background).
|
||||
*/
|
||||
constructor(_identity, isRefreshing = false, accessed = Date.now()) {
|
||||
this._identity = _identity;
|
||||
this.isRefreshing = isRefreshing;
|
||||
this.accessed = accessed;
|
||||
}
|
||||
get identity() {
|
||||
this.accessed = Date.now();
|
||||
return this._identity;
|
||||
}
|
||||
};
|
||||
__name(_S3ExpressIdentityCacheEntry, "S3ExpressIdentityCacheEntry");
|
||||
var S3ExpressIdentityCacheEntry = _S3ExpressIdentityCacheEntry;
|
||||
|
||||
// src/s3-express/classes/S3ExpressIdentityProviderImpl.ts
|
||||
var _S3ExpressIdentityProviderImpl = class _S3ExpressIdentityProviderImpl {
|
||||
constructor(createSessionFn, cache = new S3ExpressIdentityCache()) {
|
||||
this.createSessionFn = createSessionFn;
|
||||
this.cache = cache;
|
||||
}
|
||||
async getS3ExpressIdentity(awsIdentity, identityProperties) {
|
||||
const key = identityProperties.Bucket;
|
||||
const { cache } = this;
|
||||
const entry = cache.get(key);
|
||||
if (entry) {
|
||||
return entry.identity.then((identity) => {
|
||||
var _a, _b;
|
||||
const isExpired = (((_a = identity.expiration) == null ? void 0 : _a.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;
|
||||
if (isExpiringSoon && !entry.isRefreshing) {
|
||||
entry.isRefreshing = true;
|
||||
this.getIdentity(key).then((id) => {
|
||||
cache.set(key, new S3ExpressIdentityCacheEntry(Promise.resolve(id)));
|
||||
});
|
||||
}
|
||||
return identity;
|
||||
});
|
||||
}
|
||||
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
||||
}
|
||||
async getIdentity(key) {
|
||||
var _a, _b;
|
||||
await this.cache.purgeExpired().catch((error) => {
|
||||
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)) {
|
||||
throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");
|
||||
}
|
||||
const identity = {
|
||||
accessKeyId: session.Credentials.AccessKeyId,
|
||||
secretAccessKey: session.Credentials.SecretAccessKey,
|
||||
sessionToken: session.Credentials.SessionToken,
|
||||
expiration: session.Credentials.Expiration ? new Date(session.Credentials.Expiration) : void 0
|
||||
};
|
||||
return identity;
|
||||
}
|
||||
};
|
||||
__name(_S3ExpressIdentityProviderImpl, "S3ExpressIdentityProviderImpl");
|
||||
_S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS = 6e4;
|
||||
var S3ExpressIdentityProviderImpl = _S3ExpressIdentityProviderImpl;
|
||||
|
||||
// src/s3-express/classes/SignatureV4S3Express.ts
|
||||
var import_signature_v4 = require("@smithy/signature-v4");
|
||||
|
||||
// src/s3-express/constants.ts
|
||||
var import_util_config_provider = require("@smithy/util-config-provider");
|
||||
var S3_EXPRESS_BUCKET_TYPE = "Directory";
|
||||
var S3_EXPRESS_BACKEND = "S3Express";
|
||||
var S3_EXPRESS_AUTH_SCHEME = "sigv4-s3express";
|
||||
var SESSION_TOKEN_QUERY_PARAM = "X-Amz-S3session-Token";
|
||||
var SESSION_TOKEN_HEADER = SESSION_TOKEN_QUERY_PARAM.toLowerCase();
|
||||
var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME = "AWS_S3_DISABLE_EXPRESS_SESSION_AUTH";
|
||||
var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME = "s3_disable_express_session_auth";
|
||||
var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = {
|
||||
environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME, import_util_config_provider.SelectorType.ENV),
|
||||
configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME, import_util_config_provider.SelectorType.CONFIG),
|
||||
default: false
|
||||
};
|
||||
|
||||
// src/s3-express/classes/SignatureV4S3Express.ts
|
||||
var _SignatureV4S3Express = class _SignatureV4S3Express extends import_signature_v4.SignatureV4 {
|
||||
/**
|
||||
* Signs with alternate provided credentials instead of those provided in the
|
||||
* constructor.
|
||||
*
|
||||
* Additionally omits the credential sessionToken and assigns it to the
|
||||
* alternate header field for S3 Express.
|
||||
*/
|
||||
async signWithCredentials(requestToSign, credentials, options) {
|
||||
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
||||
requestToSign.headers[SESSION_TOKEN_HEADER] = credentials.sessionToken;
|
||||
const privateAccess = this;
|
||||
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
||||
return privateAccess.signRequest(requestToSign, options ?? {});
|
||||
}
|
||||
/**
|
||||
* Similar to {@link SignatureV4S3Express#signWithCredentials} but for presigning.
|
||||
*/
|
||||
async presignWithCredentials(requestToSign, credentials, options) {
|
||||
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
||||
delete requestToSign.headers[SESSION_TOKEN_HEADER];
|
||||
requestToSign.headers[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
requestToSign.query = requestToSign.query ?? {};
|
||||
requestToSign.query[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
const privateAccess = this;
|
||||
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
||||
return this.presign(requestToSign, options);
|
||||
}
|
||||
};
|
||||
__name(_SignatureV4S3Express, "SignatureV4S3Express");
|
||||
var SignatureV4S3Express = _SignatureV4S3Express;
|
||||
function getCredentialsWithoutSessionToken(credentials) {
|
||||
const credentialsWithoutSessionToken = {
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
secretAccessKey: credentials.secretAccessKey,
|
||||
expiration: credentials.expiration
|
||||
};
|
||||
return credentialsWithoutSessionToken;
|
||||
}
|
||||
__name(getCredentialsWithoutSessionToken, "getCredentialsWithoutSessionToken");
|
||||
function setSingleOverride(privateAccess, credentialsWithoutSessionToken) {
|
||||
const id = setTimeout(() => {
|
||||
throw new Error("SignatureV4S3Express credential override was created but not called.");
|
||||
}, 10);
|
||||
const currentCredentialProvider = privateAccess.credentialProvider;
|
||||
const overrideCredentialsProviderOnce = /* @__PURE__ */ __name(() => {
|
||||
clearTimeout(id);
|
||||
privateAccess.credentialProvider = currentCredentialProvider;
|
||||
return Promise.resolve(credentialsWithoutSessionToken);
|
||||
}, "overrideCredentialsProviderOnce");
|
||||
privateAccess.credentialProvider = overrideCredentialsProviderOnce;
|
||||
}
|
||||
__name(setSingleOverride, "setSingleOverride");
|
||||
|
||||
// src/s3-express/functions/s3ExpressMiddleware.ts
|
||||
|
||||
var s3ExpressMiddleware = /* @__PURE__ */ __name((options) => {
|
||||
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;
|
||||
if (isS3ExpressBucket) {
|
||||
context.isS3ExpressBucket = true;
|
||||
}
|
||||
if (isS3ExpressAuth) {
|
||||
const requestBucket = args.input.Bucket;
|
||||
if (requestBucket) {
|
||||
const s3ExpressIdentity = await options.s3ExpressIdentityProvider.getS3ExpressIdentity(
|
||||
await options.credentials(),
|
||||
{
|
||||
Bucket: requestBucket
|
||||
}
|
||||
);
|
||||
context.s3ExpressIdentity = s3ExpressIdentity;
|
||||
if (import_protocol_http.HttpRequest.isInstance(args.request) && s3ExpressIdentity.sessionToken) {
|
||||
args.request.headers[SESSION_TOKEN_HEADER] = s3ExpressIdentity.sessionToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return next(args);
|
||||
};
|
||||
}, "s3ExpressMiddleware");
|
||||
var s3ExpressMiddlewareOptions = {
|
||||
name: "s3ExpressMiddleware",
|
||||
step: "build",
|
||||
tags: ["S3", "S3_EXPRESS"],
|
||||
override: true
|
||||
};
|
||||
var getS3ExpressPlugin = /* @__PURE__ */ __name((options) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(s3ExpressMiddleware(options), s3ExpressMiddlewareOptions);
|
||||
}
|
||||
}), "getS3ExpressPlugin");
|
||||
|
||||
// src/s3Configuration.ts
|
||||
var resolveS3Config = /* @__PURE__ */ __name((input, {
|
||||
session
|
||||
}) => {
|
||||
const [s3ClientProvider, CreateSessionCommandCtor] = session;
|
||||
return {
|
||||
...input,
|
||||
forcePathStyle: input.forcePathStyle ?? false,
|
||||
useAccelerateEndpoint: input.useAccelerateEndpoint ?? false,
|
||||
disableMultiregionAccessPoints: input.disableMultiregionAccessPoints ?? false,
|
||||
followRegionRedirects: input.followRegionRedirects ?? false,
|
||||
s3ExpressIdentityProvider: input.s3ExpressIdentityProvider ?? new S3ExpressIdentityProviderImpl(
|
||||
async (key) => s3ClientProvider().send(
|
||||
new CreateSessionCommandCtor({
|
||||
Bucket: key,
|
||||
SessionMode: "ReadWrite"
|
||||
})
|
||||
)
|
||||
),
|
||||
bucketEndpoint: input.bucketEndpoint ?? false
|
||||
};
|
||||
}, "resolveS3Config");
|
||||
|
||||
// src/throw-200-exceptions.ts
|
||||
|
||||
var throw200ExceptionsMiddleware = /* @__PURE__ */ __name((config) => (next) => async (args) => {
|
||||
const result = await next(args);
|
||||
const { response } = result;
|
||||
if (!import_protocol_http.HttpResponse.isInstance(response))
|
||||
return result;
|
||||
const { statusCode, body } = response;
|
||||
if (statusCode < 200 || statusCode >= 300)
|
||||
return result;
|
||||
const bodyBytes = await collectBody(body, config);
|
||||
const bodyString = await collectBodyString(bodyBytes, config);
|
||||
if (bodyBytes.length === 0) {
|
||||
const err = new Error("S3 aborted request");
|
||||
err.name = "InternalError";
|
||||
throw err;
|
||||
}
|
||||
if (bodyString && bodyString.match("<Error>")) {
|
||||
response.statusCode = 400;
|
||||
}
|
||||
response.body = bodyBytes;
|
||||
return result;
|
||||
}, "throw200ExceptionsMiddleware");
|
||||
var collectBody = /* @__PURE__ */ __name((streamBody = new Uint8Array(), context) => {
|
||||
if (streamBody instanceof Uint8Array) {
|
||||
return Promise.resolve(streamBody);
|
||||
}
|
||||
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
||||
}, "collectBody");
|
||||
var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
|
||||
var throw200ExceptionsMiddlewareOptions = {
|
||||
relation: "after",
|
||||
toMiddleware: "deserializerMiddleware",
|
||||
tags: ["THROW_200_EXCEPTIONS", "S3"],
|
||||
name: "throw200ExceptionsMiddleware",
|
||||
override: true
|
||||
};
|
||||
var getThrow200ExceptionsPlugin = /* @__PURE__ */ __name((config) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.addRelativeTo(throw200ExceptionsMiddleware(config), throw200ExceptionsMiddlewareOptions);
|
||||
}
|
||||
}), "getThrow200ExceptionsPlugin");
|
||||
|
||||
// src/validate-bucket-name.ts
|
||||
var import_util_arn_parser = require("@aws-sdk/util-arn-parser");
|
||||
|
||||
// src/bucket-endpoint-middleware.ts
|
||||
function bucketEndpointMiddleware(options) {
|
||||
return (next, context) => async (args) => {
|
||||
var _a, _b, _c, _d;
|
||||
if (options.bucketEndpoint) {
|
||||
const endpoint = context.endpointV2;
|
||||
if (endpoint) {
|
||||
const bucket = args.input.Bucket;
|
||||
if (typeof bucket === "string") {
|
||||
try {
|
||||
const bucketEndpointUrl = new URL(bucket);
|
||||
endpoint.url = bucketEndpointUrl;
|
||||
} catch (e) {
|
||||
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") {
|
||||
console.warn(warning);
|
||||
} else {
|
||||
(_d = (_c = context.logger) == null ? void 0 : _c.warn) == null ? void 0 : _d.call(_c, warning);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return next(args);
|
||||
};
|
||||
}
|
||||
__name(bucketEndpointMiddleware, "bucketEndpointMiddleware");
|
||||
var bucketEndpointMiddlewareOptions = {
|
||||
name: "bucketEndpointMiddleware",
|
||||
override: true,
|
||||
relation: "after",
|
||||
toMiddleware: "endpointV2Middleware"
|
||||
};
|
||||
|
||||
// src/validate-bucket-name.ts
|
||||
function validateBucketNameMiddleware({ bucketEndpoint }) {
|
||||
return (next) => async (args) => {
|
||||
const {
|
||||
input: { Bucket }
|
||||
} = args;
|
||||
if (!bucketEndpoint && typeof Bucket === "string" && !(0, import_util_arn_parser.validate)(Bucket) && Bucket.indexOf("/") >= 0) {
|
||||
const err = new Error(`Bucket name shouldn't contain '/', received '${Bucket}'`);
|
||||
err.name = "InvalidBucketName";
|
||||
throw err;
|
||||
}
|
||||
return next({ ...args });
|
||||
};
|
||||
}
|
||||
__name(validateBucketNameMiddleware, "validateBucketNameMiddleware");
|
||||
var validateBucketNameMiddlewareOptions = {
|
||||
step: "initialize",
|
||||
tags: ["VALIDATE_BUCKET_NAME"],
|
||||
name: "validateBucketNameMiddleware",
|
||||
override: true
|
||||
};
|
||||
var getValidateBucketNamePlugin = /* @__PURE__ */ __name((options) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(validateBucketNameMiddleware(options), validateBucketNameMiddlewareOptions);
|
||||
clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions);
|
||||
}
|
||||
}), "getValidateBucketNamePlugin");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
|
||||
0 && (module.exports = {
|
||||
checkContentLengthHeader,
|
||||
checkContentLengthHeaderMiddlewareOptions,
|
||||
getCheckContentLengthHeaderPlugin,
|
||||
regionRedirectEndpointMiddleware,
|
||||
regionRedirectEndpointMiddlewareOptions,
|
||||
regionRedirectMiddleware,
|
||||
regionRedirectMiddlewareOptions,
|
||||
getRegionRedirectMiddlewarePlugin,
|
||||
s3ExpiresMiddleware,
|
||||
s3ExpiresMiddlewareOptions,
|
||||
getS3ExpiresMiddlewarePlugin,
|
||||
S3ExpressIdentityCache,
|
||||
S3ExpressIdentityCacheEntry,
|
||||
S3ExpressIdentityProviderImpl,
|
||||
SignatureV4S3Express,
|
||||
NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,
|
||||
getS3ExpressPlugin,
|
||||
s3ExpressMiddleware,
|
||||
s3ExpressMiddlewareOptions,
|
||||
resolveS3Config,
|
||||
throw200ExceptionsMiddleware,
|
||||
throw200ExceptionsMiddlewareOptions,
|
||||
getThrow200ExceptionsPlugin,
|
||||
validateBucketNameMiddleware,
|
||||
validateBucketNameMiddlewareOptions,
|
||||
getValidateBucketNamePlugin
|
||||
});
|
||||
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-endpoint-middleware.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-endpoint-middleware.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-middleware.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-middleware.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-expires-middleware.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-expires-middleware.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityCache.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityCache.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityCacheEntry.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityCacheEntry.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityProviderImpl.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/S3ExpressIdentityProviderImpl.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/SignatureV4S3Express.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/classes/SignatureV4S3Express.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/constants.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/constants.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/functions/s3ExpressMiddleware.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/functions/s3ExpressMiddleware.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/interfaces/S3ExpressIdentity.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/interfaces/S3ExpressIdentity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/interfaces/S3ExpressIdentityProvider.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3-express/interfaces/S3ExpressIdentityProvider.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../../index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3Configuration.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/s3Configuration.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/throw-200-exceptions.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/throw-200-exceptions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/validate-bucket-name.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/validate-bucket-name.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
33
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/bucket-endpoint-middleware.js
generated
vendored
Normal file
33
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/bucket-endpoint-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
export function bucketEndpointMiddleware(options) {
|
||||
return (next, context) => async (args) => {
|
||||
if (options.bucketEndpoint) {
|
||||
const endpoint = context.endpointV2;
|
||||
if (endpoint) {
|
||||
const bucket = args.input.Bucket;
|
||||
if (typeof bucket === "string") {
|
||||
try {
|
||||
const bucketEndpointUrl = new URL(bucket);
|
||||
endpoint.url = bucketEndpointUrl;
|
||||
}
|
||||
catch (e) {
|
||||
const warning = `@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${bucket} could not be parsed as URL.`;
|
||||
if (context.logger?.constructor?.name === "NoOpLogger") {
|
||||
console.warn(warning);
|
||||
}
|
||||
else {
|
||||
context.logger?.warn?.(warning);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return next(args);
|
||||
};
|
||||
}
|
||||
export const bucketEndpointMiddlewareOptions = {
|
||||
name: "bucketEndpointMiddleware",
|
||||
override: true,
|
||||
relation: "after",
|
||||
toMiddleware: "endpointV2Middleware",
|
||||
};
|
||||
31
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/check-content-length-header.js
generated
vendored
Normal file
31
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/check-content-length-header.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { HttpRequest } from "@smithy/protocol-http";
|
||||
import { NoOpLogger } from "@smithy/smithy-client";
|
||||
const CONTENT_LENGTH_HEADER = "content-length";
|
||||
export function checkContentLengthHeader() {
|
||||
return (next, context) => async (args) => {
|
||||
const { request } = args;
|
||||
if (HttpRequest.isInstance(request)) {
|
||||
if (!(CONTENT_LENGTH_HEADER in request.headers)) {
|
||||
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 context?.logger?.warn === "function" && !(context.logger instanceof NoOpLogger)) {
|
||||
context.logger.warn(message);
|
||||
}
|
||||
else {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return next({ ...args });
|
||||
};
|
||||
}
|
||||
export const checkContentLengthHeaderMiddlewareOptions = {
|
||||
step: "finalizeRequest",
|
||||
tags: ["CHECK_CONTENT_LENGTH_HEADER"],
|
||||
name: "getCheckContentLengthHeaderPlugin",
|
||||
override: true,
|
||||
};
|
||||
export const getCheckContentLengthHeaderPlugin = (unused) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(checkContentLengthHeader(), checkContentLengthHeaderMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
8
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/index.js
generated
vendored
Normal file
8
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from "./check-content-length-header";
|
||||
export * from "./region-redirect-endpoint-middleware";
|
||||
export * from "./region-redirect-middleware";
|
||||
export * from "./s3-expires-middleware";
|
||||
export * from "./s3-express/index";
|
||||
export * from "./s3Configuration";
|
||||
export * from "./throw-200-exceptions";
|
||||
export * from "./validate-bucket-name";
|
||||
27
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/region-redirect-endpoint-middleware.js
generated
vendored
Normal file
27
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/region-redirect-endpoint-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export const regionRedirectEndpointMiddleware = (config) => {
|
||||
return (next, context) => async (args) => {
|
||||
const originalRegion = await config.region();
|
||||
const regionProviderRef = config.region;
|
||||
if (context.__s3RegionRedirect) {
|
||||
config.region = async () => {
|
||||
config.region = regionProviderRef;
|
||||
return context.__s3RegionRedirect;
|
||||
};
|
||||
}
|
||||
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.");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
export const regionRedirectEndpointMiddlewareOptions = {
|
||||
tags: ["REGION_REDIRECT", "S3"],
|
||||
name: "regionRedirectEndpointMiddleware",
|
||||
override: true,
|
||||
relation: "before",
|
||||
toMiddleware: "endpointV2Middleware",
|
||||
};
|
||||
37
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/region-redirect-middleware.js
generated
vendored
Normal file
37
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/region-redirect-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { regionRedirectEndpointMiddleware, regionRedirectEndpointMiddlewareOptions, } from "./region-redirect-endpoint-middleware";
|
||||
export function regionRedirectMiddleware(clientConfig) {
|
||||
return (next, context) => async (args) => {
|
||||
try {
|
||||
return await next(args);
|
||||
}
|
||||
catch (err) {
|
||||
if (clientConfig.followRegionRedirects &&
|
||||
err?.$metadata?.httpStatusCode === 301) {
|
||||
try {
|
||||
const actualRegion = err.$response.headers["x-amz-bucket-region"];
|
||||
context.logger?.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`);
|
||||
context.__s3RegionRedirect = actualRegion;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("Region redirect failed: " + e);
|
||||
}
|
||||
return next(args);
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export const regionRedirectMiddlewareOptions = {
|
||||
step: "initialize",
|
||||
tags: ["REGION_REDIRECT", "S3"],
|
||||
name: "regionRedirectMiddleware",
|
||||
override: true,
|
||||
};
|
||||
export const getRegionRedirectMiddlewarePlugin = (clientConfig) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(regionRedirectMiddleware(clientConfig), regionRedirectMiddlewareOptions);
|
||||
clientStack.addRelativeTo(regionRedirectEndpointMiddleware(clientConfig), regionRedirectEndpointMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
33
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-expires-middleware.js
generated
vendored
Normal file
33
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-expires-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { HttpResponse } from "@smithy/protocol-http";
|
||||
import { parseRfc7231DateTime } from "@smithy/smithy-client";
|
||||
export const s3ExpiresMiddleware = (config) => {
|
||||
return (next, context) => async (args) => {
|
||||
const result = await next(args);
|
||||
const { response } = result;
|
||||
if (HttpResponse.isInstance(response)) {
|
||||
if (response.headers.expires) {
|
||||
response.headers.expiresstring = response.headers.expires;
|
||||
try {
|
||||
parseRfc7231DateTime(response.headers.expires);
|
||||
}
|
||||
catch (e) {
|
||||
context.logger?.warn(`AWS SDK Warning for ${context.clientName}::${context.commandName} response parsing (${response.headers.expires}): ${e}`);
|
||||
delete response.headers.expires;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
export const s3ExpiresMiddlewareOptions = {
|
||||
tags: ["S3"],
|
||||
name: "s3ExpiresMiddleware",
|
||||
override: true,
|
||||
relation: "after",
|
||||
toMiddleware: "deserializerMiddleware",
|
||||
};
|
||||
export const getS3ExpiresMiddlewarePlugin = (clientConfig) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.addRelativeTo(s3ExpiresMiddleware(clientConfig), s3ExpiresMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
38
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityCache.js
generated
vendored
Normal file
38
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityCache.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
export class S3ExpressIdentityCache {
|
||||
constructor(data = {}) {
|
||||
this.data = data;
|
||||
this.lastPurgeTime = Date.now();
|
||||
}
|
||||
get(key) {
|
||||
const entry = this.data[key];
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
set(key, entry) {
|
||||
this.data[key] = entry;
|
||||
return entry;
|
||||
}
|
||||
delete(key) {
|
||||
delete this.data[key];
|
||||
}
|
||||
async purgeExpired() {
|
||||
const now = Date.now();
|
||||
if (this.lastPurgeTime + S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS > now) {
|
||||
return;
|
||||
}
|
||||
for (const key in this.data) {
|
||||
const entry = this.data[key];
|
||||
if (!entry.isRefreshing) {
|
||||
const credential = await entry.identity;
|
||||
if (credential.expiration) {
|
||||
if (credential.expiration.getTime() < now) {
|
||||
delete this.data[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
S3ExpressIdentityCache.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS = 30000;
|
||||
11
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityCacheEntry.js
generated
vendored
Normal file
11
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityCacheEntry.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export class S3ExpressIdentityCacheEntry {
|
||||
constructor(_identity, isRefreshing = false, accessed = Date.now()) {
|
||||
this._identity = _identity;
|
||||
this.isRefreshing = isRefreshing;
|
||||
this.accessed = accessed;
|
||||
}
|
||||
get identity() {
|
||||
this.accessed = Date.now();
|
||||
return this._identity;
|
||||
}
|
||||
}
|
||||
47
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityProviderImpl.js
generated
vendored
Normal file
47
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/S3ExpressIdentityProviderImpl.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { S3ExpressIdentityCache } from "./S3ExpressIdentityCache";
|
||||
import { S3ExpressIdentityCacheEntry } from "./S3ExpressIdentityCacheEntry";
|
||||
export class S3ExpressIdentityProviderImpl {
|
||||
constructor(createSessionFn, cache = new S3ExpressIdentityCache()) {
|
||||
this.createSessionFn = createSessionFn;
|
||||
this.cache = cache;
|
||||
}
|
||||
async getS3ExpressIdentity(awsIdentity, identityProperties) {
|
||||
const key = identityProperties.Bucket;
|
||||
const { cache } = this;
|
||||
const entry = cache.get(key);
|
||||
if (entry) {
|
||||
return entry.identity.then((identity) => {
|
||||
const isExpired = (identity.expiration?.getTime() ?? 0) < Date.now();
|
||||
if (isExpired) {
|
||||
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
||||
}
|
||||
const isExpiringSoon = (identity.expiration?.getTime() ?? 0) < Date.now() + S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS;
|
||||
if (isExpiringSoon && !entry.isRefreshing) {
|
||||
entry.isRefreshing = true;
|
||||
this.getIdentity(key).then((id) => {
|
||||
cache.set(key, new S3ExpressIdentityCacheEntry(Promise.resolve(id)));
|
||||
});
|
||||
}
|
||||
return identity;
|
||||
});
|
||||
}
|
||||
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
||||
}
|
||||
async getIdentity(key) {
|
||||
await this.cache.purgeExpired().catch((error) => {
|
||||
console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n" + error);
|
||||
});
|
||||
const session = await this.createSessionFn(key);
|
||||
if (!session.Credentials?.AccessKeyId || !session.Credentials?.SecretAccessKey) {
|
||||
throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");
|
||||
}
|
||||
const identity = {
|
||||
accessKeyId: session.Credentials.AccessKeyId,
|
||||
secretAccessKey: session.Credentials.SecretAccessKey,
|
||||
sessionToken: session.Credentials.SessionToken,
|
||||
expiration: session.Credentials.Expiration ? new Date(session.Credentials.Expiration) : undefined,
|
||||
};
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
S3ExpressIdentityProviderImpl.REFRESH_WINDOW_MS = 60000;
|
||||
41
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/SignatureV4S3Express.js
generated
vendored
Normal file
41
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/SignatureV4S3Express.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { SignatureV4 } from "@smithy/signature-v4";
|
||||
import { SESSION_TOKEN_HEADER, SESSION_TOKEN_QUERY_PARAM } from "../constants";
|
||||
export class SignatureV4S3Express extends SignatureV4 {
|
||||
async signWithCredentials(requestToSign, credentials, options) {
|
||||
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
||||
requestToSign.headers[SESSION_TOKEN_HEADER] = credentials.sessionToken;
|
||||
const privateAccess = this;
|
||||
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
||||
return privateAccess.signRequest(requestToSign, options ?? {});
|
||||
}
|
||||
async presignWithCredentials(requestToSign, credentials, options) {
|
||||
const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
|
||||
delete requestToSign.headers[SESSION_TOKEN_HEADER];
|
||||
requestToSign.headers[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
requestToSign.query = requestToSign.query ?? {};
|
||||
requestToSign.query[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
const privateAccess = this;
|
||||
setSingleOverride(privateAccess, credentialsWithoutSessionToken);
|
||||
return this.presign(requestToSign, options);
|
||||
}
|
||||
}
|
||||
function getCredentialsWithoutSessionToken(credentials) {
|
||||
const credentialsWithoutSessionToken = {
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
secretAccessKey: credentials.secretAccessKey,
|
||||
expiration: credentials.expiration,
|
||||
};
|
||||
return credentialsWithoutSessionToken;
|
||||
}
|
||||
function setSingleOverride(privateAccess, credentialsWithoutSessionToken) {
|
||||
const id = setTimeout(() => {
|
||||
throw new Error("SignatureV4S3Express credential override was created but not called.");
|
||||
}, 10);
|
||||
const currentCredentialProvider = privateAccess.credentialProvider;
|
||||
const overrideCredentialsProviderOnce = () => {
|
||||
clearTimeout(id);
|
||||
privateAccess.credentialProvider = currentCredentialProvider;
|
||||
return Promise.resolve(credentialsWithoutSessionToken);
|
||||
};
|
||||
privateAccess.credentialProvider = overrideCredentialsProviderOnce;
|
||||
}
|
||||
13
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/constants.js
generated
vendored
Normal file
13
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/constants.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { booleanSelector, SelectorType } from "@smithy/util-config-provider";
|
||||
export const S3_EXPRESS_BUCKET_TYPE = "Directory";
|
||||
export const S3_EXPRESS_BACKEND = "S3Express";
|
||||
export const S3_EXPRESS_AUTH_SCHEME = "sigv4-s3express";
|
||||
export const SESSION_TOKEN_QUERY_PARAM = "X-Amz-S3session-Token";
|
||||
export const SESSION_TOKEN_HEADER = SESSION_TOKEN_QUERY_PARAM.toLowerCase();
|
||||
export const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME = "AWS_S3_DISABLE_EXPRESS_SESSION_AUTH";
|
||||
export const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME = "s3_disable_express_session_auth";
|
||||
export const NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = {
|
||||
environmentVariableSelector: (env) => booleanSelector(env, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME, SelectorType.ENV),
|
||||
configFileSelector: (profile) => booleanSelector(profile, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME, SelectorType.CONFIG),
|
||||
default: false,
|
||||
};
|
||||
39
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/functions/s3ExpressMiddleware.js
generated
vendored
Normal file
39
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/functions/s3ExpressMiddleware.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { HttpRequest } from "@smithy/protocol-http";
|
||||
import { S3_EXPRESS_AUTH_SCHEME, S3_EXPRESS_BACKEND, S3_EXPRESS_BUCKET_TYPE, SESSION_TOKEN_HEADER } from "../constants";
|
||||
export const s3ExpressMiddleware = (options) => {
|
||||
return (next, context) => async (args) => {
|
||||
if (context.endpointV2) {
|
||||
const endpoint = context.endpointV2;
|
||||
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) {
|
||||
context.isS3ExpressBucket = true;
|
||||
}
|
||||
if (isS3ExpressAuth) {
|
||||
const requestBucket = args.input.Bucket;
|
||||
if (requestBucket) {
|
||||
const s3ExpressIdentity = await options.s3ExpressIdentityProvider.getS3ExpressIdentity(await options.credentials(), {
|
||||
Bucket: requestBucket,
|
||||
});
|
||||
context.s3ExpressIdentity = s3ExpressIdentity;
|
||||
if (HttpRequest.isInstance(args.request) && s3ExpressIdentity.sessionToken) {
|
||||
args.request.headers[SESSION_TOKEN_HEADER] = s3ExpressIdentity.sessionToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return next(args);
|
||||
};
|
||||
};
|
||||
export const s3ExpressMiddlewareOptions = {
|
||||
name: "s3ExpressMiddleware",
|
||||
step: "build",
|
||||
tags: ["S3", "S3_EXPRESS"],
|
||||
override: true,
|
||||
};
|
||||
export const getS3ExpressPlugin = (options) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(s3ExpressMiddleware(options), s3ExpressMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
6
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/index.js
generated
vendored
Normal file
6
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache";
|
||||
export { S3ExpressIdentityCacheEntry } from "./classes/S3ExpressIdentityCacheEntry";
|
||||
export { S3ExpressIdentityProviderImpl } from "./classes/S3ExpressIdentityProviderImpl";
|
||||
export { SignatureV4S3Express } from "./classes/SignatureV4S3Express";
|
||||
export { NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS } from "./constants";
|
||||
export { getS3ExpressPlugin, s3ExpressMiddleware, s3ExpressMiddlewareOptions } from "./functions/s3ExpressMiddleware";
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/interfaces/S3ExpressIdentity.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/interfaces/S3ExpressIdentity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/interfaces/S3ExpressIdentityProvider.js
generated
vendored
Normal file
1
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/interfaces/S3ExpressIdentityProvider.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
17
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3Configuration.js
generated
vendored
Normal file
17
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3Configuration.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { S3ExpressIdentityProviderImpl } from "./s3-express";
|
||||
export const resolveS3Config = (input, { session, }) => {
|
||||
const [s3ClientProvider, CreateSessionCommandCtor] = session;
|
||||
return {
|
||||
...input,
|
||||
forcePathStyle: input.forcePathStyle ?? false,
|
||||
useAccelerateEndpoint: input.useAccelerateEndpoint ?? false,
|
||||
disableMultiregionAccessPoints: input.disableMultiregionAccessPoints ?? false,
|
||||
followRegionRedirects: input.followRegionRedirects ?? false,
|
||||
s3ExpressIdentityProvider: input.s3ExpressIdentityProvider ??
|
||||
new S3ExpressIdentityProviderImpl(async (key) => s3ClientProvider().send(new CreateSessionCommandCtor({
|
||||
Bucket: key,
|
||||
SessionMode: "ReadWrite",
|
||||
}))),
|
||||
bucketEndpoint: input.bucketEndpoint ?? false,
|
||||
};
|
||||
};
|
||||
41
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/throw-200-exceptions.js
generated
vendored
Normal file
41
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/throw-200-exceptions.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { HttpResponse } from "@smithy/protocol-http";
|
||||
export const throw200ExceptionsMiddleware = (config) => (next) => async (args) => {
|
||||
const result = await next(args);
|
||||
const { response } = result;
|
||||
if (!HttpResponse.isInstance(response))
|
||||
return result;
|
||||
const { statusCode, body } = response;
|
||||
if (statusCode < 200 || statusCode >= 300)
|
||||
return result;
|
||||
const bodyBytes = await collectBody(body, config);
|
||||
const bodyString = await collectBodyString(bodyBytes, config);
|
||||
if (bodyBytes.length === 0) {
|
||||
const err = new Error("S3 aborted request");
|
||||
err.name = "InternalError";
|
||||
throw err;
|
||||
}
|
||||
if (bodyString && bodyString.match("<Error>")) {
|
||||
response.statusCode = 400;
|
||||
}
|
||||
response.body = bodyBytes;
|
||||
return result;
|
||||
};
|
||||
const collectBody = (streamBody = new Uint8Array(), context) => {
|
||||
if (streamBody instanceof Uint8Array) {
|
||||
return Promise.resolve(streamBody);
|
||||
}
|
||||
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
||||
};
|
||||
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
||||
export const throw200ExceptionsMiddlewareOptions = {
|
||||
relation: "after",
|
||||
toMiddleware: "deserializerMiddleware",
|
||||
tags: ["THROW_200_EXCEPTIONS", "S3"],
|
||||
name: "throw200ExceptionsMiddleware",
|
||||
override: true,
|
||||
};
|
||||
export const getThrow200ExceptionsPlugin = (config) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.addRelativeTo(throw200ExceptionsMiddleware(config), throw200ExceptionsMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
25
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/validate-bucket-name.js
generated
vendored
Normal file
25
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/validate-bucket-name.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { validate as validateArn } from "@aws-sdk/util-arn-parser";
|
||||
import { bucketEndpointMiddleware, bucketEndpointMiddlewareOptions } from "./bucket-endpoint-middleware";
|
||||
export function validateBucketNameMiddleware({ bucketEndpoint }) {
|
||||
return (next) => async (args) => {
|
||||
const { input: { Bucket }, } = args;
|
||||
if (!bucketEndpoint && typeof Bucket === "string" && !validateArn(Bucket) && Bucket.indexOf("/") >= 0) {
|
||||
const err = new Error(`Bucket name shouldn't contain '/', received '${Bucket}'`);
|
||||
err.name = "InvalidBucketName";
|
||||
throw err;
|
||||
}
|
||||
return next({ ...args });
|
||||
};
|
||||
}
|
||||
export const validateBucketNameMiddlewareOptions = {
|
||||
step: "initialize",
|
||||
tags: ["VALIDATE_BUCKET_NAME"],
|
||||
name: "validateBucketNameMiddleware",
|
||||
override: true,
|
||||
};
|
||||
export const getValidateBucketNamePlugin = (options) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(validateBucketNameMiddleware(options), validateBucketNameMiddlewareOptions);
|
||||
clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
49
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/package.json
generated
vendored
Normal file
49
resources/app/node_modules/@aws-sdk/middleware-sdk-s3/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "@aws-sdk/middleware-sdk-s3",
|
||||
"version": "3.577.0",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"author": {
|
||||
"name": "AWS SDK for JavaScript Team",
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/types": "3.577.0",
|
||||
"@aws-sdk/util-arn-parser": "3.568.0",
|
||||
"@smithy/node-config-provider": "^3.0.0",
|
||||
"@smithy/protocol-http": "^4.0.0",
|
||||
"@smithy/signature-v4": "^3.0.0",
|
||||
"@smithy/smithy-client": "^3.0.0",
|
||||
"@smithy/types": "^3.0.0",
|
||||
"@smithy/util-config-provider": "^3.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "1.0.1",
|
||||
"concurrently": "7.0.0",
|
||||
"downlevel-dts": "0.10.1",
|
||||
"rimraf": "3.0.2",
|
||||
"typescript": "~4.9.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"typesVersions": {
|
||||
"<4.0": {
|
||||
"dist-types/*": [
|
||||
"dist-types/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**"
|
||||
],
|
||||
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/middleware-sdk-s3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-js-v3.git",
|
||||
"directory": "packages/middleware-sdk-s3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user