@aws-sdk/core 3.975.0 → 3.975.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/submodules/client/index.js +6 -121
- package/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js +0 -5
- package/package.json +1 -1
- package/dist-es/submodules/client/util-user-agent-node/getNodeModulesParentDirs.js +0 -15
- package/dist-es/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.js +0 -14
- package/dist-es/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.js +0 -9
- package/dist-es/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.js +0 -75
- package/dist-types/submodules/client/util-user-agent-node/getNodeModulesParentDirs.d.ts +0 -10
- package/dist-types/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.d.ts +0 -8
- package/dist-types/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.d.ts +0 -8
- package/dist-types/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.d.ts +0 -6
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getNodeModulesParentDirs.d.ts +0 -1
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.d.ts +0 -3
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.d.ts +0 -3
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.d.ts +0 -4
|
@@ -4,20 +4,18 @@ const { InvokeStore } = require("@aws/lambda-invoke-store");
|
|
|
4
4
|
const { normalizeProvider } = require("@smithy/core");
|
|
5
5
|
const { platform, release } = require("node:os");
|
|
6
6
|
const { versions, env } = require("node:process");
|
|
7
|
-
const {
|
|
7
|
+
const { isValidHostLabel, isIpAddress, customEndpointFunctions } = require("@smithy/core/endpoints");
|
|
8
|
+
const { EndpointError, resolveEndpoint } = require("@smithy/core/endpoints");
|
|
9
|
+
exports.EndpointError = EndpointError;
|
|
10
|
+
exports.isIpAddress = isIpAddress;
|
|
11
|
+
exports.resolveEndpoint = resolveEndpoint;
|
|
12
|
+
const { loadConfig, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS } = require("@smithy/core/config");
|
|
8
13
|
const { REGION_ENV_NAME, REGION_INI_NAME, resolveRegionConfig } = require("@smithy/core/config");
|
|
9
14
|
exports.NODE_REGION_CONFIG_FILE_OPTIONS = NODE_REGION_CONFIG_FILE_OPTIONS;
|
|
10
15
|
exports.NODE_REGION_CONFIG_OPTIONS = NODE_REGION_CONFIG_OPTIONS;
|
|
11
16
|
exports.REGION_ENV_NAME = REGION_ENV_NAME;
|
|
12
17
|
exports.REGION_INI_NAME = REGION_INI_NAME;
|
|
13
18
|
exports.resolveRegionConfig = resolveRegionConfig;
|
|
14
|
-
const { readFile } = require("node:fs/promises");
|
|
15
|
-
const { normalize, sep, join } = require("node:path");
|
|
16
|
-
const { isValidHostLabel, isIpAddress, customEndpointFunctions } = require("@smithy/core/endpoints");
|
|
17
|
-
const { EndpointError, resolveEndpoint } = require("@smithy/core/endpoints");
|
|
18
|
-
exports.EndpointError = EndpointError;
|
|
19
|
-
exports.isIpAddress = isIpAddress;
|
|
20
|
-
exports.resolveEndpoint = resolveEndpoint;
|
|
21
19
|
|
|
22
20
|
const state = {
|
|
23
21
|
warningEmitted: false,
|
|
@@ -745,115 +743,6 @@ const getRuntimeUserAgentPair = () => {
|
|
|
745
743
|
return ["md/nodejs", versions.node];
|
|
746
744
|
};
|
|
747
745
|
|
|
748
|
-
const getNodeModulesParentDirs = (dirname) => {
|
|
749
|
-
const cwd = process.cwd();
|
|
750
|
-
if (!dirname) {
|
|
751
|
-
return [cwd];
|
|
752
|
-
}
|
|
753
|
-
const normalizedPath = normalize(dirname);
|
|
754
|
-
const parts = normalizedPath.split(sep);
|
|
755
|
-
const nodeModulesIndex = parts.indexOf("node_modules");
|
|
756
|
-
const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep) : normalizedPath;
|
|
757
|
-
if (cwd === parentDir) {
|
|
758
|
-
return [cwd];
|
|
759
|
-
}
|
|
760
|
-
return [parentDir, cwd];
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
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-]+)*)?$/;
|
|
764
|
-
const getSanitizedTypeScriptVersion = (version = "") => {
|
|
765
|
-
const match = version.match(SEMVER_REGEX);
|
|
766
|
-
if (!match) {
|
|
767
|
-
return undefined;
|
|
768
|
-
}
|
|
769
|
-
const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]];
|
|
770
|
-
return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
const ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"];
|
|
774
|
-
const ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"];
|
|
775
|
-
const getSanitizedDevTypeScriptVersion = (version = "") => {
|
|
776
|
-
if (ALLOWED_DIST_TAGS.includes(version)) {
|
|
777
|
-
return version;
|
|
778
|
-
}
|
|
779
|
-
const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? "";
|
|
780
|
-
const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length));
|
|
781
|
-
if (!sanitizedTypeScriptVersion) {
|
|
782
|
-
return undefined;
|
|
783
|
-
}
|
|
784
|
-
return `${prefix}${sanitizedTypeScriptVersion}`;
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
let tscVersion;
|
|
788
|
-
const TS_PACKAGE_JSON = join("node_modules", "typescript", "package.json");
|
|
789
|
-
const getTypeScriptUserAgentPair = async () => {
|
|
790
|
-
if (tscVersion === null) {
|
|
791
|
-
return undefined;
|
|
792
|
-
}
|
|
793
|
-
else if (typeof tscVersion === "string") {
|
|
794
|
-
return ["md/tsc", tscVersion];
|
|
795
|
-
}
|
|
796
|
-
let isTypeScriptDetectionDisabled = false;
|
|
797
|
-
try {
|
|
798
|
-
isTypeScriptDetectionDisabled =
|
|
799
|
-
booleanSelector(process.env, "AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED", SelectorType.ENV) || false;
|
|
800
|
-
}
|
|
801
|
-
catch { }
|
|
802
|
-
if (isTypeScriptDetectionDisabled) {
|
|
803
|
-
tscVersion = null;
|
|
804
|
-
return undefined;
|
|
805
|
-
}
|
|
806
|
-
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
|
|
807
|
-
const nodeModulesParentDirs = getNodeModulesParentDirs(dirname);
|
|
808
|
-
let versionFromApp;
|
|
809
|
-
for (const nodeModulesParentDir of nodeModulesParentDirs) {
|
|
810
|
-
try {
|
|
811
|
-
const appPackageJsonPath = join(nodeModulesParentDir, "package.json");
|
|
812
|
-
const packageJson = await readFile(appPackageJsonPath, "utf-8");
|
|
813
|
-
const { dependencies, devDependencies } = JSON.parse(packageJson);
|
|
814
|
-
const version = devDependencies?.typescript ?? dependencies?.typescript;
|
|
815
|
-
if (typeof version !== "string") {
|
|
816
|
-
continue;
|
|
817
|
-
}
|
|
818
|
-
versionFromApp = version;
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
821
|
-
catch {
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
if (!versionFromApp) {
|
|
825
|
-
tscVersion = null;
|
|
826
|
-
return undefined;
|
|
827
|
-
}
|
|
828
|
-
let versionFromNodeModules;
|
|
829
|
-
for (const nodeModulesParentDir of nodeModulesParentDirs) {
|
|
830
|
-
try {
|
|
831
|
-
const tsPackageJsonPath = join(nodeModulesParentDir, TS_PACKAGE_JSON);
|
|
832
|
-
const packageJson = await readFile(tsPackageJsonPath, "utf-8");
|
|
833
|
-
const { version } = JSON.parse(packageJson);
|
|
834
|
-
const sanitizedVersion = getSanitizedTypeScriptVersion(version);
|
|
835
|
-
if (typeof sanitizedVersion !== "string") {
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
versionFromNodeModules = sanitizedVersion;
|
|
839
|
-
break;
|
|
840
|
-
}
|
|
841
|
-
catch {
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (versionFromNodeModules) {
|
|
845
|
-
tscVersion = versionFromNodeModules;
|
|
846
|
-
return ["md/tsc", tscVersion];
|
|
847
|
-
}
|
|
848
|
-
const sanitizedVersion = getSanitizedDevTypeScriptVersion(versionFromApp);
|
|
849
|
-
if (typeof sanitizedVersion !== "string") {
|
|
850
|
-
tscVersion = null;
|
|
851
|
-
return undefined;
|
|
852
|
-
}
|
|
853
|
-
tscVersion = `dev_${sanitizedVersion}`;
|
|
854
|
-
return ["md/tsc", tscVersion];
|
|
855
|
-
};
|
|
856
|
-
|
|
857
746
|
const crtAvailability = {
|
|
858
747
|
isCrtAvailable: false,
|
|
859
748
|
};
|
|
@@ -875,10 +764,6 @@ const createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
|
|
|
875
764
|
["lang/js"],
|
|
876
765
|
runtimeUserAgentPair,
|
|
877
766
|
];
|
|
878
|
-
const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
|
|
879
|
-
if (typescriptUserAgentPair) {
|
|
880
|
-
sections.push(typescriptUserAgentPair);
|
|
881
|
-
}
|
|
882
767
|
const crtAvailable = isCrtAvailable();
|
|
883
768
|
if (crtAvailable) {
|
|
884
769
|
sections.push(crtAvailable);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { platform, release } from "node:os";
|
|
2
2
|
import { env } from "node:process";
|
|
3
3
|
import { getRuntimeUserAgentPair } from "./getRuntimeUserAgentPair";
|
|
4
|
-
import { getTypeScriptUserAgentPair } from "./getTypeScriptUserAgentPair";
|
|
5
4
|
import { isCrtAvailable } from "./is-crt-available";
|
|
6
5
|
export { crtAvailability } from "./crt-availability";
|
|
7
6
|
export const createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
|
|
@@ -14,10 +13,6 @@ export const createDefaultUserAgentProvider = ({ serviceId, clientVersion }) =>
|
|
|
14
13
|
["lang/js"],
|
|
15
14
|
runtimeUserAgentPair,
|
|
16
15
|
];
|
|
17
|
-
const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
|
|
18
|
-
if (typescriptUserAgentPair) {
|
|
19
|
-
sections.push(typescriptUserAgentPair);
|
|
20
|
-
}
|
|
21
16
|
const crtAvailable = isCrtAvailable();
|
|
22
17
|
if (crtAvailable) {
|
|
23
18
|
sections.push(crtAvailable);
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { normalize, sep } from "node:path";
|
|
2
|
-
export const getNodeModulesParentDirs = (dirname) => {
|
|
3
|
-
const cwd = process.cwd();
|
|
4
|
-
if (!dirname) {
|
|
5
|
-
return [cwd];
|
|
6
|
-
}
|
|
7
|
-
const normalizedPath = normalize(dirname);
|
|
8
|
-
const parts = normalizedPath.split(sep);
|
|
9
|
-
const nodeModulesIndex = parts.indexOf("node_modules");
|
|
10
|
-
const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep) : normalizedPath;
|
|
11
|
-
if (cwd === parentDir) {
|
|
12
|
-
return [cwd];
|
|
13
|
-
}
|
|
14
|
-
return [parentDir, cwd];
|
|
15
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getSanitizedTypeScriptVersion } from "./getSanitizedTypeScriptVersion";
|
|
2
|
-
const ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"];
|
|
3
|
-
const ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"];
|
|
4
|
-
export const getSanitizedDevTypeScriptVersion = (version = "") => {
|
|
5
|
-
if (ALLOWED_DIST_TAGS.includes(version)) {
|
|
6
|
-
return version;
|
|
7
|
-
}
|
|
8
|
-
const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? "";
|
|
9
|
-
const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length));
|
|
10
|
-
if (!sanitizedTypeScriptVersion) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
return `${prefix}${sanitizedTypeScriptVersion}`;
|
|
14
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
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-]+)*)?$/;
|
|
2
|
-
export const getSanitizedTypeScriptVersion = (version = "") => {
|
|
3
|
-
const match = version.match(SEMVER_REGEX);
|
|
4
|
-
if (!match) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]];
|
|
8
|
-
return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
|
|
9
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { booleanSelector, SelectorType } from "@smithy/core/config";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { getNodeModulesParentDirs } from "./getNodeModulesParentDirs";
|
|
5
|
-
import { getSanitizedDevTypeScriptVersion } from "./getSanitizedDevTypeScriptVersion";
|
|
6
|
-
import { getSanitizedTypeScriptVersion } from "./getSanitizedTypeScriptVersion";
|
|
7
|
-
let tscVersion;
|
|
8
|
-
const TS_PACKAGE_JSON = join("node_modules", "typescript", "package.json");
|
|
9
|
-
export const getTypeScriptUserAgentPair = async () => {
|
|
10
|
-
if (tscVersion === null) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
else if (typeof tscVersion === "string") {
|
|
14
|
-
return ["md/tsc", tscVersion];
|
|
15
|
-
}
|
|
16
|
-
let isTypeScriptDetectionDisabled = false;
|
|
17
|
-
try {
|
|
18
|
-
isTypeScriptDetectionDisabled =
|
|
19
|
-
booleanSelector(process.env, "AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED", SelectorType.ENV) || false;
|
|
20
|
-
}
|
|
21
|
-
catch { }
|
|
22
|
-
if (isTypeScriptDetectionDisabled) {
|
|
23
|
-
tscVersion = null;
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
const dirname = typeof __dirname !== "undefined" ? __dirname : undefined;
|
|
27
|
-
const nodeModulesParentDirs = getNodeModulesParentDirs(dirname);
|
|
28
|
-
let versionFromApp;
|
|
29
|
-
for (const nodeModulesParentDir of nodeModulesParentDirs) {
|
|
30
|
-
try {
|
|
31
|
-
const appPackageJsonPath = join(nodeModulesParentDir, "package.json");
|
|
32
|
-
const packageJson = await readFile(appPackageJsonPath, "utf-8");
|
|
33
|
-
const { dependencies, devDependencies } = JSON.parse(packageJson);
|
|
34
|
-
const version = devDependencies?.typescript ?? dependencies?.typescript;
|
|
35
|
-
if (typeof version !== "string") {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
versionFromApp = version;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (!versionFromApp) {
|
|
45
|
-
tscVersion = null;
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
let versionFromNodeModules;
|
|
49
|
-
for (const nodeModulesParentDir of nodeModulesParentDirs) {
|
|
50
|
-
try {
|
|
51
|
-
const tsPackageJsonPath = join(nodeModulesParentDir, TS_PACKAGE_JSON);
|
|
52
|
-
const packageJson = await readFile(tsPackageJsonPath, "utf-8");
|
|
53
|
-
const { version } = JSON.parse(packageJson);
|
|
54
|
-
const sanitizedVersion = getSanitizedTypeScriptVersion(version);
|
|
55
|
-
if (typeof sanitizedVersion !== "string") {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
versionFromNodeModules = sanitizedVersion;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (versionFromNodeModules) {
|
|
65
|
-
tscVersion = versionFromNodeModules;
|
|
66
|
-
return ["md/tsc", tscVersion];
|
|
67
|
-
}
|
|
68
|
-
const sanitizedVersion = getSanitizedDevTypeScriptVersion(versionFromApp);
|
|
69
|
-
if (typeof sanitizedVersion !== "string") {
|
|
70
|
-
tscVersion = null;
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
tscVersion = `dev_${sanitizedVersion}`;
|
|
74
|
-
return ["md/tsc", tscVersion];
|
|
75
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns candidate paths to the node_modules parent directories based on current
|
|
3
|
-
* working directory and, if provided, from the given directory.
|
|
4
|
-
*
|
|
5
|
-
* @param dirname - Optional directory path to derive an additional candidate path from.
|
|
6
|
-
* @returns An array of unique candidate paths to the TypeScript package.json file.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare const getNodeModulesParentDirs: (dirname?: string) => string[];
|
package/dist-types/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sanitizes a TypeScript version string for user-agent reporting.
|
|
3
|
-
* Handles dist tags (e.g., "latest", "beta"), version prefixes (e.g., "^", "~"),
|
|
4
|
-
* and semver strings. Returns undefined if the version is invalid.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare const getSanitizedDevTypeScriptVersion: (version?: string) => string | undefined;
|
package/dist-types/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates a semver string (with optional pre-release and/or build metadata).
|
|
3
|
-
* If valid, returns the version string with build metadata stripped.
|
|
4
|
-
* Returns undefined if the string is not a valid semver.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare const getSanitizedTypeScriptVersion: (version?: string) => string | undefined;
|
package/dist-types/ts3.4/submodules/client/util-user-agent-node/getNodeModulesParentDirs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getNodeModulesParentDirs: (dirname?: string) => string[];
|