Skip to content

Commit cc07fbc

Browse files
Merge pull request #422 from nduthoit/next
feat(aws-sdk-v3): remove v2 types
2 parents 9a64894 + 0c84a39 commit cc07fbc

20 files changed

+34
-64
lines changed

src/aws-sdk-v2.types.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { IndexType } from './index-type.enum'
66
import { initOrUpdateIndex } from './util'
77

@@ -11,7 +11,7 @@ import { initOrUpdateIndex } from './util'
1111
export function GSIPartitionKey(indexName: string): PropertyDecorator {
1212
return (target: any, propertyKey: string | symbol) => {
1313
if (typeof propertyKey === 'string') {
14-
initOrUpdateIndex(IndexType.GSI, { name: indexName, keyType: KeyType.HASH }, target, propertyKey)
14+
initOrUpdateIndex(IndexType.GSI, { name: indexName, keyType: DynamoDB.KeyType.HASH }, target, propertyKey)
1515
}
1616
}
1717
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { IndexType } from './index-type.enum'
66
import { initOrUpdateIndex } from './util'
77

@@ -11,7 +11,7 @@ import { initOrUpdateIndex } from './util'
1111
export function GSISortKey(indexName: string): PropertyDecorator {
1212
return (target: any, propertyKey: string | symbol) => {
1313
if (typeof propertyKey === 'string') {
14-
initOrUpdateIndex(IndexType.GSI, { name: indexName, keyType: KeyType.RANGE }, target, propertyKey)
14+
initOrUpdateIndex(IndexType.GSI, { name: indexName, keyType: DynamoDB.KeyType.RANGE }, target, propertyKey)
1515
}
1616
}
1717
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { IndexType } from './index-type.enum'
66
import { initOrUpdateIndex } from './util'
77

@@ -11,7 +11,7 @@ import { initOrUpdateIndex } from './util'
1111
export function LSISortKey(indexName: string): PropertyDecorator {
1212
return (target: any, propertyKey: string | symbol) => {
1313
if (typeof propertyKey === 'string') {
14-
initOrUpdateIndex(IndexType.LSI, { name: indexName, keyType: KeyType.RANGE }, target, propertyKey)
14+
initOrUpdateIndex(IndexType.LSI, { name: indexName, keyType: DynamoDB.KeyType.RANGE }, target, propertyKey)
1515
}
1616
}
1717
}

src/decorator/impl/index/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { PropertyMetadata } from '../../metadata/property-metadata.model'
66
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
77
import { KEY_PROPERTY } from '../property/key-property.const'
@@ -12,7 +12,7 @@ import { IndexType } from './index-type.enum'
1212
*/
1313
export interface IndexData {
1414
name: string
15-
keyType: KeyType
15+
keyType: DynamoDB.KeyType
1616
}
1717

1818
/**
@@ -47,7 +47,7 @@ export function initOrUpdateIndex(indexType: IndexType, indexData: IndexData, ta
4747
/**
4848
* @hidden
4949
*/
50-
function initOrUpdateGSI(indexes: Record<string, KeyType>, indexData: IndexData): Partial<PropertyMetadata<any>> {
50+
function initOrUpdateGSI(indexes: Record<string, DynamoDB.KeyType>, indexData: IndexData): Partial<PropertyMetadata<any>> {
5151
if (indexes[indexData.name]) {
5252
// TODO INVESTIGATE when we throw an error we have a problem where multiple different classes extend one base class, this will be executed multiple times
5353
// throw new Error(

src/decorator/impl/key/partition-key.decorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { createOptModelLogger } from '../../../logger/logger'
66
import { PropertyMetadata } from '../../metadata/property-metadata.model'
77
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
@@ -32,7 +32,7 @@ export function PartitionKey(): PropertyDecorator {
3232
}
3333
}
3434

35-
initOrUpdateProperty({ key: { type: KeyType.HASH } }, target, propertyKey)
35+
initOrUpdateProperty({ key: { type: DynamoDB.KeyType.HASH } }, target, propertyKey)
3636
}
3737
}
3838
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
66

77
export function SortKey(): PropertyDecorator {
88
return (target: any, propertyKey: string | symbol) => {
99
if (typeof propertyKey === 'string') {
10-
initOrUpdateProperty({ key: { type: KeyType.RANGE } }, target, propertyKey)
10+
initOrUpdateProperty({ key: { type: DynamoDB.KeyType.RANGE } }, target, propertyKey)
1111
}
1212
}
1313
}

src/decorator/impl/model/model.decorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module decorators
33
*/
4-
import { KeyType } from '../../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { kebabCase } from '../../../helper/kebab-case.function'
66
import { ModelMetadata } from '../../metadata/model-metadata.model'
77
import { PropertyMetadata } from '../../metadata/property-metadata.model'
@@ -63,7 +63,7 @@ export function Model(opts: ModelData = {}): ClassDecorator {
6363
*/
6464
function testForGSI<T>(
6565
property: PropertyMetadata<T>,
66-
): property is PropertyMetadata<T> & { keyForGSI: Record<string, KeyType> } {
66+
): property is PropertyMetadata<T> & { keyForGSI: Record<string, DynamoDB.KeyType> } {
6767
return !!(property.keyForGSI && Object.keys(property.keyForGSI).length)
6868
}
6969

src/decorator/metadata/property-metadata.model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module metadata
33
*/
4-
import { KeyType } from '../../aws-sdk-v2.types'
4+
import * as DynamoDB from '@aws-sdk/client-dynamodb'
55
import { MapperForType } from '../../mapper/for-type/base.mapper'
66
import { Attribute } from '../../mapper/type/attribute.type'
77
import { ModelConstructor } from '../../model/model-constructor'
@@ -12,7 +12,7 @@ export interface TypeInfo {
1212
}
1313

1414
export interface Key {
15-
type: KeyType
15+
type: DynamoDB.KeyType
1616
}
1717

1818
export interface PropertyMetadata<T, R extends Attribute = Attribute> {
@@ -41,7 +41,7 @@ export interface PropertyMetadata<T, R extends Attribute = Attribute> {
4141
mapperForSingleItem?: () => MapperForType<any, any>
4242

4343
// maps the index name to the key type to describe for which GSI this property describes a key attribute
44-
keyForGSI?: Record<string, KeyType>
44+
keyForGSI?: Record<string, DynamoDB.KeyType>
4545

4646
// holds all the the index names for which this property describes the sort key attribute
4747
sortKeyForLSI?: string[]

src/dynamo/batchget/batch-get-full.response.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* @module multi-model-requests/batch-get
33
*/
44
import * as DynamoDB from '@aws-sdk/client-dynamodb'
5-
import * as DynamoDBv2 from '../../aws-sdk-v2.types'
65
import { BatchGetResponse } from './batch-get.response'
76

87
/**
@@ -16,7 +15,7 @@ export interface BatchGetFullResponse {
1615
/**
1716
* A map of tables and their respective keys that were not processed with the current response. The UnprocessedKeys value is in the same form as RequestItems, so the value can be provided directly to a subsequent BatchGetItem operation. For more information, see RequestItems in the Request Parameters section. Each element consists of: Keys - An array of primary key attribute values that define specific items in the table. ProjectionExpression - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result. ConsistentRead - The consistency of a read operation. If set to true, then a strongly consistent read is used; otherwise, an eventually consistent read is used. If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys map.
1817
*/
19-
UnprocessedKeys?: DynamoDBv2.BatchGetRequestMap
18+
UnprocessedKeys?: Record<string, DynamoDB.KeysAndAttributes>
2019
/**
2120
* The read capacity units consumed by the entire BatchGetItem operation. Each element consists of: TableName - The table that consumed the provisioned throughput. CapacityUnits - The total number of capacity units consumed.
2221
*/

0 commit comments

Comments
 (0)