You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,7 @@ Simple Type (no decorators required to work)
109
109
- Boolean
110
110
- Null
111
111
- Array
112
+
- String/Number Enum
112
113
113
114
Complex Types (properties with these types need some decorators to work properly)
114
115
- Set<simpleType | complexType>
@@ -120,7 +121,6 @@ Complex Types (properties with these types need some decorators to work properly
120
121
| String | S |
121
122
| Number | N |
122
123
| Boolean | BOOL |
123
-
| moment.Moment | S (ISO-8601 formatted) |
124
124
| null | NULL |
125
125
| Array | L, (S,N,B)S |
126
126
| ES6 Set | L, (S,N,B)S |
@@ -131,7 +131,8 @@ Complex Types (properties with these types need some decorators to work properly
131
131
| Date | Not Supported |
132
132
133
133
## Custom Attribute Mapping
134
-
It is always possible to define a custom mapping strategy, just implement the [MapperForType](https://shiftcode.github.io/dynamo-easy/interfaces/_mapper_for_type_base_mapper_.mapperfortype.html) class.
134
+
It is always possible to define a custom mapping strategy,
135
+
just implement the [MapperForType](https://shiftcode.github.io/dynamo-easy/interfaces/_mapper_for_type_base_mapper_.mapperfortype.html) and provide with the CustomMapper directive.
135
136
136
137
## Collection Mapping (Array & Set)
137
138
@@ -152,40 +153,39 @@ When one of the following decorators is present, the value is always mapped to a
152
153
We only support the native Date type and you need to explicitly mark a property to be a Date by using the @Date() decorator\
153
154
(which is basically just syntactic sugar for @CustomMapper(TheDateMapper)).\
154
155
If you want to use a different type for the @Date decorator (eg. Moment) you need to define a custom mapper and provide it to the dynamo easy config like this:\
thrownewError(`the value ${value} cannot be parsed into a valid moment date`)
170
170
}
171
171
returnparsed
172
-
}
172
+
},
173
173
174
-
toDb(value:moment.Moment):StringAttribute {
174
+
toDb: (value:moment.Moment)=> {
175
175
if (!moment.isMoment(value)) {
176
176
thrownewError(`the value ${value} is not of type moment`)
177
177
}
178
178
if (!value.isValid()) {
179
179
thrownewError(`cannot map property value ${value}, because it is not a valid moment date`)
180
180
}
181
181
return { S: value.clone().utc().format() }
182
-
}
182
+
},
183
183
}
184
184
```
185
185
186
186
187
187
## Enum
188
-
Enum values are persisted as Numbers (index of enum).
188
+
Enum values are persisted as Numbers (index of enum) or string if string value was given.
189
189
190
190
# Request API
191
191
To start making requests create an instance of [DynamoStore](https://shiftcode.github.io/dynamo-easy/classes/_dynamo_dynamo_store_.dynamostore.html) and execute the desired operation using the provided api.
@@ -197,7 +197,8 @@ We support the following dynamodb operations with a fluent api:
197
197
- Delete
198
198
- Scan
199
199
- Query
200
-
- BatchGet
200
+
- BatchGet (from a single table)
201
+
- BatchWrite (to a single table)
201
202
- MakeRequest (generic low level method for special scenarios)
202
203
203
204
There is always the possibility to access the Params object directly to add values which are not covered with our api.
@@ -218,7 +219,7 @@ function sessionValidityEnsurer(): Observable<boolean> {
218
219
this.logger.debug('withValidSession :: cognitoService.isLoggedIn() -> we have a valid session -> proceed')
219
220
returnObservable.of(true)
220
221
} else {
221
-
this.logger.debug('withValidSession :: cognitoService.isLoggedIn() -> user is not logged in or token expired, try to get a new session')
222
+
this.logger.debug(metadata)
222
223
returnthis.getUser()
223
224
.catch((err, caught): Observable<boolean>=> {
224
225
this.logger.error('withValidSession :: there was an error when refreshing the session', err)
0 commit comments