kuzzle 2.18.1 → 2.19.2

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.
Files changed (42) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +3 -0
  3. package/lib/api/controllers/adminController.js +9 -0
  4. package/lib/api/controllers/debugController.d.ts +59 -0
  5. package/lib/api/controllers/debugController.js +285 -0
  6. package/lib/api/controllers/documentController.js +43 -29
  7. package/lib/api/controllers/index.js +1 -0
  8. package/lib/api/controllers/securityController.js +2 -2
  9. package/lib/api/documentExtractor.js +49 -8
  10. package/lib/api/funnel.js +30 -8
  11. package/lib/api/httpRoutes.js +6 -0
  12. package/lib/api/request/kuzzleRequest.d.ts +12 -4
  13. package/lib/api/request/kuzzleRequest.js +17 -13
  14. package/lib/cluster/idCardHandler.js +1 -1
  15. package/lib/config/default.config.js +3 -0
  16. package/lib/config/documentEventAliases.d.ts +7 -0
  17. package/lib/config/documentEventAliases.js +26 -12
  18. package/lib/core/backend/backend.d.ts +4 -0
  19. package/lib/core/backend/backend.js +9 -0
  20. package/lib/core/network/protocols/httpwsProtocol.js +6 -0
  21. package/lib/core/shared/sdk/embeddedSdk.d.ts +1 -1
  22. package/lib/core/shared/sdk/embeddedSdk.js +33 -0
  23. package/lib/kerror/codes/0-core.json +35 -0
  24. package/lib/kerror/codes/2-api.json +6 -0
  25. package/lib/kuzzle/kuzzle.d.ts +1 -1
  26. package/lib/kuzzle/kuzzle.js +27 -8
  27. package/lib/model/storage/apiKey.js +1 -6
  28. package/lib/service/storage/elasticsearch.js +40 -13
  29. package/lib/types/DebugModule.d.ts +23 -0
  30. package/lib/types/DebugModule.js +39 -0
  31. package/lib/types/config/SecurityConfiguration.d.ts +10 -0
  32. package/lib/util/crypto.d.ts +1 -0
  33. package/lib/util/crypto.js +12 -0
  34. package/lib/util/name-generator.d.ts +79 -0
  35. package/lib/util/name-generator.js +1409 -1345
  36. package/lib/util/time.d.ts +1 -0
  37. package/lib/util/time.js +9 -0
  38. package/npm-shrinkwrap.json +19422 -0
  39. package/package.json +4 -6
  40. package/lib/core/security/README.md +0 -224
  41. package/lib/core/shared/README.md +0 -3
  42. package/package-lock.json +0 -8422
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.18.1",
4
+ "version": "2.19.2",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
- "bin": {
7
- "kuzzle": "bin/start-kuzzle-server"
8
- },
6
+ "bin": "bin/start-kuzzle-server",
9
7
  "scripts": {
10
8
  "file": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json",
11
9
  "start:dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin",
@@ -53,7 +51,6 @@
53
51
  "didyoumean": "^1.2.2",
54
52
  "dumpme": "^1.0.3",
55
53
  "eventemitter3": "^4.0.7",
56
- "express": "^4.17.3",
57
54
  "inquirer": "^8.2.2",
58
55
  "ioredis": "^5.0.4",
59
56
  "js-yaml": "^4.1.0",
@@ -78,8 +75,8 @@
78
75
  "rc": "1.2.8",
79
76
  "semver": "^7.3.7",
80
77
  "sorted-array": "^2.0.4",
81
- "uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v20.0.0.tar.gz",
82
78
  "uuid": "^8.3.2",
79
+ "uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v20.0.0.tar.gz",
83
80
  "validator": "^13.7.0",
84
81
  "winston": "^3.7.2",
85
82
  "winston-elasticsearch": "0.16.1",
@@ -102,6 +99,7 @@
102
99
  "cucumber": "^6.0.5",
103
100
  "ergol": "^1.0.2",
104
101
  "eslint": "^8.13.0",
102
+ "eslint-plugin-no-only-tests": "^2.6.0",
105
103
  "mocha": "^9.2.2",
106
104
  "mock-require": "^3.0.3",
107
105
  "mqtt": "^4.3.7",
@@ -1,224 +0,0 @@
1
- # Kuzzle repositories
2
-
3
- The Repository classes allow to fetch and store some Kuzzle internal business object from/to the persistent layer.
4
-
5
- An abstract Repository class is available to be overridden if needed depending on the business needs.
6
- The class handles the persistence both to the Cache module and to the database (elastic search by default).
7
-
8
- The **Repository** class exposes the following methods:
9
-
10
- ## Constructor
11
-
12
- The constructor expects to be passed the kuzzle instance and an options array.
13
-
14
- ### options
15
-
16
- * *string* collection (mandatory)
17
-
18
- The underlying collection to store the Business objects to.
19
-
20
- * *integer | false* ttl (optional)
21
-
22
- The ttl to use for the cache module. If set to false, the objects get an unlimited lifetime.
23
-
24
- * *function* ObjectConstructor (mandatory)
25
-
26
- The constructor function for the business objects. The load* methods will return some new instances of this function.
27
-
28
- * *function* indexStorage (optional)
29
-
30
- The read engine to use to retrieve the business objects to/from the database. Defaults to Kuzzle's internalStorage (elasticsearch).
31
-
32
- * *function* cache (optional)
33
-
34
- The cache database to use to store and retrieve the business objects to/from the cache. Defaults to Kuzzle's internal cache.
35
-
36
- ## loadOneFromDatabase
37
-
38
- ```javascript
39
- Repository.prototype.loadOneFromDatabase = function (id) {...}
40
- ```
41
-
42
- This method loads one object from the database given its id.
43
-
44
- ### parameters
45
-
46
- * *string* id
47
-
48
- The id of the document to retrieve.
49
-
50
- ### returns
51
-
52
- Returns a promise that resolves to the *ObjectConstructor* instance if found or null if the id does not exist in the database.
53
-
54
- ## loadMultiFromDatabase
55
-
56
- ```javascript
57
- Repository.prototype.loadMultiFromDatabase = function (ids, hydrate) {...}
58
- ```
59
-
60
- This method tries to load the business objects from the database matching the given ids.
61
-
62
- ### returns
63
-
64
- Returns a promise that resolves to an array containing the *ObjectConstructor* instances or documents that could be retrieved from the database.
65
-
66
- If no matching document could be found, an empty array is returned.
67
-
68
- ## search
69
-
70
- ```javascript
71
- Repository.prototype.search = function (filter, from, size) {...}
72
- ```
73
-
74
- This method tries to load documents matching the given ids from the indexStorage.
75
-
76
- ### parameters
77
-
78
- * *object* query
79
-
80
- The query sent to the indexStorage in order to retrieve documents.
81
-
82
- * *Integer* from
83
-
84
- Starting offset (default: 0).
85
-
86
- * *Integer* size
87
-
88
- Number of hits to return (default: 20).
89
-
90
- ### returns
91
-
92
- Returns a promise that resolves to an object that contains a list of documents from indexStorage.
93
-
94
-
95
- ## loadFromCache
96
-
97
- ```javascript
98
- Repository.prototype.loadFromCache = function (id, opts) {...}
99
- ```
100
-
101
- This method loads one object from the cache given its id.
102
-
103
- ### parameters
104
-
105
- * *string* id
106
-
107
- The object id to load from the cache.
108
-
109
- * *Object* opts
110
-
111
- An optional options object.
112
-
113
- Currently, the only optional parameter that can be pass to the method is *key*.
114
- If no key is given to the method, defaults to *collection* + '/' + id.
115
-
116
- ### returns
117
-
118
- Returns a promise that resolves to the *ObjectConstructor* instance if a matching document could be found in the cache, or *null* if no document could be found.
119
-
120
- ## persistToDB
121
-
122
- ```javascript
123
- Repository.prototype.persistToDB = function (object) {...}
124
- ```
125
-
126
- This method persists the given *ObjectConstructor* instance to the database.
127
-
128
- ### parameters
129
-
130
- * *ObjectConstructor* object
131
-
132
- The business object to persist.
133
-
134
- ### returns
135
-
136
- *(Promise)*
137
-
138
- ## persistToCache
139
-
140
- ```javascript
141
- Repository.prototype.persistToCache = function (object, opts) {...}
142
- ```
143
-
144
- This method persists the given *ObjectConstructor* instance to the cache.
145
-
146
- ### parameters
147
-
148
- * *ObjectConstructor* object
149
-
150
- The business object to persist.
151
-
152
- * *Object* opts
153
-
154
- An optional options object.
155
- The supported options are:
156
-
157
- > * key: The key used to store the object in the cache engine. Defaults to *collection* + '/' + object._id
158
- > * ttl: Defaults to the repository ttl. If set to false, the object will never expire.
159
-
160
- ### returns
161
-
162
- *(Promise)*
163
-
164
- ## refreshCacheTTL
165
-
166
- ```javascript
167
- Repository.prototype.refreshCacheTTL = function (object, opts) {...}
168
- ```
169
-
170
- This methods updates the object's TTL in the cache engine.
171
-
172
- ### parameters
173
-
174
- * *ObjectConstructor* object
175
-
176
- The business object to update.
177
-
178
- * *Object* opts
179
-
180
- An optional options object.
181
- The supported options are:
182
-
183
- > * key: The key used to store the object in the cache engine. Defaults to *collection* + '/' + object._id
184
- > * ttl: Defaults to the repository ttl. If set to false, the object will never expire.
185
-
186
- ### returns
187
-
188
- *(Promise)*
189
-
190
- ## serializeToCache
191
-
192
- ```javascript
193
- Repository.prototype.serializeToCache = function (object) {...}
194
- ```
195
-
196
- This method transforms the business object before being persisted to the cache. The default implementation just returns the object without any transformation and is meant to be overridden.
197
-
198
- ### parameters
199
-
200
- * *ObjectConstructor* object
201
-
202
- The business object to persist.
203
-
204
- ### returns
205
-
206
- *(Object)*
207
-
208
- ## serializeToDatabase
209
-
210
- ```javascript
211
- Repository.prototype.serializeToDatabase = function (object) {...}
212
- ```
213
-
214
- This method transforms the business object before being persisted to the cache. The default implementation just returns the object without any transformation and is meant to be overridden.
215
-
216
- ### parameters
217
-
218
- * *ObjectConstructor* object
219
-
220
- The business object to persist.
221
-
222
- ### returns
223
-
224
- *(Object)*
@@ -1,3 +0,0 @@
1
- # Description
2
-
3
- This directory contains shared objects between core modules.