Repository: jeremydaly/dynamodb-toolbox (ts)

Issue:
Query Limit is Stringified: Serialization Error (v0.8.1)
In both `queryParams` and `scanParams`, the code is incorrectly stringifying `limit`. As is, with all default configurations, the code throws "SerializationException: STRING_VALUE cannot be converted to Integer".

These are links to the two lines in Table.ts:
https://github.com/jeremydaly/dynamodb-toolbox/blob/30a82ca8839a3afe5660beb863816a48a6b6ab6d/src/classes/Table/Table.ts#L719
https://github.com/jeremydaly/dynamodb-toolbox/blob/30a82ca8839a3afe5660beb863816a48a6b6ab6d/src/classes/Table/Table.ts#L956

I believe the fix is as simple as just changing `limit ? { Limit: String(limit) } : null` to `limit ? { Limit: limit } : null` and adjusting the expectations in table.query.unit.test.ts and table.scan.unit.test.ts

Pull request:
fix(Table): resolve error with stringified limit
fixes #502

Patch:
diff --git a/src/classes/Table/Table.ts b/src/classes/Table/Table.ts
index 97877f97..37218e66 100644
--- a/src/classes/Table/Table.ts
+++ b/src/classes/Table/Table.ts
@@ -716,7 +716,7 @@ class Table<Name extends string, PartitionKey extends A.Key, SortKey extends A.K
       FilterExpression ? { FilterExpression } : null,
       ProjectionExpression ? { ProjectionExpression } : null,
       index ? { IndexName: index } : null,
-      limit ? { Limit: String(limit) } : null,
+      limit ? { Limit: limit } : null,
       reverse ? { ScanIndexForward: !reverse } : null,
       consistent ? { ConsistentRead: consistent } : null,
       capacity ? { ReturnConsumedCapacity: capacity.toUpperCase() } : null,
@@ -953,7 +953,7 @@ class Table<Name extends string, PartitionKey extends A.Key, SortKey extends A.K
       index ? { IndexName: index } : null,
       segments ? { TotalSegments: segments } : null,
       Number.isInteger(segment) ? { Segment: segment } : null,
-      limit ? { Limit: String(limit) } : null,
+      limit ? { Limit: limit } : null,
       consistent ? { ConsistentRead: consistent } : null,
       capacity ? { ReturnConsumedCapacity: capacity.toUpperCase() } : null,
       select ? { Select: select.toUpperCase() } : null,


Test patch:
diff --git a/src/__tests__/table.query.unit.test.ts b/src/__tests__/table.query.unit.test.ts
index bfc7397b..c9a2703d 100644
--- a/src/__tests__/table.query.unit.test.ts
+++ b/src/__tests__/table.query.unit.test.ts
@@ -122,7 +122,7 @@ describe('query', () => {
       FilterExpression: '#attr1 = :attr1',
       ProjectionExpression: '#proj1,#proj2,#proj3,#proj4',
       IndexName: 'GSI1',
-      Limit: '10',
+      Limit: 10,
       ScanIndexForward: false,
       ConsistentRead: true,
       ReturnConsumedCapacity: 'TOTAL',
@@ -166,7 +166,7 @@ describe('query', () => {
       FilterExpression: '#attr1_0.#attr1_1.#attr1_2 = :attr1',
       ProjectionExpression: '#proj1,#proj2,#proj3,#proj4',
       IndexName: 'GSI1',
-      Limit: '10',
+      Limit: 10,
       ScanIndexForward: false,
       ConsistentRead: true,
       ReturnConsumedCapacity: 'TOTAL',
diff --git a/src/__tests__/table.scan.unit.test.ts b/src/__tests__/table.scan.unit.test.ts
index 28804076..f41a0ecb 100644
--- a/src/__tests__/table.scan.unit.test.ts
+++ b/src/__tests__/table.scan.unit.test.ts
@@ -103,7 +103,7 @@ describe('scan', () => {
       IndexName: 'GSI1',
       TotalSegments: 5,
       Segment: 0,
-      Limit: '10',
+      Limit: 10,
       ConsistentRead: true,
       ReturnConsumedCapacity: 'TOTAL',
       Select: 'ALL_ATTRIBUTES',