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
- update README to provide some more information about what is required to start to use dynamo-easy
- adding comment with breaking change which I forgot to add previously
BREAKING CHANGE
all consumers of dynamo-easy must install and import reflect-metadata in their project.
Copy file name to clipboardExpand all lines: README.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,19 +17,23 @@ Built with :heart: by [shiftcode](https://www.shiftcode.ch).
17
17
18
18
# Get Started
19
19
20
-
## Metadata Reflection API
20
+
## Prerequisite
21
+
22
+
### Typescript Metadata
23
+
24
+
#### Reflection API
21
25
22
26
> ⚠ The reflect-metadata polyfill should be imported only once in your entire application because the Reflect object is
23
27
mean to be a global singleton.
24
28
25
-
Required always. Use reflect-metadata as polyfill.
29
+
Install the reflect-metadata polyfill.
26
30
27
31
```
28
32
npm install reflect-metadata --save
29
33
```
30
34
31
35
The type definitions for reflect-metadata are included in the npm package.
32
-
You need to add the following reference to the types field in your tsconfig.json:
36
+
You need to add the following reference to the types field in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types):
33
37
34
38
```
35
39
"types": ["reflect-metadata"]
@@ -41,8 +45,20 @@ Finally, import reflect-metadata in some entry file in your application.
41
45
import "reflect-metadata"
42
46
```
43
47
48
+
#### Decorators
49
+
50
+
51
+
We need to enable the two experimental features to work with decorators, add this to your tsconfig.json:
52
+
53
+
```
54
+
"experimentalDecorators": true
55
+
"emitDecoratorMetadata": true
56
+
```
57
+
58
+
#### Other
44
59
Also make sure to install the other peer dependencies of @shiftcoders/dynamo-easy.
45
60
61
+
46
62
## First Sample
47
63
48
64
When all the setup work is done, define your first model and create a dynamo store to execute actions on the dynamoDB.
@@ -85,11 +101,6 @@ dynamoStore.scan()
85
101
# Decorators
86
102
Decorators are used to add some metadata to our model classes, relevant to our javascript-to-dynamo mapper.
87
103
88
-
This is an experimental feature and requires to set the following typescript compiler options:
89
-
90
-
- "experimentalDecorators": true
91
-
- "emitDecoratorMetadata": true
92
-
93
104
Additionally we rely on the reflect-metadata (https://www.npmjs.com/package/reflect-metadata) library for reflection api.
94
105
95
106
To get started with decorators just add a [@Model()](https://shiftcode.github.io/dynamo-easy/modules/_decorator_impl_model_model_decorator_.html) Decorator to any typescript class.
0 commit comments