backend v4 half
This commit is contained in:
+30
@@ -46,8 +46,10 @@ __export(index_exports, {
|
||||
getUserAgentPrefix: () => getUserAgentPrefix,
|
||||
isIpAddress: () => import_util_endpoints.isIpAddress,
|
||||
partition: () => partition,
|
||||
resolveDefaultAwsRegionalEndpointsConfig: () => resolveDefaultAwsRegionalEndpointsConfig,
|
||||
resolveEndpoint: () => import_util_endpoints.resolveEndpoint,
|
||||
setPartitionInfo: () => setPartitionInfo,
|
||||
toEndpointV1: () => toEndpointV1,
|
||||
useDefaultPartitionInfo: () => useDefaultPartitionInfo
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
@@ -418,6 +420,32 @@ var awsEndpointFunctions = {
|
||||
};
|
||||
import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions;
|
||||
|
||||
// src/resolveDefaultAwsRegionalEndpointsConfig.ts
|
||||
var import_url_parser = require("@smithy/url-parser");
|
||||
var resolveDefaultAwsRegionalEndpointsConfig = /* @__PURE__ */ __name((input) => {
|
||||
if (typeof input.endpointProvider !== "function") {
|
||||
throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");
|
||||
}
|
||||
const { endpoint } = input;
|
||||
if (endpoint === void 0) {
|
||||
input.endpoint = async () => {
|
||||
return toEndpointV1(
|
||||
input.endpointProvider(
|
||||
{
|
||||
Region: typeof input.region === "function" ? await input.region() : input.region,
|
||||
UseDualStack: typeof input.useDualstackEndpoint === "function" ? await input.useDualstackEndpoint() : input.useDualstackEndpoint,
|
||||
UseFIPS: typeof input.useFipsEndpoint === "function" ? await input.useFipsEndpoint() : input.useFipsEndpoint,
|
||||
Endpoint: void 0
|
||||
},
|
||||
{ logger: input.logger }
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
return input;
|
||||
}, "resolveDefaultAwsRegionalEndpointsConfig");
|
||||
var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => (0, import_url_parser.parseUrl)(endpoint.url), "toEndpointV1");
|
||||
|
||||
// src/resolveEndpoint.ts
|
||||
|
||||
|
||||
@@ -447,6 +475,8 @@ import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions;
|
||||
useDefaultPartitionInfo,
|
||||
getUserAgentPrefix,
|
||||
isIpAddress,
|
||||
resolveDefaultAwsRegionalEndpointsConfig,
|
||||
toEndpointV1,
|
||||
resolveEndpoint,
|
||||
EndpointError
|
||||
});
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
export * from "./aws";
|
||||
export * from "./lib/aws/partition";
|
||||
export * from "./lib/isIpAddress";
|
||||
export * from "./resolveDefaultAwsRegionalEndpointsConfig";
|
||||
export * from "./resolveEndpoint";
|
||||
export * from "./types";
|
||||
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
import { parseUrl } from "@smithy/url-parser";
|
||||
export const resolveDefaultAwsRegionalEndpointsConfig = (input) => {
|
||||
if (typeof input.endpointProvider !== "function") {
|
||||
throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");
|
||||
}
|
||||
const { endpoint } = input;
|
||||
if (endpoint === undefined) {
|
||||
input.endpoint = async () => {
|
||||
return toEndpointV1(input.endpointProvider({
|
||||
Region: typeof input.region === "function" ? await input.region() : input.region,
|
||||
UseDualStack: typeof input.useDualstackEndpoint === "function"
|
||||
? await input.useDualstackEndpoint()
|
||||
: input.useDualstackEndpoint,
|
||||
UseFIPS: typeof input.useFipsEndpoint === "function" ? await input.useFipsEndpoint() : input.useFipsEndpoint,
|
||||
Endpoint: undefined,
|
||||
}, { logger: input.logger }));
|
||||
};
|
||||
}
|
||||
return input;
|
||||
};
|
||||
export const toEndpointV1 = (endpoint) => parseUrl(endpoint.url);
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
export * from "./aws";
|
||||
export * from "./lib/aws/partition";
|
||||
export * from "./lib/isIpAddress";
|
||||
export * from "./resolveDefaultAwsRegionalEndpointsConfig";
|
||||
export * from "./resolveEndpoint";
|
||||
export * from "./types";
|
||||
|
||||
Generated
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
import type { Endpoint, EndpointParameters, EndpointV2, Logger, Provider } from "@smithy/types";
|
||||
/**
|
||||
* This is an additional config resolver layer for clients using the default
|
||||
* AWS regional endpoints ruleset. It makes the *resolved* config guarantee the presence of an
|
||||
* endpoint provider function. This differs from the base behavior of the Endpoint
|
||||
* config resolver, which only normalizes config.endpoint IFF one is provided by the caller.
|
||||
*
|
||||
* This is not used by AWS SDK clients, but rather
|
||||
* generated clients that have the aws.api#service trait. This includes protocol tests
|
||||
* and other customers.
|
||||
*
|
||||
* This resolver is MUTUALLY EXCLUSIVE with the EndpointRequired config resolver from
|
||||
* |@smithy/middleware-endpoint.
|
||||
*
|
||||
* It must be placed after the `resolveEndpointConfig`
|
||||
* resolver. This replaces the endpoints.json-based default endpoint provider.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type DefaultAwsRegionalEndpointsInputConfig = {
|
||||
endpoint?: unknown;
|
||||
};
|
||||
type PreviouslyResolved = {
|
||||
logger?: Logger;
|
||||
region?: undefined | string | Provider<string | undefined>;
|
||||
useFipsEndpoint?: undefined | boolean | Provider<string | boolean>;
|
||||
useDualstackEndpoint?: undefined | boolean | Provider<string | boolean>;
|
||||
endpointProvider: (endpointParams: EndpointParameters | DefaultRegionalEndpointParameters, context?: {
|
||||
logger?: Logger;
|
||||
}) => EndpointV2;
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
type DefaultRegionalEndpointParameters = {
|
||||
Region?: string | undefined;
|
||||
UseDualStack?: boolean | undefined;
|
||||
UseFIPS?: boolean | undefined;
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface DefaultAwsRegionalEndpointsResolvedConfig {
|
||||
endpoint: Provider<Endpoint>;
|
||||
}
|
||||
/**
|
||||
* MUST resolve after `\@smithy/middleware-endpoint`::`resolveEndpointConfig`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare const resolveDefaultAwsRegionalEndpointsConfig: <T>(input: T & DefaultAwsRegionalEndpointsInputConfig & PreviouslyResolved) => T & DefaultAwsRegionalEndpointsResolvedConfig;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const toEndpointV1: (endpoint: EndpointV2) => Endpoint;
|
||||
export {};
|
||||
Generated
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
export * from "./aws";
|
||||
export * from "./lib/aws/partition";
|
||||
export * from "./lib/isIpAddress";
|
||||
export * from "./resolveDefaultAwsRegionalEndpointsConfig";
|
||||
export * from "./resolveEndpoint";
|
||||
export * from "./types";
|
||||
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
Endpoint,
|
||||
EndpointParameters,
|
||||
EndpointV2,
|
||||
Logger,
|
||||
Provider,
|
||||
} from "@smithy/types";
|
||||
export type DefaultAwsRegionalEndpointsInputConfig = {
|
||||
endpoint?: unknown;
|
||||
};
|
||||
type PreviouslyResolved = {
|
||||
logger?: Logger;
|
||||
region?: undefined | string | Provider<string | undefined>;
|
||||
useFipsEndpoint?: undefined | boolean | Provider<string | boolean>;
|
||||
useDualstackEndpoint?: undefined | boolean | Provider<string | boolean>;
|
||||
endpointProvider: (
|
||||
endpointParams: EndpointParameters | DefaultRegionalEndpointParameters,
|
||||
context?: {
|
||||
logger?: Logger;
|
||||
}
|
||||
) => EndpointV2;
|
||||
};
|
||||
type DefaultRegionalEndpointParameters = {
|
||||
Region?: string | undefined;
|
||||
UseDualStack?: boolean | undefined;
|
||||
UseFIPS?: boolean | undefined;
|
||||
};
|
||||
export interface DefaultAwsRegionalEndpointsResolvedConfig {
|
||||
endpoint: Provider<Endpoint>;
|
||||
}
|
||||
export declare const resolveDefaultAwsRegionalEndpointsConfig: <T>(
|
||||
input: T & DefaultAwsRegionalEndpointsInputConfig & PreviouslyResolved
|
||||
) => T & DefaultAwsRegionalEndpointsResolvedConfig;
|
||||
export declare const toEndpointV1: (endpoint: EndpointV2) => Endpoint;
|
||||
export {};
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aws-sdk/util-endpoints",
|
||||
"version": "3.840.0",
|
||||
"version": "3.845.0",
|
||||
"description": "Utilities to help with endpoint resolution",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
@@ -23,9 +23,11 @@
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"sideEffects": true,
|
||||
"dependencies": {
|
||||
"@aws-sdk/types": "3.840.0",
|
||||
"@smithy/types": "^4.3.1",
|
||||
"@smithy/url-parser": "^4.0.4",
|
||||
"@smithy/util-endpoints": "^3.0.6",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user