Typing
This commit is contained in:
parent
cb398dad02
commit
f2f0c2e708
|
@ -7,6 +7,7 @@ import {
|
|||
|
||||
import AWS from "aws-sdk"
|
||||
import { AWS_REGION } from "../db/dynamoClient"
|
||||
import { DocumentClient } from "aws-sdk/clients/dynamodb"
|
||||
|
||||
interface DynamoDBConfig {
|
||||
region: string
|
||||
|
@ -128,7 +129,7 @@ const SCHEMA: Integration = {
|
|||
|
||||
class DynamoDBIntegration implements IntegrationBase {
|
||||
private config: DynamoDBConfig
|
||||
private client: any
|
||||
private client
|
||||
|
||||
constructor(config: DynamoDBConfig) {
|
||||
this.config = config
|
||||
|
@ -148,7 +149,10 @@ class DynamoDBIntegration implements IntegrationBase {
|
|||
this.client = new AWS.DynamoDB.DocumentClient(this.config)
|
||||
}
|
||||
|
||||
async create(query: { table: string; json: object }) {
|
||||
async create(query: {
|
||||
table: string
|
||||
json: Omit<DocumentClient.PutItemInput, "TableName">
|
||||
}) {
|
||||
const params = {
|
||||
TableName: query.table,
|
||||
...query.json,
|
||||
|
@ -189,7 +193,10 @@ class DynamoDBIntegration implements IntegrationBase {
|
|||
return new AWS.DynamoDB(this.config).describeTable(params).promise()
|
||||
}
|
||||
|
||||
async get(query: { table: string; json: object }) {
|
||||
async get(query: {
|
||||
table: string
|
||||
json: Omit<DocumentClient.GetItemInput, "TableName">
|
||||
}) {
|
||||
const params = {
|
||||
TableName: query.table,
|
||||
...query.json,
|
||||
|
@ -197,7 +204,10 @@ class DynamoDBIntegration implements IntegrationBase {
|
|||
return this.client.get(params).promise()
|
||||
}
|
||||
|
||||
async update(query: { table: string; json: object }) {
|
||||
async update(query: {
|
||||
table: string
|
||||
json: Omit<DocumentClient.UpdateItemInput, "TableName">
|
||||
}) {
|
||||
const params = {
|
||||
TableName: query.table,
|
||||
...query.json,
|
||||
|
@ -205,7 +215,10 @@ class DynamoDBIntegration implements IntegrationBase {
|
|||
return this.client.update(params).promise()
|
||||
}
|
||||
|
||||
async delete(query: { table: string; json: object }) {
|
||||
async delete(query: {
|
||||
table: string
|
||||
json: Omit<DocumentClient.DeleteItemInput, "TableName">
|
||||
}) {
|
||||
const params = {
|
||||
TableName: query.table,
|
||||
...query.json,
|
||||
|
|
Loading…
Reference in New Issue