Skip to content

Commit aa4732b

Browse files
author
Xander Dumaine
committed
Convert to aws sdk v3
1 parent 06d9f7e commit aa4732b

26 files changed

+17240
-4794
lines changed

.eslintrc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@
88
"coverage/",
99
"bak/",
1010
"index.js",
11-
"tools/"
11+
"tools/",
1212
],
1313
"parserOptions": {
1414
"es6": true,
1515
"project": "./tsconfig.json",
16-
"tsconfigRootDir": "."
17-
}
16+
"tsconfigRootDir": ".",
17+
},
18+
"overrides": [
19+
{
20+
"files": ["**/*.spec.js", "**/*.spec.jsx"],
21+
"env": {
22+
"jest": true,
23+
},
24+
},
25+
],
1826
}

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- id: setup-node
1515
name: Setup Node
16-
uses: actions/setup-node@v1
16+
uses: actions/setup-node@v3
1717
with:
1818
node-version: ${{ matrix.node-version }}
1919

@@ -47,7 +47,7 @@ jobs:
4747
node-version: 18.x
4848

4949
- name: Check out repo
50-
uses: actions/checkout@v2
50+
uses: actions/checkout@v3
5151
with:
5252
fetch-depth: 2
5353

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ methods arguments and return values are strictly typed.
1313
**Constructor:**
1414

1515
```javascript
16-
import AWS from 'aws-sdk';
17-
import DynamoDbDao from '@jupiterone/dynamodb-dao';
16+
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
17+
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
1818

19-
const dynamodb = new AWS.DynamoDB({
19+
const ddb = new DynamoDBClient({
2020
apiVersion: '2012-08-10'
21-
});
21+
})
2222

23-
const documentClient = new AWS.DynamoDB.DocumentClient({
24-
service: dynamodb
23+
const documentClient = DynamoDBDocumentClient.from(ddb, {
24+
marshallOptions: {
25+
removeUndefinedValues: true
26+
}
2527
});
2628

2729
// The type declaration of for the documents that we are storing
@@ -120,7 +122,7 @@ const { total } = await myDocumentDao.incr(
120122
// The `number` property to increment
121123
'total',
122124
// The number to increment by. Defaults to 1.
123-
5,
125+
5
124126
);
125127

126128
// `total` will have the value `-5`
@@ -133,7 +135,7 @@ const { total } = await myDocumentDao.decr(
133135
// The `number` property to increment
134136
'total',
135137
// The number to decrement by. Defaults to 1.
136-
5,
138+
5
137139
);
138140
```
139141

@@ -147,9 +149,9 @@ const { extra, total } = await myDocumentDao.multiIncr(
147149
accountId: 'def',
148150
},
149151
{
150-
'total': 5,
151-
'extra': -1,
152-
},
152+
total: 5,
153+
extra: -1,
154+
}
153155
);
154156
```
155157

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const {
55
} = require('@jupiterone/typescript-tools/config/jest-util');
66
module.exports = {
77
...buildJestConfig({ packageDir: __dirname }),
8+
preset: 'ts-jest',
89
// The below is necessary due to differences between how p-map is packaged and our
910
// generic J1 babel and TS configs
1011
transformIgnorePatterns: ['../../node_modules/(?!${p-map})'],

0 commit comments

Comments
 (0)