Socket
Socket
Sign inDemoInstall

@aws-sdk/middleware-user-agent

Package Overview
Dependencies
Maintainers
5
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-user-agent - npm Package Compare versions

Comparing version 3.668.0 to 3.669.0

26

dist-cjs/index.js

@@ -70,7 +70,27 @@ "use strict";

var import_core2 = require("@aws-sdk/core");
var ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
async function checkFeatures(context, config, args) {
var _a, _b, _c;
var _a, _b, _c, _d, _e, _f, _g;
const request = args.request;
if (((_a = request == null ? void 0 : request.headers) == null ? void 0 : _a["smithy-protocol"]) === "rpc-v2-cbor") {
(0, import_core2.setFeature)(context, "PROTOCOL_RPC_V2_CBOR", "M");
}
if (typeof config.retryStrategy === "function") {
const retryStrategy = await config.retryStrategy();
if (typeof retryStrategy.acquireInitialRetryToken === "function") {
if ((_c = (_b = retryStrategy.constructor) == null ? void 0 : _b.name) == null ? void 0 : _c.includes("Adaptive")) {
(0, import_core2.setFeature)(context, "RETRY_MODE_ADAPTIVE", "F");
} else {
(0, import_core2.setFeature)(context, "RETRY_MODE_STANDARD", "E");
}
} else {
(0, import_core2.setFeature)(context, "RETRY_MODE_LEGACY", "D");
}
}
if (typeof config.accountIdEndpointMode === "function") {
switch (await ((_a = config.accountIdEndpointMode) == null ? void 0 : _a.call(config))) {
const endpointV2 = context.endpointV2;
if (String((_d = endpointV2 == null ? void 0 : endpointV2.url) == null ? void 0 : _d.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
(0, import_core2.setFeature)(context, "ACCOUNT_ID_ENDPOINT", "O");
}
switch (await ((_e = config.accountIdEndpointMode) == null ? void 0 : _e.call(config))) {
case "disabled":

@@ -87,3 +107,3 @@ (0, import_core2.setFeature)(context, "ACCOUNT_ID_MODE_DISABLED", "Q");

}
const identity = (_c = (_b = context.__smithy_context) == null ? void 0 : _b.selectedHttpAuthScheme) == null ? void 0 : _c.identity;
const identity = (_g = (_f = context.__smithy_context) == null ? void 0 : _f.selectedHttpAuthScheme) == null ? void 0 : _g.identity;
if (identity == null ? void 0 : identity.$source) {

@@ -90,0 +110,0 @@ const credentials = identity;

import { setFeature } from "@aws-sdk/core";
const ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
export async function checkFeatures(context, config, args) {
const request = args.request;
if (request?.headers?.["smithy-protocol"] === "rpc-v2-cbor") {
setFeature(context, "PROTOCOL_RPC_V2_CBOR", "M");
}
if (typeof config.retryStrategy === "function") {
const retryStrategy = await config.retryStrategy();
if (typeof retryStrategy.acquireInitialRetryToken === "function") {
if (retryStrategy.constructor?.name?.includes("Adaptive")) {
setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
}
else {
setFeature(context, "RETRY_MODE_STANDARD", "E");
}
}
else {
setFeature(context, "RETRY_MODE_LEGACY", "D");
}
}
if (typeof config.accountIdEndpointMode === "function") {
const endpointV2 = context.endpointV2;
if (String(endpointV2?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
setFeature(context, "ACCOUNT_ID_ENDPOINT", "O");
}
switch (await config.accountIdEndpointMode?.()) {

@@ -6,0 +28,0 @@ case "disabled":

3

dist-types/check-features.d.ts
import type { AccountIdEndpointMode } from "@aws-sdk/core/account-id-endpoint";
import type { AwsHandlerExecutionContext } from "@aws-sdk/types";
import type { AwsCredentialIdentityProvider, BuildHandlerArguments, Provider } from "@smithy/types";
import type { AwsCredentialIdentityProvider, BuildHandlerArguments, Provider, RetryStrategy, RetryStrategyV2 } from "@smithy/types";
/**

@@ -10,2 +10,3 @@ * @internal

accountIdEndpointMode?: Provider<AccountIdEndpointMode>;
retryStrategy?: Provider<RetryStrategy | RetryStrategyV2>;
}>;

@@ -12,0 +13,0 @@ /**

@@ -7,2 +7,4 @@ import { AccountIdEndpointMode } from "@aws-sdk/core/account-id-endpoint";

Provider,
RetryStrategy,
RetryStrategyV2,
} from "@smithy/types";

@@ -12,2 +14,3 @@ type PreviouslyResolved = Partial<{

accountIdEndpointMode?: Provider<AccountIdEndpointMode>;
retryStrategy?: Provider<RetryStrategy | RetryStrategyV2>;
}>;

@@ -14,0 +17,0 @@ export declare function checkFeatures(

{
"name": "@aws-sdk/middleware-user-agent",
"version": "3.668.0",
"version": "3.669.0",
"scripts": {

@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

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