kuzzle 2.27.0 → 2.27.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.
- package/README.md +12 -6
- package/lib/api/controllers/adminController.js +9 -9
- package/lib/api/controllers/bulkController.js +9 -9
- package/lib/api/controllers/collectionController.js +17 -17
- package/lib/api/controllers/documentController.js +51 -51
- package/lib/api/controllers/indexController.js +4 -4
- package/lib/api/controllers/memoryStorageController.js +11 -11
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +67 -70
- package/lib/api/controllers/serverController.js +5 -5
- package/lib/api/documentExtractor.js +3 -3
- package/lib/api/funnel.js +43 -43
- package/lib/api/rateLimiter.js +1 -1
- package/lib/cluster/command.js +4 -4
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/cluster/node.js +55 -55
- package/lib/cluster/subscriber.js +33 -33
- package/lib/cluster/workers/IDCardRenewer.js +4 -4
- package/lib/config/index.js +24 -24
- package/lib/core/auth/passportWrapper.js +6 -6
- package/lib/core/cache/cacheEngine.js +20 -20
- package/lib/core/network/accessLogger.js +15 -15
- package/lib/core/network/entryPoint.js +12 -12
- package/lib/core/network/httpRouter/index.js +4 -4
- package/lib/core/network/httpRouter/routePart.js +2 -2
- package/lib/core/network/protocols/httpwsProtocol.js +60 -53
- package/lib/core/network/protocols/internalProtocol.js +2 -2
- package/lib/core/network/protocols/mqttProtocol.js +9 -9
- package/lib/core/network/protocols/protocol.js +3 -3
- package/lib/core/network/router.js +7 -7
- package/lib/core/plugin/plugin.js +23 -23
- package/lib/core/plugin/pluginManifest.js +1 -1
- package/lib/core/plugin/pluginsManager.js +62 -62
- package/lib/core/realtime/notifier.js +14 -14
- package/lib/core/security/README.md +223 -0
- package/lib/core/security/roleRepository.js +18 -18
- package/lib/core/security/securityLoader.js +7 -7
- package/lib/core/security/userRepository.js +16 -16
- package/lib/core/shared/README.md +3 -0
- package/lib/core/shared/abstractManifest.js +1 -1
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +11 -11
- package/lib/core/statistics/statistics.js +15 -15
- package/lib/core/storage/clientAdapter.js +61 -61
- package/lib/core/validation/baseType.js +1 -1
- package/lib/core/validation/types/date.js +1 -1
- package/lib/core/validation/types/enum.js +5 -5
- package/lib/core/validation/types/geoShape.js +13 -13
- package/lib/core/validation/types/numeric.js +2 -2
- package/lib/core/validation/types/string.js +2 -2
- package/lib/core/validation/validation.js +71 -71
- package/lib/kerror/codes/index.js +23 -23
- package/lib/kuzzle/dumpGenerator.js +17 -17
- package/lib/kuzzle/event/kuzzleEventEmitter.js +9 -9
- package/lib/kuzzle/event/pipeRunner.js +2 -2
- package/lib/kuzzle/internalIndexHandler.js +8 -8
- package/lib/kuzzle/log.js +2 -2
- package/lib/kuzzle/vault.js +4 -4
- package/lib/model/security/role.js +3 -1
- package/lib/model/security/user.js +3 -1
- package/lib/model/storage/apiKey.js +3 -3
- package/lib/model/storage/baseModel.js +7 -7
- package/lib/service/cache/redis.js +3 -3
- package/lib/service/storage/elasticsearch.js +53 -54
- package/lib/service/storage/esWrapper.js +3 -3
- package/lib/service/storage/queryTranslator.js +2 -2
- package/lib/util/assertType.js +1 -1
- package/lib/util/deprecate.js +3 -3
- package/lib/util/extractFields.js +2 -2
- package/lib/util/wildcard.js +1 -1
- package/package.json +68 -81
|
@@ -62,7 +62,7 @@ class ImpersonatedSDK {
|
|
|
62
62
|
|
|
63
63
|
// Make sure we bring any local methods into our new custom context
|
|
64
64
|
Object.getOwnPropertyNames(
|
|
65
|
-
Object.getPrototypeOf(global.app.sdk[controllerName])
|
|
65
|
+
Object.getPrototypeOf(global.app.sdk[controllerName]),
|
|
66
66
|
).forEach((localMethod) => {
|
|
67
67
|
if (!["constructor", "query"].includes(localMethod)) {
|
|
68
68
|
customContext[localMethod] =
|
package/lib/core/shared/store.js
CHANGED
|
@@ -77,7 +77,7 @@ class Store {
|
|
|
77
77
|
global.kuzzle.ask(
|
|
78
78
|
`core:storage:${scope}:document:scroll`,
|
|
79
79
|
scrollId,
|
|
80
|
-
opts
|
|
80
|
+
opts,
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
this.multiSearch = (targets, searchBody, opts) =>
|
|
@@ -85,7 +85,7 @@ class Store {
|
|
|
85
85
|
`core:storage:${scope}:document:multiSearch`,
|
|
86
86
|
targets,
|
|
87
87
|
searchBody,
|
|
88
|
-
opts
|
|
88
|
+
opts,
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -137,7 +137,7 @@ class Store {
|
|
|
137
137
|
this.index,
|
|
138
138
|
collection,
|
|
139
139
|
{ mappings: config },
|
|
140
|
-
{ indexCacheOnly }
|
|
140
|
+
{ indexCacheOnly },
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -153,14 +153,14 @@ class Store {
|
|
|
153
153
|
collection,
|
|
154
154
|
// @deprecated
|
|
155
155
|
isConfigDeprecated ? { mappings: config.mappings } : config,
|
|
156
|
-
{ indexCacheOnly }
|
|
156
|
+
{ indexCacheOnly },
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
const exist = await global.kuzzle.ask(
|
|
161
161
|
`core:storage:${this.scope}:collection:exist`,
|
|
162
162
|
this.index,
|
|
163
|
-
collection
|
|
163
|
+
collection,
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
if (exist) {
|
|
@@ -172,7 +172,7 @@ class Store {
|
|
|
172
172
|
const existingSettings = await global.kuzzle.ask(
|
|
173
173
|
`core:storage:${this.scope}:collection:settings:get`,
|
|
174
174
|
this.index,
|
|
175
|
-
collection
|
|
175
|
+
collection,
|
|
176
176
|
);
|
|
177
177
|
|
|
178
178
|
if (
|
|
@@ -189,11 +189,11 @@ class Store {
|
|
|
189
189
|
this.scope,
|
|
190
190
|
"number_of_shards",
|
|
191
191
|
config.settings.number_of_shards,
|
|
192
|
-
existingSettings.number_of_shards
|
|
192
|
+
existingSettings.number_of_shards,
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
global.kuzzle.log.warn(
|
|
196
|
-
`Attempt to recreate an existing collection ${collection} of index ${this.index} of scope ${this.scope} with non matching static setting : number_of_shards at ${config.settings.number_of_shards} while existing one is at ${existingSettings.number_of_shards}
|
|
196
|
+
`Attempt to recreate an existing collection ${collection} of index ${this.index} of scope ${this.scope} with non matching static setting : number_of_shards at ${config.settings.number_of_shards} while existing one is at ${existingSettings.number_of_shards}`,
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -205,7 +205,7 @@ class Store {
|
|
|
205
205
|
isConfigDeprecated
|
|
206
206
|
? { mappings: config.mappings }
|
|
207
207
|
: { mappings: config.mappings, settings: dynamicSettings },
|
|
208
|
-
{ indexCacheOnly: true }
|
|
208
|
+
{ indexCacheOnly: true },
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
211
|
|
|
@@ -215,10 +215,10 @@ class Store {
|
|
|
215
215
|
collection,
|
|
216
216
|
// @deprecated
|
|
217
217
|
isConfigDeprecated ? { mappings: config.mappings } : config,
|
|
218
|
-
{ indexCacheOnly }
|
|
218
|
+
{ indexCacheOnly },
|
|
219
219
|
);
|
|
220
220
|
}),
|
|
221
|
-
10
|
|
221
|
+
10,
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -70,7 +70,7 @@ class Statistics {
|
|
|
70
70
|
} else {
|
|
71
71
|
this.currentStats.ongoingRequests.set(
|
|
72
72
|
protocol,
|
|
73
|
-
this.currentStats.ongoingRequests.get(protocol) + 1
|
|
73
|
+
this.currentStats.ongoingRequests.get(protocol) + 1,
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -93,7 +93,7 @@ class Statistics {
|
|
|
93
93
|
|
|
94
94
|
this.currentStats.ongoingRequests.set(
|
|
95
95
|
protocol,
|
|
96
|
-
this.currentStats.ongoingRequests.get(protocol) - 1
|
|
96
|
+
this.currentStats.ongoingRequests.get(protocol) - 1,
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
if (!this.currentStats.completedRequests.has(protocol)) {
|
|
@@ -101,7 +101,7 @@ class Statistics {
|
|
|
101
101
|
} else {
|
|
102
102
|
this.currentStats.completedRequests.set(
|
|
103
103
|
protocol,
|
|
104
|
-
this.currentStats.completedRequests.get(protocol) + 1
|
|
104
|
+
this.currentStats.completedRequests.get(protocol) + 1,
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -124,7 +124,7 @@ class Statistics {
|
|
|
124
124
|
|
|
125
125
|
this.currentStats.ongoingRequests.set(
|
|
126
126
|
protocol,
|
|
127
|
-
this.currentStats.ongoingRequests.get(protocol) - 1
|
|
127
|
+
this.currentStats.ongoingRequests.get(protocol) - 1,
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
if (!this.currentStats.failedRequests.has(protocol)) {
|
|
@@ -132,7 +132,7 @@ class Statistics {
|
|
|
132
132
|
} else {
|
|
133
133
|
this.currentStats.failedRequests.set(
|
|
134
134
|
protocol,
|
|
135
|
-
this.currentStats.failedRequests.get(protocol) + 1
|
|
135
|
+
this.currentStats.failedRequests.get(protocol) + 1,
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -159,7 +159,7 @@ class Statistics {
|
|
|
159
159
|
this.currentStats.connections.set(
|
|
160
160
|
requestContext.connection.protocol,
|
|
161
161
|
this.currentStats.connections.get(requestContext.connection.protocol) +
|
|
162
|
-
1
|
|
162
|
+
1,
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -187,7 +187,7 @@ class Statistics {
|
|
|
187
187
|
this.currentStats.connections.set(
|
|
188
188
|
requestContext.connection.protocol,
|
|
189
189
|
this.currentStats.connections.get(requestContext.connection.protocol) -
|
|
190
|
-
1
|
|
190
|
+
1,
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -204,7 +204,7 @@ class Statistics {
|
|
|
204
204
|
|
|
205
205
|
const frame = Object.assign(
|
|
206
206
|
{ timestamp: new Date().getTime() },
|
|
207
|
-
this.currentStats
|
|
207
|
+
this.currentStats,
|
|
208
208
|
);
|
|
209
209
|
|
|
210
210
|
if (!this.lastFrame) {
|
|
@@ -213,7 +213,7 @@ class Statistics {
|
|
|
213
213
|
|
|
214
214
|
const last = await global.kuzzle.ask(
|
|
215
215
|
"core:cache:internal:get",
|
|
216
|
-
this.cacheKeyPrefix + this.lastFrame
|
|
216
|
+
this.cacheKeyPrefix + this.lastFrame,
|
|
217
217
|
);
|
|
218
218
|
|
|
219
219
|
return Object.assign(frame, JSON.parse(last));
|
|
@@ -265,7 +265,7 @@ class Statistics {
|
|
|
265
265
|
|
|
266
266
|
const stats = {
|
|
267
267
|
completedRequests: Object.fromEntries(
|
|
268
|
-
this.currentStats.completedRequests
|
|
268
|
+
this.currentStats.completedRequests,
|
|
269
269
|
),
|
|
270
270
|
connections: Object.fromEntries(this.currentStats.connections),
|
|
271
271
|
failedRequests: Object.fromEntries(this.currentStats.failedRequests),
|
|
@@ -275,7 +275,7 @@ class Statistics {
|
|
|
275
275
|
if (!this.lastFrame) {
|
|
276
276
|
if (!stopTime || stopTime >= currentDate) {
|
|
277
277
|
response.hits.push(
|
|
278
|
-
Object.assign({ timestamp: new Date(currentDate).getTime() }, stats)
|
|
278
|
+
Object.assign({ timestamp: new Date(currentDate).getTime() }, stats),
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -286,14 +286,14 @@ class Statistics {
|
|
|
286
286
|
|
|
287
287
|
const frames = await global.kuzzle.ask(
|
|
288
288
|
"core:cache:internal:searchKeys",
|
|
289
|
-
`${this.cacheKeyPrefix}
|
|
289
|
+
`${this.cacheKeyPrefix}*`,
|
|
290
290
|
);
|
|
291
291
|
|
|
292
292
|
// Statistics keys are timestamp.
|
|
293
293
|
// Ordering them guarantees stats frames to be returned in the right order
|
|
294
294
|
const values = await global.kuzzle.ask(
|
|
295
295
|
"core:cache:internal:mget",
|
|
296
|
-
frames.sort()
|
|
296
|
+
frames.sort(),
|
|
297
297
|
);
|
|
298
298
|
|
|
299
299
|
values.forEach((v, idx) => {
|
|
@@ -308,7 +308,7 @@ class Statistics {
|
|
|
308
308
|
response.hits.push(
|
|
309
309
|
Object.assign(JSON.parse(v), {
|
|
310
310
|
timestamp: new Date(frameDateTime).getTime(),
|
|
311
|
-
})
|
|
311
|
+
}),
|
|
312
312
|
);
|
|
313
313
|
}
|
|
314
314
|
});
|
|
@@ -363,7 +363,7 @@ class Statistics {
|
|
|
363
363
|
"core:cache:internal:store",
|
|
364
364
|
this.cacheKeyPrefix + this.lastFrame,
|
|
365
365
|
stats,
|
|
366
|
-
{ ttl: this.ttl }
|
|
366
|
+
{ ttl: this.ttl },
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
369
|
}
|