kuzzle 2.59.0 → 2.60.0-beta.2
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 +17 -7
- 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 +3 -2
- package/dist/lib/cluster/idCardHandler.js +1 -1
- package/dist/lib/cluster/node.js +69 -64
- 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 +0 -1
- 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 +22 -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 +29 -12
- 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/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/internalIndexHandler.js +37 -32
- package/dist/lib/kuzzle/kuzzle.d.ts +13 -8
- package/dist/lib/kuzzle/kuzzle.js +103 -128
- 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
|
@@ -3,33 +3,33 @@ export declare class InternalLogger extends ApplicationManager {
|
|
|
3
3
|
/**
|
|
4
4
|
* Logs a trace message
|
|
5
5
|
*/
|
|
6
|
-
trace(message:
|
|
6
|
+
trace(message: unknown): void;
|
|
7
7
|
/**
|
|
8
8
|
* Logs an debug message
|
|
9
9
|
*/
|
|
10
|
-
debug(message:
|
|
10
|
+
debug(message: unknown): void;
|
|
11
11
|
/**
|
|
12
12
|
* Logs an info message
|
|
13
13
|
*/
|
|
14
|
-
info(message:
|
|
14
|
+
info(message: unknown): void;
|
|
15
15
|
/**
|
|
16
16
|
* Logs a warn message
|
|
17
17
|
*/
|
|
18
|
-
warn(message:
|
|
18
|
+
warn(message: unknown): void;
|
|
19
19
|
/**
|
|
20
20
|
* Logs an error message
|
|
21
21
|
*/
|
|
22
|
-
error(message:
|
|
22
|
+
error(message: unknown): void;
|
|
23
23
|
/**
|
|
24
24
|
* Logs a fatal message
|
|
25
25
|
*/
|
|
26
|
-
fatal(message:
|
|
26
|
+
fatal(message: unknown): void;
|
|
27
27
|
/**
|
|
28
28
|
* Logs a verbose message
|
|
29
29
|
*
|
|
30
30
|
* @deprecated Use InternalLogger.debug instead.
|
|
31
31
|
*/
|
|
32
|
-
verbose(message:
|
|
32
|
+
verbose(message: unknown): void;
|
|
33
33
|
/**
|
|
34
34
|
* Change the log level
|
|
35
35
|
*/
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -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
|
const uuid = __importStar(require("uuid"));
|
|
46
56
|
const safeObject_1 = require("../../util/safeObject");
|
|
47
57
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lib/types/debug" />
|
|
2
1
|
import { BadRequestError, ExternalServiceError, ForbiddenError, GatewayTimeoutError, InternalError as KuzzleInternalError, KuzzleError, NotFoundError, PartialError, PluginImplementationError, PreconditionError, ServiceUnavailableError, SizeLimitError, TooManyRequestsError, UnauthorizedError } from "../../kerror/errors";
|
|
3
2
|
import { Request, RequestContext, RequestInput } from "../../api/request";
|
|
4
3
|
import ClientConnection from "./clientConnection";
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -516,6 +526,18 @@ class HttpWsProtocol extends protocol_1.default {
|
|
|
516
526
|
httpReadData(message, response, cb) {
|
|
517
527
|
let payload = null;
|
|
518
528
|
response.aborted = false;
|
|
529
|
+
// Beware: the "response" object might be invalidated at any point of time,
|
|
530
|
+
// whenever the connection gets closed by the client for instance
|
|
531
|
+
response.onAborted(() => {
|
|
532
|
+
response.aborted = true;
|
|
533
|
+
});
|
|
534
|
+
// uWS never fires `onData` for an empty body when the request headers
|
|
535
|
+
// span several TCP packets (large headers, e.g. a forwarded client
|
|
536
|
+
// certificate): waiting for it hung the request until the idle timeout.
|
|
537
|
+
if (message.headers["content-length"] === "0") {
|
|
538
|
+
cb();
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
519
541
|
response.onData((data, isLast) => {
|
|
520
542
|
const chunk = Buffer.from(data);
|
|
521
543
|
payload = payload
|
|
@@ -551,11 +573,6 @@ class HttpWsProtocol extends protocol_1.default {
|
|
|
551
573
|
});
|
|
552
574
|
return promise;
|
|
553
575
|
});
|
|
554
|
-
// Beware: the "response" object might be invalidated at any point of time,
|
|
555
|
-
// whenever the connection gets closed by the client for instance
|
|
556
|
-
response.onAborted(() => {
|
|
557
|
-
response.aborted = true;
|
|
558
|
-
});
|
|
559
576
|
}
|
|
560
577
|
async httpParseContent(message, content, cb) {
|
|
561
578
|
const type = message.headers["content-type"] || "";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as net from "node:net";
|
|
3
2
|
import type { AedesPublishPacket, Client, PublishPacket, Subscription } from "aedes";
|
|
4
|
-
import Aedes from "aedes";
|
|
3
|
+
import { Aedes } from "aedes";
|
|
5
4
|
import type { JSONObject } from "../../../types/JSONObject";
|
|
6
5
|
import ClientConnection from "../clientConnection";
|
|
7
6
|
import type { NetworkEntryPoint } from "../networkEntryPoint";
|
|
@@ -35,19 +35,29 @@ 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
|
const net = __importStar(require("node:net"));
|
|
49
59
|
const node_util_1 = require("node:util");
|
|
50
|
-
const aedes_1 =
|
|
60
|
+
const aedes_1 = require("aedes");
|
|
51
61
|
const request_1 = require("../../../api/request");
|
|
52
62
|
const kerror_1 = require("../../../kerror");
|
|
53
63
|
const debug_1 = __importDefault(require("../../../util/debug"));
|
|
@@ -56,12 +66,22 @@ const clientConnection_1 = __importDefault(require("../clientConnection"));
|
|
|
56
66
|
const protocol_1 = __importDefault(require("./protocol"));
|
|
57
67
|
const kerror = (0, kerror_1.wrap)("network", "mqtt");
|
|
58
68
|
const debug = (0, debug_1.default)("kuzzle:network:protocols:mqtt");
|
|
69
|
+
/**
|
|
70
|
+
* aedes 1 disconnects a client whose socket stays undrained for 60s
|
|
71
|
+
* (`drainTimeout`); aedes 0.x had no such timeout. Kuzzle 2 keeps the 0.x
|
|
72
|
+
* behaviour, as nothing in the MQTT configuration lets a user choose.
|
|
73
|
+
*/
|
|
74
|
+
const AEDES_OPTIONS = {
|
|
75
|
+
drainTimeout: 0,
|
|
76
|
+
};
|
|
59
77
|
class MqttProtocol extends protocol_1.default {
|
|
60
78
|
constructor() {
|
|
61
79
|
super("mqtt");
|
|
62
80
|
this.logger = global.kuzzle.log.child("core:network:protocols:mqtt");
|
|
63
|
-
//
|
|
64
|
-
|
|
81
|
+
// Built here so that `aedes` and `server` exist from construction on, as
|
|
82
|
+
// they always have; aedes 1 only starts its broker (persistence, timers)
|
|
83
|
+
// in `listen()`, which `init()` awaits.
|
|
84
|
+
this.aedes = new aedes_1.Aedes(AEDES_OPTIONS);
|
|
65
85
|
this.server = net.createServer(this.aedes.handle);
|
|
66
86
|
this.connections = new Map();
|
|
67
87
|
this.connectionsById = new Map();
|
|
@@ -107,6 +127,7 @@ class MqttProtocol extends protocol_1.default {
|
|
|
107
127
|
this.aedes.on("clientError", this.onDisconnection.bind(this));
|
|
108
128
|
this.aedes.on("clientDisconnect", this.onDisconnection.bind(this));
|
|
109
129
|
this.aedes.on("publish", this.onMessage.bind(this));
|
|
130
|
+
await this.aedes.listen();
|
|
110
131
|
await new Promise((res) => this.server.listen(this.config.server.port, res));
|
|
111
132
|
return true;
|
|
112
133
|
}
|
|
@@ -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
|
};
|
|
@@ -6,6 +6,12 @@ import { BackendCluster } from "../backend/backendCluster";
|
|
|
6
6
|
import { EmbeddedSDK } from "../shared/sdk/embeddedSdk";
|
|
7
7
|
import type { KuzzleLogger } from "kuzzle-logger/dist";
|
|
8
8
|
import type { Kuzzle } from "../../kuzzle";
|
|
9
|
+
/**
|
|
10
|
+
* Declared as v2.56.0 declared it. The answers stay `any` because a precise
|
|
11
|
+
* type would break the plugins that read them without narrowing; the options
|
|
12
|
+
* because the implementation hands them to `ObjectRepository`, which takes an
|
|
13
|
+
* object, and narrowing them here would break a call passing anything else.
|
|
14
|
+
*/
|
|
9
15
|
export interface Repository {
|
|
10
16
|
create(document: JSONObject, options: any): Promise<any>;
|
|
11
17
|
createOrReplace(document: JSONObject, options: any): Promise<any>;
|
|
@@ -24,8 +30,13 @@ export declare class PluginContext {
|
|
|
24
30
|
sdk: EmbeddedSDK;
|
|
25
31
|
/**
|
|
26
32
|
* Trigger a custom plugin event
|
|
33
|
+
*
|
|
34
|
+
* A method signature, not a function-typed property, from here down to
|
|
35
|
+
* `log`: a method's parameters are compared bivariantly, so taking
|
|
36
|
+
* `unknown` instead of v2.56.0's `any` neither breaks a call nor an
|
|
37
|
+
* assignment of a function declaring a narrower parameter.
|
|
27
38
|
*/
|
|
28
|
-
trigger
|
|
39
|
+
trigger(eventName: string, payload: unknown): Promise<any>;
|
|
29
40
|
/**
|
|
30
41
|
* Add or remove strategies dynamically
|
|
31
42
|
*/
|
|
@@ -33,7 +44,7 @@ export declare class PluginContext {
|
|
|
33
44
|
/**
|
|
34
45
|
* Adds a new authentication strategy
|
|
35
46
|
*/
|
|
36
|
-
add
|
|
47
|
+
add(name: string, properties: unknown): Promise<void>;
|
|
37
48
|
/**
|
|
38
49
|
* Removes an authentication strategy, preventing new authentications from using it.
|
|
39
50
|
*/
|
|
@@ -82,7 +93,7 @@ export declare class PluginContext {
|
|
|
82
93
|
/**
|
|
83
94
|
* Creates a collection in the plugin storage
|
|
84
95
|
*/
|
|
85
|
-
createCollection
|
|
96
|
+
createCollection(collection: string, mappings: unknown): Promise<void>;
|
|
86
97
|
};
|
|
87
98
|
/**
|
|
88
99
|
* Cluster accessor
|
|
@@ -160,12 +171,12 @@ export declare class PluginContext {
|
|
|
160
171
|
* Internal Logger
|
|
161
172
|
*/
|
|
162
173
|
log: {
|
|
163
|
-
debug
|
|
164
|
-
error
|
|
165
|
-
info
|
|
166
|
-
silly
|
|
167
|
-
verbose
|
|
168
|
-
warn
|
|
174
|
+
debug(message: unknown): void;
|
|
175
|
+
error(message: unknown): void;
|
|
176
|
+
info(message: unknown): void;
|
|
177
|
+
silly(message: unknown): void;
|
|
178
|
+
verbose(message: unknown): void;
|
|
179
|
+
warn(message: unknown): void;
|
|
169
180
|
};
|
|
170
181
|
constructor(pluginName: string);
|
|
171
182
|
}
|
|
@@ -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
|
};
|
|
@@ -55,6 +65,7 @@ const baseType_1 = __importDefault(require("../validation/baseType"));
|
|
|
55
65
|
const kerror = __importStar(require("../../kerror"));
|
|
56
66
|
const errors_1 = require("../../kerror/errors");
|
|
57
67
|
const Elasticsearch_1 = require("../../service/storage/Elasticsearch");
|
|
68
|
+
const distributedLock_1 = require("../../util/distributedLock");
|
|
58
69
|
const mutex_1 = require("../../util/mutex");
|
|
59
70
|
const promback_1 = __importDefault(require("../../util/promback"));
|
|
60
71
|
const safeObject_1 = require("../../util/safeObject");
|
|
@@ -101,7 +112,9 @@ class PluginContext {
|
|
|
101
112
|
throw contextError.get("missing_collection");
|
|
102
113
|
}
|
|
103
114
|
const pluginRepository = new pluginRepository_1.default(pluginStore, collection);
|
|
104
|
-
pluginRepository.init({
|
|
115
|
+
pluginRepository.init({
|
|
116
|
+
ObjectConstructor: ObjectConstructor ?? undefined,
|
|
117
|
+
});
|
|
105
118
|
return {
|
|
106
119
|
create: (...args) => pluginRepository.create(...args),
|
|
107
120
|
createOrReplace: (...args) => pluginRepository.createOrReplace(...args),
|
|
@@ -118,6 +131,8 @@ class PluginContext {
|
|
|
118
131
|
}
|
|
119
132
|
this.constructors = {
|
|
120
133
|
BaseValidationType: baseType_1.default,
|
|
134
|
+
// Plain functions called with `new`, like `Request` below: each returns
|
|
135
|
+
// an object, so `new` yields that object.
|
|
121
136
|
ESClient: PluginContextESClient,
|
|
122
137
|
Koncorde: KoncordeWrapper_1.Koncorde,
|
|
123
138
|
Mutex: mutex_1.Mutex,
|
|
@@ -305,6 +320,16 @@ function inheritInput(target, source, data) {
|
|
|
305
320
|
target.input.volatile = source.input.volatile;
|
|
306
321
|
}
|
|
307
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Lock options of `auth:strategies:add` and `auth:strategies:remove`: wait
|
|
325
|
+
* as long as it takes, as the deprecated `Mutex` did (no acquisition
|
|
326
|
+
* timeout), with the same 30 s TTL — now refreshed while the strategy is
|
|
327
|
+
* being added or removed.
|
|
328
|
+
*/
|
|
329
|
+
const STRATEGY_LOCK = {
|
|
330
|
+
retryAttempts: Number.POSITIVE_INFINITY,
|
|
331
|
+
ttl: 30000,
|
|
332
|
+
};
|
|
308
333
|
/**
|
|
309
334
|
* Returns a currified function of pluginsManager.registerStrategy
|
|
310
335
|
*
|
|
@@ -325,20 +350,15 @@ function curryAddStrategy(pluginName) {
|
|
|
325
350
|
typeof strategy.config.authenticator !== "string") {
|
|
326
351
|
throw contextError.get("missing_authenticator", pluginName, name);
|
|
327
352
|
}
|
|
328
|
-
|
|
329
|
-
await mutex.lock();
|
|
330
|
-
try {
|
|
353
|
+
return (0, distributedLock_1.withLock)("auth:strategies:add", async () => {
|
|
331
354
|
// @todo use Plugin.checkName to ensure format
|
|
332
355
|
global.kuzzle.pluginsManager.registerStrategy(pluginName, name, strategy);
|
|
333
|
-
return
|
|
356
|
+
return global.kuzzle.pipe("core:auth:strategyAdded", {
|
|
334
357
|
name,
|
|
335
358
|
pluginName,
|
|
336
359
|
strategy,
|
|
337
360
|
});
|
|
338
|
-
}
|
|
339
|
-
finally {
|
|
340
|
-
await mutex.unlock();
|
|
341
|
-
}
|
|
361
|
+
}, STRATEGY_LOCK);
|
|
342
362
|
};
|
|
343
363
|
}
|
|
344
364
|
/**
|
|
@@ -353,18 +373,13 @@ function curryRemoveStrategy(pluginName) {
|
|
|
353
373
|
// either async or catch unregisterStrategy exceptions + return a rejected
|
|
354
374
|
// promise
|
|
355
375
|
return async function removeStrategy(name) {
|
|
356
|
-
|
|
357
|
-
await mutex.lock();
|
|
358
|
-
try {
|
|
376
|
+
return (0, distributedLock_1.withLock)("auth:strategies:remove", async () => {
|
|
359
377
|
global.kuzzle.pluginsManager.unregisterStrategy(pluginName, name);
|
|
360
|
-
return
|
|
378
|
+
return global.kuzzle.pipe("core:auth:strategyRemoved", {
|
|
361
379
|
name,
|
|
362
380
|
pluginName,
|
|
363
381
|
});
|
|
364
|
-
}
|
|
365
|
-
finally {
|
|
366
|
-
await mutex.unlock();
|
|
367
|
-
}
|
|
382
|
+
}, STRATEGY_LOCK);
|
|
368
383
|
};
|
|
369
384
|
}
|
|
370
385
|
//# sourceMappingURL=pluginContext.js.map
|