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
- reflect-metadata should only exist once in the whole code base of a project so the consumer of our library must import the reflect-metadata project, even if he might not use it in his code base. But if he uses the reflect-metadata in his code or uses another library like InversifyJS we must ensure the Reflect global variable only exists once, to prevent from possible hard to debug issues
This is the documentation for the new version of dynamo-easy released as a scoped package using the namespace
12
-
@shiftcoders (@shiftcoders/dynamo-easy). If you still want to use the 0.0.x version you can
13
-
by installing the old version `npm install dynamo-easy` (https://github
14
-
.com/shiftcode/dynamo-easy/releases/tag/v0.10
15
-
.1)
16
-
17
11
Abstracts away the complexity of the low level aws dynamosdk. Provides an easy to use fluent api to for requests and supports typescript decorators,
18
12
to define some metadata for your models. You don't need to care about the mapping of javascript types to their dynamo types any more. We got you covered.
19
13
@@ -22,6 +16,37 @@ Checkout the full technical api documentation [here](https://shiftcode.github.io
22
16
Built with :heart: by [shiftcode](https://www.shiftcode.ch).
23
17
24
18
# Get Started
19
+
20
+
## Metadata Reflection API
21
+
22
+
> ⚠ The reflect-metadata polyfill should be imported only once in your entire application because the Reflect object is
23
+
mean to be a global singleton.
24
+
25
+
Required always. Use reflect-metadata as polyfill.
26
+
27
+
```
28
+
npm install reflect-metadata --save
29
+
```
30
+
31
+
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:
33
+
34
+
```
35
+
"types": ["reflect-metadata"]
36
+
```
37
+
38
+
Finally, import reflect-metadata in some entry file in your application.
39
+
40
+
```
41
+
import "reflect-metadata"
42
+
```
43
+
44
+
Also make sure to install the other peer dependencies of @shiftcoders/dynamo-easy.
45
+
46
+
## First Sample
47
+
48
+
When all the setup work is done, define your first model and create a dynamo store to execute actions on the dynamoDB.
49
+
25
50
```typescript
26
51
@Model()
27
52
classPerson{
@@ -57,8 +82,6 @@ dynamoStore.scan()
57
82
58
83
```
59
84
60
-
Want to use this library with Angular (>4) [checkout our angular-service](TODO).
61
-
62
85
# Decorators
63
86
Decorators are used to add some metadata to our model classes, relevant to our javascript-to-dynamo mapper.
Copy file name to clipboardExpand all lines: tsconfig.json
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,10 @@
47
47
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
48
48
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
49
49
// "typeRoots": [], /* List of folders to include type definitions from. */
50
-
// "types": [], /* Type declaration files to be included in compilation. */
50
+
"types": [ /* Type declaration files to be included in compilation. */
51
+
"node",
52
+
"reflect-metadata"
53
+
],
51
54
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
52
55
// "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
53
56
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
0 commit comments