data-primals-engine 1.0.1 → 1.0.2-s

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -96,7 +96,7 @@ Example:
96
96
 
97
97
  #### Create a model
98
98
  ```bash
99
- curl -X POST http://localhost:7633/api/model?_user=demouser \
99
+ curl -X POST http://localhost:7633/api/model?_user=demo \
100
100
  -H "Authorization: Bearer demotoken" \
101
101
  -H "Content-Type: application/json" \
102
102
  -d '{
@@ -111,7 +111,7 @@ curl -X POST http://localhost:7633/api/model?_user=demouser \
111
111
 
112
112
  #### Update a model
113
113
  ```bash
114
- curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demouser \
114
+ curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demo \
115
115
  -H "Authorization: Bearer demotoken" \
116
116
  -H "Content-Type: application/json" \
117
117
  -d '{
@@ -126,7 +126,7 @@ curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demou
126
126
 
127
127
  #### Delete a model
128
128
  ```bash
129
- curl -X DELETE "http://localhost:7633/api/model?_user=demouser&name=newModel" \
129
+ curl -X DELETE "http://localhost:7633/api/model?_user=demo&name=newModel" \
130
130
  -H "Authorization: Bearer demotoken"
131
131
  ```
132
132
 
@@ -134,7 +134,7 @@ curl -X DELETE "http://localhost:7633/api/model?_user=demouser&name=newModel" \
134
134
 
135
135
  #### Create a document
136
136
  ```bash
137
- curl -X POST http://localhost:7633/api/data?_user=demouser \
137
+ curl -X POST http://localhost:7633/api/data?_user=demo \
138
138
  -H "Authorization: Bearer demotoken" \
139
139
  -H "Content-Type: application/json" \
140
140
  -d '{
@@ -150,7 +150,7 @@ curl -X POST http://localhost:7633/api/data?_user=demouser \
150
150
 
151
151
  #### Search documents
152
152
  ```bash
153
- curl -X POST http://localhost:7633/api/data/search?_user=demouser \
153
+ curl -X POST http://localhost:7633/api/data/search?_user=demo \
154
154
  -H "Authorization: Bearer demotoken" \
155
155
  -H "Content-Type: application/json" \
156
156
  -d '{
@@ -161,7 +161,7 @@ curl -X POST http://localhost:7633/api/data/search?_user=demouser \
161
161
 
162
162
  #### Update a document by ID
163
163
  ```bash
164
- curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demouser \
164
+ curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demo \
165
165
  -H "Authorization: Bearer demotoken" \
166
166
  -H "Content-Type: application/json" \
167
167
  -d '{
@@ -172,7 +172,7 @@ curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demous
172
172
 
173
173
  #### Bulk update
174
174
  ```bash
175
- curl -X PUT http://localhost:7633/api/data?_user=demouser \
175
+ curl -X PUT http://localhost:7633/api/data?_user=demo \
176
176
  -H "Authorization: Bearer demotoken" \
177
177
  -H "Content-Type: application/json" \
178
178
  -d '{
@@ -183,7 +183,7 @@ curl -X PUT http://localhost:7633/api/data?_user=demouser \
183
183
 
184
184
  #### Delete documents
185
185
  ```bash
186
- curl -X DELETE http://localhost:7633/api/data?_user=demouser \
186
+ curl -X DELETE http://localhost:7633/api/data?_user=demo \
187
187
  -H "Authorization: Bearer demotoken" \
188
188
  -H "Content-Type: application/json" \
189
189
  -d '{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-primals-engine",
3
- "version": "1.0.1",
3
+ "version": "1.0.2s",
4
4
 
5
5
  "description": "data-primals-engine is the package responsible from handling large amount of data in a practical and performant way. It can handle large amount of data in a practical and performant way. It can also get workflow models working (for automation), and fully supports internationalisation.",
6
6
  "main": "src/engine.js",
package/src/providers.js CHANGED
@@ -47,8 +47,10 @@ export class UserProvider {
47
47
 
48
48
  export class DefaultUserProvider extends UserProvider {
49
49
 
50
+ users= [{ username: "demo", password: "demo" }];
51
+
50
52
  async findUserByUsername(username) {
51
- return { username: "test", password: "test" };
53
+ return this.users.find(user => user.username === username);
52
54
  }
53
55
 
54
56
  async validatePassword(user, password) {
@@ -57,5 +59,6 @@ export class DefaultUserProvider extends UserProvider {
57
59
  }
58
60
 
59
61
  async initiateUser(req) {
62
+ req.me = this.users[0];
60
63
  }
61
64
  }