@moicky/dynamodb 2.6.3 → 2.6.4
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/lib/client.js +5 -29
- package/package.json +2 -3
package/dist/lib/client.js
CHANGED
|
@@ -2,38 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClient = exports.initClient = void 0;
|
|
4
4
|
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
5
|
+
const oidc_1 = require("@vercel/functions/oidc");
|
|
5
6
|
const schemas_1 = require("./schemas");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
if (!process.env.AWS_ROLE_ARN)
|
|
9
|
-
return {};
|
|
10
|
-
return {
|
|
11
|
-
credentials: import("@vercel/functions/oidc").then(({ awsCredentialsProvider }) => ({
|
|
12
|
-
credentials: awsCredentialsProvider({
|
|
13
|
-
roleArn: process.env.AWS_ROLE_ARN,
|
|
14
|
-
roleSessionName: "moicky-dynamodb",
|
|
15
|
-
}),
|
|
16
|
-
})),
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
assumeRole: () => {
|
|
20
|
-
if (!process.env.DYNAMODB_ASSUME_ROLE)
|
|
21
|
-
return {};
|
|
22
|
-
return {
|
|
23
|
-
credentials: import("@aws-sdk/credential-providers").then(({ fromTemporaryCredentials }) => fromTemporaryCredentials({
|
|
24
|
-
params: {
|
|
25
|
-
RoleArn: process.env.DYNAMODB_ASSUME_ROLE,
|
|
26
|
-
RoleSessionName: "moicky-dynamodb",
|
|
27
|
-
},
|
|
28
|
-
})),
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
const _authType = process.env.MOICKY_DYNAMODB_AWS_ROLE;
|
|
33
|
-
const authType = authTypes[_authType];
|
|
7
|
+
const authType = process.env.MOICKY_DYNAMODB_AWS_ROLE;
|
|
8
|
+
const roleArn = process.env.AWS_ROLE_ARN;
|
|
34
9
|
let client = new client_dynamodb_1.DynamoDBClient({
|
|
35
10
|
region: process.env.AWS_REGION || "eu-central-1",
|
|
36
|
-
...(authType &&
|
|
11
|
+
...(authType === "vercel" &&
|
|
12
|
+
roleArn && { credentials: (0, oidc_1.awsCredentialsProvider)({ roleArn }) }),
|
|
37
13
|
});
|
|
38
14
|
const defaultTable = process.env.DYNAMODB_TABLE;
|
|
39
15
|
if (defaultTable) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moicky/dynamodb",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "Contains a collection of convenience functions for working with AWS DynamoDB",
|
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
"aws-crt": "^1.15.20"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@aws-sdk/credential-providers": "^3.744.0",
|
|
32
|
-
"@vercel/functions": "^2.0.0",
|
|
33
31
|
"@types/jest": "^29.5.1",
|
|
34
32
|
"@types/node": "^20.2.4",
|
|
33
|
+
"@vercel/functions": "^2.0.0",
|
|
35
34
|
"dotenv": "^16.0.3",
|
|
36
35
|
"jest": "^29.5.0",
|
|
37
36
|
"typescript": "^5.0.4"
|