Skip to content

Commit ed47cc3

Browse files
Merge branch 'master' into #91-default-value-provider
# Conflicts: # src/decorator/metadata/metadata.ts # src/mapper/mapper.ts
2 parents 820600a + 3ffded4 commit ed47cc3

File tree

55 files changed

+4849
-3950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4849
-3950
lines changed

.lintstagedrc.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
"src/**/!(*.spec).ts":
22
- prettier --write --config ./.prettierrc.yml
33
- tslint --project ./tsconfig.json -t codeFrame --fix
4-
- git add
54
"(src/**/*.spec.ts|test/**/*.ts)":
65
- prettier --write --config ./.prettierrc.yml
76
# TODO LOW tslint will not work because of the following error
87
# ✖ tslint --project ./tsconfig.jest.json -t codeFrame --fix found some errors. Please fix them and try committing again.
98
#'/Users/michaelwittwer/dev/shiftcode/dynamo-easy/test/models/complex.model.ts' is not included in project.
109
# - tslint --project ./tsconfig.jest.json -t codeFrame --fix
11-
- git add
1210
"**/package.json":
1311
- sort-package-json
14-
- git add

package-lock.json

Lines changed: 4643 additions & 3689 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"lint:ci": "tslint --project tsconfig.json -t codeFrame",
4848
"prettier": "prettier --write --config ./.prettierrc.yml '{src,test}/**/*.ts'",
4949
"report-coverage": "cat ./coverage/lcov.info | coveralls",
50-
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
5150
"test": "jest",
5251
"test:ci": "jest --coverage --no-cache",
5352
"test:watch": "jest --watch",
@@ -58,21 +57,21 @@
5857
"@commitlint/cli": "^8.1.0",
5958
"@commitlint/config-conventional": "^8.1.0",
6059
"@commitlint/prompt-cli": "^8.1.0",
61-
"@types/jest": "^24.0.18",
60+
"@types/jest": "^25.2.1",
6261
"@types/node": "8.10.40",
6362
"aws-sdk": "^2.401.0",
6463
"colors": "^1.3.3",
6564
"coveralls": "^3.0.6",
66-
"husky": "^3.0.4",
67-
"jest": "^24.9.0",
68-
"lint-staged": "^9.2.3",
65+
"husky": "^4.0.0",
66+
"jest": "^25.2.7",
67+
"lint-staged": "^10.0.0",
6968
"lodash.camelcase": "^4.3.0",
70-
"prettier": "^1.18.2",
69+
"prettier": "^2.0.2",
7170
"reflect-metadata": "^0.1.13",
7271
"rimraf": "^3.0.0",
73-
"semantic-release": "^16.0.1",
72+
"semantic-release": "^17.0.0",
7473
"sort-package-json": "^1.22.1",
75-
"ts-jest": "^24.0.2",
74+
"ts-jest": "^25.0.0",
7675
"ts-node": "^8.3.0",
7776
"tslint": "^5.19.0",
7877
"tslint-config-prettier": "^1.18.0",

renovate.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@
55
],
66
"ignoreDeps": [
77
"@types/node",
8-
"typescript"
8+
"typescript",
9+
"typedoc",
10+
"typedoc-plugin-external-module-name"
911
],
1012
"packageRules": [
1113
{
12-
"packagePatterns": [ "^@types" ],
13-
"groupName": "@types"
14+
"packagePatterns": [ "^@commitlint" ],
15+
"groupName": "@commitlint"
16+
},
17+
{
18+
"packagePatterns": ["jest"],
19+
"groupName": "jest"
20+
},
21+
{
22+
"packagePatterns": ["uuid"],
23+
"groupName": "uuid"
1424
}
1525
]
1626
}

src/decorator/impl/index/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface IndexData {
2020
*/
2121
export function initOrUpdateIndex(indexType: IndexType, indexData: IndexData, target: any, propertyKey: string): void {
2222
const properties: Array<PropertyMetadata<any>> = Reflect.getMetadata(KEY_PROPERTY, target.constructor) || []
23-
const existingProperty = properties.find(property => property.name === propertyKey)
23+
const existingProperty = properties.find((property) => property.name === propertyKey)
2424

2525
let propertyMetadata: Partial<PropertyMetadata<any>>
2626
switch (indexType) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export function PartitionKey(): PropertyDecorator {
1414
// check for existing properties marked as partition key
1515
const properties: Array<PropertyMetadata<any>> = Reflect.getMetadata(KEY_PROPERTY, target.constructor) || []
1616
if (properties && properties.length) {
17-
const existingPartitionKeys = properties.filter(property => property.key && property.key.type === 'HASH')
17+
const existingPartitionKeys = properties.filter((property) => property.key && property.key.type === 'HASH')
1818
if (existingPartitionKeys.length) {
19-
if (properties.find(property => property.name === propertyKey)) {
19+
if (properties.find((property) => property.name === propertyKey)) {
2020
// just ignore this and go on, somehow the partition key gets defined two times
2121
logger.warn(
2222
`this is the second execution to define the partitionKey for property ${propertyKey}`,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function Model(opts: ModelData = {}): ClassDecorator {
2828
: Reflect.getMetadata(KEY_PROPERTY, constructor)) || []
2929

3030
// get partition key
31-
const partitionKeys = properties.filter(property => property.key && property.key.type === 'HASH')
31+
const partitionKeys = properties.filter((property) => property.key && property.key.type === 'HASH')
3232

3333
const partitionKeyName: string | null = partitionKeys.length ? partitionKeys[0].nameDb : null
3434

@@ -40,7 +40,7 @@ export function Model(opts: ModelData = {}): ClassDecorator {
4040
const indexes: Map<string, SecondaryIndex<any>> = new Map([...globalSecondaryIndexes, ...localSecondaryIndexes])
4141

4242
const transientProperties = properties.length
43-
? properties.filter(property => property.transient === true).map(property => property.name)
43+
? properties.filter((property) => property.transient === true).map((property) => property.name)
4444
: []
4545

4646
const metaData: ModelMetadata<any> = {
@@ -80,7 +80,7 @@ function testForLSI<T>(property: PropertyMetadata<T>): property is PropertyMetad
8080
function getGlobalSecondaryIndexes(properties: Array<PropertyMetadata<any>>): Map<string, SecondaryIndex<any>> {
8181
return properties.filter(testForGSI).reduce((map, property): Map<string, SecondaryIndex<any>> => {
8282
let gsi: SecondaryIndex<any>
83-
Object.keys(property.keyForGSI).forEach(indexName => {
83+
Object.keys(property.keyForGSI).forEach((indexName) => {
8484
if (map.has(indexName)) {
8585
gsi = map.get(indexName)
8686
} else {
@@ -119,7 +119,7 @@ function getLocalSecondaryIndexes(
119119
return properties.filter(testForLSI).reduce((map, property): Map<string, SecondaryIndex<any>> => {
120120
let lsi: SecondaryIndex<any>
121121

122-
property.sortKeyForLSI.forEach(indexName => {
122+
property.sortKeyForLSI.forEach((indexName) => {
123123
if (map.has(indexName)) {
124124
throw new Error(modelErrors.lsiMultipleSk(indexName, property.nameDb))
125125
}

src/decorator/impl/property/init-or-update-property.function.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export function initOrUpdateProperty(
2020

2121
// Update the attribute array
2222
let properties: Array<PropertyMetadata<any>> = Reflect.getMetadata(KEY_PROPERTY, target.constructor) || []
23-
const existingProperty = properties.find(p => p.name === propertyKey)
23+
const existingProperty = properties.find((p) => p.name === propertyKey)
2424
if (existingProperty) {
2525
// create new property with merged options
2626
property = { ...existingProperty, ...propertyMetadata }
2727
// remove existing from array
28-
properties = properties.filter(p => p !== existingProperty)
28+
properties = properties.filter((p) => p !== existingProperty)
2929
} else {
3030
// add new options
3131
property = createNewProperty(propertyMetadata, target, propertyKey)

src/decorator/metadata/metadata.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class Metadata<T> {
3232
modelOpts: ModelMetadata<M>,
3333
propertyName: keyof M,
3434
): PropertyMetadata<M> | undefined {
35-
return modelOpts.properties.find(property => property.name === propertyName || property.nameDb === propertyName)
35+
return modelOpts.properties.find((property) => property.name === propertyName || property.nameDb === propertyName)
3636
}
3737

3838
constructor(modelConstructor: ModelConstructor<T>) {
@@ -95,7 +95,7 @@ export class Metadata<T> {
9595
throw new Error(`there is no index defined for name ${indexName}`)
9696
}
9797
} else {
98-
const property = filterByFirst(this.modelOptions, p => !!(p.key && p.key.type === 'HASH'))
98+
const property = filterByFirst(this.modelOptions, (p) => !!(p.key && p.key.type === 'HASH'))
9999

100100
if (property) {
101101
return property.name
@@ -123,7 +123,7 @@ export class Metadata<T> {
123123
throw new Error(`there is no index defined for name ${indexName}`)
124124
}
125125
} else {
126-
const property = filterByFirst(this.modelOptions, p => !!(p.key && p.key.type === 'RANGE'))
126+
const property = filterByFirst(this.modelOptions, (p) => !!(p.key && p.key.type === 'RANGE'))
127127
return property ? property.name : null
128128
}
129129
}

src/dynamo/batchget/batch-get-utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ export function batchGetItemsFetchAll(
2020
backoffTimer: IterableIterator<number>,
2121
throttleTimeSlot: number,
2222
): Promise<DynamoDB.BatchGetItemOutput> {
23-
return dynamoDBWrapper.batchGetItems(params).then(response => {
23+
return dynamoDBWrapper.batchGetItems(params).then((response) => {
2424
if (hasUnprocessedKeys(response)) {
2525
// in case of unprocessedKeys do a follow-up requests
2626
return (
2727
Promise.resolve(response.UnprocessedKeys)
2828
// delay before doing the follow-up request
2929
.then(promiseDelay(backoffTimer.next().value * throttleTimeSlot))
30-
.then(UnprocessedKeys => {
30+
.then((UnprocessedKeys) => {
3131
const nextParams = { ...params, RequestItems: UnprocessedKeys }
3232
// call recursively batchGetItemsFetchAll with the returned UnprocessedItems params
3333
return batchGetItemsFetchAll(dynamoDBWrapper, nextParams, backoffTimer, throttleTimeSlot)
@@ -56,7 +56,7 @@ export function hasUnprocessedKeys(
5656
if (!response.UnprocessedKeys) {
5757
return false
5858
}
59-
return Object.values(response.UnprocessedKeys).some(t => !!t && t.Keys && t.Keys.length > 0)
59+
return Object.values(response.UnprocessedKeys).some((t) => !!t && t.Keys && t.Keys.length > 0)
6060
}
6161

6262
/**
@@ -68,8 +68,8 @@ export function combineBatchGetResponses(response1: DynamoDB.BatchGetItemOutput)
6868
const tableNames: string[] = Object.keys(response1.Responses || {})
6969

7070
Object.keys(response2.Responses || {})
71-
.filter(tn => !tableNames.includes(tn))
72-
.forEach(tn => tableNames.push(tn))
71+
.filter((tn) => !tableNames.includes(tn))
72+
.forEach((tn) => tableNames.push(tn))
7373

7474
const Responses = tableNames.reduce(
7575
(u, tableName) => ({

0 commit comments

Comments
 (0)