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

@aws-sdk/core

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/core - npm Package Compare versions

Comparing version
3.975.0
to
3.975.1
+6
-121
dist-cjs/submodules/client/index.js

@@ -7,3 +7,8 @@ const { Retry, RETRY_MODES } = require("@smithy/core/retry");

const { versions, env } = require("node:process");
const { booleanSelector, SelectorType, loadConfig, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS } = require("@smithy/core/config");
const { isValidHostLabel, isIpAddress, customEndpointFunctions } = require("@smithy/core/endpoints");
const { EndpointError, resolveEndpoint } = require("@smithy/core/endpoints");
exports.EndpointError = EndpointError;
exports.isIpAddress = isIpAddress;
exports.resolveEndpoint = resolveEndpoint;
const { loadConfig, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS } = require("@smithy/core/config");
const { REGION_ENV_NAME, REGION_INI_NAME, resolveRegionConfig } = require("@smithy/core/config");

@@ -15,9 +20,2 @@ exports.NODE_REGION_CONFIG_FILE_OPTIONS = NODE_REGION_CONFIG_FILE_OPTIONS;

exports.resolveRegionConfig = resolveRegionConfig;
const { readFile } = require("node:fs/promises");
const { normalize, sep, join } = require("node:path");
const { isValidHostLabel, isIpAddress, customEndpointFunctions } = require("@smithy/core/endpoints");
const { EndpointError, resolveEndpoint } = require("@smithy/core/endpoints");
exports.EndpointError = EndpointError;
exports.isIpAddress = isIpAddress;
exports.resolveEndpoint = resolveEndpoint;

@@ -750,111 +748,2 @@ const state = {

const getNodeModulesParentDirs = (dirname) => {
const cwd = process.cwd();
if (!dirname) {
return [cwd];
}
const normalizedPath = normalize(dirname);
const parts = normalizedPath.split(sep);
const nodeModulesIndex = parts.indexOf("node_modules");
const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep) : normalizedPath;
if (cwd === parentDir) {
return [cwd];
}
return [parentDir, cwd];
};
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
const getSanitizedTypeScriptVersion = (version = "") => {
const match = version.match(SEMVER_REGEX);
if (!match) {
return undefined;
}
const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]];
return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
};
const ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"];
const ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"];
const getSanitizedDevTypeScriptVersion = (version = "") => {
if (ALLOWED_DIST_TAGS.includes(version)) {
return version;
}
const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? "";
const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length));
if (!sanitizedTypeScriptVersion) {
return undefined;
}
return `${prefix}${sanitizedTypeScriptVersion}`;
};
let tscVersion;
const TS_PACKAGE_JSON = join("node_modules", "typescript", "package.json");
const getTypeScriptUserAgentPair = async () => {
if (tscVersion === null) {
return undefined;
}
else if (typeof tscVersion === "string") {
return ["md/tsc", tscVersion];
}
let isTypeScriptDetectionDisabled = false;
try {
isTypeScriptDetectionDisabled =
booleanSelector(process.env, "AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED", SelectorType.ENV) || false;
}
catch { }
if (isTypeScriptDetectionDisabled) {
tscVersion = null;
return undefined;
}
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
const nodeModulesParentDirs = getNodeModulesParentDirs(dirname);
let versionFromApp;
for (const nodeModulesParentDir of nodeModulesParentDirs) {
try {
const appPackageJsonPath = join(nodeModulesParentDir, "package.json");
const packageJson = await readFile(appPackageJsonPath, "utf-8");
const { dependencies, devDependencies } = JSON.parse(packageJson);
const version = devDependencies?.typescript ?? dependencies?.typescript;
if (typeof version !== "string") {
continue;
}
versionFromApp = version;
break;
}
catch {
}
}
if (!versionFromApp) {
tscVersion = null;
return undefined;
}
let versionFromNodeModules;
for (const nodeModulesParentDir of nodeModulesParentDirs) {
try {
const tsPackageJsonPath = join(nodeModulesParentDir, TS_PACKAGE_JSON);
const packageJson = await readFile(tsPackageJsonPath, "utf-8");
const { version } = JSON.parse(packageJson);
const sanitizedVersion = getSanitizedTypeScriptVersion(version);
if (typeof sanitizedVersion !== "string") {
continue;
}
versionFromNodeModules = sanitizedVersion;
break;
}
catch {
}
}
if (versionFromNodeModules) {
tscVersion = versionFromNodeModules;
return ["md/tsc", tscVersion];
}
const sanitizedVersion = getSanitizedDevTypeScriptVersion(versionFromApp);
if (typeof sanitizedVersion !== "string") {
tscVersion = null;
return undefined;
}
tscVersion = `dev_${sanitizedVersion}`;
return ["md/tsc", tscVersion];
};
const crtAvailability = {

@@ -881,6 +770,2 @@ isCrtAvailable: false,

];
const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
if (typescriptUserAgentPair) {
sections.push(typescriptUserAgentPair);
}
const crtAvailable = isCrtAvailable();

@@ -887,0 +772,0 @@ if (crtAvailable) {

import { platform, release } from "node:os";
import { env } from "node:process";
import { getRuntimeUserAgentPair } from "./getRuntimeUserAgentPair";
import { getTypeScriptUserAgentPair } from "./getTypeScriptUserAgentPair";
import { isCrtAvailable } from "./is-crt-available";

@@ -17,6 +16,2 @@ export { crtAvailability } from "./crt-availability";

];
const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
if (typescriptUserAgentPair) {
sections.push(typescriptUserAgentPair);
}
const crtAvailable = isCrtAvailable();

@@ -23,0 +18,0 @@ if (crtAvailable) {

+1
-1
{
"name": "@aws-sdk/core",
"version": "3.975.0",
"version": "3.975.1",
"description": "Core functions & classes shared by multiple AWS SDK clients.",

@@ -5,0 +5,0 @@ "scripts": {

import { normalize, sep } from "node:path";
export const getNodeModulesParentDirs = (dirname) => {
const cwd = process.cwd();
if (!dirname) {
return [cwd];
}
const normalizedPath = normalize(dirname);
const parts = normalizedPath.split(sep);
const nodeModulesIndex = parts.indexOf("node_modules");
const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep) : normalizedPath;
if (cwd === parentDir) {
return [cwd];
}
return [parentDir, cwd];
};
import { getSanitizedTypeScriptVersion } from "./getSanitizedTypeScriptVersion";
const ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"];
const ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"];
export const getSanitizedDevTypeScriptVersion = (version = "") => {
if (ALLOWED_DIST_TAGS.includes(version)) {
return version;
}
const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? "";
const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length));
if (!sanitizedTypeScriptVersion) {
return undefined;
}
return `${prefix}${sanitizedTypeScriptVersion}`;
};
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
export const getSanitizedTypeScriptVersion = (version = "") => {
const match = version.match(SEMVER_REGEX);
if (!match) {
return undefined;
}
const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]];
return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
};
import { booleanSelector, SelectorType } from "@smithy/core/config";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { getNodeModulesParentDirs } from "./getNodeModulesParentDirs";
import { getSanitizedDevTypeScriptVersion } from "./getSanitizedDevTypeScriptVersion";
import { getSanitizedTypeScriptVersion } from "./getSanitizedTypeScriptVersion";
let tscVersion;
const TS_PACKAGE_JSON = join("node_modules", "typescript", "package.json");
export const getTypeScriptUserAgentPair = async () => {
if (tscVersion === null) {
return undefined;
}
else if (typeof tscVersion === "string") {
return ["md/tsc", tscVersion];
}
let isTypeScriptDetectionDisabled = false;
try {
isTypeScriptDetectionDisabled =
booleanSelector(process.env, "AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED", SelectorType.ENV) || false;
}
catch { }
if (isTypeScriptDetectionDisabled) {
tscVersion = null;
return undefined;
}
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
const nodeModulesParentDirs = getNodeModulesParentDirs(dirname);
let versionFromApp;
for (const nodeModulesParentDir of nodeModulesParentDirs) {
try {
const appPackageJsonPath = join(nodeModulesParentDir, "package.json");
const packageJson = await readFile(appPackageJsonPath, "utf-8");
const { dependencies, devDependencies } = JSON.parse(packageJson);
const version = devDependencies?.typescript ?? dependencies?.typescript;
if (typeof version !== "string") {
continue;
}
versionFromApp = version;
break;
}
catch {
}
}
if (!versionFromApp) {
tscVersion = null;
return undefined;
}
let versionFromNodeModules;
for (const nodeModulesParentDir of nodeModulesParentDirs) {
try {
const tsPackageJsonPath = join(nodeModulesParentDir, TS_PACKAGE_JSON);
const packageJson = await readFile(tsPackageJsonPath, "utf-8");
const { version } = JSON.parse(packageJson);
const sanitizedVersion = getSanitizedTypeScriptVersion(version);
if (typeof sanitizedVersion !== "string") {
continue;
}
versionFromNodeModules = sanitizedVersion;
break;
}
catch {
}
}
if (versionFromNodeModules) {
tscVersion = versionFromNodeModules;
return ["md/tsc", tscVersion];
}
const sanitizedVersion = getSanitizedDevTypeScriptVersion(versionFromApp);
if (typeof sanitizedVersion !== "string") {
tscVersion = null;
return undefined;
}
tscVersion = `dev_${sanitizedVersion}`;
return ["md/tsc", tscVersion];
};
/**
* Returns candidate paths to the node_modules parent directories based on current
* working directory and, if provided, from the given directory.
*
* @param dirname - Optional directory path to derive an additional candidate path from.
* @returns An array of unique candidate paths to the TypeScript package.json file.
*
* @internal
*/
export declare const getNodeModulesParentDirs: (dirname?: string) => string[];
/**
* Sanitizes a TypeScript version string for user-agent reporting.
* Handles dist tags (e.g., "latest", "beta"), version prefixes (e.g., "^", "~"),
* and semver strings. Returns undefined if the version is invalid.
*
* @internal
*/
export declare const getSanitizedDevTypeScriptVersion: (version?: string) => string | undefined;
/**
* Validates a semver string (with optional pre-release and/or build metadata).
* If valid, returns the version string with build metadata stripped.
* Returns undefined if the string is not a valid semver.
*
* @internal
*/
export declare const getSanitizedTypeScriptVersion: (version?: string) => string | undefined;
import type { UserAgentPair } from "@smithy/types";
/**
* Returns the tyescript name and version as a user agent pair, if present.
* @internal
*/
export declare const getTypeScriptUserAgentPair: () => Promise<UserAgentPair | undefined>;
export declare const getNodeModulesParentDirs: (dirname?: string) => string[];
export declare const getSanitizedDevTypeScriptVersion: (
version?: string
) => string | undefined;
export declare const getSanitizedTypeScriptVersion: (
version?: string
) => string | undefined;
import { UserAgentPair } from "@smithy/types";
export declare const getTypeScriptUserAgentPair: () => Promise<
UserAgentPair | undefined
>;