kuzzle 2.61.0-beta.8 → 2.61.0-beta.9
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/dist/lib/api/funnel.js +7 -8
- package/dist/lib/cluster/idCardHandler.js +2 -1
- package/dist/lib/cluster/node.js +13 -8
- package/dist/lib/core/plugin/pluginContext.js +6 -6
- package/dist/lib/core/storage/clientAdapter.d.ts +4 -0
- package/dist/lib/core/storage/clientAdapter.js +10 -3
- package/dist/lib/kuzzle/kuzzle.d.ts +8 -4
- package/dist/lib/kuzzle/kuzzle.js +58 -47
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/api/funnel.js
CHANGED
|
@@ -385,18 +385,17 @@ class Funnel {
|
|
|
385
385
|
})
|
|
386
386
|
.then((processResult) => {
|
|
387
387
|
debug("Request %s successfully executed. Result: %a", modifiedRequest.id, processResult);
|
|
388
|
-
return global.kuzzle
|
|
389
|
-
.pipe("request:afterExecution", {
|
|
388
|
+
return global.kuzzle.pipe("request:afterExecution", {
|
|
390
389
|
request: _request,
|
|
391
390
|
result: processResult,
|
|
392
391
|
success: true,
|
|
393
|
-
})
|
|
394
|
-
.then((pipeEvent) => {
|
|
395
|
-
callback(null, pipeEvent.result);
|
|
396
|
-
// disables a bluebird warning in dev. mode triggered when
|
|
397
|
-
// a promise is created and not returned
|
|
398
|
-
return null;
|
|
399
392
|
});
|
|
393
|
+
})
|
|
394
|
+
.then((pipeEvent) => {
|
|
395
|
+
callback(null, pipeEvent.result);
|
|
396
|
+
// disables a bluebird warning in dev. mode triggered when
|
|
397
|
+
// a promise is created and not returned
|
|
398
|
+
return null;
|
|
400
399
|
})
|
|
401
400
|
.catch((err) => {
|
|
402
401
|
debug("Error processing request %s: %a", modifiedRequest.id, err);
|
|
@@ -205,7 +205,8 @@ class ClusterIdCardHandler {
|
|
|
205
205
|
storageDriver: this.node.storageDriver,
|
|
206
206
|
topology: [],
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
// Sequential by design: retry with a new name until one is free
|
|
209
|
+
reserved = await this.save({ creation: true }); // NOSONAR (S9382)
|
|
209
210
|
} while (!reserved);
|
|
210
211
|
await this.addIdCardToIndex();
|
|
211
212
|
// Same extension as this module, not a hard-coded `.js`: the functional
|
package/dist/lib/cluster/node.js
CHANGED
|
@@ -273,7 +273,7 @@ class ClusterNode {
|
|
|
273
273
|
if (this.countActiveNodes() < this.config.minimumNodes) {
|
|
274
274
|
this.logger.info("[CLUSTER] Not enough nodes active. Waiting for other nodes to join the cluster...");
|
|
275
275
|
while (this.countActiveNodes() < this.config.minimumNodes) {
|
|
276
|
-
await bluebird_1.default.delay(100);
|
|
276
|
+
await bluebird_1.default.delay(100); // NOSONAR (S9382): sequential polling, by design
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
return this.nodeId;
|
|
@@ -366,7 +366,7 @@ class ClusterNode {
|
|
|
366
366
|
* @param {Error} [error]
|
|
367
367
|
* @return {void}
|
|
368
368
|
*/
|
|
369
|
-
|
|
369
|
+
evictSelf(reason, error = null) {
|
|
370
370
|
this.logger.error(`[CLUSTER] ${reason}`);
|
|
371
371
|
if (error) {
|
|
372
372
|
this.logger.error(error.stack);
|
|
@@ -387,6 +387,9 @@ class ClusterNode {
|
|
|
387
387
|
// Exit code 1: this is a failure, and a node that exits 0 is not restarted
|
|
388
388
|
// by an `on-failure` policy (#2785).
|
|
389
389
|
void global.kuzzle.shutdown(1);
|
|
390
|
+
// A promise, as the `ClusterSubscriber` interface declares: nothing above
|
|
391
|
+
// waits, the shutdown runs on its own
|
|
392
|
+
return Promise.resolve();
|
|
390
393
|
}
|
|
391
394
|
/**
|
|
392
395
|
* Evicts a remote from the list
|
|
@@ -688,9 +691,10 @@ class ClusterNode {
|
|
|
688
691
|
this.trackActivity(this.nodeId, this.ip, nodeActivityEnum.ADDED);
|
|
689
692
|
return;
|
|
690
693
|
}
|
|
691
|
-
|
|
694
|
+
// Sequential by design: each retry needs the previous round's answer
|
|
695
|
+
await this.subscribeToNodes(nodes); // NOSONAR (S9382)
|
|
692
696
|
debug("[CLUSTER] Successfully subscribed to nodes");
|
|
693
|
-
fullState = await this.command.getFullState(nodes);
|
|
697
|
+
fullState = await this.command.getFullState(nodes); // NOSONAR (S9382)
|
|
694
698
|
if (fullState === null) {
|
|
695
699
|
// Sequential by design: the retry waits for a heartbeat round
|
|
696
700
|
await this.retryFullState(retried); // NOSONAR
|
|
@@ -796,7 +800,8 @@ class ClusterNode {
|
|
|
796
800
|
this.remoteNodes.delete(nodeId);
|
|
797
801
|
}
|
|
798
802
|
else {
|
|
799
|
-
|
|
803
|
+
// One peer at a time, by design: see the `sync()` comment below
|
|
804
|
+
await this.idCardHandler.addNode(nodeId); // NOSONAR (S9382)
|
|
800
805
|
const nodesStates = fullState.nodesState || [];
|
|
801
806
|
const nodeStatus = nodesStates.find((node) => node.id === nodeId);
|
|
802
807
|
// Protobuf leaves an absent field undefined, and zero is where a
|
|
@@ -808,7 +813,7 @@ class ClusterNode {
|
|
|
808
813
|
// there evicts this node. Fired and forgotten, it used to print
|
|
809
814
|
// "Successfully completed the handshake" 2ms AFTER the eviction that
|
|
810
815
|
// contradicts it — a log describing a state the code is not in.
|
|
811
|
-
const synced = await subscriber.sync(lastMessageId);
|
|
816
|
+
const synced = await subscriber.sync(lastMessageId); // NOSONAR (S9382)
|
|
812
817
|
if (synced) {
|
|
813
818
|
this.logger.info(`[CLUSTER] Successfully completed the handshake with node ${nodeId}`);
|
|
814
819
|
}
|
|
@@ -1216,8 +1221,8 @@ class ClusterNode {
|
|
|
1216
1221
|
* @param {string} roomId
|
|
1217
1222
|
* @return {void}
|
|
1218
1223
|
*/
|
|
1219
|
-
|
|
1220
|
-
return this.fullState.countRealtimeSubscriptions(roomId);
|
|
1224
|
+
countRealtimeSubscribers(roomId) {
|
|
1225
|
+
return Promise.resolve(this.fullState.countRealtimeSubscriptions(roomId));
|
|
1221
1226
|
}
|
|
1222
1227
|
}
|
|
1223
1228
|
module.exports = ClusterNode;
|
|
@@ -58,15 +58,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
59
|
exports.PluginContext = void 0;
|
|
60
60
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
61
|
-
const
|
|
62
|
-
const KoncordeWrapper_1 = require("../shared/KoncordeWrapper");
|
|
61
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
62
|
+
const KoncordeWrapper_1 = require("../shared/KoncordeWrapper"); // NOSONAR: the deprecated API plugins still get, until v3
|
|
63
63
|
const request_1 = require("../../api/request");
|
|
64
64
|
const baseType_1 = __importDefault(require("../validation/baseType"));
|
|
65
65
|
const kerror = __importStar(require("../../kerror"));
|
|
66
66
|
const errors_1 = require("../../kerror/errors");
|
|
67
67
|
const storageDriverLoader_1 = require("../storage/storageDriverLoader");
|
|
68
68
|
const distributedLock_1 = require("../../util/distributedLock");
|
|
69
|
-
const mutex_1 = require("../../util/mutex");
|
|
69
|
+
const mutex_1 = require("../../util/mutex"); // NOSONAR: the deprecated API plugins still get, until v3
|
|
70
70
|
const promback_1 = __importDefault(require("../../util/promback"));
|
|
71
71
|
const safeObject_1 = require("../../util/safeObject");
|
|
72
72
|
const backendCluster_1 = require("../backend/backendCluster");
|
|
@@ -134,8 +134,8 @@ class PluginContext {
|
|
|
134
134
|
// Plain functions called with `new`, like `Request` below: each returns
|
|
135
135
|
// an object, so `new` yields that object.
|
|
136
136
|
ESClient: PluginContextESClient,
|
|
137
|
-
Koncorde: KoncordeWrapper_1.Koncorde,
|
|
138
|
-
Mutex: mutex_1.Mutex,
|
|
137
|
+
Koncorde: KoncordeWrapper_1.Koncorde, // NOSONAR: the deprecated API plugins still get, until v3
|
|
138
|
+
Mutex: mutex_1.Mutex, // NOSONAR: the deprecated API plugins still get, until v3
|
|
139
139
|
Repository: PluginContextRepository,
|
|
140
140
|
// A plain function called with `new`: it returns an object, so `new`
|
|
141
141
|
// yields that object — which is what plugins have always relied on.
|
|
@@ -212,7 +212,7 @@ function execute(request, callback) {
|
|
|
212
212
|
return bluebird_1.default.reject(error);
|
|
213
213
|
}
|
|
214
214
|
const promback = new promback_1.default(isPrombackCallback(callback) ? callback : null);
|
|
215
|
-
if (!request ||
|
|
215
|
+
if (!request || (0, isEmpty_1.default)(request)) {
|
|
216
216
|
return asRequestPromise(promback.reject(contextError.get("missing_request")), request);
|
|
217
217
|
}
|
|
218
218
|
if (request.input.controller === "realtime" &&
|
|
@@ -148,6 +148,10 @@ declare class ClientAdapter {
|
|
|
148
148
|
* @returns {Promise}
|
|
149
149
|
*/
|
|
150
150
|
loadMappings(fixtures?: ImportPayload, options?: LoadMappingsOptions): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Loads the mappings of an index's collections, one at a time
|
|
153
|
+
*/
|
|
154
|
+
private _loadIndexMappings;
|
|
151
155
|
/**
|
|
152
156
|
* Creates one index/collection pair from an import payload. Extracted from
|
|
153
157
|
* `loadMappings` verbatim.
|
|
@@ -1113,12 +1113,19 @@ class ClientAdapter {
|
|
|
1113
1113
|
if (!(0, safeObject_1.isPlainObject)(collections)) {
|
|
1114
1114
|
throw kerror.get("api", "assert", "invalid_argument", collections, "object");
|
|
1115
1115
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1116
|
+
// Sequential by design: one index at a time under the lock
|
|
1117
|
+
await this._loadIndexMappings(index, collections, options); // NOSONAR (S9382)
|
|
1119
1118
|
}
|
|
1120
1119
|
}, { retryAttempts: Number.POSITIVE_INFINITY, ttl: 60000 });
|
|
1121
1120
|
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Loads the mappings of an index's collections, one at a time
|
|
1123
|
+
*/
|
|
1124
|
+
async _loadIndexMappings(index, collections, options) {
|
|
1125
|
+
for (const [collection, mappings] of Object.entries(collections)) {
|
|
1126
|
+
await this._loadCollectionMappings(index, collection, mappings, options); // NOSONAR (S9382)
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1122
1129
|
/**
|
|
1123
1130
|
* Creates one index/collection pair from an import payload. Extracted from
|
|
1124
1131
|
* `loadMappings` verbatim.
|
|
@@ -58,7 +58,7 @@ declare class Kuzzle extends KuzzleEventEmitter {
|
|
|
58
58
|
/**
|
|
59
59
|
* Dump generator
|
|
60
60
|
*/
|
|
61
|
-
private dumpGenerator;
|
|
61
|
+
private readonly dumpGenerator;
|
|
62
62
|
/**
|
|
63
63
|
* Vault component (will be initialized after bootstrap)
|
|
64
64
|
*/
|
|
@@ -70,11 +70,11 @@ declare class Kuzzle extends KuzzleEventEmitter {
|
|
|
70
70
|
/**
|
|
71
71
|
* Kuzzle internal debugger
|
|
72
72
|
*/
|
|
73
|
-
private debugger;
|
|
73
|
+
private readonly debugger;
|
|
74
74
|
/**
|
|
75
75
|
* Kuzzle version
|
|
76
76
|
*/
|
|
77
|
-
private version;
|
|
77
|
+
private readonly version;
|
|
78
78
|
/**
|
|
79
79
|
* Built by `start()`, from the application's own OpenAPI declaration.
|
|
80
80
|
* Nothing reads it before then — `server:openapi` answers off it, and the
|
|
@@ -84,7 +84,7 @@ declare class Kuzzle extends KuzzleEventEmitter {
|
|
|
84
84
|
/**
|
|
85
85
|
* List of differents imports types and their associated method
|
|
86
86
|
*/
|
|
87
|
-
private importTypes;
|
|
87
|
+
private readonly importTypes;
|
|
88
88
|
/**
|
|
89
89
|
* The realtime engine, and the secret read out of the internal index.
|
|
90
90
|
* Both are set by `start()`, before anything that uses them is wired up.
|
|
@@ -151,6 +151,10 @@ declare class Kuzzle extends KuzzleEventEmitter {
|
|
|
151
151
|
* @returns {Promise<void>}
|
|
152
152
|
*/
|
|
153
153
|
install(installations?: InstallationConfig[]): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Runs an installation, unless it is already recorded, then records it
|
|
156
|
+
*/
|
|
157
|
+
private runInstallation;
|
|
154
158
|
ask(event: string, ...args: [payload?: unknown, ...rest: unknown[]]): Promise<any>;
|
|
155
159
|
emit(event: string, ...args: unknown[]): boolean;
|
|
156
160
|
pipe(event: string, ...args: unknown[]): Promise<any>;
|
|
@@ -62,7 +62,9 @@ const node_util_1 = require("node:util");
|
|
|
62
62
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
63
63
|
const json_stable_stringify_1 = __importDefault(require("json-stable-stringify"));
|
|
64
64
|
const koncorde_1 = require("koncorde");
|
|
65
|
-
const
|
|
65
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
66
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
67
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
66
68
|
const murmurhash_1 = __importDefault(require("murmurhash"));
|
|
67
69
|
const package_json_1 = require("../../package.json");
|
|
68
70
|
const funnel_1 = __importDefault(require("../api/funnel"));
|
|
@@ -85,7 +87,7 @@ const kerror = __importStar(require("../kerror"));
|
|
|
85
87
|
const asyncStore_1 = __importDefault(require("../util/asyncStore"));
|
|
86
88
|
const crypto_1 = require("../util/crypto");
|
|
87
89
|
const distributedLock_1 = require("../util/distributedLock");
|
|
88
|
-
const mutex_1 = require("../util/mutex");
|
|
90
|
+
const mutex_1 = require("../util/mutex"); // NOSONAR: only to free locks taken through the deprecated API, see shutdown()
|
|
89
91
|
const dumpGenerator_1 = __importDefault(require("./dumpGenerator"));
|
|
90
92
|
const KuzzleEventEmitter_1 = __importDefault(require("./event/KuzzleEventEmitter"));
|
|
91
93
|
const internalIndexHandler_1 = __importDefault(require("./internalIndexHandler"));
|
|
@@ -221,7 +223,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
221
223
|
this.stopIfShuttingDown();
|
|
222
224
|
this.pluginsManager.application = application;
|
|
223
225
|
const pluginImports = await this.pluginsManager.init(options?.plugins);
|
|
224
|
-
const imports =
|
|
226
|
+
const imports = (0, merge_1.default)({}, pluginImports, options?.import);
|
|
225
227
|
// Authentification plugins must be loaded before users import to avoid
|
|
226
228
|
// credentials related error which would prevent Kuzzle from starting
|
|
227
229
|
this.stopIfShuttingDown();
|
|
@@ -357,7 +359,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
357
359
|
this.emit("core:shutdown");
|
|
358
360
|
while (this.funnel.remainingRequests !== 0) {
|
|
359
361
|
this.log.info(`[shutdown] Waiting: ${this.funnel.remainingRequests} remaining requests`);
|
|
360
|
-
await bluebird_1.default.delay(1000);
|
|
362
|
+
await bluebird_1.default.delay(1000); // NOSONAR (S9382): sequential polling, by design
|
|
361
363
|
}
|
|
362
364
|
// The storage closes below: let the plugin requests in progress finish
|
|
363
365
|
// (#3160)
|
|
@@ -412,24 +414,33 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
412
414
|
// The lock may come long after it was asked for, once the node
|
|
413
415
|
// holding it is done: by then, this one may be shutting down
|
|
414
416
|
this.stopIfShuttingDown();
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
await installation.handler();
|
|
419
|
-
}
|
|
420
|
-
catch (error) {
|
|
421
|
-
throw kerror.get("plugin", "runtime", "unexpected_installation_error", installation.id, error);
|
|
422
|
-
}
|
|
423
|
-
await this.ask("core:storage:private:document:create", "kuzzle", "installations", {
|
|
424
|
-
description: installation.description,
|
|
425
|
-
handler: installation.handler.toString(),
|
|
426
|
-
installedAt: Date.now(),
|
|
427
|
-
}, { id: installation.id });
|
|
428
|
-
this.log.info(`[✔] Install code "${installation.id}" successfully executed`);
|
|
429
|
-
}
|
|
417
|
+
// Sequential by design: installations run in their declaration
|
|
418
|
+
// order, and each one is recorded before the next one starts
|
|
419
|
+
await this.runInstallation(installation); // NOSONAR (S9382)
|
|
430
420
|
}
|
|
431
421
|
}, { retryAttempts: Number.POSITIVE_INFINITY });
|
|
432
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* Runs an installation, unless it is already recorded, then records it
|
|
425
|
+
*/
|
|
426
|
+
async runInstallation(installation) {
|
|
427
|
+
const isAlreadyInstalled = await this.ask("core:storage:private:document:exist", "kuzzle", "installations", installation.id);
|
|
428
|
+
if (isAlreadyInstalled) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
try {
|
|
432
|
+
await installation.handler();
|
|
433
|
+
}
|
|
434
|
+
catch (error) {
|
|
435
|
+
throw kerror.get("plugin", "runtime", "unexpected_installation_error", installation.id, error);
|
|
436
|
+
}
|
|
437
|
+
await this.ask("core:storage:private:document:create", "kuzzle", "installations", {
|
|
438
|
+
description: installation.description,
|
|
439
|
+
handler: installation.handler.toString(),
|
|
440
|
+
installedAt: Date.now(),
|
|
441
|
+
}, { id: installation.id });
|
|
442
|
+
this.log.info(`[✔] Install code "${installation.id}" successfully executed`);
|
|
443
|
+
}
|
|
433
444
|
// For testing purpose
|
|
434
445
|
async ask(event, ...args) {
|
|
435
446
|
return super.ask(event, ...args);
|
|
@@ -447,7 +458,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
447
458
|
return;
|
|
448
459
|
}
|
|
449
460
|
const toImport = config.toImport;
|
|
450
|
-
if (!
|
|
461
|
+
if (!(0, isEmpty_1.default)(toImport.userMappings)) {
|
|
451
462
|
await this.internalIndex.updateMapping("users", toImport.userMappings);
|
|
452
463
|
await this.internalIndex.refreshCollection("users");
|
|
453
464
|
this.log.info("[✔] User mappings import successful");
|
|
@@ -456,10 +467,10 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
456
467
|
async importMappings(config, status) {
|
|
457
468
|
const toImport = config.toImport;
|
|
458
469
|
const toSupport = config.toSupport;
|
|
459
|
-
if (!
|
|
470
|
+
if (!(0, isEmpty_1.default)(toSupport.mappings) && !(0, isEmpty_1.default)(toImport.mappings)) {
|
|
460
471
|
throw kerror.get("plugin", "runtime", "incompatible", "_support.mappings", "import.mappings");
|
|
461
472
|
}
|
|
462
|
-
else if (!
|
|
473
|
+
else if (!(0, isEmpty_1.default)(toSupport.mappings)) {
|
|
463
474
|
await this.ask("core:storage:public:mappings:import", toSupport.mappings, {
|
|
464
475
|
// Already imported (by this node or another one): only fill the cache
|
|
465
476
|
indexCacheOnly: status.initialized,
|
|
@@ -469,7 +480,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
469
480
|
});
|
|
470
481
|
this.log.info("[✔] Mappings import successful");
|
|
471
482
|
}
|
|
472
|
-
else if (!
|
|
483
|
+
else if (!(0, isEmpty_1.default)(toImport.mappings)) {
|
|
473
484
|
await this.ask("core:storage:public:mappings:import", toImport.mappings, {
|
|
474
485
|
// Already imported (by this node or another one): only fill the cache
|
|
475
486
|
indexCacheOnly: status.initialized,
|
|
@@ -484,7 +495,7 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
484
495
|
return;
|
|
485
496
|
}
|
|
486
497
|
const toSupport = config.toSupport;
|
|
487
|
-
if (!
|
|
498
|
+
if (!(0, isEmpty_1.default)(toSupport.fixtures)) {
|
|
488
499
|
await this.ask("core:storage:public:document:import", toSupport.fixtures);
|
|
489
500
|
this.log.info("[✔] Fixtures import successful");
|
|
490
501
|
}
|
|
@@ -495,13 +506,13 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
495
506
|
}
|
|
496
507
|
const toImport = config.toImport;
|
|
497
508
|
const toSupport = config.toSupport;
|
|
498
|
-
const isPermissionsToImport = !(
|
|
499
|
-
|
|
500
|
-
|
|
509
|
+
const isPermissionsToImport = !((0, isEmpty_1.default)(toImport.profiles) &&
|
|
510
|
+
(0, isEmpty_1.default)(toImport.roles) &&
|
|
511
|
+
(0, isEmpty_1.default)(toImport.users));
|
|
501
512
|
const isPermissionsToSupport = toSupport.securities &&
|
|
502
|
-
!(
|
|
503
|
-
|
|
504
|
-
|
|
513
|
+
!((0, isEmpty_1.default)(toSupport.securities.profiles) &&
|
|
514
|
+
(0, isEmpty_1.default)(toSupport.securities.roles) &&
|
|
515
|
+
(0, isEmpty_1.default)(toSupport.securities.users));
|
|
505
516
|
if (isPermissionsToSupport && isPermissionsToImport) {
|
|
506
517
|
throw kerror.get("plugin", "runtime", "incompatible", "_support.securities", "import profiles roles or users");
|
|
507
518
|
}
|
|
@@ -526,14 +537,14 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
526
537
|
}
|
|
527
538
|
}
|
|
528
539
|
isConfigsEmpty(importConfig, supportConfig) {
|
|
529
|
-
if (
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
540
|
+
if ((0, isEmpty_1.default)(importConfig.mappings) &&
|
|
541
|
+
(0, isEmpty_1.default)(importConfig.profiles) &&
|
|
542
|
+
(0, isEmpty_1.default)(importConfig.roles) &&
|
|
543
|
+
(0, isEmpty_1.default)(importConfig.userMappings) &&
|
|
544
|
+
(0, isEmpty_1.default)(importConfig.users) &&
|
|
545
|
+
(0, isEmpty_1.default)(supportConfig.fixtures) &&
|
|
546
|
+
(0, isEmpty_1.default)(supportConfig.mappings) &&
|
|
547
|
+
(0, isEmpty_1.default)(supportConfig.securities)) {
|
|
537
548
|
return true;
|
|
538
549
|
}
|
|
539
550
|
return false;
|
|
@@ -586,17 +597,17 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
586
597
|
const importPayload = {};
|
|
587
598
|
switch (type) {
|
|
588
599
|
case "fixtures":
|
|
589
|
-
|
|
600
|
+
(0, set_1.default)(importPayload, "toSupport.fixtures", toSupport.fixtures);
|
|
590
601
|
break;
|
|
591
602
|
case "mappings":
|
|
592
|
-
|
|
593
|
-
|
|
603
|
+
(0, set_1.default)(importPayload, "toSupport.mappings", toSupport.mappings);
|
|
604
|
+
(0, set_1.default)(importPayload, "toImport.mappings", toImport.mappings);
|
|
594
605
|
break;
|
|
595
606
|
case "permissions":
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
607
|
+
(0, set_1.default)(importPayload, "toSupport.securities", toSupport.securities);
|
|
608
|
+
(0, set_1.default)(importPayload, "toImport.profiles", toImport.profiles);
|
|
609
|
+
(0, set_1.default)(importPayload, "toImport.roles", toImport.roles);
|
|
610
|
+
(0, set_1.default)(importPayload, "toImport.users", toImport.users);
|
|
600
611
|
break;
|
|
601
612
|
}
|
|
602
613
|
// `?? ""`: `json-stable-stringify` answers undefined for a value it
|
|
@@ -689,11 +700,11 @@ class Kuzzle extends KuzzleEventEmitter_1.default {
|
|
|
689
700
|
this.log.error(`ERROR: unhandledRejection: ${reason.message}. Reason: ${reason.stack}`);
|
|
690
701
|
}
|
|
691
702
|
else {
|
|
692
|
-
this.log.error(`ERROR: unhandledRejection: ${reason}`);
|
|
703
|
+
this.log.error(`ERROR: unhandledRejection: ${typeof reason === "string" ? reason : (0, node_util_1.inspect)(reason)}`);
|
|
693
704
|
}
|
|
694
705
|
}
|
|
695
706
|
else {
|
|
696
|
-
this.log.error(`ERROR: unhandledRejection: ${promise}`);
|
|
707
|
+
this.log.error(`ERROR: unhandledRejection: ${(0, node_util_1.inspect)(promise)}`);
|
|
697
708
|
}
|
|
698
709
|
// A shutdown already in progress has closed, or is closing, what late
|
|
699
710
|
// work may still use (the network, the storage): crashing would turn a
|
package/dist/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.61.0-beta.
|
|
4
|
+
"version": "2.61.0-beta.9",
|
|
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
|
"scripts": {
|
|
7
7
|
"build": "rm -Rf ./dist && tsc && node -r ts-node/register/transpile-only ./bin/copy-binaries.ts",
|
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.61.0-beta.
|
|
4
|
+
"version": "2.61.0-beta.9",
|
|
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
|
"scripts": {
|
|
7
7
|
"build": "rm -Rf ./dist && tsc && node -r ts-node/register/transpile-only ./bin/copy-binaries.ts",
|