kuzzle 2.60.0-beta.1 → 2.60.0-beta.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.
- package/dist/bin/copy-binaries.js +17 -7
- package/dist/bin/start-kuzzle-server +19 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -2
- package/dist/lib/api/controllers/adminController.d.ts +9 -3
- package/dist/lib/api/controllers/adminController.js +42 -26
- package/dist/lib/api/controllers/authController.d.ts +15 -5
- package/dist/lib/api/controllers/authController.js +35 -20
- package/dist/lib/api/controllers/baseController.js +17 -7
- package/dist/lib/api/controllers/bulkController.js +17 -7
- package/dist/lib/api/controllers/collectionController.js +17 -7
- package/dist/lib/api/controllers/debugController.js +17 -7
- package/dist/lib/api/controllers/documentController.js +17 -7
- package/dist/lib/api/controllers/indexController.d.ts +1 -1
- package/dist/lib/api/controllers/memoryStorageController.js +17 -7
- package/dist/lib/api/controllers/securityController.d.ts +30 -28
- package/dist/lib/api/controllers/securityController.js +18 -8
- package/dist/lib/api/controllers/serverController.d.ts +0 -1
- package/dist/lib/api/controllers/serverController.js +17 -7
- package/dist/lib/api/documentExtractor.js +17 -7
- package/dist/lib/api/funnel.js +19 -9
- package/dist/lib/api/httpRoutes.d.ts +2 -1
- package/dist/lib/api/openapi/OpenApiManager.d.ts +2 -1
- package/dist/lib/api/openapi/openApiGenerator.js +1 -2
- package/dist/lib/api/request/kuzzleRequest.d.ts +9 -2
- package/dist/lib/api/request/kuzzleRequest.js +21 -7
- package/dist/lib/api/request/requestContext.d.ts +7 -2
- package/dist/lib/api/request/requestContext.js +17 -7
- package/dist/lib/api/request/requestInput.d.ts +1 -1
- package/dist/lib/api/request/requestInput.js +17 -7
- package/dist/lib/api/request/requestResponse.d.ts +2 -2
- package/dist/lib/api/request/requestResponse.js +21 -10
- package/dist/lib/cluster/command.d.ts +0 -2
- package/dist/lib/cluster/command.js +17 -7
- package/dist/lib/cluster/idCardHandler.d.ts +7 -2
- package/dist/lib/cluster/idCardHandler.js +24 -3
- package/dist/lib/cluster/node.d.ts +15 -3
- package/dist/lib/cluster/node.js +112 -40
- package/dist/lib/cluster/protobuf/command.proto +23 -22
- package/dist/lib/cluster/protobuf/sync.proto +91 -85
- package/dist/lib/cluster/publisher.js +17 -7
- package/dist/lib/cluster/state.js +17 -7
- package/dist/lib/cluster/subscriber.d.ts +0 -2
- package/dist/lib/cluster/subscriber.js +17 -7
- package/dist/lib/cluster/workers/IDCardRenewer.d.ts +6 -1
- package/dist/lib/cluster/workers/IDCardRenewer.js +14 -8
- package/dist/lib/config/index.js +20 -14
- package/dist/lib/core/auth/formatProcessing.d.ts +1 -1
- package/dist/lib/core/auth/formatProcessing.js +3 -3
- package/dist/lib/core/auth/passportResponse.d.ts +0 -1
- package/dist/lib/core/auth/passportWrapper.js +24 -8
- package/dist/lib/core/backend/backend.js +17 -7
- package/dist/lib/core/backend/backendConfig.d.ts +1 -1
- package/dist/lib/core/backend/backendConfig.js +17 -7
- package/dist/lib/core/backend/backendController.js +17 -7
- package/dist/lib/core/backend/backendErrors.js +17 -7
- package/dist/lib/core/backend/backendHook.js +17 -7
- package/dist/lib/core/backend/backendImport.js +17 -7
- package/dist/lib/core/backend/backendPipe.d.ts +4 -1
- package/dist/lib/core/backend/backendPipe.js +17 -7
- package/dist/lib/core/backend/backendPlugin.js +17 -7
- package/dist/lib/core/backend/backendStorage.js +8 -8
- package/dist/lib/core/backend/backendSubscription.js +17 -7
- package/dist/lib/core/backend/backendVault.js +17 -7
- package/dist/lib/core/backend/internalLogger.d.ts +7 -7
- package/dist/lib/core/debug/kuzzleDebugger.js +17 -7
- package/dist/lib/core/network/accessLogger.d.ts +0 -1
- package/dist/lib/core/network/accessLogger.js +17 -7
- package/dist/lib/core/network/clientConnection.js +17 -7
- package/dist/lib/core/network/context.d.ts +0 -1
- package/dist/lib/core/network/entryPoint.js +17 -7
- package/dist/lib/core/network/httpRouter/routePart.js +17 -7
- package/dist/lib/core/network/protocols/httpMessage.d.ts +0 -2
- package/dist/lib/core/network/protocols/httpwsProtocol.d.ts +0 -3
- package/dist/lib/core/network/protocols/httpwsProtocol.js +17 -7
- package/dist/lib/core/network/protocols/mqttProtocol.d.ts +1 -2
- package/dist/lib/core/network/protocols/mqttProtocol.js +31 -10
- package/dist/lib/core/network/router.js +17 -7
- package/dist/lib/core/plugin/plugin.js +17 -7
- package/dist/lib/core/plugin/pluginContext.d.ts +20 -9
- package/dist/lib/core/plugin/pluginContext.js +39 -24
- package/dist/lib/core/plugin/pluginsManager.js +17 -7
- package/dist/lib/core/realtime/channel.js +17 -7
- package/dist/lib/core/realtime/hotelClerk.d.ts +3 -2
- package/dist/lib/core/realtime/hotelClerk.js +17 -7
- package/dist/lib/core/realtime/notifier.js +17 -7
- package/dist/lib/core/security/profileRepository.js +17 -7
- package/dist/lib/core/security/roleRepository.js +17 -7
- package/dist/lib/core/security/securityLoader.js +17 -7
- package/dist/lib/core/security/tokenRepository.js +18 -8
- package/dist/lib/core/security/userRepository.js +17 -7
- package/dist/lib/core/shared/ObjectRepository.js +20 -7
- package/dist/lib/core/shared/abstractManifest.js +17 -7
- package/dist/lib/core/shared/sdk/embeddedSdk.js +20 -8
- package/dist/lib/core/shared/sdk/funnelProtocol.js +17 -7
- package/dist/lib/core/shared/store.d.ts +11 -1
- package/dist/lib/core/shared/store.js +26 -30
- package/dist/lib/core/statistics/statistics.d.ts +0 -1
- package/dist/lib/core/statistics/statistics.js +17 -7
- package/dist/lib/core/storage/clientAdapter.d.ts +4 -6
- package/dist/lib/core/storage/clientAdapter.js +24 -18
- package/dist/lib/core/storage/indexCache.js +17 -7
- package/dist/lib/core/validation/specification.js +1 -2
- package/dist/lib/core/validation/types/date.js +17 -7
- package/dist/lib/core/validation/types/enum.js +17 -7
- package/dist/lib/core/validation/types/geoShape.js +17 -7
- package/dist/lib/core/validation/types/geoShapeUtils.js +6 -7
- package/dist/lib/core/validation/validation.js +17 -7
- package/dist/lib/core/validation/validationUtils.js +24 -15
- package/dist/lib/kerror/codes/8-cluster.json +23 -0
- package/dist/lib/kerror/codes/index.js +20 -10
- package/dist/lib/kerror/errors/kuzzleError.js +18 -8
- package/dist/lib/kerror/index.js +31 -18
- package/dist/lib/kuzzle/Logger.js +4 -3
- package/dist/lib/kuzzle/dumpGenerator.js +17 -7
- package/dist/lib/kuzzle/event/KuzzleEventEmitter.d.ts +3 -3
- package/dist/lib/kuzzle/event/KuzzleEventEmitter.js +17 -7
- package/dist/lib/kuzzle/event/pipeRunner.js +17 -7
- package/dist/lib/kuzzle/exitOnFailure.d.ts +13 -0
- package/dist/lib/kuzzle/exitOnFailure.js +60 -0
- package/dist/lib/kuzzle/internalIndexHandler.js +37 -32
- package/dist/lib/kuzzle/kuzzle.d.ts +20 -8
- package/dist/lib/kuzzle/kuzzle.js +148 -130
- package/dist/lib/model/security/profile.js +17 -7
- package/dist/lib/model/security/role.js +17 -7
- package/dist/lib/model/security/user.js +17 -7
- package/dist/lib/model/storage/apiKey.d.ts +1 -1
- package/dist/lib/model/storage/apiKey.js +17 -7
- package/dist/lib/service/cache/redis.js +40 -9
- package/dist/lib/service/service.js +17 -7
- package/dist/lib/service/storage/7/elasticsearch.d.ts +36 -25
- package/dist/lib/service/storage/7/elasticsearch.js +73 -55
- package/dist/lib/service/storage/8/elasticsearch.d.ts +47 -36
- package/dist/lib/service/storage/8/elasticsearch.js +73 -55
- package/dist/lib/service/storage/Elasticsearch.d.ts +10 -4
- package/dist/lib/types/HttpStream.d.ts +0 -1
- package/dist/lib/types/Plugin.js +17 -7
- package/dist/lib/types/config/SecurityConfiguration.d.ts +0 -2
- package/dist/lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.d.ts +5 -0
- package/dist/lib/types/controllers/GetCurrentUserResponse.d.ts +5 -0
- package/dist/lib/types/controllers/GetCurrentUserResponse.js +3 -0
- package/dist/lib/types/controllers/ResetSecurityResult.d.ts +5 -0
- package/dist/lib/types/controllers/ResetSecurityResult.js +3 -0
- package/dist/lib/types/controllers/adminController.type.d.ts +7 -5
- package/dist/lib/types/controllers/authController.type.d.ts +7 -5
- package/dist/lib/types/core/auth/Serialized.d.ts +14 -0
- package/dist/lib/types/core/auth/Serialized.js +3 -0
- package/dist/lib/types/core/auth/formatProcessing.type.d.ts +5 -11
- package/dist/lib/types/events/EventProtocol.d.ts +0 -2
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.js +1 -0
- package/dist/lib/types/storage/8/Elasticsearch.d.ts +4 -3
- package/dist/lib/util/array.d.ts +1 -1
- package/dist/lib/util/array.js +7 -6
- package/dist/lib/util/assertType.js +5 -6
- package/dist/lib/util/async.js +1 -2
- package/dist/lib/util/asyncStore.d.ts +0 -1
- package/dist/lib/util/bufferedPassThrough.d.ts +0 -3
- package/dist/lib/util/crypto.js +1 -2
- package/dist/lib/util/debug.d.ts +0 -1
- package/dist/lib/util/debug.js +17 -7
- package/dist/lib/util/distributedLock.d.ts +27 -4
- package/dist/lib/util/distributedLock.js +69 -16
- package/dist/lib/util/dump-collection.d.ts +2 -2
- package/dist/lib/util/dump-collection.js +22 -13
- package/dist/lib/util/esRequest.js +1 -2
- package/dist/lib/util/extractFields.d.ts +16 -7
- package/dist/lib/util/extractFields.js +1 -10
- package/dist/lib/util/koncordeCompat.js +22 -13
- package/dist/lib/util/mutex.d.ts +4 -4
- package/dist/lib/util/mutex.js +21 -11
- package/dist/lib/util/name-generator.js +2 -2
- package/dist/lib/util/requestAssertions.js +27 -18
- package/dist/lib/util/safeObject.js +3 -4
- package/dist/lib/util/stackTrace.js +2 -3
- package/dist/lib/util/thrown.js +1 -2
- package/dist/lib/util/time.js +1 -2
- package/dist/package.json +22 -15
- package/package.json +22 -15
|
@@ -35,15 +35,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
56
|
+
exports.checkAllowedProperties = checkAllowedProperties;
|
|
57
|
+
exports.curateStructuredFields = curateStructuredFields;
|
|
58
|
+
exports.getParent = getParent;
|
|
59
|
+
exports.storeErrorMessage = storeErrorMessage;
|
|
60
|
+
exports.throwErrorMessage = throwErrorMessage;
|
|
61
|
+
exports.manageErrorMessage = manageErrorMessage;
|
|
62
|
+
exports.getValidationConfiguration = getValidationConfiguration;
|
|
47
63
|
const kerror = __importStar(require("../../kerror"));
|
|
48
64
|
const safeObject_1 = require("../../util/safeObject");
|
|
49
65
|
const specification_1 = require("./specification");
|
|
@@ -57,7 +73,6 @@ function checkAllowedProperties(object, allowedProperties) {
|
|
|
57
73
|
}
|
|
58
74
|
return !Object.keys(object).some((propertyName) => !allowedProperties.includes(propertyName));
|
|
59
75
|
}
|
|
60
|
-
exports.checkAllowedProperties = checkAllowedProperties;
|
|
61
76
|
/**
|
|
62
77
|
* Assembles curated fields, grouped by depth, into the tree the validator
|
|
63
78
|
* walks. Depth counting starts at 1.
|
|
@@ -88,7 +103,6 @@ function curateStructuredFields(typeAllowsChildren, fields, maxDepth) {
|
|
|
88
103
|
}
|
|
89
104
|
return structuredFields;
|
|
90
105
|
}
|
|
91
|
-
exports.curateStructuredFields = curateStructuredFields;
|
|
92
106
|
/**
|
|
93
107
|
* Walks a field's path down the tree and answers the node that must hold it.
|
|
94
108
|
*
|
|
@@ -108,7 +122,6 @@ function getParent(structuredFields, fieldPath) {
|
|
|
108
122
|
}
|
|
109
123
|
return pointer;
|
|
110
124
|
}
|
|
111
|
-
exports.getParent = getParent;
|
|
112
125
|
/**
|
|
113
126
|
* Files a validation message, or throws it.
|
|
114
127
|
*
|
|
@@ -132,7 +145,6 @@ function storeErrorMessage(errorContext, errorHolder, message) {
|
|
|
132
145
|
const messages = (pointer.messages ?? (pointer.messages = []));
|
|
133
146
|
messages.push(message);
|
|
134
147
|
}
|
|
135
|
-
exports.storeErrorMessage = storeErrorMessage;
|
|
136
148
|
function throwErrorMessage(errorContext, message) {
|
|
137
149
|
if (errorContext === "document") {
|
|
138
150
|
throw kerror.get("validation", "check", "failed_document", message);
|
|
@@ -140,7 +152,6 @@ function throwErrorMessage(errorContext, message) {
|
|
|
140
152
|
// Everything that is not the "document" literal is a field path.
|
|
141
153
|
throw kerror.get("validation", "check", "failed_field", Array.isArray(errorContext) ? errorContext.join(".") : errorContext, message);
|
|
142
154
|
}
|
|
143
|
-
exports.throwErrorMessage = throwErrorMessage;
|
|
144
155
|
function manageErrorMessage(errorContext, errorHolder, message, structured) {
|
|
145
156
|
if (!structured) {
|
|
146
157
|
throwErrorMessage(errorContext, message);
|
|
@@ -153,7 +164,6 @@ function manageErrorMessage(errorContext, errorHolder, message, structured) {
|
|
|
153
164
|
}
|
|
154
165
|
storeErrorMessage(errorContext, errorHolder, message);
|
|
155
166
|
}
|
|
156
|
-
exports.manageErrorMessage = manageErrorMessage;
|
|
157
167
|
/**
|
|
158
168
|
* Reads every stored specification, falling back to the one in the
|
|
159
169
|
* configuration when the internal index holds none — the database is not
|
|
@@ -186,5 +196,4 @@ function getValidationConfiguration() {
|
|
|
186
196
|
return validation;
|
|
187
197
|
});
|
|
188
198
|
}
|
|
189
|
-
exports.getValidationConfiguration = getValidationConfiguration;
|
|
190
199
|
//# sourceMappingURL=validationUtils.js.map
|
|
@@ -11,6 +11,29 @@
|
|
|
11
11
|
"class": "InternalError"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
},
|
|
15
|
+
"join": {
|
|
16
|
+
"code": 1,
|
|
17
|
+
"errors": {
|
|
18
|
+
"duplicate_ip": {
|
|
19
|
+
"description": "Another node of the cluster has the same IP address as the one joining it. The joining node does not start.",
|
|
20
|
+
"code": 1,
|
|
21
|
+
"message": "Another node shares the same IP address as this one (%s): %s.",
|
|
22
|
+
"class": "InternalError"
|
|
23
|
+
},
|
|
24
|
+
"full_state_unavailable": {
|
|
25
|
+
"description": "None of the cluster nodes discovered could give the joining node the cluster state, twice in a row (network split). The joining node does not start.",
|
|
26
|
+
"code": 2,
|
|
27
|
+
"message": "Could not connect to the discovered cluster nodes (network split detected).",
|
|
28
|
+
"class": "InternalError"
|
|
29
|
+
},
|
|
30
|
+
"timeout": {
|
|
31
|
+
"description": "The node did not join the cluster within the configured cluster.joinTimeout. It does not start.",
|
|
32
|
+
"code": 3,
|
|
33
|
+
"message": "Failed to join the cluster: timed out (joinTimeout: %sms).",
|
|
34
|
+
"class": "InternalError"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
14
37
|
}
|
|
15
38
|
}
|
|
16
39
|
}
|
|
@@ -35,18 +35,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
57
|
};
|
|
48
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.
|
|
59
|
+
exports.domains = void 0;
|
|
60
|
+
exports.checkDomains = checkDomains;
|
|
61
|
+
exports.loadPluginsErrors = loadPluginsErrors;
|
|
50
62
|
const assert_1 = __importDefault(require("assert"));
|
|
51
63
|
const errors = __importStar(require("../errors"));
|
|
52
64
|
const safeObject_1 = require("../../util/safeObject");
|
|
@@ -128,7 +140,6 @@ function checkDomains(errorCodesFiles, options = { plugin: false }) {
|
|
|
128
140
|
checkSubdomains(domain, options);
|
|
129
141
|
}
|
|
130
142
|
}
|
|
131
|
-
exports.checkDomains = checkDomains;
|
|
132
143
|
function loadPluginsErrors(pluginManifest, pluginCode) {
|
|
133
144
|
domains.plugin.subDomains[pluginManifest.name] = {
|
|
134
145
|
code: pluginCode,
|
|
@@ -136,6 +147,5 @@ function loadPluginsErrors(pluginManifest, pluginCode) {
|
|
|
136
147
|
};
|
|
137
148
|
checkDomains({ plugin: domains.plugin }, { plugin: true });
|
|
138
149
|
}
|
|
139
|
-
exports.loadPluginsErrors = loadPluginsErrors;
|
|
140
150
|
checkDomains(domains);
|
|
141
151
|
//# sourceMappingURL=index.js.map
|
|
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
56
|
exports.KuzzleError = void 0;
|
|
47
57
|
const util = __importStar(require("util"));
|
|
@@ -50,7 +60,7 @@ const util = __importStar(require("util"));
|
|
|
50
60
|
* for an error built in another realm, which `instanceof` does not, and false
|
|
51
61
|
* for an object that merely has `Error.prototype`. Node deprecates it in
|
|
52
62
|
* favour of `Error.isError`, which needs Node 24 while this package supports
|
|
53
|
-
* `>=
|
|
63
|
+
* `>=22.12` — hence the NOSONAR. Revisit when the floor reaches Node 24.
|
|
54
64
|
*/
|
|
55
65
|
function isError(value) {
|
|
56
66
|
return util.types.isNativeError(value); // NOSONAR
|
package/dist/lib/kerror/index.js
CHANGED
|
@@ -35,15 +35,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
56
|
+
exports.rawGet = rawGet;
|
|
57
|
+
exports.rawReject = rawReject;
|
|
58
|
+
exports.rawGetFrom = rawGetFrom;
|
|
59
|
+
exports.rawWrap = rawWrap;
|
|
60
|
+
exports.get = get;
|
|
61
|
+
exports.reject = reject;
|
|
62
|
+
exports.getFrom = getFrom;
|
|
63
|
+
exports.wrap = wrap;
|
|
47
64
|
const util_1 = require("util");
|
|
48
65
|
const codes_1 = require("./codes");
|
|
49
66
|
const errors = __importStar(require("./errors"));
|
|
@@ -139,7 +156,6 @@ function rawGet(domains, domain, subdomain, error, ...placeholders) {
|
|
|
139
156
|
}
|
|
140
157
|
return kerror;
|
|
141
158
|
}
|
|
142
|
-
exports.rawGet = rawGet;
|
|
143
159
|
/**
|
|
144
160
|
* Removes the first lines of the stacktrace because they are related
|
|
145
161
|
* to internal mechanisms.
|
|
@@ -185,10 +201,11 @@ function cleanStackTrace(error) {
|
|
|
185
201
|
* @param error - Error name: (eg: 'index_not_found')
|
|
186
202
|
* @param placeholders - Placeholders value to inject in error message
|
|
187
203
|
*/
|
|
188
|
-
function rawReject(domains, domain, subdomain, error, ...placeholders
|
|
204
|
+
function rawReject(domains, domain, subdomain, error, ...placeholders
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- kept for v2 compatibility, see docs/v3-breaking-changes.md
|
|
206
|
+
) {
|
|
189
207
|
return Promise.reject(rawGet(domains, domain, subdomain, error, ...placeholders));
|
|
190
208
|
}
|
|
191
|
-
exports.rawReject = rawReject;
|
|
192
209
|
/**
|
|
193
210
|
* Construct and return the corresponding error, with its stack
|
|
194
211
|
* trace derivated from a provided source error
|
|
@@ -220,7 +237,6 @@ source, domain, subdomain, error, ...placeholders) {
|
|
|
220
237
|
}
|
|
221
238
|
return derivedError;
|
|
222
239
|
}
|
|
223
|
-
exports.rawGetFrom = rawGetFrom;
|
|
224
240
|
/**
|
|
225
241
|
* Wrap error functions with the provided domain and subdomain.
|
|
226
242
|
*/
|
|
@@ -231,7 +247,6 @@ function rawWrap(domains, domain, subdomain) {
|
|
|
231
247
|
reject: (error, ...placeholders) => rawReject(domains, domain, subdomain, error, ...placeholders),
|
|
232
248
|
};
|
|
233
249
|
}
|
|
234
|
-
exports.rawWrap = rawWrap;
|
|
235
250
|
/**
|
|
236
251
|
* Construct and return the corresponding error
|
|
237
252
|
*
|
|
@@ -244,7 +259,6 @@ exports.rawWrap = rawWrap;
|
|
|
244
259
|
function get(domain, subdomain, error, ...placeholders) {
|
|
245
260
|
return rawGet(codes_1.domains, domain, subdomain, error, ...placeholders);
|
|
246
261
|
}
|
|
247
|
-
exports.get = get;
|
|
248
262
|
/**
|
|
249
263
|
* Returns a promise rejected with the corresponding error
|
|
250
264
|
*
|
|
@@ -253,10 +267,11 @@ exports.get = get;
|
|
|
253
267
|
* @param error - Error name: (eg: 'index_not_found')
|
|
254
268
|
* @param placeholders - Placeholders value to inject in error message
|
|
255
269
|
*/
|
|
256
|
-
function reject(domain, subdomain, error, ...placeholders
|
|
270
|
+
function reject(domain, subdomain, error, ...placeholders
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- kept for v2 compatibility, see docs/v3-breaking-changes.md
|
|
272
|
+
) {
|
|
257
273
|
return rawReject(codes_1.domains, domain, subdomain, error, ...placeholders);
|
|
258
274
|
}
|
|
259
|
-
exports.reject = reject;
|
|
260
275
|
/**
|
|
261
276
|
* Construct and return the corresponding error, with its stack
|
|
262
277
|
* trace derivated from a provided source error
|
|
@@ -270,7 +285,6 @@ exports.reject = reject;
|
|
|
270
285
|
function getFrom(source, domain, subdomain, error, ...placeholders) {
|
|
271
286
|
return rawGetFrom(codes_1.domains, source, domain, subdomain, error, ...placeholders);
|
|
272
287
|
}
|
|
273
|
-
exports.getFrom = getFrom;
|
|
274
288
|
/**
|
|
275
289
|
* Wrap error functions with the provided domain and subdomain.
|
|
276
290
|
*/
|
|
@@ -281,5 +295,4 @@ function wrap(domain, subdomain) {
|
|
|
281
295
|
reject: (error, ...placeholders) => reject(domain, subdomain, error, ...placeholders),
|
|
282
296
|
};
|
|
283
297
|
}
|
|
284
|
-
exports.wrap = wrap;
|
|
285
298
|
//# sourceMappingURL=index.js.map
|
|
@@ -46,7 +46,8 @@ class Logger extends kuzzle_logger_1.KuzzleLogger {
|
|
|
46
46
|
}
|
|
47
47
|
return mergingObject;
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const sharedPino = Logger.basePino;
|
|
50
|
+
const hasSharedPino = sharedPino !== undefined;
|
|
50
51
|
let loggerConfig;
|
|
51
52
|
if (hasSharedPino) {
|
|
52
53
|
loggerConfig = { getMergingObject, skipPinoInstance: true };
|
|
@@ -83,10 +84,10 @@ class Logger extends kuzzle_logger_1.KuzzleLogger {
|
|
|
83
84
|
super(loggerConfig);
|
|
84
85
|
this.warnedForSillyDeprecation = false;
|
|
85
86
|
this.warnedForVerboseDeprecation = false;
|
|
86
|
-
if (
|
|
87
|
+
if (sharedPino !== undefined) {
|
|
87
88
|
// Reuse the shared pino instance to avoid stacking process exit listeners
|
|
88
89
|
// added by pino.transport when spawning its worker thread.
|
|
89
|
-
this.pino =
|
|
90
|
+
this.pino = sharedPino.child({});
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
92
93
|
Logger.basePino = this.pino;
|
|
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
57
|
};
|
|
@@ -39,7 +39,7 @@ declare class KuzzleEventEmitter extends EventEmitter {
|
|
|
39
39
|
*
|
|
40
40
|
* @warning Critical section of code
|
|
41
41
|
*/
|
|
42
|
-
emit(event: string | symbol, ...args:
|
|
42
|
+
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
43
43
|
/**
|
|
44
44
|
* Emits a pipe event, which triggers the following, in that order:
|
|
45
45
|
* 1. Plugin pipes are invoked one after another (waterfall). Each plugin must
|
|
@@ -59,11 +59,11 @@ declare class KuzzleEventEmitter extends EventEmitter {
|
|
|
59
59
|
/**
|
|
60
60
|
* Emits an "ask" event to get information about the provided payload
|
|
61
61
|
*/
|
|
62
|
-
ask<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], ...args: [payload?: TAskEventDefinition["payload"], ...rest:
|
|
62
|
+
ask<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], ...args: [payload?: TAskEventDefinition["payload"], ...rest: unknown[]]): Promise<TAskEventDefinition["result"]>;
|
|
63
63
|
/**
|
|
64
64
|
* Calls a callback to get information about the provided payload
|
|
65
65
|
*/
|
|
66
|
-
call<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], ...args: [payload?: TAskEventDefinition["payload"], ...rest:
|
|
66
|
+
call<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], ...args: [payload?: TAskEventDefinition["payload"], ...rest: unknown[]]): TAskEventDefinition["result"];
|
|
67
67
|
/**
|
|
68
68
|
* Registers a plugin hook.
|
|
69
69
|
* Catch any error in the handler and emit the hook:onError event.
|
|
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
57
|
};
|
|
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
57
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ends the process with exit code 1, for a start script whose Kuzzle failed
|
|
3
|
+
* to start or to run.
|
|
4
|
+
*
|
|
5
|
+
* A bare `process.exit(1)` cuts Kuzzle's graceful shutdown short: the locks
|
|
6
|
+
* the node holds and its ID card stay in Redis until they expire (#3022).
|
|
7
|
+
* Once a Kuzzle instance exists, this goes through `shutdown(1)` instead,
|
|
8
|
+
* which joins the one a failed start already began (#3020). Before that,
|
|
9
|
+
* there is nothing to release.
|
|
10
|
+
*
|
|
11
|
+
* Internal to Kuzzle: not exported by the package.
|
|
12
|
+
*/
|
|
13
|
+
export declare function exitOnFailure(): Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Kuzzle, a backend software, self-hostable and ready to use
|
|
4
|
+
* to power modern apps
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2015-2022 Kuzzle
|
|
7
|
+
* mailto: support AT kuzzle.io
|
|
8
|
+
* website: http://kuzzle.io
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.exitOnFailure = exitOnFailure;
|
|
24
|
+
const node_util_1 = require("node:util");
|
|
25
|
+
/**
|
|
26
|
+
* Ends the process with exit code 1, for a start script whose Kuzzle failed
|
|
27
|
+
* to start or to run.
|
|
28
|
+
*
|
|
29
|
+
* A bare `process.exit(1)` cuts Kuzzle's graceful shutdown short: the locks
|
|
30
|
+
* the node holds and its ID card stay in Redis until they expire (#3022).
|
|
31
|
+
* Once a Kuzzle instance exists, this goes through `shutdown(1)` instead,
|
|
32
|
+
* which joins the one a failed start already began (#3020). Before that,
|
|
33
|
+
* there is nothing to release.
|
|
34
|
+
*
|
|
35
|
+
* Internal to Kuzzle: not exported by the package.
|
|
36
|
+
*/
|
|
37
|
+
async function exitOnFailure() {
|
|
38
|
+
const kuzzle = currentKuzzle();
|
|
39
|
+
if (kuzzle) {
|
|
40
|
+
try {
|
|
41
|
+
// Ends with `process.exit`
|
|
42
|
+
await kuzzle.shutdown(1);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
kuzzle.log.error(`Unable to shut down: ${error instanceof Error ? error.message : (0, node_util_1.inspect)(error)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
function currentKuzzle() {
|
|
52
|
+
try {
|
|
53
|
+
return global.kuzzle;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// The `global.kuzzle` getter throws until an instance is built
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=exitOnFailure.js.map
|
|
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
35
35
|
}) : function(o, v) {
|
|
36
36
|
o["default"] = v;
|
|
37
37
|
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
45
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
57
|
};
|
|
@@ -52,7 +62,7 @@ const storeScopeEnum_1 = require("../core/storage/storeScopeEnum");
|
|
|
52
62
|
const specification_1 = require("../core/validation/specification");
|
|
53
63
|
const kerror = __importStar(require("../kerror"));
|
|
54
64
|
const debug_1 = __importDefault(require("../util/debug"));
|
|
55
|
-
const
|
|
65
|
+
const distributedLock_1 = require("../util/distributedLock");
|
|
56
66
|
const debug = (0, debug_1.default)("kuzzle:bootstrap:internalIndex");
|
|
57
67
|
const securitiesBootstrap = {
|
|
58
68
|
profiles: {
|
|
@@ -112,32 +122,27 @@ class InternalIndexHandler extends store_1.Store {
|
|
|
112
122
|
}
|
|
113
123
|
async init() {
|
|
114
124
|
await super.init(this.config.collections);
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await this.
|
|
125
|
-
|
|
125
|
+
// No retry limit: the node holding it is bootstrapping the internal
|
|
126
|
+
// index, and this one cannot start before that is done
|
|
127
|
+
await (0, distributedLock_1.withLock)("InternalIndexBootstrap", async () => {
|
|
128
|
+
try {
|
|
129
|
+
const bootstrapped = await this.exists("config", this._BOOTSTRAP_DONE_ID);
|
|
130
|
+
if (bootstrapped) {
|
|
131
|
+
await this._initSecret();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
await bluebird_1.default.resolve(this._bootstrapSequence()).timeout(this.timeout);
|
|
135
|
+
await this.create("config", { timestamp: Date.now() }, {
|
|
136
|
+
id: this._BOOTSTRAP_DONE_ID,
|
|
137
|
+
});
|
|
126
138
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
catch (error) {
|
|
133
|
-
if (error instanceof bluebird_1.default.TimeoutError) {
|
|
134
|
-
throw kerror.get("services", "storage", "bootstrap_timeout", "internalIndex");
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error instanceof bluebird_1.default.TimeoutError) {
|
|
141
|
+
throw kerror.get("services", "storage", "bootstrap_timeout", "internalIndex");
|
|
142
|
+
}
|
|
143
|
+
throw error;
|
|
135
144
|
}
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
finally {
|
|
139
|
-
await mutex.unlock();
|
|
140
|
-
}
|
|
145
|
+
}, { retryAttempts: Number.POSITIVE_INFINITY, ttl: 30000 });
|
|
141
146
|
}
|
|
142
147
|
/**
|
|
143
148
|
* @override
|