Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to aws sdk v3, switch to npm #51

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
"coverage/",
"bak/",
"index.js",
"tools/"
"tools/",
],
"parserOptions": {
"es6": true,
"project": "./tsconfig.json",
"tsconfigRootDir": "."
}
"tsconfigRootDir": ".",
},
"overrides": [
{
"files": ["**/*.spec.js", "**/*.spec.jsx"],
"env": {
"jest": true,
},
},
],
}
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- id: setup-node
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
node-version: 18.x

- name: Check out repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ methods arguments and return values are strictly typed.
**Constructor:**

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

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

const documentClient = new AWS.DynamoDB.DocumentClient({
service: dynamodb
const documentClient = DynamoDBDocumentClient.from(ddb, {
marshallOptions: {
removeUndefinedValues: true
}
});

// The type declaration of for the documents that we are storing
Expand Down Expand Up @@ -120,7 +122,7 @@ const { total } = await myDocumentDao.incr(
// The `number` property to increment
'total',
// The number to increment by. Defaults to 1.
5,
5
);

// `total` will have the value `-5`
Expand All @@ -133,7 +135,7 @@ const { total } = await myDocumentDao.decr(
// The `number` property to increment
'total',
// The number to decrement by. Defaults to 1.
5,
5
);
```

Expand All @@ -147,9 +149,9 @@ const { extra, total } = await myDocumentDao.multiIncr(
accountId: 'def',
},
{
'total': 5,
'extra': -1,
},
total: 5,
extra: -1,
}
);
```

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
} = require('@jupiterone/typescript-tools/config/jest-util');
module.exports = {
...buildJestConfig({ packageDir: __dirname }),
preset: 'ts-jest',
// The below is necessary due to differences between how p-map is packaged and our
// generic J1 babel and TS configs
transformIgnorePatterns: ['../../node_modules/(?!${p-map})'],
Expand Down
Loading
Loading