include node_modules so release .zip is deployable

This commit is contained in:
2023-11-24 17:44:25 -05:00
parent 6c86cfe5d2
commit 8b11c41267
8963 changed files with 874175 additions and 1 deletions
+70
View File
@@ -0,0 +1,70 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.451.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.450.0...v3.451.0) (2023-11-14)
**Note:** Version bump only for package @aws-sdk/core
# [3.445.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.444.0...v3.445.0) (2023-11-07)
### Bug Fixes
* **core:** add tslib ([#5459](https://github.com/aws/aws-sdk-js-v3/issues/5459)) ([35a1aed](https://github.com/aws/aws-sdk-js-v3/commit/35a1aed1f0d2d6fb33c24232cb24268a1f8c1b05))
# [3.441.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.440.0...v3.441.0) (2023-11-01)
**Note:** Version bump only for package @aws-sdk/core
# [3.436.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.435.0...v3.436.0) (2023-10-25)
**Note:** Version bump only for package @aws-sdk/core
# [3.433.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.432.0...v3.433.0) (2023-10-20)
### Bug Fixes
* **codegen:** use partial record for enum keyed types ([#5391](https://github.com/aws/aws-sdk-js-v3/issues/5391)) ([70c2107](https://github.com/aws/aws-sdk-js-v3/commit/70c2107b970d035bfedb211278c88fdbfc2e5334))
# [3.431.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.430.0...v3.431.0) (2023-10-18)
**Note:** Version bump only for package @aws-sdk/core
# [3.430.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.429.0...v3.430.0) (2023-10-17)
**Note:** Version bump only for package @aws-sdk/core
# [3.429.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.428.0...v3.429.0) (2023-10-16)
**Note:** Version bump only for package @aws-sdk/core
+5
View File
@@ -0,0 +1,5 @@
# @aws-sdk/core
This package provides common or core functionality to the AWS SDK for JavaScript (v3).
You do not need to explicitly install this package, since it will be transitively installed by AWS SDK clients.
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../api-extractor.packages.json",
"mainEntryPointFilePath": "./dist-types/index.d.ts"
}
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.emitWarningIfUnsupportedVersion = void 0;
let warningEmitted = false;
const emitWarningIfUnsupportedVersion = (version) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
warningEmitted = true;
process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 14.x on May 1, 2024.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to an active Node.js LTS version.
More information can be found at: https://a.co/dzr2AJd`);
}
};
exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
+4
View File
@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./emitWarningIfUnsupportedVersion"), exports);
+5
View File
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./client/index"), exports);
tslib_1.__exportStar(require("./protocols/index"), exports);
+59
View File
@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._toNum = exports._toBool = exports._toStr = void 0;
const _toStr = (val) => {
if (val == null) {
return val;
}
if (typeof val === "number" || typeof val === "bigint") {
const warning = new Error(`Received number ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
if (typeof val === "boolean") {
const warning = new Error(`Received boolean ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
return val;
};
exports._toStr = _toStr;
const _toBool = (val) => {
if (val == null) {
return val;
}
if (typeof val === "number") {
}
if (typeof val === "string") {
const lowercase = val.toLowerCase();
if (val !== "" && lowercase !== "false" && lowercase !== "true") {
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
warning.name = "Warning";
console.warn(warning);
}
return val !== "" && lowercase !== "false";
}
return val;
};
exports._toBool = _toBool;
const _toNum = (val) => {
if (val == null) {
return val;
}
if (typeof val === "boolean") {
}
if (typeof val === "string") {
const num = Number(val);
if (num.toString() !== val) {
const warning = new Error(`Received string "${val}" where a number was expected.`);
warning.name = "Warning";
console.warn(warning);
return val;
}
return num;
}
return val;
};
exports._toNum = _toNum;
+5
View File
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./coercing-serializers"), exports);
tslib_1.__exportStar(require("./json/awsExpectUnion"), exports);
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.awsExpectUnion = void 0;
const smithy_client_1 = require("@smithy/smithy-client");
const awsExpectUnion = (value) => {
if (value == null) {
return undefined;
}
if (typeof value === "object" && "__type" in value) {
delete value.__type;
}
return (0, smithy_client_1.expectUnion)(value);
};
exports.awsExpectUnion = awsExpectUnion;
@@ -0,0 +1,13 @@
let warningEmitted = false;
export const emitWarningIfUnsupportedVersion = (version) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
warningEmitted = true;
process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 14.x on May 1, 2024.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to an active Node.js LTS version.
More information can be found at: https://a.co/dzr2AJd`);
}
};
+1
View File
@@ -0,0 +1 @@
export * from "./emitWarningIfUnsupportedVersion";
+2
View File
@@ -0,0 +1,2 @@
export * from "./client/index";
export * from "./protocols/index";
+53
View File
@@ -0,0 +1,53 @@
export const _toStr = (val) => {
if (val == null) {
return val;
}
if (typeof val === "number" || typeof val === "bigint") {
const warning = new Error(`Received number ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
if (typeof val === "boolean") {
const warning = new Error(`Received boolean ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
return val;
};
export const _toBool = (val) => {
if (val == null) {
return val;
}
if (typeof val === "number") {
}
if (typeof val === "string") {
const lowercase = val.toLowerCase();
if (val !== "" && lowercase !== "false" && lowercase !== "true") {
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
warning.name = "Warning";
console.warn(warning);
}
return val !== "" && lowercase !== "false";
}
return val;
};
export const _toNum = (val) => {
if (val == null) {
return val;
}
if (typeof val === "boolean") {
}
if (typeof val === "string") {
const num = Number(val);
if (num.toString() !== val) {
const warning = new Error(`Received string "${val}" where a number was expected.`);
warning.name = "Warning";
console.warn(warning);
return val;
}
return num;
}
return val;
};
+2
View File
@@ -0,0 +1,2 @@
export * from "./coercing-serializers";
export * from "./json/awsExpectUnion";
+10
View File
@@ -0,0 +1,10 @@
import { expectUnion } from "@smithy/smithy-client";
export const awsExpectUnion = (value) => {
if (value == null) {
return undefined;
}
if (typeof value === "object" && "__type" in value) {
delete value.__type;
}
return expectUnion(value);
};
@@ -0,0 +1,9 @@
/**
* @internal
*
* Emits warning if the provided Node.js version string is
* pending deprecation by AWS SDK JSv3.
*
* @param version - The Node.js version string.
*/
export declare const emitWarningIfUnsupportedVersion: (version: string) => void;
+1
View File
@@ -0,0 +1 @@
export * from "./emitWarningIfUnsupportedVersion";
+2
View File
@@ -0,0 +1,2 @@
export * from "./client/index";
export * from "./protocols/index";
@@ -0,0 +1,18 @@
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export declare const _toStr: (val: unknown) => string | undefined;
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export declare const _toBool: (val: unknown) => boolean | undefined;
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export declare const _toNum: (val: unknown) => number | undefined;
+2
View File
@@ -0,0 +1,2 @@
export * from "./coercing-serializers";
export * from "./json/awsExpectUnion";
@@ -0,0 +1,7 @@
/**
* @internal
*
* Forwards to Smithy's expectUnion function, but also ignores
* the `__type` field if it is present.
*/
export declare const awsExpectUnion: (value: unknown) => Record<string, any> | undefined;
@@ -0,0 +1 @@
export declare const emitWarningIfUnsupportedVersion: (version: string) => void;
+1
View File
@@ -0,0 +1 @@
export * from "./emitWarningIfUnsupportedVersion";
+2
View File
@@ -0,0 +1,2 @@
export * from "./client/index";
export * from "./protocols/index";
@@ -0,0 +1,3 @@
export declare const _toStr: (val: unknown) => string | undefined;
export declare const _toBool: (val: unknown) => boolean | undefined;
export declare const _toNum: (val: unknown) => number | undefined;
+2
View File
@@ -0,0 +1,2 @@
export * from "./coercing-serializers";
export * from "./json/awsExpectUnion";
@@ -0,0 +1,3 @@
export declare const awsExpectUnion: (
value: unknown
) => Record<string, any> | undefined;
+6
View File
@@ -0,0 +1,6 @@
const base = require("../../jest.config.base.js");
module.exports = {
...base,
testPathIgnorePatterns: ["/node_modules/"],
};
+57
View File
@@ -0,0 +1,57 @@
{
"name": "@aws-sdk/core",
"version": "3.451.0",
"description": "Core functions & classes shared by multiple AWS SDK clients",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
"build:cjs": "tsc -p tsconfig.cjs.json && yarn lint",
"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",
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
"lint": "node ./scripts/lint.js",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"test": "jest --passWithNoTests"
},
"main": "./dist-cjs/index.js",
"module": "./dist-es/index.js",
"types": "./dist-types/index.d.ts",
"sideEffects": false,
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0",
"dependencies": {
"@smithy/smithy-client": "^2.1.15",
"tslib": "^2.5.0"
},
"devDependencies": {
"@tsconfig/recommended": "1.0.1",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"rimraf": "3.0.2",
"typedoc": "0.23.23",
"typescript": "~4.9.5"
},
"engines": {
"node": ">=14.0.0"
},
"typesVersions": {
"<4.0": {
"dist-types/*": [
"dist-types/ts3.4/*"
]
}
},
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/master/packages/core",
"repository": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-js-v3.git",
"directory": "packages/core"
},
"typedoc": {
"entryPoint": "src/index.ts"
}
}
+24
View File
@@ -0,0 +1,24 @@
const fs = require("fs");
const path = require("path");
const assert = require("assert");
const root = path.join(__dirname, "..");
const pkgJson = require(path.join(root, "package.json"));
const srcFolders = fs.readdirSync(path.join(root, "src"));
assert(pkgJson.exports === undefined, "We cannot support package.json exports yet.");
/**
* We probably can't enable package.json exports until
* dropping support for Node.js 14.x and TypeScript 4.6.
*/
process.exit(0);
for (const srcFolder of srcFolders) {
if (fs.lstatSync(path.join(root, "src", srcFolder)).isDirectory()) {
if (!pkgJson.exports["./" + srcFolder]) {
throw new Error(`${srcFolder} is missing exports statement in package.json`);
}
}
}
@@ -0,0 +1,70 @@
describe("emitWarningIfUnsupportedVersion", () => {
let emitWarningIfUnsupportedVersion;
const emitWarning = process.emitWarning;
const supportedVersion = "16.0.0";
beforeEach(() => {
const module = require("./emitWarningIfUnsupportedVersion");
emitWarningIfUnsupportedVersion = module.emitWarningIfUnsupportedVersion;
});
afterEach(() => {
jest.clearAllMocks();
jest.resetModules();
process.emitWarning = emitWarning;
});
describe(`emits warning for Node.js <${supportedVersion}`, () => {
const getPreviousMajorVersion = (major: number) => (major === 0 ? 0 : major - 1);
const getPreviousMinorVersion = ([major, minor]: [number, number]) =>
minor === 0 ? [getPreviousMajorVersion(major), 9] : [major, minor - 1];
const getPreviousPatchVersion = ([major, minor, patch]: [number, number, number]) =>
patch === 0 ? [...getPreviousMinorVersion([major, minor]), 9] : [major, minor, patch - 1];
const [major, minor, patch] = supportedVersion.split(".").map(Number);
it.each(
[
getPreviousPatchVersion([major, minor, patch]),
[...getPreviousMinorVersion([major, minor]), 0],
[getPreviousMajorVersion(major), 0, 0],
].map((arr) => `v${arr.join(".")}`)
)(`%s`, async (unsupportedVersion) => {
process.emitWarning = jest.fn();
emitWarningIfUnsupportedVersion(unsupportedVersion);
// Verify that the warning was emitted.
expect(process.emitWarning).toHaveBeenCalledTimes(1);
expect(process.emitWarning).toHaveBeenCalledWith(
`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 14.x on May 1, 2024.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to an active Node.js LTS version.
More information can be found at: https://a.co/dzr2AJd`
);
// Verify that the warning emits only once.
emitWarningIfUnsupportedVersion(unsupportedVersion);
expect(process.emitWarning).toHaveBeenCalledTimes(1);
});
});
describe(`emits no warning for Node.js >=${supportedVersion}`, () => {
const [major, minor, patch] = supportedVersion.split(".").map(Number);
it.each(
[
[major, minor, patch],
[major, minor, patch + 1],
[major, minor + 1, 0],
[major + 1, 0, 0],
].map((arr) => `v${arr.join(".")}`)
)(`%s`, async (unsupportedVersion) => {
process.emitWarning = jest.fn();
emitWarningIfUnsupportedVersion(unsupportedVersion);
expect(process.emitWarning).not.toHaveBeenCalled();
});
});
});
@@ -0,0 +1,25 @@
// Stores whether the warning was already emitted.
let warningEmitted = false;
/**
* @internal
*
* Emits warning if the provided Node.js version string is
* pending deprecation by AWS SDK JSv3.
*
* @param version - The Node.js version string.
*/
export const emitWarningIfUnsupportedVersion = (version: string) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
warningEmitted = true;
process.emitWarning(
`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 14.x on May 1, 2024.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to an active Node.js LTS version.
More information can be found at: https://a.co/dzr2AJd`
);
}
};
+1
View File
@@ -0,0 +1 @@
export * from "./emitWarningIfUnsupportedVersion";
+2
View File
@@ -0,0 +1,2 @@
export * from "./client/index";
export * from "./protocols/index";
+76
View File
@@ -0,0 +1,76 @@
import { _toBool, _toNum, _toStr } from "./coercing-serializers";
const consoleWarn = console.warn;
beforeAll(() => {
console.warn = () => {};
});
afterAll(() => {
console.warn = consoleWarn;
});
describe(_toBool.name, () => {
it("ignores nullish", () => {
expect(_toBool(null)).toBe(null);
expect(_toBool(undefined)).toBe(undefined);
});
it("converts strings", () => {
expect(_toBool("false")).toEqual(false);
expect(_toBool("true")).toEqual(true);
expect(_toBool("False")).toEqual(false);
expect(_toBool("True")).toEqual(true);
expect(_toBool("")).toEqual(false);
expect(_toBool("a")).toEqual(true); // warns
});
it("does not convert numbers", () => {
expect(_toBool(0)).toEqual(0);
expect(_toBool(1)).toEqual(1);
});
});
describe(_toStr.name, () => {
it("ignores nullish", () => {
expect(_toStr(null)).toBe(null);
expect(_toStr(undefined)).toBe(undefined);
});
it("converts numbers", () => {
expect(_toStr(0)).toEqual("0");
expect(_toStr(1)).toEqual("1");
});
it("converts booleans", () => {
expect(_toStr(false)).toEqual("false");
expect(_toStr(true)).toEqual("true");
});
});
describe(_toNum.name, () => {
it("ignores nullish", () => {
expect(_toNum(null)).toBe(null);
expect(_toNum(undefined)).toBe(undefined);
});
it("converts numeric strings", () => {
expect(_toNum("1234")).toEqual(1234);
expect(_toNum("1234.56")).toEqual(1234.56);
});
it("does not convert prefix-numeric strings", () => {
expect(_toNum("1234abc")).toEqual("1234abc");
expect(_toNum("1234.56abc")).toEqual("1234.56abc");
});
it("does not convert non-numeric strings", () => {
expect(_toNum("abcdef")).toEqual("abcdef");
});
it("does not convert bools", () => {
expect(_toNum(false)).toEqual(false);
expect(_toNum(true)).toEqual(true);
});
});
+72
View File
@@ -0,0 +1,72 @@
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export const _toStr = (val: unknown): string | undefined => {
if (val == null) {
return val as undefined;
}
if (typeof val === "number" || typeof val === "bigint") {
const warning = new Error(`Received number ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
if (typeof val === "boolean") {
const warning = new Error(`Received boolean ${val} where a string was expected.`);
warning.name = "Warning";
console.warn(warning);
return String(val);
}
return val as string;
};
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export const _toBool = (val: unknown): boolean | undefined => {
if (val == null) {
return val as undefined;
}
if (typeof val === "number") {
// transmit to service to be rejected.
}
if (typeof val === "string") {
const lowercase = val.toLowerCase();
if (val !== "" && lowercase !== "false" && lowercase !== "true") {
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
warning.name = "Warning";
console.warn(warning);
}
return val !== "" && lowercase !== "false";
}
return val as boolean;
};
/**
* @internal
*
* Used for awsQueryCompatibility trait.
*/
export const _toNum = (val: unknown): number | undefined => {
if (val == null) {
return val as undefined;
}
if (typeof val === "boolean") {
// transmit to service to be rejected.
}
if (typeof val === "string") {
const num = Number(val);
if (num.toString() !== val) {
const warning = new Error(`Received string "${val}" where a number was expected.`);
warning.name = "Warning";
console.warn(warning);
return val as unknown as undefined;
}
return num;
}
return val as number;
};
+2
View File
@@ -0,0 +1,2 @@
export * from "./coercing-serializers";
export * from "./json/awsExpectUnion";
+30
View File
@@ -0,0 +1,30 @@
import { awsExpectUnion } from "./awsExpectUnion";
describe(awsExpectUnion.name, () => {
it("ignores the __type field", () => {
expect(
awsExpectUnion({
K: "V",
__type: "X",
})
).toEqual({
K: "V",
});
});
it("throws when there are extra keys or no keys", () => {
expect(() =>
awsExpectUnion({
__type: "X",
})
).toThrowError();
expect(() =>
awsExpectUnion({
K: "V",
I: "S",
__type: "X",
})
).toThrowError();
});
});
+17
View File
@@ -0,0 +1,17 @@
import { expectUnion } from "@smithy/smithy-client";
/**
* @internal
*
* Forwards to Smithy's expectUnion function, but also ignores
* the `__type` field if it is present.
*/
export const awsExpectUnion = (value: unknown): Record<string, any> | undefined => {
if (value == null) {
return undefined;
}
if (typeof value === "object" && "__type" in value) {
delete value.__type;
}
return expectUnion(value);
};
+9
View File
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist-cjs",
"baseUrl": "."
},
"extends": "../../tsconfig.cjs.json",
"include": ["src/"]
}
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist-es",
"baseUrl": "."
},
"extends": "../../tsconfig.es.json",
"include": ["src/"]
}
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"baseUrl": ".",
"declarationDir": "dist-types",
"rootDir": "src"
},
"extends": "../../tsconfig.types.json",
"include": ["src/"]
}
File diff suppressed because one or more lines are too long