kuzzle 2.17.7 → 2.17.8
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/bin/start-kuzzle-server +1 -1
- package/lib/api/controllers/adminController.js +1 -1
- package/lib/api/controllers/authController.js +1 -1
- package/lib/api/controllers/baseController.js +1 -1
- package/lib/api/controllers/bulkController.js +1 -1
- package/lib/api/controllers/clusterController.js +1 -1
- package/lib/api/controllers/collectionController.js +1 -1
- package/lib/api/controllers/documentController.js +7 -2
- package/lib/api/controllers/index.js +1 -1
- package/lib/api/controllers/indexController.js +1 -1
- package/lib/api/controllers/memoryStorageController.js +1 -1
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +1 -1
- package/lib/api/controllers/serverController.js +1 -1
- package/lib/api/documentExtractor.js +1 -1
- package/lib/api/funnel.js +1 -1
- package/lib/api/httpRoutes.js +5 -4
- package/lib/api/openapi/OpenApiManager.js +2 -1
- package/lib/api/openapi/components/document/index.d.ts +2 -0
- package/lib/api/openapi/components/document/index.js +6 -1
- package/lib/api/openapi/components/document/mCreateOrReplace.yaml +93 -0
- package/lib/api/openapi/openApiGenerator.js +1 -1
- package/lib/api/rateLimiter.js +1 -1
- package/lib/api/request/kuzzleRequest.js +1 -1
- package/lib/api/request/requestContext.js +1 -1
- package/lib/api/request/requestInput.js +1 -1
- package/lib/api/request/requestResponse.js +1 -1
- package/lib/cluster/command.js +1 -1
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/cluster/index.js +1 -1
- package/lib/cluster/node.js +8 -8
- package/lib/cluster/publisher.js +1 -1
- package/lib/cluster/state.js +1 -1
- package/lib/cluster/subscriber.js +4 -1
- package/lib/config/documentEventAliases.js +1 -1
- package/lib/config/index.js +1 -1
- package/lib/core/auth/formatProcessing.js +1 -1
- package/lib/core/auth/passportResponse.js +1 -1
- package/lib/core/auth/passportWrapper.js +1 -1
- package/lib/core/auth/tokenManager.js +1 -1
- package/lib/core/backend/applicationManager.js +1 -1
- package/lib/core/backend/backend.js +1 -1
- package/lib/core/backend/backendCluster.js +1 -1
- package/lib/core/backend/backendConfig.js +1 -1
- package/lib/core/backend/backendController.js +1 -1
- package/lib/core/backend/backendErrors.js +1 -1
- package/lib/core/backend/backendHook.js +1 -1
- package/lib/core/backend/backendImport.js +1 -1
- package/lib/core/backend/backendOpenApi.js +1 -1
- package/lib/core/backend/backendPipe.js +1 -1
- package/lib/core/backend/backendPlugin.js +1 -1
- package/lib/core/backend/backendStorage.js +1 -1
- package/lib/core/backend/backendVault.js +1 -1
- package/lib/core/backend/internalLogger.js +1 -1
- package/lib/core/cache/cacheDbEnum.js +1 -1
- package/lib/core/cache/cacheEngine.js +1 -1
- package/lib/core/network/accessLogger.js +1 -1
- package/lib/core/network/clientConnection.js +1 -1
- package/lib/core/network/context.js +1 -1
- package/lib/core/network/entryPoint.js +6 -6
- package/lib/core/network/httpRouter/index.js +1 -1
- package/lib/core/network/httpRouter/routeHandler.js +1 -1
- package/lib/core/network/httpRouter/routePart.js +1 -1
- package/lib/core/network/protocolManifest.js +1 -1
- package/lib/core/network/protocols/httpMessage.js +1 -1
- package/lib/core/network/protocols/httpwsProtocol.js +5 -10
- package/lib/core/network/protocols/internalProtocol.js +1 -1
- package/lib/core/network/protocols/mqttProtocol.js +4 -3
- package/lib/core/network/protocols/protocol.js +1 -1
- package/lib/core/network/router.js +11 -2
- package/lib/core/plugin/plugin.js +1 -1
- package/lib/core/plugin/pluginContext.js +1 -1
- package/lib/core/plugin/pluginManifest.js +1 -1
- package/lib/core/plugin/pluginRepository.js +1 -1
- package/lib/core/plugin/pluginsManager.js +1 -1
- package/lib/core/plugin/privilegedContext.js +1 -1
- package/lib/core/realtime/actionEnum.js +1 -1
- package/lib/core/realtime/channel.js +1 -1
- package/lib/core/realtime/connectionRooms.js +1 -1
- package/lib/core/realtime/hotelClerk.js +66 -24
- package/lib/core/realtime/index.js +1 -1
- package/lib/core/realtime/notification/document.js +1 -1
- package/lib/core/realtime/notification/index.js +1 -1
- package/lib/core/realtime/notification/server.js +1 -1
- package/lib/core/realtime/notification/user.js +1 -1
- package/lib/core/realtime/notifier.js +1 -1
- package/lib/core/realtime/room.js +1 -1
- package/lib/core/realtime/subscription.js +1 -1
- package/lib/core/security/index.js +1 -1
- package/lib/core/security/profileRepository.js +1 -1
- package/lib/core/security/roleRepository.js +1 -1
- package/lib/core/security/securityLoader.js +1 -1
- package/lib/core/security/tokenRepository.js +1 -1
- package/lib/core/security/userRepository.js +1 -1
- package/lib/core/shared/KoncordeWrapper.js +1 -1
- package/lib/core/shared/abstractManifest.js +1 -1
- package/lib/core/shared/repository.js +1 -1
- package/lib/core/shared/sdk/embeddedSdk.js +4 -3
- package/lib/core/shared/sdk/funnelProtocol.d.ts +14 -0
- package/lib/core/shared/sdk/funnelProtocol.js +76 -81
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +1 -1
- package/lib/core/statistics/index.js +1 -1
- package/lib/core/statistics/statistics.js +1 -1
- package/lib/core/storage/clientAdapter.js +1 -1
- package/lib/core/storage/indexCache.js +1 -1
- package/lib/core/storage/storageEngine.js +1 -1
- package/lib/core/storage/storeScopeEnum.js +1 -1
- package/lib/core/validation/baseType.js +1 -1
- package/lib/core/validation/index.js +1 -1
- package/lib/core/validation/types/anything.js +1 -1
- package/lib/core/validation/types/boolean.js +1 -1
- package/lib/core/validation/types/date.js +1 -1
- package/lib/core/validation/types/email.js +1 -1
- package/lib/core/validation/types/enum.js +1 -1
- package/lib/core/validation/types/geoPoint.js +1 -1
- package/lib/core/validation/types/geoShape.js +1 -1
- package/lib/core/validation/types/integer.js +1 -1
- package/lib/core/validation/types/ipAddress.js +1 -1
- package/lib/core/validation/types/numeric.js +1 -1
- package/lib/core/validation/types/object.js +1 -1
- package/lib/core/validation/types/string.js +1 -1
- package/lib/core/validation/types/url.js +1 -1
- package/lib/core/validation/validation.js +1 -1
- package/lib/kerror/codes/index.js +1 -1
- package/lib/kerror/errors/badRequestError.js +1 -1
- package/lib/kerror/errors/externalServiceError.js +1 -1
- package/lib/kerror/errors/forbiddenError.js +1 -1
- package/lib/kerror/errors/gatewayTimeoutError.js +1 -1
- package/lib/kerror/errors/index.js +1 -1
- package/lib/kerror/errors/internalError.js +1 -1
- package/lib/kerror/errors/kuzzleError.js +1 -1
- package/lib/kerror/errors/multipleErrorsError.js +1 -1
- package/lib/kerror/errors/notFoundError.js +1 -1
- package/lib/kerror/errors/partialError.js +1 -1
- package/lib/kerror/errors/pluginImplementationError.js +1 -1
- package/lib/kerror/errors/preconditionError.js +1 -1
- package/lib/kerror/errors/serviceUnavailableError.js +1 -1
- package/lib/kerror/errors/sizeLimitError.js +1 -1
- package/lib/kerror/errors/tooManyRequestsError.js +1 -1
- package/lib/kerror/errors/unauthorizedError.js +1 -1
- package/lib/kerror/index.js +2 -4
- package/lib/kuzzle/dumpGenerator.js +1 -1
- package/lib/kuzzle/event/kuzzleEventEmitter.js +39 -1
- package/lib/kuzzle/event/pipeRunner.js +1 -1
- package/lib/kuzzle/event/waterfall.js +1 -1
- package/lib/kuzzle/index.js +1 -1
- package/lib/kuzzle/internalIndexHandler.js +1 -1
- package/lib/kuzzle/kuzzle.js +1 -1
- package/lib/kuzzle/kuzzleStateEnum.js +1 -1
- package/lib/kuzzle/log.js +1 -1
- package/lib/kuzzle/vault.js +1 -1
- package/lib/model/security/profile.js +1 -1
- package/lib/model/security/rights.js +1 -1
- package/lib/model/security/role.js +1 -1
- package/lib/model/security/token.js +1 -1
- package/lib/model/security/user.js +1 -1
- package/lib/model/storage/apiKey.js +1 -1
- package/lib/model/storage/baseModel.js +1 -1
- package/lib/service/cache/redis.js +1 -1
- package/lib/service/service.js +1 -1
- package/lib/service/storage/elasticsearch.js +5 -5
- package/lib/service/storage/esWrapper.js +1 -1
- package/lib/service/storage/queryTranslator.js +1 -1
- package/lib/types/Controller.js +1 -1
- package/lib/types/ControllerDefinition.js +1 -1
- package/lib/types/Deprecation.js +1 -1
- package/lib/types/EventHandler.js +1 -1
- package/lib/types/KuzzleDocument.d.ts +3 -0
- package/lib/types/Plugin.js +1 -1
- package/lib/types/PluginManifest.js +1 -1
- package/lib/types/RequestPayload.js +1 -1
- package/lib/types/ResponsePayload.js +1 -1
- package/lib/types/StrategyDefinition.js +1 -1
- package/lib/types/Token.js +1 -1
- package/lib/types/User.js +1 -1
- package/lib/types/index.js +1 -1
- package/lib/util/array.js +1 -1
- package/lib/util/assertType.js +1 -1
- package/lib/util/asyncStore.js +1 -1
- package/lib/util/debug.js +1 -1
- package/lib/util/deprecate.js +1 -1
- package/lib/util/didYouMean.js +1 -1
- package/lib/util/extractFields.js +1 -1
- package/lib/util/inflector.js +1 -1
- package/lib/util/koncordeCompat.js +1 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/mutex.js +1 -1
- package/lib/util/name-generator.js +1 -1
- package/lib/util/promback.js +1 -1
- package/lib/util/requestAssertions.js +1 -1
- package/lib/util/safeObject.js +1 -1
- package/lib/util/stackTrace.js +56 -17
- package/lib/util/wildcard.js +1 -1
- package/package-lock.json +1 -1
- package/package.json +4 -3
- package/lib/core/network/removeErrorStack.js +0 -56
package/lib/kerror/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
4
4
|
* to power modern apps
|
|
5
5
|
*
|
|
6
|
-
* Copyright 2015-
|
|
6
|
+
* Copyright 2015-2022 Kuzzle
|
|
7
7
|
* mailto: support AT kuzzle.io
|
|
8
8
|
* website: http://kuzzle.io
|
|
9
9
|
*
|
|
@@ -51,7 +51,6 @@ const util_1 = require("util");
|
|
|
51
51
|
const lodash_1 = __importDefault(require("lodash"));
|
|
52
52
|
const codes_1 = require("./codes");
|
|
53
53
|
const errors = __importStar(require("./errors"));
|
|
54
|
-
const stackTrace_1 = require("../util/stackTrace");
|
|
55
54
|
/**
|
|
56
55
|
* Gets this file name in the exact same format than the one printed in the
|
|
57
56
|
* stacktraces (used to clean kerror lines from stacktraces)
|
|
@@ -136,8 +135,7 @@ function cleanStackTrace(error) {
|
|
|
136
135
|
}
|
|
137
136
|
// filter all lines related to the kerror object
|
|
138
137
|
return !line.includes(currentFileName);
|
|
139
|
-
})
|
|
140
|
-
.map(stackTrace_1.hilightUserCode);
|
|
138
|
+
});
|
|
141
139
|
// insert a deletion message in place of the new error instantiation line
|
|
142
140
|
newStack[messageLength] = ' [...Kuzzle internal calls deleted...]';
|
|
143
141
|
error.stack = newStack.join('\n');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -67,6 +67,7 @@ class KuzzleEventEmitter extends EventEmitter {
|
|
|
67
67
|
|
|
68
68
|
this.corePipes = new Map();
|
|
69
69
|
this.coreAnswerers = new Map();
|
|
70
|
+
this.coreSyncedAnswerers = new Map();
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
@@ -101,6 +102,21 @@ class KuzzleEventEmitter extends EventEmitter {
|
|
|
101
102
|
this.coreAnswerers.set(event, fn);
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Registers a core 'callback' answerer
|
|
108
|
+
* There can only be 0 or 1 answerer per callback event.
|
|
109
|
+
*
|
|
110
|
+
* @param {String} event
|
|
111
|
+
* @param {Function} fn
|
|
112
|
+
*/
|
|
113
|
+
onCall (event, fn) {
|
|
114
|
+
assert(typeof fn === 'function', `Cannot register callback for event "${event}": "${fn}" is not a function`);
|
|
115
|
+
assert(! this.coreSyncedAnswerers.has(event), `Cannot register callback for event "${event}": a callback has already been registered`);
|
|
116
|
+
|
|
117
|
+
this.coreSyncedAnswerers.set(event, fn);
|
|
118
|
+
}
|
|
119
|
+
|
|
104
120
|
/**
|
|
105
121
|
* Emits an event and all its wildcarded versions
|
|
106
122
|
*
|
|
@@ -199,6 +215,28 @@ class KuzzleEventEmitter extends EventEmitter {
|
|
|
199
215
|
return response;
|
|
200
216
|
}
|
|
201
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Calls a callback to get information about the provided payload
|
|
220
|
+
*/
|
|
221
|
+
call (event, ...payload) {
|
|
222
|
+
debug('Triggering callback "%s" with payload: %o', event, payload);
|
|
223
|
+
|
|
224
|
+
const fn = this.coreSyncedAnswerers.get(event);
|
|
225
|
+
|
|
226
|
+
if (! fn) {
|
|
227
|
+
throw kerror.get('core', 'fatal', 'assertion_failed', `the requested callback event '${event}' doesn't have an answerer`);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const response = fn(...payload);
|
|
231
|
+
|
|
232
|
+
getWildcardEvents(event).forEach(ev => super.emit(ev, {
|
|
233
|
+
args: payload,
|
|
234
|
+
response,
|
|
235
|
+
}));
|
|
236
|
+
|
|
237
|
+
return response;
|
|
238
|
+
}
|
|
239
|
+
|
|
202
240
|
/**
|
|
203
241
|
* Registers a plugin hook.
|
|
204
242
|
* Catch any error in the handler and emit the hook:onError event.
|
package/lib/kuzzle/index.js
CHANGED
package/lib/kuzzle/kuzzle.js
CHANGED
package/lib/kuzzle/log.js
CHANGED
package/lib/kuzzle/vault.js
CHANGED
package/lib/service/service.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
3
|
* to power modern apps
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2015-
|
|
5
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
6
|
* mailto: support AT kuzzle.io
|
|
7
7
|
* website: http://kuzzle.io
|
|
8
8
|
*
|
|
@@ -2148,7 +2148,7 @@ class ElasticSearch extends Service {
|
|
|
2148
2148
|
index,
|
|
2149
2149
|
collection,
|
|
2150
2150
|
documents,
|
|
2151
|
-
{ refresh, timeout, userId = null, injectKuzzleMeta = true, limits = true } = {}) {
|
|
2151
|
+
{ refresh, timeout, userId = null, injectKuzzleMeta = true, limits = true, source = true } = {}) {
|
|
2152
2152
|
let kuzzleMeta = {};
|
|
2153
2153
|
|
|
2154
2154
|
if (injectKuzzleMeta) {
|
|
@@ -2192,7 +2192,7 @@ class ElasticSearch extends Service {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
/* end critical code section */
|
|
2194
2194
|
|
|
2195
|
-
return this._mExecute(esRequest, extractedDocuments, rejected, { limits });
|
|
2195
|
+
return this._mExecute(esRequest, extractedDocuments, rejected, { limits, source });
|
|
2196
2196
|
}
|
|
2197
2197
|
|
|
2198
2198
|
/**
|
|
@@ -2564,7 +2564,7 @@ class ElasticSearch extends Service {
|
|
|
2564
2564
|
*
|
|
2565
2565
|
* @returns {Promise.<Object[]>} results
|
|
2566
2566
|
*/
|
|
2567
|
-
async _mExecute (esRequest, documents, partialErrors, { limits = true } = {}) {
|
|
2567
|
+
async _mExecute (esRequest, documents, partialErrors, { limits = true, source = true } = {}) {
|
|
2568
2568
|
assertWellFormedRefresh(esRequest);
|
|
2569
2569
|
|
|
2570
2570
|
if ( limits
|
|
@@ -2618,7 +2618,7 @@ class ElasticSearch extends Service {
|
|
|
2618
2618
|
else {
|
|
2619
2619
|
successes.push({
|
|
2620
2620
|
_id: result._id,
|
|
2621
|
-
_source: documents[i]._source,
|
|
2621
|
+
_source: source ? documents[i]._source : undefined,
|
|
2622
2622
|
_version: result._version,
|
|
2623
2623
|
created: result.result === 'created',
|
|
2624
2624
|
get: result.get,
|
package/lib/types/Controller.js
CHANGED
package/lib/types/Deprecation.js
CHANGED
package/lib/types/Plugin.js
CHANGED
package/lib/types/Token.js
CHANGED
package/lib/types/User.js
CHANGED
package/lib/types/index.js
CHANGED
package/lib/util/array.js
CHANGED
package/lib/util/assertType.js
CHANGED
package/lib/util/asyncStore.js
CHANGED
package/lib/util/debug.js
CHANGED