diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f91d7ee..c89ba2b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -12,7 +12,7 @@ jobs: # Setup .npmrc file to publish to npm - uses: actions/setup-node@v1 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm ci - run: npm run build diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e1cfbe6..04be819 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [18.x] steps: - uses: actions/checkout@v2 diff --git a/.nvmrc b/.nvmrc index b6a7d89..3c03207 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +18 diff --git a/cdkv2.ts b/cdkv2.ts index a430bde..f1061e7 100644 --- a/cdkv2.ts +++ b/cdkv2.ts @@ -23,7 +23,7 @@ export class SesSmtpCredentialsProvider extends Construct { this.provider = new customResource.Provider(this, 'ses-smtp-credentials-provider', { onEventHandler: new lambda.Function(this, 'ses-smtp-credentials-event', { code: lambda.Code.fromAsset(path.join(__dirname, 'provider')), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_18_X, handler: 'main.onEvent', timeout: cdk.Duration.minutes(5), initialPolicy: [ diff --git a/package-lock.json b/package-lock.json index 6912e33..e2233c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,18 +12,18 @@ "@aws-cdk/aws-lambda": "^1.89.0", "@aws-cdk/core": "^1.89.0", "@aws-cdk/custom-resources": "^1.89.0", - "@types/node": "^16.11.68", + "@types/node": "^18.19.33", "@typescript-eslint/eslint-plugin": "4.8.2", "@typescript-eslint/parser": "4.8.2", "auto-changelog": "^2.2.1", - "aws-cdk-lib": "^2.0.0", + "aws-cdk-lib": "^2.51.0", "constructs": "^10.0.0", "esbuild": "^0.17.8", "eslint": "6.8.0", "eslint-config-prettier": "6.9.0", "eslint-plugin-prettier": "3.1.2", "prettier": "1.19.1", - "typescript": "^4.1.5", + "typescript": "^4.9.5", "utf8": "^3.0.0" }, "peerDependencies": { @@ -32,7 +32,7 @@ "@aws-cdk/aws-lambda": "^1.89.0", "@aws-cdk/core": "^1.89.0", "@aws-cdk/custom-resources": "^1.89.0", - "aws-cdk-lib": "^2.0.0", + "aws-cdk-lib": "^2.51.0", "constructs": "^10.0.0" }, "peerDependenciesMeta": { @@ -59,6 +59,24 @@ } } }, + "node_modules/@aws-cdk/asset-awscli-v1": { + "version": "2.2.202", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-awscli-v1/-/asset-awscli-v1-2.2.202.tgz", + "integrity": "sha512-JqlF0D4+EVugnG5dAsNZMqhu3HW7ehOXm5SDMxMbXNDMdsF0pxtQKNHRl52z1U9igsHmaFpUgSGjbhAJ+0JONg==", + "dev": true + }, + "node_modules/@aws-cdk/asset-kubectl-v20": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-kubectl-v20/-/asset-kubectl-v20-2.1.2.tgz", + "integrity": "sha512-3M2tELJOxQv0apCIiuKQ4pAbncz9GuLwnKFqxifWfe77wuMxyTRPmxssYHs42ePqzap1LT6GDcPygGs+hHstLg==", + "dev": true + }, + "node_modules/@aws-cdk/asset-node-proxy-agent-v6": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-node-proxy-agent-v6/-/asset-node-proxy-agent-v6-2.0.3.tgz", + "integrity": "sha512-twhuEG+JPOYCYPx/xy5uH2+VUsIEhPTzDY0F1KuB+ocjWWB/KEDiOVL19nHvbPCB6fhWnkykXEMJ4HHcKvjtvg==", + "dev": true + }, "node_modules/@aws-cdk/assets": { "version": "1.174.0", "resolved": "https://registry.npmjs.org/@aws-cdk/assets/-/assets-1.174.0.tgz", @@ -1527,10 +1545,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.18.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", - "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "dev": true + "version": "18.19.33", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.33.tgz", + "integrity": "sha512-NR9+KrpSajr2qBVp/Yt5TU/rp+b5Mayi3+OlMlcg2cVCfRmcG5PWZ7S4+MG9PZ5gWBoc9Pd0BKSRViuBCRPu0A==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "4.8.2", @@ -1831,9 +1852,9 @@ } }, "node_modules/aws-cdk-lib": { - "version": "2.43.0", - "resolved": "https://registry.npmjs.org/aws-cdk-lib/-/aws-cdk-lib-2.43.0.tgz", - "integrity": "sha512-r7wJXOFskOz4ksFE1oILLlQRATkhMeju4aSUafp8JcGh+mSVacXmA2h5oA2py1UbsSSJkLR8gU4CGSaGfDpjaA==", + "version": "2.141.0", + "resolved": "https://registry.npmjs.org/aws-cdk-lib/-/aws-cdk-lib-2.141.0.tgz", + "integrity": "sha512-xda56Lfwpdqg9MssnFdXrAKTmeeNjfrfFCaWwqGqToG6cfGY2W+6wyyoObX60/MeZGhhs3Lhdb/K94ulLJ4X/A==", "bundleDependencies": [ "@balena/dockerignore", "case", @@ -1843,18 +1864,25 @@ "minimatch", "punycode", "semver", - "yaml" + "table", + "yaml", + "mime-types" ], "dev": true, "dependencies": { + "@aws-cdk/asset-awscli-v1": "^2.2.202", + "@aws-cdk/asset-kubectl-v20": "^2.1.2", + "@aws-cdk/asset-node-proxy-agent-v6": "^2.0.3", "@balena/dockerignore": "^1.0.2", "case": "1.6.3", - "fs-extra": "^9.1.0", - "ignore": "^5.2.0", + "fs-extra": "^11.2.0", + "ignore": "^5.3.1", "jsonschema": "^1.4.1", + "mime-types": "^2.1.35", "minimatch": "^3.1.2", - "punycode": "^2.1.1", - "semver": "^7.3.7", + "punycode": "^2.3.1", + "semver": "^7.6.0", + "table": "^6.8.2", "yaml": "1.10.2" }, "engines": { @@ -1870,13 +1898,53 @@ "inBundle": true, "license": "Apache-2.0" }, - "node_modules/aws-cdk-lib/node_modules/at-least-node": { - "version": "1.0.0", + "node_modules/aws-cdk-lib/node_modules/ajv": { + "version": "8.13.0", "dev": true, "inBundle": true, - "license": "ISC", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/aws-cdk-lib/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", "engines": { - "node": ">= 4.0.0" + "node": ">=8" + } + }, + "node_modules/aws-cdk-lib/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aws-cdk-lib/node_modules/astral-regex": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" } }, "node_modules/aws-cdk-lib/node_modules/balanced-match": { @@ -1904,35 +1972,64 @@ "node": ">= 0.8.0" } }, + "node_modules/aws-cdk-lib/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/aws-cdk-lib/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "MIT" + }, "node_modules/aws-cdk-lib/node_modules/concat-map": { "version": "0.0.1", "dev": true, "inBundle": true, "license": "MIT" }, + "node_modules/aws-cdk-lib/node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/aws-cdk-lib/node_modules/fast-deep-equal": { + "version": "3.1.3", + "dev": true, + "inBundle": true, + "license": "MIT" + }, "node_modules/aws-cdk-lib/node_modules/fs-extra": { - "version": "9.1.0", + "version": "11.2.0", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.14" } }, "node_modules/aws-cdk-lib/node_modules/graceful-fs": { - "version": "4.2.10", + "version": "4.2.11", "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/aws-cdk-lib/node_modules/ignore": { - "version": "5.2.0", + "version": "5.3.1", "dev": true, "inBundle": true, "license": "MIT", @@ -1940,6 +2037,21 @@ "node": ">= 4" } }, + "node_modules/aws-cdk-lib/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/aws-cdk-lib/node_modules/json-schema-traverse": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, "node_modules/aws-cdk-lib/node_modules/jsonfile": { "version": "6.1.0", "dev": true, @@ -1961,6 +2073,12 @@ "node": "*" } }, + "node_modules/aws-cdk-lib/node_modules/lodash.truncate": { + "version": "4.4.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, "node_modules/aws-cdk-lib/node_modules/lru-cache": { "version": "6.0.0", "dev": true, @@ -1973,6 +2091,27 @@ "node": ">=10" } }, + "node_modules/aws-cdk-lib/node_modules/mime-db": { + "version": "1.52.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/aws-cdk-lib/node_modules/mime-types": { + "version": "2.1.35", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/aws-cdk-lib/node_modules/minimatch": { "version": "3.1.2", "dev": true, @@ -1986,7 +2125,7 @@ } }, "node_modules/aws-cdk-lib/node_modules/punycode": { - "version": "2.1.1", + "version": "2.3.1", "dev": true, "inBundle": true, "license": "MIT", @@ -1994,8 +2133,17 @@ "node": ">=6" } }, + "node_modules/aws-cdk-lib/node_modules/require-from-string": { + "version": "2.0.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/aws-cdk-lib/node_modules/semver": { - "version": "7.3.7", + "version": "7.6.0", "dev": true, "inBundle": true, "license": "ISC", @@ -2009,8 +2157,67 @@ "node": ">=10" } }, + "node_modules/aws-cdk-lib/node_modules/slice-ansi": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/aws-cdk-lib/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aws-cdk-lib/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aws-cdk-lib/node_modules/table": { + "version": "6.8.2", + "dev": true, + "inBundle": true, + "license": "BSD-3-Clause", + "dependencies": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/aws-cdk-lib/node_modules/universalify": { - "version": "2.0.0", + "version": "2.0.1", "dev": true, "inBundle": true, "license": "MIT", @@ -2018,6 +2225,15 @@ "node": ">= 10.0.0" } }, + "node_modules/aws-cdk-lib/node_modules/uri-js": { + "version": "4.4.1", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/aws-cdk-lib/node_modules/yallist": { "version": "4.0.0", "dev": true, @@ -3763,9 +3979,9 @@ } }, "node_modules/typescript": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", - "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3788,6 +4004,12 @@ "node": ">=0.8.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -3878,6 +4100,24 @@ } }, "dependencies": { + "@aws-cdk/asset-awscli-v1": { + "version": "2.2.202", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-awscli-v1/-/asset-awscli-v1-2.2.202.tgz", + "integrity": "sha512-JqlF0D4+EVugnG5dAsNZMqhu3HW7ehOXm5SDMxMbXNDMdsF0pxtQKNHRl52z1U9igsHmaFpUgSGjbhAJ+0JONg==", + "dev": true + }, + "@aws-cdk/asset-kubectl-v20": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-kubectl-v20/-/asset-kubectl-v20-2.1.2.tgz", + "integrity": "sha512-3M2tELJOxQv0apCIiuKQ4pAbncz9GuLwnKFqxifWfe77wuMxyTRPmxssYHs42ePqzap1LT6GDcPygGs+hHstLg==", + "dev": true + }, + "@aws-cdk/asset-node-proxy-agent-v6": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@aws-cdk/asset-node-proxy-agent-v6/-/asset-node-proxy-agent-v6-2.0.3.tgz", + "integrity": "sha512-twhuEG+JPOYCYPx/xy5uH2+VUsIEhPTzDY0F1KuB+ocjWWB/KEDiOVL19nHvbPCB6fhWnkykXEMJ4HHcKvjtvg==", + "dev": true + }, "@aws-cdk/assets": { "version": "1.174.0", "resolved": "https://registry.npmjs.org/@aws-cdk/assets/-/assets-1.174.0.tgz", @@ -4769,10 +5009,13 @@ "dev": true }, "@types/node": { - "version": "16.18.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", - "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "dev": true + "version": "18.19.33", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.33.tgz", + "integrity": "sha512-NR9+KrpSajr2qBVp/Yt5TU/rp+b5Mayi3+OlMlcg2cVCfRmcG5PWZ7S4+MG9PZ5gWBoc9Pd0BKSRViuBCRPu0A==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@typescript-eslint/eslint-plugin": { "version": "4.8.2", @@ -4958,19 +5201,24 @@ } }, "aws-cdk-lib": { - "version": "2.43.0", - "resolved": "https://registry.npmjs.org/aws-cdk-lib/-/aws-cdk-lib-2.43.0.tgz", - "integrity": "sha512-r7wJXOFskOz4ksFE1oILLlQRATkhMeju4aSUafp8JcGh+mSVacXmA2h5oA2py1UbsSSJkLR8gU4CGSaGfDpjaA==", + "version": "2.141.0", + "resolved": "https://registry.npmjs.org/aws-cdk-lib/-/aws-cdk-lib-2.141.0.tgz", + "integrity": "sha512-xda56Lfwpdqg9MssnFdXrAKTmeeNjfrfFCaWwqGqToG6cfGY2W+6wyyoObX60/MeZGhhs3Lhdb/K94ulLJ4X/A==", "dev": true, "requires": { + "@aws-cdk/asset-awscli-v1": "^2.2.202", + "@aws-cdk/asset-kubectl-v20": "^2.1.2", + "@aws-cdk/asset-node-proxy-agent-v6": "^2.0.3", "@balena/dockerignore": "^1.0.2", "case": "1.6.3", - "fs-extra": "^9.1.0", - "ignore": "^5.2.0", + "fs-extra": "^11.2.0", + "ignore": "^5.3.1", "jsonschema": "^1.4.1", + "mime-types": "^2.1.35", "minimatch": "^3.1.2", - "punycode": "^2.1.1", - "semver": "^7.3.7", + "punycode": "^2.3.1", + "semver": "^7.6.0", + "table": "^6.8.2", "yaml": "1.10.2" }, "dependencies": { @@ -4979,8 +5227,32 @@ "bundled": true, "dev": true }, - "at-least-node": { - "version": "1.0.0", + "ajv": { + "version": "8.13.0", + "bundled": true, + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + } + }, + "ansi-regex": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "bundled": true, + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "astral-regex": { + "version": "2.0.0", "bundled": true, "dev": true }, @@ -5003,29 +5275,61 @@ "bundled": true, "dev": true }, + "color-convert": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "bundled": true, + "dev": true + }, "concat-map": { "version": "0.0.1", "bundled": true, "dev": true }, + "emoji-regex": { + "version": "8.0.0", + "bundled": true, + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "bundled": true, + "dev": true + }, "fs-extra": { - "version": "9.1.0", + "version": "11.2.0", "bundled": true, "dev": true, "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "graceful-fs": { - "version": "4.2.10", + "version": "4.2.11", "bundled": true, "dev": true }, "ignore": { - "version": "5.2.0", + "version": "5.3.1", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "json-schema-traverse": { + "version": "1.0.0", "bundled": true, "dev": true }, @@ -5043,6 +5347,11 @@ "bundled": true, "dev": true }, + "lodash.truncate": { + "version": "4.4.2", + "bundled": true, + "dev": true + }, "lru-cache": { "version": "6.0.0", "bundled": true, @@ -5051,6 +5360,19 @@ "yallist": "^4.0.0" } }, + "mime-db": { + "version": "1.52.0", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, "minimatch": { "version": "3.1.2", "bundled": true, @@ -5060,23 +5382,76 @@ } }, "punycode": { - "version": "2.1.1", + "version": "2.3.1", + "bundled": true, + "dev": true + }, + "require-from-string": { + "version": "2.0.2", "bundled": true, "dev": true }, "semver": { - "version": "7.3.7", + "version": "7.6.0", "bundled": true, "dev": true, "requires": { "lru-cache": "^6.0.0" } }, + "slice-ansi": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "bundled": true, + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "table": { + "version": "6.8.2", + "bundled": true, + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + } + }, "universalify": { - "version": "2.0.0", + "version": "2.0.1", "bundled": true, "dev": true }, + "uri-js": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "yallist": { "version": "4.0.0", "bundled": true, @@ -6380,9 +6755,9 @@ "dev": true }, "typescript": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", - "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true }, "uglify-js": { @@ -6392,6 +6767,12 @@ "dev": true, "optional": true }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index a60f148..f863d87 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "clean": "rm -rf ./lib", "build": "npm run clean && npm run compile && npm run compile-provider && cp -R ./provider/build/ ./lib/provider/ && cp package.json README.md ./lib", "clean-provider": "rm -rf provider/build/", - "compile-provider": "npm run clean-provider && npx esbuild --platform=node --target=node16 --minify-syntax --external:aws-sdk --bundle --outdir=./provider/build ./provider/main.ts", + "compile-provider": "npm run clean-provider && npx esbuild --platform=node --target=node18 --minify-syntax --external:@aws-sdk/client-iam --bundle --outdir=./provider/build ./provider/main.ts", "lint": "eslint '*.ts' --fix", "lint-check": "eslint '*.ts' --max-warnings 0", "version": "auto-changelog --hide-credit -p && git add CHANGELOG.md" @@ -28,7 +28,7 @@ "@aws-cdk/aws-lambda": "^1.89.0", "@aws-cdk/core": "^1.89.0", "@aws-cdk/custom-resources": "^1.89.0", - "aws-cdk-lib": "^2.0.0", + "aws-cdk-lib": "^2.51.0", "constructs": "^10.0.0" }, "peerDependenciesMeta": { @@ -58,18 +58,18 @@ "@aws-cdk/aws-lambda": "^1.89.0", "@aws-cdk/core": "^1.89.0", "@aws-cdk/custom-resources": "^1.89.0", - "@types/node": "^16.11.68", + "@types/node": "^18.19.33", "@typescript-eslint/eslint-plugin": "4.8.2", "@typescript-eslint/parser": "4.8.2", "auto-changelog": "^2.2.1", - "aws-cdk-lib": "^2.0.0", + "aws-cdk-lib": "^2.51.0", "constructs": "^10.0.0", "esbuild": "^0.17.8", "eslint": "6.8.0", "eslint-config-prettier": "6.9.0", "eslint-plugin-prettier": "3.1.2", "prettier": "1.19.1", - "typescript": "^4.1.5", + "typescript": "^4.9.5", "utf8": "^3.0.0" } } diff --git a/provider/main.ts b/provider/main.ts index d7a368f..e345cc4 100644 --- a/provider/main.ts +++ b/provider/main.ts @@ -5,7 +5,7 @@ import { CloudFormationCustomResourceResponse, CloudFormationCustomResourceUpdateEvent, } from 'aws-lambda'; -import * as AWS from 'aws-sdk'; +import { IAM } from '@aws-sdk/client-iam'; import * as crypto from 'crypto'; import * as utf8 from 'utf8'; @@ -41,7 +41,7 @@ export const getSmtpPassword = (key: string, region: string) => { export const onCreate = async (event: CloudFormationCustomResourceCreateEvent): Promise => { const region = event.ResourceProperties.Region; - const iam = new AWS.IAM(); + const iam = new IAM(); const now = new Date(); const userName = `ses-user-${now.toISOString().replace('T', '.').replace('Z', '').replace(/:/g, '-')}`; @@ -49,8 +49,7 @@ export const onCreate = async (event: CloudFormationCustomResourceCreateEvent): const user = await iam .createUser({ UserName: userName, - }) - .promise(); + }); if (!user.User) { throw new Error('No user created'); } @@ -66,13 +65,11 @@ export const onCreate = async (event: CloudFormationCustomResourceCreateEvent): Resource: '*', }, }), - }) - .promise(); + }); const accessKey = await iam .createAccessKey({ UserName: user.User.UserName, - }) - .promise(); + }); const username = accessKey.AccessKey.AccessKeyId; const secretKey = accessKey.AccessKey.SecretAccessKey; const password = getSmtpPassword(secretKey, region); @@ -100,25 +97,22 @@ export const onUpdate = async (event: CloudFormationCustomResourceUpdateEvent): }; export const onDelete = async (event: CloudFormationCustomResourceDeleteEvent): Promise => { - const iam = new AWS.IAM(); + const iam = new IAM(); const [username, accessKeyId] = event.PhysicalResourceId.split(/\//); await iam .deleteAccessKey({ UserName: username, AccessKeyId: accessKeyId, - }) - .promise(); + }); await iam .deleteUserPolicy({ UserName: username, PolicyName: policyName, - }) - .promise(); + }); await iam .deleteUser({ UserName: username, - }) - .promise(); + }); return { Status: 'SUCCESS', RequestId: event.RequestId,