Socket
Socket
Sign inDemoInstall

@aws-sdk/middleware-endpoint

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-endpoint - npm Package Compare versions

Comparing version 3.171.0 to 3.178.0

dist-cjs/adaptors/getEndpointFromInstructions.js

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)
### Features
* **endpoint:** endpoints 2.0 existing package changes ([#3947](https://github.com/aws/aws-sdk-js-v3/issues/3947)) ([df99fc3](https://github.com/aws/aws-sdk-js-v3/commit/df99fc33a43982e1c59000721a535f6fe77a3c23))
# [3.171.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.170.0...v3.171.0) (2022-09-14)

@@ -8,0 +19,0 @@

22

dist-cjs/endpointMiddleware.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.endpointMiddleware = void 0;
const endpointMiddleware = (options) => {
return (next) => async (args) => {
const getEndpointFromInstructions_1 = require("./adaptors/getEndpointFromInstructions");
const service_customizations_1 = require("./service-customizations");
const endpointMiddleware = ({ config, instructions, }) => {
return (next, context) => async (args) => {
var _a, _b;
const endpoint = await (0, getEndpointFromInstructions_1.getEndpointFromInstructions)(args.input, {
getEndpointParameterInstructions() {
return instructions;
},
}, { ...config }, context);
context.endpointV2 = endpoint;
context.authSchemes = (_a = endpoint.properties) === null || _a === void 0 ? void 0 : _a.authSchemes;
const authScheme = (_b = context.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
if (authScheme) {
context["signing_region"] = authScheme.signingScope;
context["signing_service"] = authScheme.signingName;
}
if (config.serviceId === "S3") {
await (0, service_customizations_1.s3Customizations)(config, instructions, args, context);
}
return next({

@@ -7,0 +25,0 @@ ...args,

11

dist-cjs/getEndpointPlugin.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndpointPlugin = exports.endpointMiddlewareOptions = void 0;
const middleware_serde_1 = require("@aws-sdk/middleware-serde");
const endpointMiddleware_1 = require("./endpointMiddleware");

@@ -8,10 +9,12 @@ exports.endpointMiddlewareOptions = {

tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
name: "endpointMiddleware",
name: "endpointV2Middleware",
override: true,
relation: "before",
toMiddleware: middleware_serde_1.serializerMiddlewareOption.name,
};
const getEndpointPlugin = (config, instruction) => ({
const getEndpointPlugin = (config, instructions) => ({
applyToStack: (clientStack) => {
clientStack.add((0, endpointMiddleware_1.endpointMiddleware)({
clientStack.addRelativeTo((0, endpointMiddleware_1.endpointMiddleware)({
config,
instruction,
instructions,
}), exports.endpointMiddlewareOptions);

@@ -18,0 +21,0 @@ },

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./adaptors"), exports);
tslib_1.__exportStar(require("./endpointMiddleware"), exports);

@@ -5,0 +6,0 @@ tslib_1.__exportStar(require("./getEndpointPlugin"), exports);

@@ -5,2 +5,3 @@ "use strict";

const util_middleware_1 = require("@aws-sdk/util-middleware");
const toEndpointV1_1 = require("./adaptors/toEndpointV1");
const resolveEndpointConfig = (input) => {

@@ -10,13 +11,7 @@ var _a, _b, _c;

const { endpoint } = input;
const resolvedEndpoint = endpoint != null
? typeof endpoint === "function"
? async () => {
return toEndpointV1(await endpoint());
}
: (0, util_middleware_1.normalizeProvider)(toEndpointV1(endpoint))
: undefined;
const isCustomEndpoint = input.endpoint ? true : false;
const customEndpointProvider = endpoint != null ? async () => (0, toEndpointV1_1.toEndpointV1)(await (0, util_middleware_1.normalizeProvider)(endpoint)()) : undefined;
const isCustomEndpoint = !!endpoint;
return {
...input,
endpoint: resolvedEndpoint,
endpoint: customEndpointProvider,
tls,

@@ -23,0 +18,0 @@ isCustomEndpoint,

import { __assign, __awaiter, __generator } from "tslib";
export var endpointMiddleware = function (options) {
return function (next) {
import { getEndpointFromInstructions } from "./adaptors/getEndpointFromInstructions";
import { s3Customizations } from "./service-customizations";
export var endpointMiddleware = function (_a) {
var config = _a.config, instructions = _a.instructions;
return function (next, context) {
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2, next(__assign({}, args))];
var endpoint, authScheme;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4, getEndpointFromInstructions(args.input, {
getEndpointParameterInstructions: function () {
return instructions;
},
}, __assign({}, config), context)];
case 1:
endpoint = _c.sent();
context.endpointV2 = endpoint;
context.authSchemes = (_a = endpoint.properties) === null || _a === void 0 ? void 0 : _a.authSchemes;
authScheme = (_b = context.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
if (authScheme) {
context["signing_region"] = authScheme.signingScope;
context["signing_service"] = authScheme.signingName;
}
if (!(config.serviceId === "S3")) return [3, 3];
return [4, s3Customizations(config, instructions, args, context)];
case 2:
_c.sent();
_c.label = 3;
case 3: return [2, next(__assign({}, args))];
}
});

@@ -8,0 +34,0 @@ }); };

@@ -0,1 +1,2 @@

import { serializerMiddlewareOption } from "@aws-sdk/middleware-serde";
import { endpointMiddleware } from "./endpointMiddleware";

@@ -5,12 +6,14 @@ export var endpointMiddlewareOptions = {

tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
name: "endpointMiddleware",
name: "endpointV2Middleware",
override: true,
relation: "before",
toMiddleware: serializerMiddlewareOption.name,
};
export var getEndpointPlugin = function (config, instruction) { return ({
export var getEndpointPlugin = function (config, instructions) { return ({
applyToStack: function (clientStack) {
clientStack.add(endpointMiddleware({
clientStack.addRelativeTo(endpointMiddleware({
config: config,
instruction: instruction,
instructions: instructions,
}), endpointMiddlewareOptions);
},
}); };

@@ -0,1 +1,2 @@

export * from "./adaptors";
export * from "./endpointMiddleware";

@@ -2,0 +3,0 @@ export * from "./getEndpointPlugin";

import { __assign, __awaiter, __generator } from "tslib";
import { normalizeProvider } from "@aws-sdk/util-middleware";
import { toEndpointV1 } from "./adaptors/toEndpointV1";
export var resolveEndpointConfig = function (input) {

@@ -7,19 +8,12 @@ var _a, _b, _c;

var endpoint = input.endpoint;
var resolvedEndpoint = endpoint != null
? typeof endpoint === "function"
? function () { return __awaiter(void 0, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = toEndpointV1;
return [4, endpoint()];
case 1: return [2, _a.apply(void 0, [_b.sent()])];
}
});
}); }
: normalizeProvider(toEndpointV1(endpoint))
: undefined;
var isCustomEndpoint = input.endpoint ? true : false;
return __assign(__assign({}, input), { endpoint: resolvedEndpoint, tls: tls, isCustomEndpoint: isCustomEndpoint, useDualstackEndpoint: normalizeProvider((_b = input.useDualstackEndpoint) !== null && _b !== void 0 ? _b : false), useFipsEndpoint: normalizeProvider((_c = input.useFipsEndpoint) !== null && _c !== void 0 ? _c : false) });
var customEndpointProvider = endpoint != null ? function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = toEndpointV1;
return [4, normalizeProvider(endpoint)()];
case 1: return [2, _a.apply(void 0, [_b.sent()])];
}
}); }); } : undefined;
var isCustomEndpoint = !!endpoint;
return __assign(__assign({}, input), { endpoint: customEndpointProvider, tls: tls, isCustomEndpoint: isCustomEndpoint, useDualstackEndpoint: normalizeProvider((_b = input.useDualstackEndpoint) !== null && _b !== void 0 ? _b : false), useFipsEndpoint: normalizeProvider((_c = input.useFipsEndpoint) !== null && _c !== void 0 ? _c : false) });
};

@@ -1,6 +0,13 @@

import { SerializeMiddleware } from "@aws-sdk/types";
import { EndpointParameterInstruction } from "./types";
export declare const endpointMiddleware: (options: {
config: any;
instruction: EndpointParameterInstruction;
import { EndpointParameters, SerializeMiddleware } from "@aws-sdk/types";
import { EndpointResolvedConfig } from "./resolveEndpointConfig";
import { EndpointParameterInstructions } from "./types";
export declare type PreviouslyResolvedServiceId = {
serviceId?: string;
};
/**
* @private
*/
export declare const endpointMiddleware: <T extends EndpointParameters>({ config, instructions, }: {
config: EndpointResolvedConfig<T> & PreviouslyResolvedServiceId;
instructions: EndpointParameterInstructions;
}) => SerializeMiddleware<any, any>;

@@ -1,4 +0,6 @@

import { Pluggable, SerializeHandlerOptions } from "@aws-sdk/types";
import { EndpointParameterInstruction } from "./types";
export declare const endpointMiddlewareOptions: SerializeHandlerOptions;
export declare const getEndpointPlugin: (config: any, instruction: EndpointParameterInstruction) => Pluggable<any, any>;
import { EndpointParameters, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@aws-sdk/types";
import { PreviouslyResolvedServiceId } from "./endpointMiddleware";
import { EndpointResolvedConfig } from "./resolveEndpointConfig";
import { EndpointParameterInstructions } from "./types";
export declare const endpointMiddlewareOptions: SerializeHandlerOptions & RelativeMiddlewareOptions;
export declare const getEndpointPlugin: <T extends EndpointParameters>(config: EndpointResolvedConfig<T> & PreviouslyResolvedServiceId, instructions: EndpointParameterInstructions) => Pluggable<any, any>;

@@ -0,1 +1,2 @@

export * from "./adaptors";
export * from "./endpointMiddleware";

@@ -2,0 +3,0 @@ export * from "./getEndpointPlugin";

import { Endpoint, EndpointParameters, EndpointV2, Logger, Provider, UrlParser } from "@aws-sdk/types";
/**
* Endpoint config interfaces and resolver for Endpoint v2. They live in separate package to allow per-service onboarding.
* When all services onboard the endpoint v2, the resolver in config-resolver package can be removed.
* When all services onboard Endpoint v2, the resolver in config-resolver package can be removed.
* This interface includes all the endpoint parameters with built-in bindings of "AWS::*" and "SDK::*"

@@ -9,3 +9,4 @@ */

/**
* The fully qualified endpoint of the webservice. This is only required when using a custom endpoint (for example, when using a local version of S3).
* The fully qualified endpoint of the webservice. This is only required when using
* a custom endpoint (for example, when using a local version of S3).
*/

@@ -38,2 +39,6 @@ endpoint?: string | Endpoint | Provider<Endpoint> | EndpointV2 | Provider<EndpointV2>;

}
/**
* This supercedes the similarly named EndpointsResolvedConfig (no parametric types)
* from resolveEndpointsConfig.ts in @aws-sdk/config-resolver.
*/
export interface EndpointResolvedConfig<T extends EndpointParameters = EndpointParameters> {

@@ -44,3 +49,3 @@ /**

*/
endpoint?: Provider<Endpoint>;
endpoint: Provider<Endpoint>;
endpointProvider: (params: T, context?: {

@@ -47,0 +52,0 @@ logger?: Logger;

@@ -1,6 +0,13 @@

import { SerializeMiddleware } from "@aws-sdk/types";
import { EndpointParameterInstruction } from "./types";
export declare const endpointMiddleware: (options: {
config: any;
instruction: EndpointParameterInstruction;
import { EndpointParameters, SerializeMiddleware } from "@aws-sdk/types";
import { EndpointResolvedConfig } from "./resolveEndpointConfig";
import { EndpointParameterInstructions } from "./types";
export declare type PreviouslyResolvedServiceId = {
serviceId?: string;
};
export declare const endpointMiddleware: <T extends EndpointParameters>({
config,
instructions,
}: {
config: EndpointResolvedConfig<T> & PreviouslyResolvedServiceId;
instructions: EndpointParameterInstructions;
}) => SerializeMiddleware<any, any>;

@@ -1,7 +0,15 @@

import { Pluggable, SerializeHandlerOptions } from "@aws-sdk/types";
import { EndpointParameterInstruction } from "./types";
export declare const endpointMiddlewareOptions: SerializeHandlerOptions;
export declare const getEndpointPlugin: (
config: any,
instruction: EndpointParameterInstruction
import {
EndpointParameters,
Pluggable,
RelativeMiddlewareOptions,
SerializeHandlerOptions,
} from "@aws-sdk/types";
import { PreviouslyResolvedServiceId } from "./endpointMiddleware";
import { EndpointResolvedConfig } from "./resolveEndpointConfig";
import { EndpointParameterInstructions } from "./types";
export declare const endpointMiddlewareOptions: SerializeHandlerOptions &
RelativeMiddlewareOptions;
export declare const getEndpointPlugin: <T extends EndpointParameters>(
config: EndpointResolvedConfig<T> & PreviouslyResolvedServiceId,
instructions: EndpointParameterInstructions
) => Pluggable<any, any>;

@@ -0,1 +1,2 @@

export * from "./adaptors";
export * from "./endpointMiddleware";

@@ -2,0 +3,0 @@ export * from "./getEndpointPlugin";

@@ -44,3 +44,3 @@ import {

> {
endpoint?: Provider<Endpoint>;
endpoint: Provider<Endpoint>;
endpointProvider: (

@@ -47,0 +47,0 @@ params: T,

@@ -1,2 +0,2 @@

export interface EndpointParameterInstruction {
export interface EndpointParameterInstructions {
[name: string]:

@@ -3,0 +3,0 @@ | BuiltInParamInstruction

@@ -1,2 +0,2 @@

export interface EndpointParameterInstruction {
export interface EndpointParameterInstructions {
[name: string]: BuiltInParamInstruction | ClientContextParamInstruction | StaticContextParamInstruction | ContextParamInstruction;

@@ -3,0 +3,0 @@ }

{
"name": "@aws-sdk/middleware-endpoint",
"version": "3.171.0",
"version": "3.178.0",
"scripts": {

@@ -8,2 +8,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"build:es": "tsc -p tsconfig.es.json",
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
"build:types": "tsc -p tsconfig.types.json",

@@ -23,10 +24,11 @@ "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",

"dependencies": {
"@aws-sdk/signature-v4": "3.171.0",
"@aws-sdk/types": "3.171.0",
"@aws-sdk/protocol-http": "3.178.0",
"@aws-sdk/signature-v4": "3.178.0",
"@aws-sdk/types": "3.178.0",
"@aws-sdk/util-config-provider": "3.170.0",
"@aws-sdk/util-middleware": "3.171.0",
"@aws-sdk/util-middleware": "3.178.0",
"tslib": "^2.3.1"
},
"devDependencies": {
"@aws-sdk/node-config-provider": "3.171.0",
"@aws-sdk/node-config-provider": "3.178.0",
"@tsconfig/recommended": "1.0.1",

@@ -33,0 +35,0 @@ "concurrently": "7.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc