Skip to content

Commit 6a2f03b

Browse files
committed
refactor(decorators): remove deprecated decorators
BREAKING CHANGE - use `@CollectionProperty(opts)` instead of `@SortedSet`, `@TypedSet`, `@TypedArray` - use `@Property({mapper: MapperForType})` instead of @CustomMapper(mapper)
1 parent 6794255 commit 6a2f03b

27 files changed

+51
-129
lines changed

src/decorator/impl/collection/collection-property-data.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BinaryAttribute, MapperForType, NumberAttribute, StringAttribute } from '../../../mapper'
22
import { ModelConstructor } from '../../../model'
33

4-
export interface CollectionPropertyDataBase<R, T extends StringAttribute | NumberAttribute | BinaryAttribute> {
4+
export interface CollectionPropertyData<R, T extends StringAttribute | NumberAttribute | BinaryAttribute> {
55
/**
66
* the name of property how it is named in dynamoDB
77
*/

src/decorator/impl/collection/collection-property.decorator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// tslint:disable:max-classes-per-file
22
// tslint:disable:no-non-null-assertion
3-
import { Model } from '..'
43
import { FormId, formIdMapper } from '../../../../test/models/real-world'
54
import { metadataForClass, metadataForProperty } from '../../metadata'
5+
import { Model } from '../model/model.decorator'
66
import { CollectionProperty } from './collection-property.decorator'
77

88
describe('@CollectionProperty', () => {

src/decorator/impl/collection/collection-property.decorator.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import { ModelConstructor } from '../../../model'
99
import { PropertyMetadata, TypeInfo } from '../../metadata'
1010
import { getMetadataType } from '../../util'
1111
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
12-
import { CollectionPropertyDataBase } from './collection-property-data.model'
12+
import { CollectionPropertyData } from './collection-property-data.model'
1313

14-
type DecoratorFn = (target: object, propertyKey: string | symbol) => void
1514

16-
export function CollectionProperty<R, T extends StringAttribute | NumberAttribute | BinaryAttribute>(opts: CollectionPropertyDataBase<R, T> = {}): DecoratorFn {
15+
export function CollectionProperty<R, T extends StringAttribute | NumberAttribute | BinaryAttribute>(opts: CollectionPropertyData<R, T> = {}): PropertyDecorator {
1716
return (target: object, propertyKey: string | symbol) => {
1817
if (typeof propertyKey === 'string') {
1918

src/decorator/impl/collection/sorted-set.decorator.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/decorator/impl/collection/typed-array.decorator.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/decorator/impl/collection/typed-set.decorator.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/decorator/impl/custom-mapper/custom-mapper.decorator.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/decorator/impl/date/date.decorator.spec.ts renamed to src/decorator/impl/date/date-property.decorator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getMetaDataProperty } from '../../../../test/helper'
44
import { resetDynamoEasyConfig } from '../../../../test/helper/resetDynamoEasyConfig.function'
55
import { updateDynamoEasyConfig } from '../../../config'
66
import { dateToNumberMapper } from '../../../mapper/custom'
7-
import { DateProperty } from './date.decorator'
7+
import { DateProperty } from './date-property.decorator'
88

99
@Model()
1010
class ModelWithDate {

src/decorator/impl/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// collection
2-
export * from './collection/sorted-set.decorator'
3-
export * from './collection/typed-set.decorator'
4-
export * from './collection/typed-array.decorator'
2+
export * from './collection/collection-property.decorator'
3+
54
// date
6-
export * from './date/date.decorator'
5+
export * from './date/date-property.decorator'
76
// index
87
export * from './index/secondary-index'
98
export * from './index/gsi-partition-key.decorator'
@@ -14,11 +13,13 @@ export * from './index/index-type.enum'
1413
export * from './key/partition-key.decorator'
1514
export * from './key/partition-key-uuid.decorator'
1615
export * from './key/sort-key.decorator'
17-
// mapper
18-
export * from './custom-mapper/custom-mapper.decorator'
16+
1917
// model
2018
export * from './model/model.decorator'
2119
// property
2220
export * from './property/property.decorator'
2321
// transient
2422
export * from './transient/transient.decorator'
23+
24+
25+

0 commit comments

Comments
 (0)