kuzzle 2.17.6 → 2.18.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/bin/start-kuzzle-server +1 -1
- package/lib/api/controllers/adminController.js +1 -1
- package/lib/api/controllers/authController.js +7 -2
- 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 +11 -7
- package/lib/api/controllers/memoryStorageController.js +1 -1
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +55 -23
- 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 +7 -5
- package/lib/api/openapi/OpenApiManager.js +5 -1
- package/lib/api/openapi/components/document/get.yaml +1 -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/components/document/update.yaml +1 -1
- package/lib/api/openapi/components/index.d.ts +1 -0
- package/lib/api/openapi/components/index.js +1 -0
- package/lib/api/openapi/components/security/index.d.ts +2 -0
- package/lib/api/openapi/components/security/index.js +10 -0
- package/lib/api/openapi/components/security/upsertUser.yaml +59 -0
- package/lib/api/openapi/openApiGenerator.js +1 -1
- package/lib/api/rateLimiter.js +1 -1
- package/lib/api/request/kuzzleRequest.d.ts +21 -0
- package/lib/api/request/kuzzleRequest.js +49 -3
- 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 +12 -7
- 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.d.ts +2 -2
- package/lib/core/shared/sdk/embeddedSdk.js +4 -3
- package/lib/core/shared/sdk/funnelProtocol.d.ts +13 -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/1-services.json +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.d.ts +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 +6 -7
- 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 +108 -39
- 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.d.ts +0 -1
- package/lib/types/index.js +1 -2
- 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/dump-collection.d.ts +35 -0
- package/lib/util/dump-collection.js +11 -8
- 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 +102 -83
- package/package.json +18 -17
- package/lib/core/network/removeErrorStack.js +0 -56
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*
|
|
2
3
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
3
4
|
* to power modern apps
|
|
4
5
|
*
|
|
5
|
-
* Copyright 2015-
|
|
6
|
+
* Copyright 2015-2022 Kuzzle
|
|
6
7
|
* mailto: support AT kuzzle.io
|
|
7
8
|
* website: http://kuzzle.io
|
|
8
9
|
*
|
|
@@ -18,88 +19,82 @@
|
|
|
18
19
|
* See the License for the specific language governing permissions and
|
|
19
20
|
* limitations under the License.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const { Request } = require('../../../api/request');
|
|
27
|
-
const kerror = require('../../../kerror');
|
|
28
|
-
const { hilightUserCode } = require('../../../util/stackTrace');
|
|
29
|
-
|
|
30
|
-
class FunnelProtocol extends KuzzleEventEmitter {
|
|
31
|
-
constructor () {
|
|
32
|
-
super();
|
|
33
|
-
|
|
34
|
-
this.id = 'funnel';
|
|
35
|
-
this.connectionId = null;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Realtime notifications are sent by the InternalProtocol
|
|
39
|
-
* through the internal event system.
|
|
40
|
-
*/
|
|
41
|
-
global.kuzzle.on('core:network:internal:message', message => {
|
|
42
|
-
// Send the notifications to the SDK for the internal Room mechanism
|
|
43
|
-
this.emit(message.room, message);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
isReady () {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Hydrate the user and execute SDK query
|
|
53
|
-
*/
|
|
54
|
-
async query (request) {
|
|
55
|
-
if (! this.connectionId) {
|
|
56
|
-
this.connectionId = await global.kuzzle.ask('core:network:internal:connectionId:get');
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
57
27
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.FunnelProtocol = void 0;
|
|
47
|
+
const kuzzle_sdk_1 = require("kuzzle-sdk");
|
|
48
|
+
const request_1 = require("../../../api/request");
|
|
49
|
+
const kerror = __importStar(require("../../../kerror"));
|
|
50
|
+
class FunnelProtocol extends kuzzle_sdk_1.KuzzleEventEmitter {
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
this.id = 'funnel';
|
|
54
|
+
this.connectionId = null;
|
|
55
|
+
/**
|
|
56
|
+
* Realtime notifications are sent by the InternalProtocol
|
|
57
|
+
* through the internal event system.
|
|
58
|
+
*/
|
|
59
|
+
global.kuzzle.on('core:network:internal:message', message => {
|
|
60
|
+
// Send the notifications to the SDK for the internal Room mechanism
|
|
61
|
+
this.emit(message.room, message);
|
|
62
|
+
});
|
|
74
63
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
if (requestOptions.user && request.__checkRights__
|
|
80
|
-
&& ! await requestOptions.user.isActionAllowed(kuzzleRequest)
|
|
81
|
-
) {
|
|
82
|
-
throw kerror.get(
|
|
83
|
-
'security',
|
|
84
|
-
'rights',
|
|
85
|
-
'forbidden',
|
|
86
|
-
kuzzleRequest.input.controller,
|
|
87
|
-
kuzzleRequest.input.action,
|
|
88
|
-
requestOptions.user._id);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const result = await global.kuzzle.funnel.executePluginRequest(kuzzleRequest);
|
|
92
|
-
|
|
93
|
-
return { result };
|
|
64
|
+
isReady() {
|
|
65
|
+
return true;
|
|
94
66
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Hydrate the user and execute SDK query
|
|
69
|
+
*/
|
|
70
|
+
async query(request) {
|
|
71
|
+
if (!this.connectionId) {
|
|
72
|
+
this.connectionId = await global.kuzzle.ask('core:network:internal:connectionId:get');
|
|
73
|
+
}
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
connection: {
|
|
76
|
+
id: this.connectionId,
|
|
77
|
+
protocol: this.id
|
|
78
|
+
},
|
|
79
|
+
user: null,
|
|
80
|
+
};
|
|
81
|
+
// Validate and use the provided request.kuid
|
|
82
|
+
if (request.__kuid__) {
|
|
83
|
+
if (typeof request.__kuid__ !== 'string') {
|
|
84
|
+
throw kerror.get('plugin', 'context', 'invalid_user');
|
|
85
|
+
}
|
|
86
|
+
// Get the user and store it in this context to prevent any possible race conditions
|
|
87
|
+
requestOptions.user = await global.kuzzle.ask('core:security:user:get', request.__kuid__);
|
|
88
|
+
}
|
|
89
|
+
const kuzzleRequest = new request_1.Request(request, requestOptions);
|
|
90
|
+
if (requestOptions.user
|
|
91
|
+
&& request.__checkRights__
|
|
92
|
+
&& !await requestOptions.user.isActionAllowed(kuzzleRequest)) {
|
|
93
|
+
throw kerror.get('security', 'rights', 'forbidden', kuzzleRequest.input.controller, kuzzleRequest.input.action, requestOptions.user._id);
|
|
94
|
+
}
|
|
95
|
+
const result = await global.kuzzle.funnel.executePluginRequest(kuzzleRequest);
|
|
96
|
+
return { result };
|
|
101
97
|
}
|
|
102
|
-
}
|
|
103
98
|
}
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
exports.FunnelProtocol = FunnelProtocol;
|
|
100
|
+
//# sourceMappingURL=funnelProtocol.js.map
|
package/lib/core/shared/store.js
CHANGED
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
"multiple_indice_alias": {
|
|
274
274
|
"description": "The unique association between an indice and its alias has not been respected",
|
|
275
275
|
"code": 48,
|
|
276
|
-
"message": "An
|
|
276
|
+
"message": "An %s is not allowed to be associated with multiple %s. This is probably not linked to this request but rather the consequence of previous actions on ElasticSearch.",
|
|
277
277
|
"class": "PreconditionError"
|
|
278
278
|
},
|
|
279
279
|
"invalid_multi_index_collection_usage": {
|
|
@@ -10,7 +10,7 @@ export declare class KuzzleError extends Error {
|
|
|
10
10
|
status: number;
|
|
11
11
|
/**
|
|
12
12
|
* Error unique code
|
|
13
|
-
* @see https://docs.kuzzle.io/core/2/
|
|
13
|
+
* @see https://docs.kuzzle.io/core/2/api/errors/error-codes/
|
|
14
14
|
*/
|
|
15
15
|
code: number;
|
|
16
16
|
/**
|
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');
|