ag-common 0.0.435 → 0.0.437

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.
@@ -1,9 +1,13 @@
1
- import STS from 'aws-sdk/clients/sts';
2
1
  /**
3
- * @param {assumeRoleArn} assume this role arn
2
+ * @param {assumeRoleArn} assume this role arn. remember to use the credentials returned in subsequent calls
4
3
  * @returns {string} assumed accountId
5
4
  */
6
5
  export declare function assumeRole({ assumeRoleArn, region, }: {
7
6
  assumeRoleArn: string;
8
7
  region: string;
9
- }): Promise<STS.Credentials | undefined>;
8
+ }): Promise<{
9
+ accessKeyId: string;
10
+ secretAccessKey: string;
11
+ sessionToken: string;
12
+ expiration: Date;
13
+ }>;
@@ -16,7 +16,7 @@ exports.assumeRole = void 0;
16
16
  const sts_1 = __importDefault(require("aws-sdk/clients/sts"));
17
17
  const log_1 = require("../../common/helpers/log");
18
18
  /**
19
- * @param {assumeRoleArn} assume this role arn
19
+ * @param {assumeRoleArn} assume this role arn. remember to use the credentials returned in subsequent calls
20
20
  * @returns {string} assumed accountId
21
21
  */
22
22
  function assumeRole({ assumeRoleArn, region, }) {
@@ -29,11 +29,16 @@ function assumeRole({ assumeRoleArn, region, }) {
29
29
  RoleSessionName: 'stssession',
30
30
  })
31
31
  .promise();
32
- if (data.$response.error) {
32
+ if (data.$response.error || !data.Credentials) {
33
+ (0, log_1.error)('aws assume role error');
33
34
  throw new Error(JSON.stringify(data.$response.error, null, 2));
34
35
  }
35
- (0, log_1.info)(`resp:${JSON.stringify(data, null, 2)}`);
36
- return data.Credentials;
36
+ return {
37
+ accessKeyId: data.Credentials.AccessKeyId,
38
+ secretAccessKey: data.Credentials.SecretAccessKey,
39
+ sessionToken: data.Credentials.SessionToken,
40
+ expiration: data.Credentials.Expiration,
41
+ };
37
42
  });
38
43
  }
39
44
  exports.assumeRole = assumeRole;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.435",
2
+ "version": "0.0.437",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
@@ -28,28 +28,28 @@
28
28
  "typescript": ">=5"
29
29
  },
30
30
  "devDependencies": {
31
- "@babel/core": "7.22.1",
31
+ "@babel/core": "7.22.5",
32
32
  "@babel/preset-typescript": "^7.21.5",
33
33
  "@babel/types": "^7.21.5",
34
34
  "@emotion/react": "11.11.1",
35
35
  "@emotion/styled": "11.11.0",
36
- "@storybook/addon-actions": "7.0.20",
37
- "@storybook/addon-docs": "7.0.20",
38
- "@storybook/addon-essentials": "7.0.20",
39
- "@storybook/addon-interactions": "7.0.20",
40
- "@storybook/addon-links": "7.0.20",
41
- "@storybook/addons": "7.0.20",
42
- "@storybook/react": "7.0.20",
43
- "@storybook/react-webpack5": "7.0.20",
44
- "@storybook/theming": "7.0.20",
36
+ "@storybook/addon-actions": "7.0.23",
37
+ "@storybook/addon-docs": "7.0.23",
38
+ "@storybook/addon-essentials": "7.0.23",
39
+ "@storybook/addon-interactions": "7.0.23",
40
+ "@storybook/addon-links": "7.0.23",
41
+ "@storybook/addons": "7.0.23",
42
+ "@storybook/react": "7.0.23",
43
+ "@storybook/react-webpack5": "7.0.23",
44
+ "@storybook/theming": "7.0.23",
45
45
  "@types/jsonwebtoken": "9.0.2",
46
- "@types/node": "20.2.5",
47
- "@types/react": "18.2.9",
48
- "@types/react-dom": "18.2.4",
46
+ "@types/node": "20.3.1",
47
+ "@types/react": "18.2.13",
48
+ "@types/react-dom": "18.2.6",
49
49
  "cross-env": "7.0.3",
50
50
  "eslint-config-e7npm": "0.0.9",
51
51
  "rimraf": "5.0.1",
52
- "storybook": "7.0.20"
52
+ "storybook": "7.0.23"
53
53
  },
54
54
  "files": [
55
55
  "dist/**/*",