serverless-kms-alias 4.0.6 → 5.0.0

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/README.md CHANGED
@@ -18,7 +18,7 @@ service: foo
18
18
  provider:
19
19
  name: aws
20
20
  kmsKeyArn: '${kms:alias/aws/lambda}'
21
- runtime: nodejs16.x
21
+ runtime: nodejs20.x
22
22
 
23
23
  plugins:
24
24
  - serverless-kms-alias
@@ -34,7 +34,7 @@ functions:
34
34
  service: foo
35
35
  provider:
36
36
  name: aws
37
- runtime: nodejs16.x
37
+ runtime: nodejs20.x
38
38
 
39
39
  plugins:
40
40
  - serverless-kms-alias
@@ -51,7 +51,7 @@ functions:
51
51
  service: foo
52
52
  provider:
53
53
  name: aws
54
- runtime: nodejs16.x
54
+ runtime: nodejs20.x
55
55
 
56
56
  plugins:
57
57
  - serverless-kms-alias
package/dist/index.cjs ADDED
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ const clientKms = require('@aws-sdk/client-kms');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => {
8
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
+ return value;
10
+ };
11
+ class KmsAliasPlugin {
12
+ constructor(serverless) {
13
+ __publicField(this, "configurationVariablesSources");
14
+ this.configurationVariablesSources = {
15
+ kms: {
16
+ async resolve({ address }) {
17
+ if (!/^(alias\/[a-z]|arn:aws:kms:[\w-]*:\d*:alias)/i.test(address)) {
18
+ throw new Error(`Expected variable in the form of 'kms:alias/foo'`);
19
+ }
20
+ if (serverless.service?.custom?.kmsAlias?.enabled != null) {
21
+ try {
22
+ const isEnabled = serverless.service.custom.kmsAlias.enabled ? Boolean(JSON.parse(serverless.service.custom.kmsAlias.enabled.toLowerCase())) : false;
23
+ if (!isEnabled) {
24
+ serverless.cli.log(`Info: KMS Alias plugin not enabled`);
25
+ return {
26
+ value: address
27
+ };
28
+ }
29
+ } catch (ex) {
30
+ throw new Error(`Unable to get enabled configuration for kms alias.`, {
31
+ cause: ex
32
+ });
33
+ }
34
+ }
35
+ serverless.cli.log(`Info: Fetching KMS key for alias: ${address}`);
36
+ const client = new clientKms.KMSClient({
37
+ ...serverless.providers.aws.getCredentials(),
38
+ region: serverless.providers.aws.getRegion()
39
+ });
40
+ const command = new clientKms.DescribeKeyCommand({
41
+ KeyId: address
42
+ });
43
+ const response = await client.send(command);
44
+ const keyMetadata = response.KeyMetadata;
45
+ if (!keyMetadata) {
46
+ throw new Error(`Unable to get key metadata for kms alias: ${address}`);
47
+ }
48
+ if (!keyMetadata.Arn) {
49
+ throw new Error(`Unable to determine ARN for kms alias: ${address}`);
50
+ }
51
+ serverless.cli.log(`Info: Found KMS key for alias (${address}): ${keyMetadata.Arn}`);
52
+ return {
53
+ value: keyMetadata.Arn
54
+ };
55
+ }
56
+ }
57
+ };
58
+ }
59
+ }
60
+ module.exports = KmsAliasPlugin;
@@ -0,0 +1,40 @@
1
+ import { HttpAuthSchemeInputConfig } from '@aws-sdk/client-kms/dist-types/auth/httpAuthSchemeProvider';
2
+
3
+ interface KmsAliasSettings {
4
+ enabled?: string;
5
+ }
6
+
7
+ interface ServerlessInstance {
8
+ providers: {
9
+ aws: {
10
+ getCredentials(): HttpAuthSchemeInputConfig['credentials'];
11
+ getRegion(): string;
12
+ };
13
+ };
14
+ service?: {
15
+ custom?: {
16
+ kmsAlias?: KmsAliasSettings;
17
+ };
18
+ };
19
+ cli: {
20
+ log(str: string, entity?: string): void;
21
+ };
22
+ }
23
+
24
+ interface ResolveParams {
25
+ address: string;
26
+ params?: string[];
27
+ resolveVariable: (name: string) => Promise<string>;
28
+ }
29
+ interface ResolveResult {
30
+ value: string;
31
+ }
32
+ interface ServerlessVariableSource {
33
+ resolve(params: ResolveParams): Promise<ResolveResult>;
34
+ }
35
+ declare class KmsAliasPlugin {
36
+ configurationVariablesSources: Record<string, ServerlessVariableSource>;
37
+ constructor(serverless: ServerlessInstance);
38
+ }
39
+
40
+ export { KmsAliasPlugin as default };
@@ -0,0 +1,40 @@
1
+ import { HttpAuthSchemeInputConfig } from '@aws-sdk/client-kms/dist-types/auth/httpAuthSchemeProvider';
2
+
3
+ interface KmsAliasSettings {
4
+ enabled?: string;
5
+ }
6
+
7
+ interface ServerlessInstance {
8
+ providers: {
9
+ aws: {
10
+ getCredentials(): HttpAuthSchemeInputConfig['credentials'];
11
+ getRegion(): string;
12
+ };
13
+ };
14
+ service?: {
15
+ custom?: {
16
+ kmsAlias?: KmsAliasSettings;
17
+ };
18
+ };
19
+ cli: {
20
+ log(str: string, entity?: string): void;
21
+ };
22
+ }
23
+
24
+ interface ResolveParams {
25
+ address: string;
26
+ params?: string[];
27
+ resolveVariable: (name: string) => Promise<string>;
28
+ }
29
+ interface ResolveResult {
30
+ value: string;
31
+ }
32
+ interface ServerlessVariableSource {
33
+ resolve(params: ResolveParams): Promise<ResolveResult>;
34
+ }
35
+ declare class KmsAliasPlugin {
36
+ configurationVariablesSources: Record<string, ServerlessVariableSource>;
37
+ constructor(serverless: ServerlessInstance);
38
+ }
39
+
40
+ export { KmsAliasPlugin as default };
@@ -0,0 +1,40 @@
1
+ import { HttpAuthSchemeInputConfig } from '@aws-sdk/client-kms/dist-types/auth/httpAuthSchemeProvider';
2
+
3
+ interface KmsAliasSettings {
4
+ enabled?: string;
5
+ }
6
+
7
+ interface ServerlessInstance {
8
+ providers: {
9
+ aws: {
10
+ getCredentials(): HttpAuthSchemeInputConfig['credentials'];
11
+ getRegion(): string;
12
+ };
13
+ };
14
+ service?: {
15
+ custom?: {
16
+ kmsAlias?: KmsAliasSettings;
17
+ };
18
+ };
19
+ cli: {
20
+ log(str: string, entity?: string): void;
21
+ };
22
+ }
23
+
24
+ interface ResolveParams {
25
+ address: string;
26
+ params?: string[];
27
+ resolveVariable: (name: string) => Promise<string>;
28
+ }
29
+ interface ResolveResult {
30
+ value: string;
31
+ }
32
+ interface ServerlessVariableSource {
33
+ resolve(params: ResolveParams): Promise<ResolveResult>;
34
+ }
35
+ declare class KmsAliasPlugin {
36
+ configurationVariablesSources: Record<string, ServerlessVariableSource>;
37
+ constructor(serverless: ServerlessInstance);
38
+ }
39
+
40
+ export { KmsAliasPlugin as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,58 @@
1
+ import { KMSClient, DescribeKeyCommand } from '@aws-sdk/client-kms';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __publicField = (obj, key, value) => {
6
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ return value;
8
+ };
9
+ class KmsAliasPlugin {
10
+ constructor(serverless) {
11
+ __publicField(this, "configurationVariablesSources");
12
+ this.configurationVariablesSources = {
13
+ kms: {
14
+ async resolve({ address }) {
15
+ if (!/^(alias\/[a-z]|arn:aws:kms:[\w-]*:\d*:alias)/i.test(address)) {
16
+ throw new Error(`Expected variable in the form of 'kms:alias/foo'`);
17
+ }
18
+ if (serverless.service?.custom?.kmsAlias?.enabled != null) {
19
+ try {
20
+ const isEnabled = serverless.service.custom.kmsAlias.enabled ? Boolean(JSON.parse(serverless.service.custom.kmsAlias.enabled.toLowerCase())) : false;
21
+ if (!isEnabled) {
22
+ serverless.cli.log(`Info: KMS Alias plugin not enabled`);
23
+ return {
24
+ value: address
25
+ };
26
+ }
27
+ } catch (ex) {
28
+ throw new Error(`Unable to get enabled configuration for kms alias.`, {
29
+ cause: ex
30
+ });
31
+ }
32
+ }
33
+ serverless.cli.log(`Info: Fetching KMS key for alias: ${address}`);
34
+ const client = new KMSClient({
35
+ ...serverless.providers.aws.getCredentials(),
36
+ region: serverless.providers.aws.getRegion()
37
+ });
38
+ const command = new DescribeKeyCommand({
39
+ KeyId: address
40
+ });
41
+ const response = await client.send(command);
42
+ const keyMetadata = response.KeyMetadata;
43
+ if (!keyMetadata) {
44
+ throw new Error(`Unable to get key metadata for kms alias: ${address}`);
45
+ }
46
+ if (!keyMetadata.Arn) {
47
+ throw new Error(`Unable to determine ARN for kms alias: ${address}`);
48
+ }
49
+ serverless.cli.log(`Info: Found KMS key for alias (${address}): ${keyMetadata.Arn}`);
50
+ return {
51
+ value: keyMetadata.Arn
52
+ };
53
+ }
54
+ }
55
+ };
56
+ }
57
+ }
58
+ module.exports = KmsAliasPlugin;
package/package.json CHANGED
@@ -1,42 +1,31 @@
1
1
  {
2
2
  "name": "serverless-kms-alias",
3
- "version": "4.0.6",
4
- "engines": {
5
- "node": ">= 18"
6
- },
7
- "dependencies": {
8
- "@aws-sdk/client-kms": "^3.549.0"
9
- },
10
- "devDependencies": {
11
- "@types/lodash": "4.17.0",
12
- "@types/serverless": "3.12.22",
13
- "@typescript-eslint/eslint-plugin": "7.6.0",
14
- "@typescript-eslint/parser": "7.6.0",
15
- "eslint": "8.57.0",
16
- "eslint-config-airbnb-base": "15.0.0",
17
- "eslint-config-airbnb-typescript": "18.0.0",
18
- "eslint-config-prettier": "9.1.0",
19
- "eslint-plugin-import": "2.29.1",
20
- "eslint-plugin-jsdoc": "48.2.3",
21
- "eslint-plugin-prettier": "5.1.3",
22
- "eslint-plugin-promise": "6.1.1",
23
- "eslint-plugin-security": "2.1.1",
24
- "husky": "9.0.11",
25
- "lint-staged": "15.2.2",
26
- "markdownlint-cli": "0.39.0",
27
- "npm-run-all": "4.1.5",
28
- "pinst": "3.0.0",
29
- "prettier": "3.2.5",
30
- "prettier-plugin-packagejson": "2.4.14",
31
- "typescript": "5.4.4"
3
+ "version": "5.0.0",
4
+ "main": "./dist/index.cjs",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
32
19
  },
33
- "main": "dist/index.js",
34
- "license": "MIT",
20
+ "files": [
21
+ "dist",
22
+ "src"
23
+ ],
35
24
  "scripts": {
36
- "build": "tsc",
25
+ "build": "unbuild",
37
26
  "check:types": "tsc --noEmit",
38
27
  "lint:markdown": "prettier --write '*.md' '!(node_modules|dist)/**/*.md' && markdownlint '*.md' '!(node_modules|dist)/**/*.md' --config=.github/linters/.markdown-lint.yml --fix",
39
- "lint:code": "prettier --write *.json .eslintrc.js .prettierrc.js && eslint --fix --ext .ts src",
28
+ "lint:code": "prettier --write package.json && eslint --fix",
40
29
  "lint": "run-p lint:*",
41
30
  "lint-staged": "lint-staged",
42
31
  "prepublishOnly": "rm -rf dist && npm run build && npm run lint && pinst --disable",
@@ -48,12 +37,38 @@
48
37
  "prettier --write",
49
38
  "markdownlint --config=.github/linters/.markdown-lint.yml --fix"
50
39
  ],
51
- "./*.js": [
40
+ "./*.cjs": [
41
+ "eslint --fix"
42
+ ],
43
+ "./*.mjs": [
52
44
  "eslint --fix"
53
45
  ],
54
46
  "*.ts": [
55
47
  "eslint --fix"
56
48
  ]
57
49
  },
58
- "repository": "github:serverless-plugins/serverless-kms-alias"
50
+ "license": "MIT",
51
+ "repository": "github:serverless-plugins/serverless-kms-alias",
52
+ "engines": {
53
+ "node": ">= 18"
54
+ },
55
+ "dependencies": {
56
+ "@aws-sdk/client-kms": "^3.614.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/lodash": "4.17.6",
60
+ "@types/serverless": "3.12.22",
61
+ "eslint": "9.6.0",
62
+ "eslint-config-decent": "1.4.0",
63
+ "husky": "9.0.11",
64
+ "lint-staged": "15.2.7",
65
+ "markdownlint-cli": "0.41.0",
66
+ "npm-run-all": "4.1.5",
67
+ "pinst": "3.0.0",
68
+ "prettier": "3.3.2",
69
+ "prettier-plugin-packagejson": "2.5.0",
70
+ "typescript": "5.5.3",
71
+ "typescript-eslint": "8.0.0-alpha.41",
72
+ "unbuild": "2.0.0"
73
+ }
59
74
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DescribeKeyCommand, KMSClient } from '@aws-sdk/client-kms';
2
2
 
3
- import type { ServerlessInstance } from './types';
3
+ import type { ServerlessInstance } from './types/index.js';
4
4
 
5
5
  interface ResolveParams {
6
6
  address: string;
@@ -23,7 +23,7 @@ class KmsAliasPlugin {
23
23
  this.configurationVariablesSources = {
24
24
  kms: {
25
25
  async resolve({ address }: ResolveParams): Promise<ResolveResult> {
26
- if (!/^(alias\/[a-zA-Z]|arn:aws:kms:[\w-]*:[\d]*:alias)/i.test(address)) {
26
+ if (!/^(alias\/[a-z]|arn:aws:kms:[\w-]*:\d*:alias)/i.test(address)) {
27
27
  throw new Error(`Expected variable in the form of 'kms:alias/foo'`);
28
28
  }
29
29
 
@@ -1,6 +1,6 @@
1
1
  import type { HttpAuthSchemeInputConfig } from '@aws-sdk/client-kms/dist-types/auth/httpAuthSchemeProvider';
2
2
 
3
- import type { KmsAliasSettings } from './KmsAliasSettings';
3
+ import type { KmsAliasSettings } from './KmsAliasSettings.js';
4
4
 
5
5
  export interface ServerlessInstance {
6
6
  providers: {
@@ -1,2 +1,2 @@
1
- export * from './KmsAliasSettings';
2
- export * from './ServerlessInstance';
1
+ export * from './KmsAliasSettings.js';
2
+ export * from './ServerlessInstance.js';
@@ -1,16 +0,0 @@
1
- {
2
- "name": "serverless-kms-alias",
3
- "features": {
4
- "ghcr.io/devcontainers/features/node:1": {
5
- "version": "lts"
6
- }
7
- },
8
- "customizations": {
9
- "vscode": {
10
- "extensions": [
11
- "EditorConfig.EditorConfig"
12
- ]
13
- }
14
- },
15
- "postCreateCommand": "npm install"
16
- }
package/.husky/pre-commit DELETED
@@ -1,5 +0,0 @@
1
- PATH=$PATH:/usr/local/bin:/opt/homebrew/bin
2
-
3
- echo 'NOTE: If node or npm is not found, you may need to run brew link for your specific node version'
4
- npm run lint-staged
5
- npm run check:types
package/CHANGELOG.md DELETED
@@ -1,86 +0,0 @@
1
- # Change Log
2
-
3
- ## 4.0.6 - 2024-04-08
4
-
5
- - Update npms
6
-
7
- ## 4.0.5 - 2024-03-11
8
-
9
- - Update npms
10
-
11
- ## 4.0.4 - 2024-02-07
12
-
13
- - Update npms
14
-
15
- ## 4.0.3 - 2024-01-05
16
-
17
- - Update npms
18
-
19
- ## 4.0.2 - 2023-11-28
20
-
21
- - Update npms
22
-
23
- ## 4.0.1 - 2023-10-27
24
-
25
- - Update npms
26
-
27
- ## 4.0.0 - 2023-10-05
28
-
29
- - Remove support for Node.js v16
30
- - Update npms
31
-
32
- ## 3.0.1 - 2023-07-24
33
-
34
- - Update npms
35
-
36
- ## 3.0.0 - 2023-05-24
37
-
38
- - Remove support for Node.js v14. Support Node.js v20.
39
- - Update npms
40
-
41
- ## 2.2.1 - 2023-04-17
42
-
43
- - Update npms
44
-
45
- ## 2.2.0 - 2023-02-08
46
-
47
- - Replace enable/disable by stage with `enabled`
48
-
49
- ## 2.1.0 - 2023-02-08
50
-
51
- - Add configuration to enable for explicit stages. Fix #3
52
- - Update npms
53
-
54
- ## 2.0.4 - 2022-12-06
55
-
56
- - Update npms
57
-
58
- ## 2.0.3 - 2022-10-11
59
-
60
- - Update npms
61
-
62
- ## 2.0.2 - 2022-08-30
63
-
64
- - Update npms
65
-
66
- ## 2.0.1 - 2022-06-29
67
-
68
- - Update npms
69
-
70
- ## 2.0.0 - 2022-05-23
71
-
72
- - Drop Node.js 12 support
73
- - Update npms
74
-
75
- ## 1.0.2 - 2022-04-13
76
-
77
- - Update npms
78
-
79
- ## 1.0.1 - 2022-02-22
80
-
81
- - Update npms
82
- - Update husky to support Apple silicon homebrew package links
83
-
84
- ## 1.0.0 - 2022-01-18
85
-
86
- - Initial release
@@ -1,76 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to make participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- - Using welcoming and inclusive language
18
- - Being respectful of differing viewpoints and experiences
19
- - Gracefully accepting constructive criticism
20
- - Focusing on what is best for the community
21
- - Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- - The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- - Trolling, insulting/derogatory comments, and personal or political attacks
28
- - Public or private harassment
29
- - Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- - Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies within all project spaces, and it also applies when
49
- an individual is representing the project or its community in public spaces.
50
- Examples of representing a project or community include using an official
51
- project e-mail address, posting via an official social media account, or acting
52
- as an appointed representative at an online or offline event. Representation of
53
- a project may be further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at <opensource@github.com>. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
72
-
73
- [homepage]: https://www.contributor-covenant.org
74
-
75
- For answers to common questions about this code of conduct, see
76
- <https://www.contributor-covenant.org/faq>
package/CONTRIBUTING.md DELETED
@@ -1,22 +0,0 @@
1
- # Contributors
2
-
3
- ## Checkin
4
-
5
- - Do checkin source (src)
6
- - Do not checkin build output (dist)
7
- - Do not checkin node_modules
8
-
9
- ## Development
10
-
11
- In order to handle code style and static analysis, we run [Husky](https://github.com/typicode/husky) before each commit.
12
- This step ensures that formatting and checkin rules are followed. To make sure Husky runs correctly, please use the
13
- following workflow:
14
-
15
- ```sh
16
- npm install # installs all devDependencies including Husky
17
- git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
18
- git commit -m "Informative commit message" # Commit. This will run Husky
19
- ```
20
-
21
- During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier).
22
- It will also make sure these changes are appropriately included in your commit (no further work is needed)
package/dist/index.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- const client_kms_1 = require("@aws-sdk/client-kms");
3
- class KmsAliasPlugin {
4
- configurationVariablesSources;
5
- constructor(serverless) {
6
- this.configurationVariablesSources = {
7
- kms: {
8
- async resolve({ address }) {
9
- if (!/^(alias\/[a-zA-Z]|arn:aws:kms:[\w-]*:[\d]*:alias)/i.test(address)) {
10
- throw new Error(`Expected variable in the form of 'kms:alias/foo'`);
11
- }
12
- if (serverless.service?.custom?.kmsAlias?.enabled != null) {
13
- try {
14
- const isEnabled = serverless.service.custom.kmsAlias.enabled ? Boolean(JSON.parse(serverless.service.custom.kmsAlias.enabled.toLowerCase())) : false;
15
- if (!isEnabled) {
16
- serverless.cli.log(`Info: KMS Alias plugin not enabled`);
17
- return {
18
- value: address,
19
- };
20
- }
21
- }
22
- catch (ex) {
23
- throw new Error(`Unable to get enabled configuration for kms alias.`, {
24
- cause: ex,
25
- });
26
- }
27
- }
28
- serverless.cli.log(`Info: Fetching KMS key for alias: ${address}`);
29
- const client = new client_kms_1.KMSClient({
30
- ...serverless.providers.aws.getCredentials(),
31
- region: serverless.providers.aws.getRegion(),
32
- });
33
- const command = new client_kms_1.DescribeKeyCommand({
34
- KeyId: address,
35
- });
36
- const response = await client.send(command);
37
- const keyMetadata = response.KeyMetadata;
38
- if (!keyMetadata) {
39
- throw new Error(`Unable to get key metadata for kms alias: ${address}`);
40
- }
41
- if (!keyMetadata.Arn) {
42
- throw new Error(`Unable to determine ARN for kms alias: ${address}`);
43
- }
44
- serverless.cli.log(`Info: Found KMS key for alias (${address}): ${keyMetadata.Arn}`);
45
- return {
46
- value: keyMetadata.Arn,
47
- };
48
- },
49
- },
50
- };
51
- }
52
- }
53
- module.exports = KmsAliasPlugin;
54
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9EQUFvRTtBQWtCcEUsTUFBTSxjQUFjO0lBQ1gsNkJBQTZCLENBQTJDO0lBRS9FLFlBQW1CLFVBQThCO1FBQy9DLElBQUksQ0FBQyw2QkFBNkIsR0FBRztZQUNuQyxHQUFHLEVBQUU7Z0JBQ0gsS0FBSyxDQUFDLE9BQU8sQ0FBQyxFQUFFLE9BQU8sRUFBaUI7b0JBQ3RDLElBQUksQ0FBQyxvREFBb0QsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQzt3QkFDeEUsTUFBTSxJQUFJLEtBQUssQ0FBQyxrREFBa0QsQ0FBQyxDQUFDO29CQUN0RSxDQUFDO29CQUVELElBQUksVUFBVSxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFLE9BQU8sSUFBSSxJQUFJLEVBQUUsQ0FBQzt3QkFDMUQsSUFBSSxDQUFDOzRCQUNILE1BQU0sU0FBUyxHQUFHLFVBQVUsQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUM7NEJBQ3JKLElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQztnQ0FDZixVQUFVLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxvQ0FBb0MsQ0FBQyxDQUFDO2dDQUN6RCxPQUFPO29DQUNMLEtBQUssRUFBRSxPQUFPO2lDQUNmLENBQUM7NEJBQ0osQ0FBQzt3QkFDSCxDQUFDO3dCQUFDLE9BQU8sRUFBRSxFQUFFLENBQUM7NEJBQ1osTUFBTSxJQUFJLEtBQUssQ0FBQyxvREFBb0QsRUFBRTtnQ0FDcEUsS0FBSyxFQUFFLEVBQUU7NkJBQ1YsQ0FBQyxDQUFDO3dCQUNMLENBQUM7b0JBQ0gsQ0FBQztvQkFFRCxVQUFVLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxxQ0FBcUMsT0FBTyxFQUFFLENBQUMsQ0FBQztvQkFFbkUsTUFBTSxNQUFNLEdBQUcsSUFBSSxzQkFBUyxDQUFDO3dCQUMzQixHQUFHLFVBQVUsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBRTt3QkFDNUMsTUFBTSxFQUFFLFVBQVUsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLFNBQVMsRUFBRTtxQkFDN0MsQ0FBQyxDQUFDO29CQUNILE1BQU0sT0FBTyxHQUFHLElBQUksK0JBQWtCLENBQUM7d0JBQ3JDLEtBQUssRUFBRSxPQUFPO3FCQUNmLENBQUMsQ0FBQztvQkFDSCxNQUFNLFFBQVEsR0FBRyxNQUFNLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7b0JBRTVDLE1BQU0sV0FBVyxHQUFHLFFBQVEsQ0FBQyxXQUFXLENBQUM7b0JBRXpDLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQzt3QkFDakIsTUFBTSxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsT0FBTyxFQUFFLENBQUMsQ0FBQztvQkFDMUUsQ0FBQztvQkFFRCxJQUFJLENBQUMsV0FBVyxDQUFDLEdBQUcsRUFBRSxDQUFDO3dCQUNyQixNQUFNLElBQUksS0FBSyxDQUFDLDBDQUEwQyxPQUFPLEVBQUUsQ0FBQyxDQUFDO29CQUN2RSxDQUFDO29CQUVELFVBQVUsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGtDQUFrQyxPQUFPLE1BQU0sV0FBVyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUM7b0JBRXJGLE9BQU87d0JBQ0wsS0FBSyxFQUFFLFdBQVcsQ0FBQyxHQUFHO3FCQUN2QixDQUFDO2dCQUNKLENBQUM7YUFDRjtTQUNGLENBQUM7SUFDSixDQUFDO0NBQ0Y7QUFFRCxpQkFBUyxjQUFjLENBQUMifQ==
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiS21zQWxpYXNTZXR0aW5ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9LbXNBbGlhc1NldHRpbmdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2VydmVybGVzc0luc3RhbmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL1NlcnZlcmxlc3NJbnN0YW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./KmsAliasSettings"), exports);
18
- __exportStar(require("./ServerlessInstance"), exports);
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHFEQUFtQztBQUNuQyx1REFBcUMifQ==
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "lib": ["ESNext"],
5
- "module": "CommonJS",
6
- "moduleResolution": "node",
7
-
8
- "inlineSourceMap": true,
9
- "skipLibCheck": true,
10
-
11
- "baseUrl": ".",
12
- "outDir": "dist",
13
-
14
- "strict": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "noUnusedLocals": true,
17
- "noUnusedParameters": true,
18
- "noImplicitReturns": true,
19
- "noFallthroughCasesInSwitch": true
20
- },
21
- "include": ["src"]
22
- }