diff --git a/package-lock.json b/package-lock.json index a6c9ea2..fe04fdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dynameh", - "version": "3.3.0-beta.3", + "version": "3.3.0-beta.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8ee97ea..41892eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dynameh", - "version": "3.3.0-beta.4", + "version": "3.3.0-beta.5", "description": "DynamoDB on Node more easier", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/FluentDynameh.ts b/src/FluentDynameh.ts index 8161776..ed4cf6f 100644 --- a/src/FluentDynameh.ts +++ b/src/FluentDynameh.ts @@ -28,7 +28,7 @@ export class FluentRequestBuilder { return this.resultGetter(await this.execute()); } - addProjection(attributes: string[]): FluentRequestBuilder { + addProjection(attributes: string[]): FluentRequestBuilder> { const req = requestBuilder.addProjection(this.tableSchema, this.request, attributes); return new FluentRequestBuilder(this.tableSchema, req, this.executor, this.resultGetter); } @@ -48,18 +48,18 @@ function emptyResultGetter(): {} { return {}; } -export class FluentDynameh { +export class FluentDynameh { constructor(public tableSchema: TableSchema, public client: aws.DynamoDB) { checkSchema(tableSchema); } - getItem(partitionKeyValue: DynamoKey, sortKeyValue?: DynamoKey): FluentRequestBuilder { + getItem(partitionKeyValue: DynamoKey, sortKeyValue?: DynamoKey): FluentRequestBuilder { const req = requestBuilder.buildGetInput(this.tableSchema, partitionKeyValue, sortKeyValue); return new FluentRequestBuilder(this.tableSchema, req, this.client.getItem, responseUnwrapper.unwrapGetOutput); } - putItem(item: object): FluentRequestBuilder { + putItem(item: T): FluentRequestBuilder { const req = requestBuilder.buildPutInput(this.tableSchema, item); return new FluentRequestBuilder(this.tableSchema, req, this.client.putItem, emptyResultGetter); } @@ -69,19 +69,21 @@ export class FluentDynameh { return new FluentRequestBuilder(this.tableSchema, req, this.client.updateItem, emptyResultGetter); } - deleteItem(itemToDelete: object): FluentRequestBuilder { + deleteItem(itemToDelete: Partial): FluentRequestBuilder { const req = requestBuilder.buildDeleteInput(this.tableSchema, itemToDelete); return new FluentRequestBuilder(this.tableSchema, req, this.client.deleteItem, emptyResultGetter); } - query(partitionKeyValue: DynamoKey, sortKeyOp?: DynamoQueryConditionOperator, ...sortKeyValues: DynamoKey[]): FluentRequestBuilder { + query(partitionKeyValue: DynamoKey, sortKeyOp?: DynamoQueryConditionOperator, ...sortKeyValues: DynamoKey[]): FluentRequestBuilder { const req = requestBuilder.buildQueryInput(this.tableSchema, partitionKeyValue, sortKeyOp, ...sortKeyValues); return new FluentRequestBuilder(this.tableSchema, req, this.client.query, responseUnwrapper.unwrapQueryOutput); + // TODO executor should get ALL query results with paging } - scan(...filter: Condition[]): FluentRequestBuilder { + scan(...filter: Condition[]): FluentRequestBuilder { const req = requestBuilder.buildScanInput(this.tableSchema, ...filter); return new FluentRequestBuilder(this.tableSchema, req, this.client.scan, responseUnwrapper.unwrapScanOutput); + // TODO executor should get ALL scan results with paging } transactWriteItems(...input: FluentRequestBuilder[]): FluentRequestBuilder {