kuzzle 2.27.1 → 2.27.3

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 (71) hide show
  1. package/README.md +12 -6
  2. package/lib/api/controllers/adminController.js +9 -9
  3. package/lib/api/controllers/bulkController.js +9 -9
  4. package/lib/api/controllers/collectionController.js +17 -17
  5. package/lib/api/controllers/documentController.js +51 -51
  6. package/lib/api/controllers/indexController.js +4 -4
  7. package/lib/api/controllers/memoryStorageController.js +11 -11
  8. package/lib/api/controllers/realtimeController.js +1 -1
  9. package/lib/api/controllers/securityController.js +67 -70
  10. package/lib/api/controllers/serverController.js +5 -5
  11. package/lib/api/documentExtractor.js +3 -3
  12. package/lib/api/funnel.js +43 -43
  13. package/lib/api/rateLimiter.js +1 -1
  14. package/lib/cluster/command.js +4 -4
  15. package/lib/cluster/idCardHandler.js +1 -1
  16. package/lib/cluster/node.js +55 -55
  17. package/lib/cluster/subscriber.js +33 -33
  18. package/lib/cluster/workers/IDCardRenewer.js +4 -4
  19. package/lib/config/index.js +24 -24
  20. package/lib/core/auth/passportWrapper.js +6 -6
  21. package/lib/core/cache/cacheEngine.js +20 -20
  22. package/lib/core/network/accessLogger.js +15 -15
  23. package/lib/core/network/entryPoint.js +12 -12
  24. package/lib/core/network/httpRouter/index.js +4 -4
  25. package/lib/core/network/httpRouter/routePart.js +2 -2
  26. package/lib/core/network/protocols/httpwsProtocol.js +41 -41
  27. package/lib/core/network/protocols/internalProtocol.js +2 -2
  28. package/lib/core/network/protocols/mqttProtocol.js +9 -9
  29. package/lib/core/network/protocols/protocol.js +3 -3
  30. package/lib/core/network/router.js +7 -7
  31. package/lib/core/plugin/plugin.js +23 -23
  32. package/lib/core/plugin/pluginManifest.js +1 -1
  33. package/lib/core/plugin/pluginsManager.js +62 -62
  34. package/lib/core/realtime/notifier.js +14 -14
  35. package/lib/core/security/README.md +223 -0
  36. package/lib/core/security/roleRepository.js +18 -18
  37. package/lib/core/security/securityLoader.js +7 -7
  38. package/lib/core/security/userRepository.js +16 -16
  39. package/lib/core/shared/README.md +3 -0
  40. package/lib/core/shared/abstractManifest.js +1 -1
  41. package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
  42. package/lib/core/shared/store.js +11 -11
  43. package/lib/core/statistics/statistics.js +15 -15
  44. package/lib/core/storage/clientAdapter.js +61 -61
  45. package/lib/core/validation/baseType.js +1 -1
  46. package/lib/core/validation/types/date.js +1 -1
  47. package/lib/core/validation/types/enum.js +5 -5
  48. package/lib/core/validation/types/geoShape.js +13 -13
  49. package/lib/core/validation/types/numeric.js +2 -2
  50. package/lib/core/validation/types/string.js +2 -2
  51. package/lib/core/validation/validation.js +71 -71
  52. package/lib/kerror/codes/index.js +23 -23
  53. package/lib/kuzzle/dumpGenerator.js +17 -17
  54. package/lib/kuzzle/event/kuzzleEventEmitter.js +9 -9
  55. package/lib/kuzzle/event/pipeRunner.js +2 -2
  56. package/lib/kuzzle/internalIndexHandler.js +8 -8
  57. package/lib/kuzzle/log.js +2 -2
  58. package/lib/kuzzle/vault.js +4 -4
  59. package/lib/model/security/role.js +3 -1
  60. package/lib/model/security/user.js +3 -1
  61. package/lib/model/storage/apiKey.js +3 -3
  62. package/lib/model/storage/baseModel.js +7 -7
  63. package/lib/service/cache/redis.js +3 -3
  64. package/lib/service/storage/elasticsearch.js +52 -52
  65. package/lib/service/storage/esWrapper.js +3 -3
  66. package/lib/service/storage/queryTranslator.js +2 -2
  67. package/lib/util/assertType.js +1 -1
  68. package/lib/util/deprecate.js +3 -3
  69. package/lib/util/extractFields.js +2 -2
  70. package/lib/util/wildcard.js +1 -1
  71. package/package.json +69 -81
package/README.md CHANGED
@@ -48,13 +48,19 @@ Check out our [support plans](https://kuzzle.io/pricing/).
48
48
  The easiest way to start a Kuzzle application is to use [Kourou](https://github.com/kuzzleio/kourou):
49
49
 
50
50
  ```bash
51
- npx kourou app:scaffold playground
51
+ kourou app:scaffold playground
52
52
 
53
53
  🚀 Kourou - Scaffolds a new Kuzzle application
54
54
 
55
- ✔ Creating and rendering application files
55
+ generic
56
+ ✔ Checking destination
57
+ ✔ Prepare temporary folder
58
+ ✔ Cloning template repository
59
+ ✔ Copying template files
60
+ ✔ Cleaning up
56
61
 
57
- [✔] Scaffolding complete! Use cd playground && npm run docker npm install install dependencies and then npm run docker:dev to run your application!
62
+ [✔] Scaffolding complete!
63
+ [✔] Use cd playground && docker compose up -d to start your Kuzzle stack.
58
64
  ```
59
65
 
60
66
  Then you need to run Kuzzle services, Elasticsearch and Redis: `kourou app:start-services`
@@ -123,7 +129,7 @@ Check our [contributing documentation](./CONTRIBUTING.md) to know about our codi
123
129
 
124
130
  ## Join our community
125
131
 
126
- * Follow us on [twitter](https://twitter.com/kuzzleio) to get latest news
132
+ * Follow us on [𝕏 (Twitter)](https://twitter.com/kuzzleio) to get latest news
127
133
  * Register to our monthly [newsletter](http://eepurl.com/bxRxpr) to get highlighed news
128
134
  * Visit our [blog](https://blog.kuzzle.io/) to be informed about what we are doing
129
135
  * Come chat with us on [Discord](http://join.discord.kuzzle.io)
@@ -139,8 +145,8 @@ First of all make sure that you have at least `4GB` of ram allocated to your vm
139
145
 
140
146
  Run the following command to install all the dependencies in your container:
141
147
  ```bash
142
- npm run docker:install
148
+ docker compose run kuzzle_node_1 npm ci
143
149
  ```
144
150
 
145
- finally run the command `docker-compose up` to launch your kuzzle stack.
151
+ Finally, run the command `docker compose up` to start your Kuzzle stack.
146
152
 
@@ -81,7 +81,7 @@ class AdminController extends NativeController {
81
81
  "api",
82
82
  "process",
83
83
  "action_locked",
84
- "Kuzzle is already reseting roles, profiles and users."
84
+ "Kuzzle is already reseting roles, profiles and users.",
85
85
  );
86
86
  }
87
87
 
@@ -92,22 +92,22 @@ class AdminController extends NativeController {
92
92
 
93
93
  result.deletedUsers = await this.ask(
94
94
  "core:security:user:truncate",
95
- options
95
+ options,
96
96
  );
97
97
  result.deletedProfiles = await this.ask(
98
98
  "core:security:profile:truncate",
99
- options
99
+ options,
100
100
  );
101
101
  result.deletedRoles = await this.ask(
102
102
  "core:security:role:truncate",
103
- options
103
+ options,
104
104
  );
105
105
 
106
106
  await global.kuzzle.internalIndex.createInitialSecurities();
107
107
 
108
108
  await this.ask(
109
109
  "core:cache:internal:del",
110
- `${BACKEND_IMPORT_KEY}:permissions`
110
+ `${BACKEND_IMPORT_KEY}:permissions`,
111
111
  );
112
112
  } finally {
113
113
  await mutex.unlock();
@@ -127,7 +127,7 @@ class AdminController extends NativeController {
127
127
  "api",
128
128
  "process",
129
129
  "action_locked",
130
- "Kuzzle is already reseting all indexes."
130
+ "Kuzzle is already reseting all indexes.",
131
131
  );
132
132
  }
133
133
 
@@ -137,7 +137,7 @@ class AdminController extends NativeController {
137
137
 
138
138
  await this.ask(
139
139
  "core:cache:internal:del",
140
- `${BACKEND_IMPORT_KEY}:mappings`
140
+ `${BACKEND_IMPORT_KEY}:mappings`,
141
141
  );
142
142
 
143
143
  return { acknowledge: true };
@@ -168,7 +168,7 @@ class AdminController extends NativeController {
168
168
  "api",
169
169
  "process",
170
170
  "action_locked",
171
- "Kuzzle is already shutting down."
171
+ "Kuzzle is already shutting down.",
172
172
  );
173
173
  }
174
174
 
@@ -193,7 +193,7 @@ class AdminController extends NativeController {
193
193
  request.getRefresh("wait_for"),
194
194
  global.kuzzle.ask("core:storage:public:mappings:import", mappings, {
195
195
  rawMappings: true,
196
- })
196
+ }),
197
197
  );
198
198
  }
199
199
 
@@ -55,7 +55,7 @@ class BulkController extends NativeController {
55
55
  index,
56
56
  collection,
57
57
  bulkData,
58
- options
58
+ options,
59
59
  );
60
60
 
61
61
  if (strict && errors.length) {
@@ -64,7 +64,7 @@ class BulkController extends NativeController {
64
64
  "process",
65
65
  "incomplete_multiple_request",
66
66
  "import",
67
- errors
67
+ errors,
68
68
  );
69
69
  }
70
70
 
@@ -92,7 +92,7 @@ class BulkController extends NativeController {
92
92
  collection,
93
93
  id,
94
94
  content,
95
- { injectKuzzleMeta: false, refresh }
95
+ { injectKuzzleMeta: false, refresh },
96
96
  );
97
97
 
98
98
  if (notify) {
@@ -100,7 +100,7 @@ class BulkController extends NativeController {
100
100
  "core:realtime:document:notify",
101
101
  request,
102
102
  actionEnum.WRITE,
103
- result
103
+ result,
104
104
  );
105
105
  }
106
106
 
@@ -126,7 +126,7 @@ class BulkController extends NativeController {
126
126
  index,
127
127
  collection,
128
128
  documents,
129
- { injectKuzzleMeta: false, limits: false, refresh }
129
+ { injectKuzzleMeta: false, limits: false, refresh },
130
130
  );
131
131
 
132
132
  if (strict && errors.length) {
@@ -135,7 +135,7 @@ class BulkController extends NativeController {
135
135
  "process",
136
136
  "incomplete_multiple_request",
137
137
  "write",
138
- errors
138
+ errors,
139
139
  );
140
140
  }
141
141
 
@@ -146,7 +146,7 @@ class BulkController extends NativeController {
146
146
  "core:realtime:document:mNotify",
147
147
  request,
148
148
  actionEnum.WRITE,
149
- items
149
+ items,
150
150
  );
151
151
  }
152
152
 
@@ -178,7 +178,7 @@ class BulkController extends NativeController {
178
178
  index,
179
179
  collection,
180
180
  query,
181
- { fetch: false, refresh, size: -1 }
181
+ { fetch: false, refresh, size: -1 },
182
182
  );
183
183
 
184
184
  return { deleted };
@@ -202,7 +202,7 @@ class BulkController extends NativeController {
202
202
  collection,
203
203
  query,
204
204
  changes,
205
- { refresh }
205
+ { refresh },
206
206
  );
207
207
  }
208
208
  }
@@ -61,7 +61,7 @@ class CollectionController extends NativeController {
61
61
  async updateMapping(request) {
62
62
  request.addDeprecation(
63
63
  "2.1.0",
64
- 'This action has been deprecated since Kuzzle version 2.1.0. This feature might be removed in a future major version. To update a collection, use this API action instead: "collection:update".'
64
+ 'This action has been deprecated since Kuzzle version 2.1.0. This feature might be removed in a future major version. To update a collection, use this API action instead: "collection:update".',
65
65
  );
66
66
 
67
67
  const { index, collection } = request.getIndexAndCollection();
@@ -71,7 +71,7 @@ class CollectionController extends NativeController {
71
71
  "core:storage:public:mappings:update",
72
72
  index,
73
73
  collection,
74
- mappings
74
+ mappings,
75
75
  );
76
76
 
77
77
  return this._filterMappingResponse(updated);
@@ -91,7 +91,7 @@ class CollectionController extends NativeController {
91
91
  "core:storage:public:mappings:get",
92
92
  index,
93
93
  collection,
94
- { includeKuzzleMeta }
94
+ { includeKuzzleMeta },
95
95
  );
96
96
 
97
97
  return this._filterMappingResponse(mapping);
@@ -117,7 +117,7 @@ class CollectionController extends NativeController {
117
117
  "assert",
118
118
  "not_found",
119
119
  index,
120
- collection
120
+ collection,
121
121
  );
122
122
  }
123
123
 
@@ -143,7 +143,7 @@ class CollectionController extends NativeController {
143
143
  const { hits, scrollId, total } = await global.kuzzle.internalIndex.search(
144
144
  "validations",
145
145
  searchBody,
146
- { from, scroll: scrollTTL, size }
146
+ { from, scroll: scrollTTL, size },
147
147
  );
148
148
 
149
149
  return { hits, scrollId, total };
@@ -182,7 +182,7 @@ class CollectionController extends NativeController {
182
182
  index,
183
183
  collection,
184
184
  specifications,
185
- true
185
+ true,
186
186
  );
187
187
 
188
188
  if (!isValid) {
@@ -190,7 +190,7 @@ class CollectionController extends NativeController {
190
190
  "validation",
191
191
  "assert",
192
192
  "invalid_specifications",
193
- errors.join("\n\t- ")
193
+ errors.join("\n\t- "),
194
194
  );
195
195
  }
196
196
 
@@ -201,7 +201,7 @@ class CollectionController extends NativeController {
201
201
  collection,
202
202
  index,
203
203
  validation: specifications,
204
- }
204
+ },
205
205
  );
206
206
 
207
207
  await global.kuzzle.internalIndex.refreshCollection("validations");
@@ -279,7 +279,7 @@ class CollectionController extends NativeController {
279
279
  await this.ask(
280
280
  "core:storage:public:collection:truncate",
281
281
  index,
282
- collection
282
+ collection,
283
283
  );
284
284
 
285
285
  return {
@@ -302,14 +302,14 @@ class CollectionController extends NativeController {
302
302
  "api",
303
303
  "assert",
304
304
  "invalid_argument",
305
- '"all", "stored", "realtime"'
305
+ '"all", "stored", "realtime"',
306
306
  );
307
307
  }
308
308
 
309
309
  if (request.input.args.type) {
310
310
  request.addDeprecation(
311
311
  "2.10.2",
312
- 'The "type" argument and this route returning a list of realtime collections have both been deprecated since Kuzzle version 2.10.1. This feature might be removed in a future major version. To get a list of realtime collections, use this API action instead: "realtime:list".'
312
+ 'The "type" argument and this route returning a list of realtime collections have both been deprecated since Kuzzle version 2.10.1. This feature might be removed in a future major version. To get a list of realtime collections, use this API action instead: "realtime:list".',
313
313
  );
314
314
  }
315
315
 
@@ -323,11 +323,11 @@ class CollectionController extends NativeController {
323
323
  if (type !== "realtime") {
324
324
  const publicCollections = await this.ask(
325
325
  "core:storage:public:collection:list",
326
- index
326
+ index,
327
327
  );
328
328
 
329
329
  collections = collections.concat(
330
- publicCollections.map((name) => ({ name, type: "stored" }))
330
+ publicCollections.map((name) => ({ name, type: "stored" })),
331
331
  );
332
332
  }
333
333
 
@@ -369,7 +369,7 @@ class CollectionController extends NativeController {
369
369
  config.mappings = body;
370
370
  request.addDeprecation(
371
371
  "2.1.0",
372
- 'Using "properties", "dynamic" or "_meta" fields in the body has been deprecated since Kuzzle version 2.1.0. This feature might be removed in a future major version. Use "settings" and "mappings" fields instead'
372
+ 'Using "properties", "dynamic" or "_meta" fields in the body has been deprecated since Kuzzle version 2.1.0. This feature might be removed in a future major version. Use "settings" and "mappings" fields instead',
373
373
  );
374
374
  } else {
375
375
  config = body;
@@ -379,7 +379,7 @@ class CollectionController extends NativeController {
379
379
  "core:storage:public:collection:create",
380
380
  index,
381
381
  collection,
382
- config
382
+ config,
383
383
  );
384
384
 
385
385
  return { acknowledged: true };
@@ -399,7 +399,7 @@ class CollectionController extends NativeController {
399
399
  "core:storage:public:collection:update",
400
400
  index,
401
401
  collection,
402
- config
402
+ config,
403
403
  );
404
404
 
405
405
  return null;
@@ -457,7 +457,7 @@ class CollectionController extends NativeController {
457
457
 
458
458
  response.collections = response.collections.slice(
459
459
  response.from,
460
- response.from + response.size
460
+ response.from + response.size,
461
461
  );
462
462
  } else {
463
463
  response.collections = response.collections.slice(response.from);