fix: 修复配额说明重复和undefined问题
- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit - 删除重复的旧配额说明块,保留新的当前配额设置显示 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
10
backend/node_modules/@aws-sdk/credential-provider-http/README.md
generated
vendored
Normal file
10
backend/node_modules/@aws-sdk/credential-provider-http/README.md
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# @aws-sdk/credential-provider-http
|
||||
|
||||
[](https://www.npmjs.com/package/@aws-sdk/credential-provider-http)
|
||||
[](https://www.npmjs.com/package/@aws-sdk/credential-provider-http)
|
||||
|
||||
> An internal transitively required package.
|
||||
|
||||
## Usage
|
||||
|
||||
See https://www.npmjs.com/package/@aws-sdk/credential-providers
|
||||
46
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js
generated
vendored
Normal file
46
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkUrl = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
||||
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
||||
const ECS_CONTAINER_HOST = "169.254.170.2";
|
||||
const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
||||
const EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
||||
const checkUrl = (url, logger) => {
|
||||
if (url.protocol === "https:") {
|
||||
return;
|
||||
}
|
||||
if (url.hostname === ECS_CONTAINER_HOST ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv4 ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
||||
return;
|
||||
}
|
||||
if (url.hostname.includes("[")) {
|
||||
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (url.hostname === "localhost") {
|
||||
return;
|
||||
}
|
||||
const ipComponents = url.hostname.split(".");
|
||||
const inRange = (component) => {
|
||||
const num = parseInt(component, 10);
|
||||
return 0 <= num && num <= 255;
|
||||
};
|
||||
if (ipComponents[0] === "127" &&
|
||||
inRange(ipComponents[1]) &&
|
||||
inRange(ipComponents[2]) &&
|
||||
inRange(ipComponents[3]) &&
|
||||
ipComponents.length === 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
||||
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
||||
- ECS container host 169.254.170.2
|
||||
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
||||
};
|
||||
exports.checkUrl = checkUrl;
|
||||
31
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js
generated
vendored
Normal file
31
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromHttp = void 0;
|
||||
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const checkUrl_1 = require("./checkUrl");
|
||||
const requestHelpers_1 = require("./requestHelpers");
|
||||
const retry_wrapper_1 = require("./retry-wrapper");
|
||||
const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const full = options.credentialsFullUri;
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError("No HTTP credential provider host provided.", { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
(0, checkUrl_1.checkUrl)(url, options.logger);
|
||||
const requestHandler = new fetch_http_handler_1.FetchHttpHandler();
|
||||
return (0, retry_wrapper_1.retryWrapper)(async () => {
|
||||
const request = (0, requestHelpers_1.createGetRequest)(url);
|
||||
if (options.authorizationToken) {
|
||||
request.headers.Authorization = options.authorizationToken;
|
||||
}
|
||||
const result = await requestHandler.handle(request);
|
||||
return (0, requestHelpers_1.getCredentials)(result.response);
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
exports.fromHttp = fromHttp;
|
||||
70
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js
generated
vendored
Normal file
70
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromHttp = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const client_1 = require("@aws-sdk/core/client");
|
||||
const node_http_handler_1 = require("@smithy/node-http-handler");
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
||||
const checkUrl_1 = require("./checkUrl");
|
||||
const requestHelpers_1 = require("./requestHelpers");
|
||||
const retry_wrapper_1 = require("./retry-wrapper");
|
||||
const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
||||
const AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
||||
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
||||
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
||||
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
||||
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn
|
||||
? console.warn
|
||||
: options.logger.warn.bind(options.logger);
|
||||
if (relative && full) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
||||
warn("awsContainerCredentialsFullUri will take precedence.");
|
||||
}
|
||||
if (token && tokenFile) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
||||
warn("awsContainerAuthorizationToken will take precedence.");
|
||||
}
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else if (relative) {
|
||||
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided.
|
||||
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
(0, checkUrl_1.checkUrl)(url, options.logger);
|
||||
const requestHandler = node_http_handler_1.NodeHttpHandler.create({
|
||||
requestTimeout: options.timeout ?? 1000,
|
||||
connectionTimeout: options.timeout ?? 1000,
|
||||
});
|
||||
return (0, retry_wrapper_1.retryWrapper)(async () => {
|
||||
const request = (0, requestHelpers_1.createGetRequest)(url);
|
||||
if (token) {
|
||||
request.headers.Authorization = token;
|
||||
}
|
||||
else if (tokenFile) {
|
||||
request.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString();
|
||||
}
|
||||
try {
|
||||
const result = await requestHandler.handle(request);
|
||||
return (0, requestHelpers_1.getCredentials)(result.response).then((creds) => (0, client_1.setCredentialFeature)(creds, "CREDENTIALS_HTTP", "z"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new property_provider_1.CredentialsProviderError(String(e), { logger: options.logger });
|
||||
}
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
exports.fromHttp = fromHttp;
|
||||
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttpTypes.js
generated
vendored
Normal file
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttpTypes.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
53
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js
generated
vendored
Normal file
53
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createGetRequest = createGetRequest;
|
||||
exports.getCredentials = getCredentials;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const protocol_http_1 = require("@smithy/protocol-http");
|
||||
const smithy_client_1 = require("@smithy/smithy-client");
|
||||
const util_stream_1 = require("@smithy/util-stream");
|
||||
function createGetRequest(url) {
|
||||
return new protocol_http_1.HttpRequest({
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: Number(url.port),
|
||||
path: url.pathname,
|
||||
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
||||
acc[k] = v;
|
||||
return acc;
|
||||
}, {}),
|
||||
fragment: url.hash,
|
||||
});
|
||||
}
|
||||
async function getCredentials(response, logger) {
|
||||
const stream = (0, util_stream_1.sdkStreamMixin)(response.body);
|
||||
const str = await stream.transformToString();
|
||||
if (response.statusCode === 200) {
|
||||
const parsed = JSON.parse(str);
|
||||
if (typeof parsed.AccessKeyId !== "string" ||
|
||||
typeof parsed.SecretAccessKey !== "string" ||
|
||||
typeof parsed.Token !== "string" ||
|
||||
typeof parsed.Expiration !== "string") {
|
||||
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " +
|
||||
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
||||
}
|
||||
return {
|
||||
accessKeyId: parsed.AccessKeyId,
|
||||
secretAccessKey: parsed.SecretAccessKey,
|
||||
sessionToken: parsed.Token,
|
||||
expiration: (0, smithy_client_1.parseRfc3339DateTime)(parsed.Expiration),
|
||||
};
|
||||
}
|
||||
if (response.statusCode >= 400 && response.statusCode < 500) {
|
||||
let parsedBody = {};
|
||||
try {
|
||||
parsedBody = JSON.parse(str);
|
||||
}
|
||||
catch (e) { }
|
||||
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
||||
Code: parsedBody.Code,
|
||||
Message: parsedBody.Message,
|
||||
});
|
||||
}
|
||||
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
||||
}
|
||||
17
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js
generated
vendored
Normal file
17
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.retryWrapper = void 0;
|
||||
const retryWrapper = (toRetry, maxRetries, delayMs) => {
|
||||
return async () => {
|
||||
for (let i = 0; i < maxRetries; ++i) {
|
||||
try {
|
||||
return await toRetry();
|
||||
}
|
||||
catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
}
|
||||
}
|
||||
return await toRetry();
|
||||
};
|
||||
};
|
||||
exports.retryWrapper = retryWrapper;
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromHttp = void 0;
|
||||
var fromHttp_browser_1 = require("./fromHttp/fromHttp.browser");
|
||||
Object.defineProperty(exports, "fromHttp", { enumerable: true, get: function () { return fromHttp_browser_1.fromHttp; } });
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromHttp = void 0;
|
||||
var fromHttp_1 = require("./fromHttp/fromHttp");
|
||||
Object.defineProperty(exports, "fromHttp", { enumerable: true, get: function () { return fromHttp_1.fromHttp; } });
|
||||
42
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
generated
vendored
Normal file
42
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
||||
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
||||
const ECS_CONTAINER_HOST = "169.254.170.2";
|
||||
const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
||||
const EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
||||
export const checkUrl = (url, logger) => {
|
||||
if (url.protocol === "https:") {
|
||||
return;
|
||||
}
|
||||
if (url.hostname === ECS_CONTAINER_HOST ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv4 ||
|
||||
url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
||||
return;
|
||||
}
|
||||
if (url.hostname.includes("[")) {
|
||||
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (url.hostname === "localhost") {
|
||||
return;
|
||||
}
|
||||
const ipComponents = url.hostname.split(".");
|
||||
const inRange = (component) => {
|
||||
const num = parseInt(component, 10);
|
||||
return 0 <= num && num <= 255;
|
||||
};
|
||||
if (ipComponents[0] === "127" &&
|
||||
inRange(ipComponents[1]) &&
|
||||
inRange(ipComponents[2]) &&
|
||||
inRange(ipComponents[3]) &&
|
||||
ipComponents.length === 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
||||
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
||||
- ECS container host 169.254.170.2
|
||||
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
||||
};
|
||||
27
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.browser.js
generated
vendored
Normal file
27
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.browser.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { FetchHttpHandler } from "@smithy/fetch-http-handler";
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
import { checkUrl } from "./checkUrl";
|
||||
import { createGetRequest, getCredentials } from "./requestHelpers";
|
||||
import { retryWrapper } from "./retry-wrapper";
|
||||
export const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const full = options.credentialsFullUri;
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else {
|
||||
throw new CredentialsProviderError("No HTTP credential provider host provided.", { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
checkUrl(url, options.logger);
|
||||
const requestHandler = new FetchHttpHandler();
|
||||
return retryWrapper(async () => {
|
||||
const request = createGetRequest(url);
|
||||
if (options.authorizationToken) {
|
||||
request.headers.Authorization = options.authorizationToken;
|
||||
}
|
||||
const result = await requestHandler.handle(request);
|
||||
return getCredentials(result.response);
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
65
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
generated
vendored
Normal file
65
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { setCredentialFeature } from "@aws-sdk/core/client";
|
||||
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
import fs from "fs/promises";
|
||||
import { checkUrl } from "./checkUrl";
|
||||
import { createGetRequest, getCredentials } from "./requestHelpers";
|
||||
import { retryWrapper } from "./retry-wrapper";
|
||||
const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
||||
const DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
||||
const AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
||||
const AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
||||
export const fromHttp = (options = {}) => {
|
||||
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
||||
let host;
|
||||
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
||||
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
||||
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
||||
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
||||
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn
|
||||
? console.warn
|
||||
: options.logger.warn.bind(options.logger);
|
||||
if (relative && full) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
||||
warn("awsContainerCredentialsFullUri will take precedence.");
|
||||
}
|
||||
if (token && tokenFile) {
|
||||
warn("@aws-sdk/credential-provider-http: " +
|
||||
"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
||||
warn("awsContainerAuthorizationToken will take precedence.");
|
||||
}
|
||||
if (full) {
|
||||
host = full;
|
||||
}
|
||||
else if (relative) {
|
||||
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
||||
}
|
||||
else {
|
||||
throw new CredentialsProviderError(`No HTTP credential provider host provided.
|
||||
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
||||
}
|
||||
const url = new URL(host);
|
||||
checkUrl(url, options.logger);
|
||||
const requestHandler = NodeHttpHandler.create({
|
||||
requestTimeout: options.timeout ?? 1000,
|
||||
connectionTimeout: options.timeout ?? 1000,
|
||||
});
|
||||
return retryWrapper(async () => {
|
||||
const request = createGetRequest(url);
|
||||
if (token) {
|
||||
request.headers.Authorization = token;
|
||||
}
|
||||
else if (tokenFile) {
|
||||
request.headers.Authorization = (await fs.readFile(tokenFile)).toString();
|
||||
}
|
||||
try {
|
||||
const result = await requestHandler.handle(request);
|
||||
return getCredentials(result.response).then((creds) => setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new CredentialsProviderError(String(e), { logger: options.logger });
|
||||
}
|
||||
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
||||
};
|
||||
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttpTypes.js
generated
vendored
Normal file
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttpTypes.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
49
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
generated
vendored
Normal file
49
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
import { HttpRequest } from "@smithy/protocol-http";
|
||||
import { parseRfc3339DateTime } from "@smithy/smithy-client";
|
||||
import { sdkStreamMixin } from "@smithy/util-stream";
|
||||
export function createGetRequest(url) {
|
||||
return new HttpRequest({
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: Number(url.port),
|
||||
path: url.pathname,
|
||||
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
||||
acc[k] = v;
|
||||
return acc;
|
||||
}, {}),
|
||||
fragment: url.hash,
|
||||
});
|
||||
}
|
||||
export async function getCredentials(response, logger) {
|
||||
const stream = sdkStreamMixin(response.body);
|
||||
const str = await stream.transformToString();
|
||||
if (response.statusCode === 200) {
|
||||
const parsed = JSON.parse(str);
|
||||
if (typeof parsed.AccessKeyId !== "string" ||
|
||||
typeof parsed.SecretAccessKey !== "string" ||
|
||||
typeof parsed.Token !== "string" ||
|
||||
typeof parsed.Expiration !== "string") {
|
||||
throw new CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " +
|
||||
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
||||
}
|
||||
return {
|
||||
accessKeyId: parsed.AccessKeyId,
|
||||
secretAccessKey: parsed.SecretAccessKey,
|
||||
sessionToken: parsed.Token,
|
||||
expiration: parseRfc3339DateTime(parsed.Expiration),
|
||||
};
|
||||
}
|
||||
if (response.statusCode >= 400 && response.statusCode < 500) {
|
||||
let parsedBody = {};
|
||||
try {
|
||||
parsedBody = JSON.parse(str);
|
||||
}
|
||||
catch (e) { }
|
||||
throw Object.assign(new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
||||
Code: parsedBody.Code,
|
||||
Message: parsedBody.Message,
|
||||
});
|
||||
}
|
||||
throw new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
||||
}
|
||||
13
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
generated
vendored
Normal file
13
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export const retryWrapper = (toRetry, maxRetries, delayMs) => {
|
||||
return async () => {
|
||||
for (let i = 0; i < maxRetries; ++i) {
|
||||
try {
|
||||
return await toRetry();
|
||||
}
|
||||
catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
}
|
||||
}
|
||||
return await toRetry();
|
||||
};
|
||||
};
|
||||
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/index.browser.js
generated
vendored
Normal file
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/index.browser.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp.browser";
|
||||
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/index.js
generated
vendored
Normal file
1
backend/node_modules/@aws-sdk/credential-provider-http/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp";
|
||||
9
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/checkUrl.d.ts
generated
vendored
Normal file
9
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/checkUrl.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Logger } from "@smithy/types";
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param url - to be validated.
|
||||
* @param logger - passed to CredentialsProviderError.
|
||||
* @throws if not acceptable to this provider.
|
||||
*/
|
||||
export declare const checkUrl: (url: URL, logger?: Logger) => void;
|
||||
6
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttp.browser.d.ts
generated
vendored
Normal file
6
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttp.browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
||||
import type { FromHttpOptions } from "./fromHttpTypes";
|
||||
/**
|
||||
* Creates a provider that gets credentials via HTTP request.
|
||||
*/
|
||||
export declare const fromHttp: (options?: FromHttpOptions) => AwsCredentialIdentityProvider;
|
||||
6
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttp.d.ts
generated
vendored
Normal file
6
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
||||
import type { FromHttpOptions } from "./fromHttpTypes";
|
||||
/**
|
||||
* Creates a provider that gets credentials via HTTP request.
|
||||
*/
|
||||
export declare const fromHttp: (options?: FromHttpOptions) => AwsCredentialIdentityProvider;
|
||||
69
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttpTypes.d.ts
generated
vendored
Normal file
69
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/fromHttpTypes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import type { CredentialProviderOptions } from "@aws-sdk/types";
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Input for the fromHttp function in the HTTP Credentials Provider for Node.js.
|
||||
*/
|
||||
export interface FromHttpOptions extends CredentialProviderOptions {
|
||||
/**
|
||||
* If this value is provided, it will be used as-is.
|
||||
*
|
||||
* For browser environments, use instead {@link credentialsFullUri}.
|
||||
*/
|
||||
awsContainerCredentialsFullUri?: string;
|
||||
/**
|
||||
* If this value is provided instead of the full URI, it
|
||||
* will be appended to the default link local host of 169.254.170.2.
|
||||
*
|
||||
* Not supported in browsers.
|
||||
*/
|
||||
awsContainerCredentialsRelativeUri?: string;
|
||||
/**
|
||||
* Will be read on each credentials request to
|
||||
* add an Authorization request header value.
|
||||
*
|
||||
* Not supported in browsers.
|
||||
*/
|
||||
awsContainerAuthorizationTokenFile?: string;
|
||||
/**
|
||||
* An alternative to awsContainerAuthorizationTokenFile,
|
||||
* this is the token value itself.
|
||||
*
|
||||
* For browser environments, use instead {@link authorizationToken}.
|
||||
*/
|
||||
awsContainerAuthorizationToken?: string;
|
||||
/**
|
||||
* BROWSER ONLY.
|
||||
*
|
||||
* In browsers, a relative URI is not allowed, and a full URI must be provided.
|
||||
* HTTPS is required.
|
||||
*
|
||||
* This value is required for the browser environment.
|
||||
*/
|
||||
credentialsFullUri?: string;
|
||||
/**
|
||||
* BROWSER ONLY.
|
||||
*
|
||||
* Providing this value will set an "Authorization" request
|
||||
* header value on the GET request.
|
||||
*/
|
||||
authorizationToken?: string;
|
||||
/**
|
||||
* Default is 3 retry attempts or 4 total attempts.
|
||||
*/
|
||||
maxRetries?: number;
|
||||
/**
|
||||
* Default is 1000ms. Time in milliseconds to spend waiting between retry attempts.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type HttpProviderCredentials = {
|
||||
AccessKeyId: string;
|
||||
SecretAccessKey: string;
|
||||
Token: string;
|
||||
AccountId?: string;
|
||||
Expiration: string;
|
||||
};
|
||||
11
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/requestHelpers.d.ts
generated
vendored
Normal file
11
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/requestHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { AwsCredentialIdentity } from "@aws-sdk/types";
|
||||
import { HttpRequest } from "@smithy/protocol-http";
|
||||
import { HttpResponse, Logger } from "@smithy/types";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function createGetRequest(url: URL): HttpRequest;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function getCredentials(response: HttpResponse, logger?: Logger): Promise<AwsCredentialIdentity>;
|
||||
10
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/retry-wrapper.d.ts
generated
vendored
Normal file
10
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/fromHttp/retry-wrapper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface RetryableProvider<T> {
|
||||
(): Promise<T>;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const retryWrapper: <T>(toRetry: RetryableProvider<T>, maxRetries: number, delayMs: number) => RetryableProvider<T>;
|
||||
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/index.browser.d.ts
generated
vendored
Normal file
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/index.browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp.browser";
|
||||
export type { FromHttpOptions, HttpProviderCredentials } from "./fromHttp/fromHttpTypes";
|
||||
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/index.d.ts
generated
vendored
Normal file
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp";
|
||||
export type { FromHttpOptions, HttpProviderCredentials } from "./fromHttp/fromHttpTypes";
|
||||
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/checkUrl.d.ts
generated
vendored
Normal file
2
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/checkUrl.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Logger } from "@smithy/types";
|
||||
export declare const checkUrl: (url: URL, logger?: Logger) => void;
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttp.browser.d.ts
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttp.browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
||||
import { FromHttpOptions } from "./fromHttpTypes";
|
||||
export declare const fromHttp: (
|
||||
options?: FromHttpOptions
|
||||
) => AwsCredentialIdentityProvider;
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttp.d.ts
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
||||
import { FromHttpOptions } from "./fromHttpTypes";
|
||||
export declare const fromHttp: (
|
||||
options?: FromHttpOptions
|
||||
) => AwsCredentialIdentityProvider;
|
||||
18
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttpTypes.d.ts
generated
vendored
Normal file
18
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/fromHttpTypes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { CredentialProviderOptions } from "@aws-sdk/types";
|
||||
export interface FromHttpOptions extends CredentialProviderOptions {
|
||||
awsContainerCredentialsFullUri?: string;
|
||||
awsContainerCredentialsRelativeUri?: string;
|
||||
awsContainerAuthorizationTokenFile?: string;
|
||||
awsContainerAuthorizationToken?: string;
|
||||
credentialsFullUri?: string;
|
||||
authorizationToken?: string;
|
||||
maxRetries?: number;
|
||||
timeout?: number;
|
||||
}
|
||||
export type HttpProviderCredentials = {
|
||||
AccessKeyId: string;
|
||||
SecretAccessKey: string;
|
||||
Token: string;
|
||||
AccountId?: string;
|
||||
Expiration: string;
|
||||
};
|
||||
8
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/requestHelpers.d.ts
generated
vendored
Normal file
8
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/requestHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { AwsCredentialIdentity } from "@aws-sdk/types";
|
||||
import { HttpRequest } from "@smithy/protocol-http";
|
||||
import { HttpResponse, Logger } from "@smithy/types";
|
||||
export declare function createGetRequest(url: URL): HttpRequest;
|
||||
export declare function getCredentials(
|
||||
response: HttpResponse,
|
||||
logger?: Logger
|
||||
): Promise<AwsCredentialIdentity>;
|
||||
8
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/retry-wrapper.d.ts
generated
vendored
Normal file
8
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/fromHttp/retry-wrapper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface RetryableProvider<T> {
|
||||
(): Promise<T>;
|
||||
}
|
||||
export declare const retryWrapper: <T>(
|
||||
toRetry: RetryableProvider<T>,
|
||||
maxRetries: number,
|
||||
delayMs: number
|
||||
) => RetryableProvider<T>;
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/index.browser.d.ts
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/index.browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp.browser";
|
||||
export {
|
||||
FromHttpOptions,
|
||||
HttpProviderCredentials,
|
||||
} from "./fromHttp/fromHttpTypes";
|
||||
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/index.d.ts
generated
vendored
Normal file
5
backend/node_modules/@aws-sdk/credential-provider-http/dist-types/ts3.4/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { fromHttp } from "./fromHttp/fromHttp";
|
||||
export {
|
||||
FromHttpOptions,
|
||||
HttpProviderCredentials,
|
||||
} from "./fromHttp/fromHttpTypes";
|
||||
70
backend/node_modules/@aws-sdk/credential-provider-http/package.json
generated
vendored
Normal file
70
backend/node_modules/@aws-sdk/credential-provider-http/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "@aws-sdk/credential-provider-http",
|
||||
"version": "3.970.0",
|
||||
"description": "AWS credential provider for containers and HTTP sources",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
"browser": "./dist-es/index.browser.js",
|
||||
"react-native": "./dist-es/index.browser.js",
|
||||
"scripts": {
|
||||
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
||||
"build:cjs": "node ../../scripts/compilation/inline credential-provider-http",
|
||||
"build:es": "tsc -p tsconfig.es.json",
|
||||
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
||||
"build:types": "tsc -p tsconfig.types.json",
|
||||
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
||||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
||||
"test": "yarn g:vitest run",
|
||||
"test:watch": "yarn g:vitest watch"
|
||||
},
|
||||
"keywords": [
|
||||
"aws",
|
||||
"credentials"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"author": {
|
||||
"name": "AWS SDK for JavaScript Team",
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/core": "3.970.0",
|
||||
"@aws-sdk/types": "3.969.0",
|
||||
"@smithy/fetch-http-handler": "^5.3.9",
|
||||
"@smithy/node-http-handler": "^4.4.8",
|
||||
"@smithy/property-provider": "^4.2.8",
|
||||
"@smithy/protocol-http": "^5.3.8",
|
||||
"@smithy/smithy-client": "^4.10.8",
|
||||
"@smithy/types": "^4.12.0",
|
||||
"@smithy/util-stream": "^4.5.10",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "1.0.1",
|
||||
"@types/node": "^20.14.8",
|
||||
"concurrently": "7.0.0",
|
||||
"downlevel-dts": "0.10.1",
|
||||
"rimraf": "5.0.10",
|
||||
"typescript": "~5.8.3"
|
||||
},
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=20.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/credential-provider-http",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-js-v3.git",
|
||||
"directory": "packages/credential-provider-http"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user