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:
50
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js
generated
vendored
Normal file
50
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
export const createConfigValueProvider = (configKey, canonicalEndpointParamKey, config, isClientContextParam = false) => {
|
||||
const configProvider = async () => {
|
||||
let configValue;
|
||||
if (isClientContextParam) {
|
||||
const clientContextParams = config.clientContextParams;
|
||||
const nestedValue = clientContextParams?.[configKey];
|
||||
configValue = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];
|
||||
}
|
||||
else {
|
||||
configValue = config[configKey] ?? config[canonicalEndpointParamKey];
|
||||
}
|
||||
if (typeof configValue === "function") {
|
||||
return configValue();
|
||||
}
|
||||
return configValue;
|
||||
};
|
||||
if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
|
||||
return async () => {
|
||||
const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
|
||||
const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
|
||||
return configValue;
|
||||
};
|
||||
}
|
||||
if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
|
||||
return async () => {
|
||||
const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
|
||||
const configValue = credentials?.accountId ?? credentials?.AccountId;
|
||||
return configValue;
|
||||
};
|
||||
}
|
||||
if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
|
||||
return async () => {
|
||||
if (config.isCustomEndpoint === false) {
|
||||
return undefined;
|
||||
}
|
||||
const endpoint = await configProvider();
|
||||
if (endpoint && typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return endpoint.url.href;
|
||||
}
|
||||
if ("hostname" in endpoint) {
|
||||
const { protocol, hostname, port, path } = endpoint;
|
||||
return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
|
||||
}
|
||||
}
|
||||
return endpoint;
|
||||
};
|
||||
}
|
||||
return configProvider;
|
||||
};
|
||||
1
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.browser.js
generated
vendored
Normal file
1
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.browser.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const getEndpointFromConfig = async (serviceId) => undefined;
|
||||
3
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js
generated
vendored
Normal file
3
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { loadConfig } from "@smithy/node-config-provider";
|
||||
import { getEndpointUrlConfig } from "./getEndpointUrlConfig";
|
||||
export const getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
|
||||
55
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js
generated
vendored
Normal file
55
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import { resolveParamsForS3 } from "../service-customizations";
|
||||
import { createConfigValueProvider } from "./createConfigValueProvider";
|
||||
import { getEndpointFromConfig } from "./getEndpointFromConfig";
|
||||
import { toEndpointV1 } from "./toEndpointV1";
|
||||
export const getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
|
||||
if (!clientConfig.isCustomEndpoint) {
|
||||
let endpointFromConfig;
|
||||
if (clientConfig.serviceConfiguredEndpoint) {
|
||||
endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
|
||||
}
|
||||
else {
|
||||
endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId);
|
||||
}
|
||||
if (endpointFromConfig) {
|
||||
clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
|
||||
clientConfig.isCustomEndpoint = true;
|
||||
}
|
||||
}
|
||||
const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
|
||||
if (typeof clientConfig.endpointProvider !== "function") {
|
||||
throw new Error("config.endpointProvider is not set.");
|
||||
}
|
||||
const endpoint = clientConfig.endpointProvider(endpointParams, context);
|
||||
return endpoint;
|
||||
};
|
||||
export const resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
|
||||
const endpointParams = {};
|
||||
const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
|
||||
for (const [name, instruction] of Object.entries(instructions)) {
|
||||
switch (instruction.type) {
|
||||
case "staticContextParams":
|
||||
endpointParams[name] = instruction.value;
|
||||
break;
|
||||
case "contextParams":
|
||||
endpointParams[name] = commandInput[instruction.name];
|
||||
break;
|
||||
case "clientContextParams":
|
||||
case "builtInParams":
|
||||
endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig, instruction.type !== "builtInParams")();
|
||||
break;
|
||||
case "operationContextParams":
|
||||
endpointParams[name] = instruction.get(commandInput);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
|
||||
}
|
||||
}
|
||||
if (Object.keys(instructions).length === 0) {
|
||||
Object.assign(endpointParams, clientConfig);
|
||||
}
|
||||
if (String(clientConfig.serviceId).toLowerCase() === "s3") {
|
||||
await resolveParamsForS3(endpointParams);
|
||||
}
|
||||
return endpointParams;
|
||||
};
|
||||
31
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointUrlConfig.js
generated
vendored
Normal file
31
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointUrlConfig.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { CONFIG_PREFIX_SEPARATOR } from "@smithy/shared-ini-file-loader";
|
||||
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
|
||||
const CONFIG_ENDPOINT_URL = "endpoint_url";
|
||||
export const getEndpointUrlConfig = (serviceId) => ({
|
||||
environmentVariableSelector: (env) => {
|
||||
const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
|
||||
const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
|
||||
if (serviceEndpointUrl)
|
||||
return serviceEndpointUrl;
|
||||
const endpointUrl = env[ENV_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
configFileSelector: (profile, config) => {
|
||||
if (config && profile.services) {
|
||||
const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
|
||||
if (servicesSection) {
|
||||
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
|
||||
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
}
|
||||
}
|
||||
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
default: undefined,
|
||||
});
|
||||
2
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/index.js
generated
vendored
Normal file
2
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./getEndpointFromInstructions";
|
||||
export * from "./toEndpointV1";
|
||||
10
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js
generated
vendored
Normal file
10
backend/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { parseUrl } from "@smithy/url-parser";
|
||||
export const toEndpointV1 = (endpoint) => {
|
||||
if (typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return parseUrl(endpoint.url);
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
return parseUrl(endpoint);
|
||||
};
|
||||
Reference in New Issue
Block a user