kuzzle 2.44.0 → 2.46.0
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/lib/api/controllers/adminController.js +2 -1
- package/lib/api/controllers/authController.d.ts +1 -0
- package/lib/api/controllers/authController.js +2 -1
- package/lib/api/controllers/securityController.js +22 -20
- package/lib/api/funnel.js +30 -10
- package/lib/cluster/command.js +3 -2
- package/lib/cluster/idCardHandler.d.ts +1 -0
- package/lib/cluster/idCardHandler.js +2 -1
- package/lib/cluster/node.js +18 -19
- package/lib/cluster/subscriber.js +5 -3
- package/lib/core/backend/backend.d.ts +4 -6
- package/lib/core/backend/backend.js +25 -23
- package/lib/core/cache/cacheEngine.js +3 -1
- package/lib/core/network/accessLogger.js +3 -2
- package/lib/core/network/entryPoint.js +7 -7
- package/lib/core/network/protocols/httpwsProtocol.js +7 -7
- package/lib/core/network/protocols/mqttProtocol.js +3 -2
- package/lib/core/network/router.js +4 -3
- package/lib/core/plugin/pluginsManager.js +13 -5
- package/lib/core/realtime/hotelClerk.d.ts +1 -0
- package/lib/core/realtime/hotelClerk.js +4 -3
- package/lib/core/realtime/notifier.js +2 -1
- package/lib/core/security/roleRepository.js +3 -2
- package/lib/core/security/securityLoader.js +5 -7
- package/lib/core/shared/store.d.ts +1 -0
- package/lib/core/shared/store.js +2 -1
- package/lib/core/statistics/statistics.js +3 -1
- package/lib/core/storage/storageEngine.js +6 -1
- package/lib/core/validation/validation.js +6 -5
- package/lib/kuzzle/Logger.d.ts +1 -1
- package/lib/kuzzle/Logger.js +7 -7
- package/lib/kuzzle/dumpGenerator.js +17 -16
- package/lib/kuzzle/internalIndexHandler.js +3 -1
- package/lib/kuzzle/kuzzle.js +5 -7
- package/lib/service/cache/redis.js +4 -0
- package/lib/service/storage/7/elasticsearch.d.ts +1 -0
- package/lib/service/storage/7/elasticsearch.js +5 -4
- package/lib/service/storage/8/elasticsearch.d.ts +1 -0
- package/lib/service/storage/8/elasticsearch.js +5 -4
- package/lib/service/storage/Elasticsearch.d.ts +1 -0
- package/lib/service/storage/Elasticsearch.js +1 -1
- package/package.json +1 -1
package/lib/kuzzle/kuzzle.js
CHANGED
|
@@ -73,7 +73,6 @@ const kerror = __importStar(require("../kerror"));
|
|
|
73
73
|
const asyncStore_1 = __importDefault(require("../util/asyncStore"));
|
|
74
74
|
const crypto_1 = require("../util/crypto");
|
|
75
75
|
const mutex_1 = require("../util/mutex");
|
|
76
|
-
const name_generator_1 = require("../util/name-generator");
|
|
77
76
|
const dumpGenerator_1 = __importDefault(require("./dumpGenerator"));
|
|
78
77
|
const KuzzleEventEmitter_1 = __importDefault(require("./event/KuzzleEventEmitter"));
|
|
79
78
|
const internalIndexHandler_1 = __importDefault(require("./internalIndexHandler"));
|
|
@@ -152,7 +151,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
152
151
|
await this.internalIndex.init();
|
|
153
152
|
await new security_1.default().init();
|
|
154
153
|
// This will init the cluster module if enabled
|
|
155
|
-
|
|
154
|
+
await this.initKuzzleNode();
|
|
156
155
|
this.vault = vault_1.default.load(options.vaultKey, options.secretsFile);
|
|
157
156
|
await this.validation.init();
|
|
158
157
|
await this.tokenManager.init();
|
|
@@ -165,7 +164,6 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
165
164
|
await this.debugger.init();
|
|
166
165
|
this.pluginsManager.application = application;
|
|
167
166
|
const pluginImports = await this.pluginsManager.init(options.plugins);
|
|
168
|
-
this.log.info(`[✔] Successfully loaded ${this.pluginsManager.loadedPlugins.length} plugins: ${this.pluginsManager.loadedPlugins.join(", ")}`);
|
|
169
167
|
const imports = lodash_1.default.merge({}, pluginImports, options.import);
|
|
170
168
|
// Authentification plugins must be loaded before users import to avoid
|
|
171
169
|
// credentials related error which would prevent Kuzzle from starting
|
|
@@ -197,16 +195,13 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
197
195
|
* This will init the cluster if it's enabled.
|
|
198
196
|
*/
|
|
199
197
|
async initKuzzleNode() {
|
|
200
|
-
let id;
|
|
201
198
|
if (this.config.cluster.enabled) {
|
|
202
|
-
|
|
199
|
+
await new cluster_1.default().init();
|
|
203
200
|
this.log.info("[✔] Cluster initialized");
|
|
204
201
|
}
|
|
205
202
|
else {
|
|
206
|
-
id = name_generator_1.NameGenerator.generateRandomName({ prefix: "knode" });
|
|
207
203
|
this.log.info("[X] Cluster disabled: single node mode.");
|
|
208
204
|
}
|
|
209
|
-
return id;
|
|
210
205
|
}
|
|
211
206
|
/**
|
|
212
207
|
* Gracefully exits after processing remaining requests
|
|
@@ -226,6 +221,9 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
226
221
|
await bluebird_1.default.delay(1000);
|
|
227
222
|
}
|
|
228
223
|
this.log.info("Halted.");
|
|
224
|
+
// flush both application and Kuzzle core loggers before leaving (Could happen even if some core/application components are not initialized)
|
|
225
|
+
await this?.log?.flush?.();
|
|
226
|
+
await this?.pluginsManager?.application?.log?.flush?.();
|
|
229
227
|
process.exit(0);
|
|
230
228
|
}
|
|
231
229
|
/**
|
|
@@ -43,6 +43,10 @@ class Redis extends Service {
|
|
|
43
43
|
this.commands = {};
|
|
44
44
|
this.adapterName = name;
|
|
45
45
|
this.pingIntervalID = null;
|
|
46
|
+
|
|
47
|
+
this.logger = global.kuzzle.log.child // It means we're in the main Kuzzle process
|
|
48
|
+
? global.kuzzle.log.child("services:cache:redis")
|
|
49
|
+
: global.kuzzle.log;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -99,6 +99,7 @@ let esState = esStateEnum.NONE;
|
|
|
99
99
|
*/
|
|
100
100
|
class ES7 {
|
|
101
101
|
constructor(config, scope = storeScopeEnum_1.storeScopeEnum.PUBLIC) {
|
|
102
|
+
this.logger = global.kuzzle.log.child("service:storage:elasticsearch:7");
|
|
102
103
|
this._config = config;
|
|
103
104
|
this._scope = scope;
|
|
104
105
|
this._indexPrefix =
|
|
@@ -151,7 +152,7 @@ class ES7 {
|
|
|
151
152
|
}
|
|
152
153
|
if (global.NODE_ENV !== "development" &&
|
|
153
154
|
this._config.commonMapping.dynamic === "true") {
|
|
154
|
-
|
|
155
|
+
this.logger.warn([
|
|
155
156
|
"Your dynamic mapping policy is set to 'true' for new fields.",
|
|
156
157
|
"Elasticsearch will try to automatically infer mapping for new fields, and those cannot be changed afterward.",
|
|
157
158
|
'See the "services.storageEngine.commonMapping.dynamic" option in the kuzzlerc configuration file to change this value.',
|
|
@@ -2768,7 +2769,7 @@ class ES7 {
|
|
|
2768
2769
|
return;
|
|
2769
2770
|
}
|
|
2770
2771
|
esState = esStateEnum.AWAITING;
|
|
2771
|
-
|
|
2772
|
+
this.logger.info("[ℹ] Trying to connect to Elasticsearch...");
|
|
2772
2773
|
while (esState !== esStateEnum.OK) {
|
|
2773
2774
|
try {
|
|
2774
2775
|
// Wait for at least 1 shard to be initialized
|
|
@@ -2776,11 +2777,11 @@ class ES7 {
|
|
|
2776
2777
|
wait_for_no_initializing_shards: true,
|
|
2777
2778
|
});
|
|
2778
2779
|
if (health.body.number_of_pending_tasks === 0) {
|
|
2779
|
-
|
|
2780
|
+
this.logger.info("[✔] Elasticsearch is ready");
|
|
2780
2781
|
esState = esStateEnum.OK;
|
|
2781
2782
|
}
|
|
2782
2783
|
else {
|
|
2783
|
-
|
|
2784
|
+
this.logger.info(`[ℹ] Still waiting for Elasticsearch: ${health.body.number_of_pending_tasks} cluster tasks remaining`);
|
|
2784
2785
|
await bluebird_1.default.delay(1000);
|
|
2785
2786
|
}
|
|
2786
2787
|
}
|
|
@@ -99,6 +99,7 @@ let esState = esStateEnum.NONE;
|
|
|
99
99
|
*/
|
|
100
100
|
class ES8 {
|
|
101
101
|
constructor(config, scope = storeScopeEnum_1.storeScopeEnum.PUBLIC) {
|
|
102
|
+
this.logger = global.kuzzle.log.child("service:storage:elasticsearch:8");
|
|
102
103
|
this._config = config;
|
|
103
104
|
this._scope = scope;
|
|
104
105
|
this._indexPrefix =
|
|
@@ -151,7 +152,7 @@ class ES8 {
|
|
|
151
152
|
}
|
|
152
153
|
if (global.NODE_ENV !== "development" &&
|
|
153
154
|
this._config.commonMapping.dynamic === "true") {
|
|
154
|
-
|
|
155
|
+
this.logger.warn([
|
|
155
156
|
"Your dynamic mapping policy is set to 'true' for new fields.",
|
|
156
157
|
"Elasticsearch will try to automatically infer mapping for new fields, and those cannot be changed afterward.",
|
|
157
158
|
'See the "services.storageEngine.commonMapping.dynamic" option in the kuzzlerc configuration file to change this value.',
|
|
@@ -2758,7 +2759,7 @@ class ES8 {
|
|
|
2758
2759
|
return;
|
|
2759
2760
|
}
|
|
2760
2761
|
esState = esStateEnum.AWAITING;
|
|
2761
|
-
|
|
2762
|
+
this.logger.info("[ℹ] Trying to connect to Elasticsearch...");
|
|
2762
2763
|
while (esState !== esStateEnum.OK) {
|
|
2763
2764
|
try {
|
|
2764
2765
|
// Wait for at least 1 shard to be initialized
|
|
@@ -2766,11 +2767,11 @@ class ES8 {
|
|
|
2766
2767
|
wait_for_no_initializing_shards: true,
|
|
2767
2768
|
});
|
|
2768
2769
|
if (health.number_of_pending_tasks === 0) {
|
|
2769
|
-
|
|
2770
|
+
this.logger.info("[✔] Elasticsearch is ready");
|
|
2770
2771
|
esState = esStateEnum.OK;
|
|
2771
2772
|
}
|
|
2772
2773
|
else {
|
|
2773
|
-
|
|
2774
|
+
this.logger.info(`[ℹ] Still waiting for Elasticsearch: ${health.number_of_pending_tasks} cluster tasks remaining`);
|
|
2774
2775
|
await bluebird_1.default.delay(1000);
|
|
2775
2776
|
}
|
|
2776
2777
|
}
|
|
@@ -2,6 +2,7 @@ import Service from "../service";
|
|
|
2
2
|
import { storeScopeEnum } from "../../core/storage/storeScopeEnum";
|
|
3
3
|
export declare class Elasticsearch extends Service {
|
|
4
4
|
client: any;
|
|
5
|
+
private readonly logger;
|
|
5
6
|
constructor(config: any, scope?: storeScopeEnum);
|
|
6
7
|
static buildClient(config: any, version?: "7" | "8"): any;
|
|
7
8
|
_initSequence(): Promise<void>;
|
|
@@ -13,7 +13,7 @@ const storeScopeEnum_1 = require("../../core/storage/storeScopeEnum");
|
|
|
13
13
|
class Elasticsearch extends service_1.default {
|
|
14
14
|
constructor(config, scope = storeScopeEnum_1.storeScopeEnum.PUBLIC) {
|
|
15
15
|
super("elasticsearch", config);
|
|
16
|
-
global.kuzzle.log.
|
|
16
|
+
this.logger = global.kuzzle.log.child("service:storage:elasticsearch");
|
|
17
17
|
if (config.majorVersion === "7") {
|
|
18
18
|
this.client = new elasticsearch_1.ES7(config, scope);
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle",
|
|
3
3
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.46.0",
|
|
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
6
|
"bin": "bin/start-kuzzle-server",
|
|
7
7
|
"scripts": {
|