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:
38
backend/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
generated
vendored
Normal file
38
backend/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
||||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
||||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
||||
let _credentials = runtimeConfig.credentials;
|
||||
return {
|
||||
setHttpAuthScheme(httpAuthScheme) {
|
||||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
||||
if (index === -1) {
|
||||
_httpAuthSchemes.push(httpAuthScheme);
|
||||
}
|
||||
else {
|
||||
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
||||
}
|
||||
},
|
||||
httpAuthSchemes() {
|
||||
return _httpAuthSchemes;
|
||||
},
|
||||
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
||||
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
||||
},
|
||||
httpAuthSchemeProvider() {
|
||||
return _httpAuthSchemeProvider;
|
||||
},
|
||||
setCredentials(credentials) {
|
||||
_credentials = credentials;
|
||||
},
|
||||
credentials() {
|
||||
return _credentials;
|
||||
},
|
||||
};
|
||||
};
|
||||
export const resolveHttpAuthRuntimeConfig = (config) => {
|
||||
return {
|
||||
httpAuthSchemes: config.httpAuthSchemes(),
|
||||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
||||
credentials: config.credentials(),
|
||||
};
|
||||
};
|
||||
122
backend/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
generated
vendored
Normal file
122
backend/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
import { resolveAwsSdkSigV4AConfig, resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
|
||||
import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
|
||||
import { resolveParams } from "@smithy/middleware-endpoint";
|
||||
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
|
||||
import { defaultEndpointResolver } from "../endpoint/endpointResolver";
|
||||
const createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
|
||||
if (!input) {
|
||||
throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
|
||||
}
|
||||
const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
|
||||
const instructionsFn = getSmithyContext(context)?.commandInstance?.constructor
|
||||
?.getEndpointParameterInstructions;
|
||||
if (!instructionsFn) {
|
||||
throw new Error(`getEndpointParameterInstructions() is not defined on '${context.commandName}'`);
|
||||
}
|
||||
const endpointParameters = await resolveParams(input, { getEndpointParameterInstructions: instructionsFn }, config);
|
||||
return Object.assign(defaultParameters, endpointParameters);
|
||||
};
|
||||
const _defaultS3HttpAuthSchemeParametersProvider = async (config, context, input) => {
|
||||
return {
|
||||
operation: getSmithyContext(context).operation,
|
||||
region: await normalizeProvider(config.region)() || (() => {
|
||||
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
||||
})(),
|
||||
};
|
||||
};
|
||||
export const defaultS3HttpAuthSchemeParametersProvider = createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultS3HttpAuthSchemeParametersProvider);
|
||||
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4",
|
||||
signingProperties: {
|
||||
name: "s3",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
function createAwsAuthSigv4aHttpAuthOption(authParameters) {
|
||||
return {
|
||||
schemeId: "aws.auth#sigv4a",
|
||||
signingProperties: {
|
||||
name: "s3",
|
||||
region: authParameters.region,
|
||||
},
|
||||
propertiesExtractor: (config, context) => ({
|
||||
signingProperties: {
|
||||
config,
|
||||
context,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
const createEndpointRuleSetHttpAuthSchemeProvider = (defaultEndpointResolver, defaultHttpAuthSchemeResolver, createHttpAuthOptionFunctions) => {
|
||||
const endpointRuleSetHttpAuthSchemeProvider = (authParameters) => {
|
||||
const endpoint = defaultEndpointResolver(authParameters);
|
||||
const authSchemes = endpoint.properties?.authSchemes;
|
||||
if (!authSchemes) {
|
||||
return defaultHttpAuthSchemeResolver(authParameters);
|
||||
}
|
||||
const options = [];
|
||||
for (const scheme of authSchemes) {
|
||||
const { name: resolvedName, properties = {}, ...rest } = scheme;
|
||||
const name = resolvedName.toLowerCase();
|
||||
if (resolvedName !== name) {
|
||||
console.warn(`HttpAuthScheme has been normalized with lowercasing: '${resolvedName}' to '${name}'`);
|
||||
}
|
||||
let schemeId;
|
||||
if (name === "sigv4a") {
|
||||
schemeId = "aws.auth#sigv4a";
|
||||
const sigv4Present = authSchemes.find((s) => {
|
||||
const name = s.name.toLowerCase();
|
||||
return name !== "sigv4a" && name.startsWith("sigv4");
|
||||
});
|
||||
if (SignatureV4MultiRegion.sigv4aDependency() === "none" && sigv4Present) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (name.startsWith("sigv4")) {
|
||||
schemeId = "aws.auth#sigv4";
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${name}'`);
|
||||
}
|
||||
const createOption = createHttpAuthOptionFunctions[schemeId];
|
||||
if (!createOption) {
|
||||
throw new Error(`Could not find HttpAuthOption create function for '${schemeId}'`);
|
||||
}
|
||||
const option = createOption(authParameters);
|
||||
option.schemeId = schemeId;
|
||||
option.signingProperties = { ...(option.signingProperties || {}), ...rest, ...properties };
|
||||
options.push(option);
|
||||
}
|
||||
return options;
|
||||
};
|
||||
return endpointRuleSetHttpAuthSchemeProvider;
|
||||
};
|
||||
const _defaultS3HttpAuthSchemeProvider = (authParameters) => {
|
||||
const options = [];
|
||||
switch (authParameters.operation) {
|
||||
default: {
|
||||
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
||||
options.push(createAwsAuthSigv4aHttpAuthOption(authParameters));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
export const defaultS3HttpAuthSchemeProvider = createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver, _defaultS3HttpAuthSchemeProvider, {
|
||||
"aws.auth#sigv4": createAwsAuthSigv4HttpAuthOption,
|
||||
"aws.auth#sigv4a": createAwsAuthSigv4aHttpAuthOption,
|
||||
});
|
||||
export const resolveHttpAuthSchemeConfig = (config) => {
|
||||
const config_0 = resolveAwsSdkSigV4Config(config);
|
||||
const config_1 = resolveAwsSdkSigV4AConfig(config_0);
|
||||
return Object.assign(config_1, {
|
||||
authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user