🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@smithy/core

Package Overview
Dependencies
Maintainers
2
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/core - npm Package Compare versions

Comparing version
3.29.5
to
3.29.6
+8
dist-es/submodules...tors/getIgnoreConfiguredEndpointUrls.js
import { booleanSelector, SelectorType } from "@smithy/core/config";
export const ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
export const CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
export const ignoreConfiguredEndpointUrlsConfigSelectors = {
environmentVariableSelector: (env) => booleanSelector(env, ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.ENV),
configFileSelector: (profile) => booleanSelector(profile, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.CONFIG),
default: false,
};
import { type LoadedConfigSelectors } from "@smithy/core/config";
/**
* @internal
*/
export declare const ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
/**
* @internal
*/
export declare const CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
/**
* Config selectors for the ignore_configured_endpoint_urls option.
* When true, configured endpoint URLs from environment variables
* and the shared configuration file are not used.
*
* @internal
*/
export declare const ignoreConfiguredEndpointUrlsConfigSelectors: LoadedConfigSelectors<boolean | undefined>;
import { LoadedConfigSelectors } from "@smithy/core/config";
/**
* @internal
*/
export declare const ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
/**
* @internal
*/
export declare const CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
/**
* Config selectors for the ignore_configured_endpoint_urls option.
* When true, configured endpoint URLs from environment variables
* and the shared configuration file are not used.
*
* @internal
*/
export declare const ignoreConfiguredEndpointUrlsConfigSelectors: LoadedConfigSelectors<boolean | undefined>;
+3
-1

@@ -98,3 +98,3 @@ const { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel } = require("@smithy/core/transport");

return async (commandInput, instructionsSupplier, clientConfig, context) => {
if (!clientConfig.isCustomEndpoint) {
if (!clientConfig.isCustomEndpoint && !clientConfig.ignoreConfiguredEndpointUrls) {
let endpointFromConfig;

@@ -110,2 +110,3 @@ if (clientConfig.serviceConfiguredEndpoint) {

clientConfig.isCustomEndpoint = true;
context?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${endpointFromConfig}`);
}

@@ -241,2 +242,3 @@ }

useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false),
ignoreConfiguredEndpointUrls: !!input.ignoreConfiguredEndpointUrls,
});

@@ -243,0 +245,0 @@ let configuredEndpointPromise = undefined;

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

const { CONFIG_PREFIX_SEPARATOR, loadConfig } = require("@smithy/core/config");
const { CONFIG_PREFIX_SEPARATOR, booleanSelector, SelectorType, loadConfig } = require("@smithy/core/config");
const { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel } = require("@smithy/core/transport");

@@ -22,10 +22,12 @@ exports.isValidHostLabel = isValidHostLabel;

configFileSelector: (profile, config) => {
if (config && profile.services) {
const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
if (servicesSection) {
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
if (endpointUrl)
return endpointUrl;
if (profile.services) {
const servicesSectionKey = ["services", profile.services].join(CONFIG_PREFIX_SEPARATOR);
if (!config || !config[servicesSectionKey]) {
throw new Error(`The services section "${profile.services}" specified in the profile is not present in the shared configuration file.`);
}
const servicesSection = config[servicesSectionKey];
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
if (endpointUrl)
return endpointUrl;
}

@@ -40,4 +42,18 @@ const endpointUrl = profile[CONFIG_ENDPOINT_URL];

const getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
const ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
const CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
const ignoreConfiguredEndpointUrlsConfigSelectors = {
environmentVariableSelector: (env) => booleanSelector(env, ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.ENV),
configFileSelector: (profile) => booleanSelector(profile, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.CONFIG),
default: false,
};
const getEndpointFromConfig = async (serviceId) => {
const ignore = await loadConfig(ignoreConfiguredEndpointUrlsConfigSelectors)();
if (ignore) {
return undefined;
}
return loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
};
const resolveParamsForS3 = async (endpointParams) => {

@@ -132,3 +148,3 @@ const bucket = endpointParams?.Bucket || "";

return async (commandInput, instructionsSupplier, clientConfig, context) => {
if (!clientConfig.isCustomEndpoint) {
if (!clientConfig.isCustomEndpoint && !clientConfig.ignoreConfiguredEndpointUrls) {
let endpointFromConfig;

@@ -144,2 +160,3 @@ if (clientConfig.serviceConfiguredEndpoint) {

clientConfig.isCustomEndpoint = true;
context?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${endpointFromConfig}`);
}

@@ -275,2 +292,3 @@ }

useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false),
ignoreConfiguredEndpointUrls: !!input.ignoreConfiguredEndpointUrls,
});

@@ -277,0 +295,0 @@ let configuredEndpointPromise = undefined;

import { loadConfig } from "@smithy/core/config";
import { getEndpointUrlConfig } from "./getEndpointUrlConfig";
export const getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
import { ignoreConfiguredEndpointUrlsConfigSelectors } from "./getIgnoreConfiguredEndpointUrls";
export const getEndpointFromConfig = async (serviceId) => {
const ignore = await loadConfig(ignoreConfiguredEndpointUrlsConfigSelectors)();
if (ignore) {
return undefined;
}
return loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
};

@@ -6,3 +6,3 @@ import { resolveParamsForS3 } from "../service-customizations";

return async (commandInput, instructionsSupplier, clientConfig, context) => {
if (!clientConfig.isCustomEndpoint) {
if (!clientConfig.isCustomEndpoint && !clientConfig.ignoreConfiguredEndpointUrls) {
let endpointFromConfig;

@@ -18,2 +18,3 @@ if (clientConfig.serviceConfiguredEndpoint) {

clientConfig.isCustomEndpoint = true;
context?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${endpointFromConfig}`);
}

@@ -20,0 +21,0 @@ }

import { CONFIG_PREFIX_SEPARATOR } from "@smithy/core/config";
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
const CONFIG_ENDPOINT_URL = "endpoint_url";
export const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
export const CONFIG_ENDPOINT_URL = "endpoint_url";
export const getEndpointUrlConfig = (serviceId) => ({

@@ -16,10 +16,12 @@ environmentVariableSelector: (env) => {

configFileSelector: (profile, config) => {
if (config && profile.services) {
const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
if (servicesSection) {
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
if (endpointUrl)
return endpointUrl;
if (profile.services) {
const servicesSectionKey = ["services", profile.services].join(CONFIG_PREFIX_SEPARATOR);
if (!config || !config[servicesSectionKey]) {
throw new Error(`The services section "${profile.services}" specified in the profile is not present in the shared configuration file.`);
}
const servicesSection = config[servicesSectionKey];
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
if (endpointUrl)
return endpointUrl;
}

@@ -26,0 +28,0 @@ const endpointUrl = profile[CONFIG_ENDPOINT_URL];

@@ -15,2 +15,3 @@ import { normalizeProvider } from "@smithy/core/transport";

useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false),
ignoreConfiguredEndpointUrls: !!input.ignoreConfiguredEndpointUrls,
});

@@ -17,0 +18,0 @@ let configuredEndpointPromise = undefined;

import { type LoadedConfigSelectors } from "@smithy/core/config";
/**
* @internal
*/
export declare const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
/**
* @internal
*/
export declare const CONFIG_ENDPOINT_URL = "endpoint_url";
/**
* @internal
*/
export declare const getEndpointUrlConfig: (serviceId: string) => LoadedConfigSelectors<string | undefined>;

@@ -41,2 +41,10 @@ import type { Endpoint, EndpointParameters, EndpointV2, Logger, Provider, UrlParser } from "@smithy/types";

/**
* When true, endpoint URLs from environment variables and the shared
* configuration file are not used. Does not affect endpoints set
* via code (e.g. client constructor endpoint option).
*
* Default false.
*/
ignoreConfiguredEndpointUrls?: boolean;
/**
* This field is used internally so you should not fill any value to this field.

@@ -103,2 +111,6 @@ *

/**
* Whether configured endpoint URLs should be ignored.
*/
ignoreConfiguredEndpointUrls: boolean;
/**
* A configured endpoint global or specific to the service from ENV or AWS SDK configuration files.

@@ -105,0 +117,0 @@ * @internal

import { LoadedConfigSelectors } from "@smithy/core/config";
/**
* @internal
*/
export declare const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
/**
* @internal
*/
export declare const CONFIG_ENDPOINT_URL = "endpoint_url";
/**
* @internal
*/
export declare const getEndpointUrlConfig: (serviceId: string) => LoadedConfigSelectors<string | undefined>;

@@ -41,2 +41,10 @@ import { Endpoint, EndpointParameters, EndpointV2, Logger, Provider, UrlParser } from "@smithy/types";

/**
* When true, endpoint URLs from environment variables and the shared
* configuration file are not used. Does not affect endpoints set
* via code (e.g. client constructor endpoint option).
*
* Default false.
*/
ignoreConfiguredEndpointUrls?: boolean;
/**
* This field is used internally so you should not fill any value to this field.

@@ -103,2 +111,6 @@ *

/**
* Whether configured endpoint URLs should be ignored.
*/
ignoreConfiguredEndpointUrls: boolean;
/**
* A configured endpoint global or specific to the service from ENV or AWS SDK configuration files.

@@ -105,0 +117,0 @@ * @internal

{
"name": "@smithy/core",
"version": "3.29.5",
"scripts": {
"benchmark:cbor": "node ./scripts/cbor-perf.mjs",
"benchmark:checksum": "node ./scripts/checksum-perf.mjs",
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
"clean": "premove dist-cjs dist-es dist-types",
"extract:docs": "api-extractor run --local",
"lint": "node ../../scripts/validation/submodules-linter.js",
"prebuild": "yarn lint",
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"test": "yarn g:vitest run",
"test:watch": "yarn g:vitest watch",
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
"version": "3.29.6",
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
"license": "Apache-2.0",
"author": {
"name": "AWS Smithy Team",
"email": "",
"url": "https://smithy.io"
},
"repository": {
"type": "git",
"url": "https://github.com/smithy-lang/smithy-typescript.git",
"directory": "packages/core"
},
"files": [
"./cbor.d.ts",
"./cbor.js",
"./checksum.d.ts",
"./checksum.js",
"./client.d.ts",
"./client.js",
"./config.d.ts",
"./config.js",
"./endpoints.d.ts",
"./endpoints.js",
"./event-streams.d.ts",
"./event-streams.js",
"./protocols.d.ts",
"./protocols.js",
"./retry.d.ts",
"./retry.js",
"./schema.d.ts",
"./schema.js",
"./serde.d.ts",
"./serde.js",
"./transport.d.ts",
"./transport.js",
"dist-*/**"
],
"sideEffects": false,
"main": "./dist-cjs/index.js",
"module": "./dist-es/index.js",
"browser": {
"./dist-es/submodules/checksum/index.js": "./dist-es/submodules/checksum/index.browser.js",
"./dist-es/submodules/config/index.js": "./dist-es/submodules/config/index.browser.js",
"./dist-es/submodules/endpoints/index.js": "./dist-es/submodules/endpoints/index.browser.js",
"./dist-es/submodules/event-streams/index.js": "./dist-es/submodules/event-streams/index.browser.js",
"./dist-es/submodules/retry/index.js": "./dist-es/submodules/retry/index.browser.js",
"./dist-es/submodules/serde/index.js": "./dist-es/submodules/serde/index.browser.js"
},
"types": "./dist-types/index.d.ts",
"typesVersions": {
"<4.5": {
"dist-types/*": [
"dist-types/ts3.4/*"
],
"*": [
"dist-types/ts3.4/submodules/*/index.d.ts"
]
}
},
"react-native": {
"./dist-es/submodules/checksum/index.js": "./dist-es/submodules/checksum/index.native.js",
"./dist-cjs/submodules/checksum/index.js": "./dist-cjs/submodules/checksum/index.native.js",
"./dist-es/submodules/config/index.js": "./dist-es/submodules/config/index.native.js",
"./dist-cjs/submodules/config/index.js": "./dist-cjs/submodules/config/index.native.js",
"./dist-es/submodules/serde/index.js": "./dist-es/submodules/serde/index.native.js",
"./dist-cjs/submodules/serde/index.js": "./dist-cjs/submodules/serde/index.native.js",
"./dist-es/submodules/endpoints/index.js": "./dist-es/submodules/endpoints/index.browser.js",
"./dist-cjs/submodules/endpoints/index.js": "./dist-cjs/submodules/endpoints/index.browser.js",
"./dist-es/submodules/event-streams/index.js": "./dist-es/submodules/event-streams/index.browser.js",
"./dist-cjs/submodules/event-streams/index.js": "./dist-cjs/submodules/event-streams/index.browser.js",
"./dist-es/submodules/retry/index.js": "./dist-es/submodules/retry/index.browser.js",
"./dist-cjs/submodules/retry/index.js": "./dist-cjs/submodules/retry/index.browser.js"
},
"exports": {

@@ -164,9 +217,22 @@ ".": {

},
"author": {
"name": "AWS Smithy Team",
"email": "",
"url": "https://smithy.io"
"publishConfig": {
"directory": ".release/package"
},
"license": "Apache-2.0",
"sideEffects": false,
"scripts": {
"benchmark:cbor": "node ./scripts/cbor-perf.mjs",
"benchmark:checksum": "node ./scripts/checksum-perf.mjs",
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
"clean": "premove dist-cjs dist-es dist-types",
"extract:docs": "api-extractor run --local",
"lint": "node ../../scripts/validation/submodules-linter.js",
"prebuild": "yarn lint",
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"test": "yarn g:vitest run",
"test:watch": "yarn g:vitest watch",
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
},
"dependencies": {

@@ -185,74 +251,8 @@ "@smithy/types": "^4.16.1",

},
"engines": {
"node": ">=18.0.0"
},
"typesVersions": {
"<4.5": {
"dist-types/*": [
"dist-types/ts3.4/*"
],
"*": [
"dist-types/ts3.4/submodules/*/index.d.ts"
]
}
},
"files": [
"./cbor.d.ts",
"./cbor.js",
"./checksum.d.ts",
"./checksum.js",
"./client.d.ts",
"./client.js",
"./config.d.ts",
"./config.js",
"./endpoints.d.ts",
"./endpoints.js",
"./event-streams.d.ts",
"./event-streams.js",
"./protocols.d.ts",
"./protocols.js",
"./retry.d.ts",
"./retry.js",
"./schema.d.ts",
"./schema.js",
"./serde.d.ts",
"./serde.js",
"./transport.d.ts",
"./transport.js",
"dist-*/**"
],
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
"repository": {
"type": "git",
"url": "https://github.com/smithy-lang/smithy-typescript.git",
"directory": "packages/core"
},
"typedoc": {
"entryPoint": "src/index.ts"
},
"publishConfig": {
"directory": ".release/package"
},
"browser": {
"./dist-es/submodules/checksum/index.js": "./dist-es/submodules/checksum/index.browser.js",
"./dist-es/submodules/config/index.js": "./dist-es/submodules/config/index.browser.js",
"./dist-es/submodules/endpoints/index.js": "./dist-es/submodules/endpoints/index.browser.js",
"./dist-es/submodules/event-streams/index.js": "./dist-es/submodules/event-streams/index.browser.js",
"./dist-es/submodules/retry/index.js": "./dist-es/submodules/retry/index.browser.js",
"./dist-es/submodules/serde/index.js": "./dist-es/submodules/serde/index.browser.js"
},
"react-native": {
"./dist-es/submodules/checksum/index.js": "./dist-es/submodules/checksum/index.native.js",
"./dist-cjs/submodules/checksum/index.js": "./dist-cjs/submodules/checksum/index.native.js",
"./dist-es/submodules/config/index.js": "./dist-es/submodules/config/index.native.js",
"./dist-cjs/submodules/config/index.js": "./dist-cjs/submodules/config/index.native.js",
"./dist-es/submodules/serde/index.js": "./dist-es/submodules/serde/index.native.js",
"./dist-cjs/submodules/serde/index.js": "./dist-cjs/submodules/serde/index.native.js",
"./dist-es/submodules/endpoints/index.js": "./dist-es/submodules/endpoints/index.browser.js",
"./dist-cjs/submodules/endpoints/index.js": "./dist-cjs/submodules/endpoints/index.browser.js",
"./dist-es/submodules/event-streams/index.js": "./dist-es/submodules/event-streams/index.browser.js",
"./dist-cjs/submodules/event-streams/index.js": "./dist-cjs/submodules/event-streams/index.browser.js",
"./dist-es/submodules/retry/index.js": "./dist-es/submodules/retry/index.browser.js",
"./dist-cjs/submodules/retry/index.js": "./dist-cjs/submodules/retry/index.browser.js"
"engines": {
"node": ">=18.0.0"
}
}
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
const CONFIG_ENDPOINT_URL = "endpoint_url";
export const getEndpointUrlConfig = (serviceId) => ({
environmentVariableSelector: (env) => {
const serviceEndpointUrlSections = [ENV_ENDPOINT_URL, ...serviceId.split(" ").map((w) => w.toUpperCase())];
const serviceEndpointUrl = env[serviceEndpointUrlSections.join("_")];
if (serviceEndpointUrl)
return serviceEndpointUrl;
const endpointUrl = env[ENV_ENDPOINT_URL];
if (endpointUrl)
return endpointUrl;
return undefined;
},
configFileSelector: (profile) => {
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
if (endpointUrl)
return endpointUrl;
return undefined;
},
default: undefined,
});
/**
* Inlined from @smithy/core/config to avoid circular dependency.
*
* @internal
*/
type LoadedConfigSelectors<T> = {
environmentVariableSelector: (env: Record<string, string | undefined>) => T | undefined;
configFileSelector: (profile: Record<string, string | undefined>, configFile?: Record<string, Record<string, string | undefined>>) => T | undefined;
default: T | (() => T);
};
export declare const getEndpointUrlConfig: (serviceId: string) => LoadedConfigSelectors<string | undefined>;
export {};
/**
* Inlined from @smithy/core/config to avoid circular dependency.
*
* @internal
*/
type LoadedConfigSelectors<T> = {
environmentVariableSelector: (env: Record<string, string | undefined>) => T | undefined;
configFileSelector: (profile: Record<string, string | undefined>, configFile?: Record<string, Record<string, string | undefined>>) => T | undefined;
default: T | (() => T);
};
export declare const getEndpointUrlConfig: (serviceId: string) => LoadedConfigSelectors<string | undefined>;
export {};