backend v4 half
This commit is contained in:
+6
-2
@@ -89,6 +89,9 @@ var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndp
|
||||
}
|
||||
if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
|
||||
return async () => {
|
||||
if (config.isCustomEndpoint === false) {
|
||||
return void 0;
|
||||
}
|
||||
const endpoint = await configProvider();
|
||||
if (endpoint && typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
@@ -122,7 +125,7 @@ var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => {
|
||||
|
||||
// src/adaptors/getEndpointFromInstructions.ts
|
||||
var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => {
|
||||
if (!clientConfig.endpoint) {
|
||||
if (!clientConfig.isCustomEndpoint) {
|
||||
let endpointFromConfig;
|
||||
if (clientConfig.serviceConfiguredEndpoint) {
|
||||
endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
|
||||
@@ -131,6 +134,7 @@ var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, in
|
||||
}
|
||||
if (endpointFromConfig) {
|
||||
clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
|
||||
clientConfig.isCustomEndpoint = true;
|
||||
}
|
||||
}
|
||||
const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
|
||||
@@ -179,7 +183,7 @@ var endpointMiddleware = /* @__PURE__ */ __name(({
|
||||
instructions
|
||||
}) => {
|
||||
return (next, context) => async (args) => {
|
||||
if (config.endpoint) {
|
||||
if (config.isCustomEndpoint) {
|
||||
(0, import_core.setFeature)(context, "ENDPOINT_OVERRIDE", "N");
|
||||
}
|
||||
const endpoint = await getEndpointFromInstructions(
|
||||
|
||||
Generated
Vendored
+3
@@ -22,6 +22,9 @@ export const createConfigValueProvider = (configKey, canonicalEndpointParamKey,
|
||||
}
|
||||
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) {
|
||||
|
||||
Generated
Vendored
+2
-1
@@ -3,7 +3,7 @@ import { createConfigValueProvider } from "./createConfigValueProvider";
|
||||
import { getEndpointFromConfig } from "./getEndpointFromConfig";
|
||||
import { toEndpointV1 } from "./toEndpointV1";
|
||||
export const getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
|
||||
if (!clientConfig.endpoint) {
|
||||
if (!clientConfig.isCustomEndpoint) {
|
||||
let endpointFromConfig;
|
||||
if (clientConfig.serviceConfiguredEndpoint) {
|
||||
endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
|
||||
@@ -13,6 +13,7 @@ export const getEndpointFromInstructions = async (commandInput, instructionsSupp
|
||||
}
|
||||
if (endpointFromConfig) {
|
||||
clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
|
||||
clientConfig.isCustomEndpoint = true;
|
||||
}
|
||||
}
|
||||
const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -3,7 +3,7 @@ import { getSmithyContext } from "@smithy/util-middleware";
|
||||
import { getEndpointFromInstructions } from "./adaptors/getEndpointFromInstructions";
|
||||
export const endpointMiddleware = ({ config, instructions, }) => {
|
||||
return (next, context) => async (args) => {
|
||||
if (config.endpoint) {
|
||||
if (config.isCustomEndpoint) {
|
||||
setFeature(context, "ENDPOINT_OVERRIDE", "N");
|
||||
}
|
||||
const endpoint = await getEndpointFromInstructions(args.input, {
|
||||
|
||||
Generated
Vendored
+5
-2
@@ -56,7 +56,7 @@ interface PreviouslyResolved<T extends EndpointParameters = EndpointParameters>
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This supercedes the similarly named EndpointsResolvedConfig (no parametric types)
|
||||
* This supersedes the similarly named EndpointsResolvedConfig (no parametric types)
|
||||
* from resolveEndpointsConfig.ts in \@smithy/config-resolver.
|
||||
*/
|
||||
export interface EndpointResolvedConfig<T extends EndpointParameters = EndpointParameters> {
|
||||
@@ -76,8 +76,11 @@ export interface EndpointResolvedConfig<T extends EndpointParameters = EndpointP
|
||||
tls: boolean;
|
||||
/**
|
||||
* Whether the endpoint is specified by caller.
|
||||
* This should be used over checking the existence of `endpoint`, since
|
||||
* that may have been set by other means, such as the default regional
|
||||
* endpoint provider function.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated
|
||||
*/
|
||||
isCustomEndpoint?: boolean;
|
||||
/**
|
||||
|
||||
Generated
Vendored
+5
-2
@@ -56,7 +56,7 @@ interface PreviouslyResolved<T extends EndpointParameters = EndpointParameters>
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This supercedes the similarly named EndpointsResolvedConfig (no parametric types)
|
||||
* This supersedes the similarly named EndpointsResolvedConfig (no parametric types)
|
||||
* from resolveEndpointsConfig.ts in \@smithy/config-resolver.
|
||||
*/
|
||||
export interface EndpointResolvedConfig<T extends EndpointParameters = EndpointParameters> {
|
||||
@@ -76,8 +76,11 @@ export interface EndpointResolvedConfig<T extends EndpointParameters = EndpointP
|
||||
tls: boolean;
|
||||
/**
|
||||
* Whether the endpoint is specified by caller.
|
||||
* This should be used over checking the existence of `endpoint`, since
|
||||
* that may have been set by other means, such as the default regional
|
||||
* endpoint provider function.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated
|
||||
*/
|
||||
isCustomEndpoint?: boolean;
|
||||
/**
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@smithy/middleware-endpoint",
|
||||
"version": "4.1.13",
|
||||
"version": "4.1.15",
|
||||
"scripts": {
|
||||
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
||||
"build:cjs": "node ../../scripts/inline middleware-endpoint",
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@smithy/core": "^3.6.0",
|
||||
"@smithy/core": "^3.7.0",
|
||||
"@smithy/middleware-serde": "^4.0.8",
|
||||
"@smithy/node-config-provider": "^4.1.3",
|
||||
"@smithy/shared-ini-file-loader": "^4.0.4",
|
||||
|
||||
Reference in New Issue
Block a user