kuzzle 2.16.3 → 2.16.4
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.
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateOpenApi = void 0;
|
|
7
2
|
/*
|
|
8
3
|
* Kuzzle, a backend software, self-hostable and ready to use
|
|
9
4
|
* to power modern apps
|
|
@@ -24,13 +19,18 @@ exports.generateOpenApi = void 0;
|
|
|
24
19
|
* See the License for the specific language governing permissions and
|
|
25
20
|
* limitations under the License.
|
|
26
21
|
*/
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.generateOpenApi = void 0;
|
|
27
27
|
const lodash_1 = __importDefault(require("lodash"));
|
|
28
|
-
const package_json_1 = require("
|
|
28
|
+
const package_json_1 = require("../../package.json");
|
|
29
29
|
const openapi_1 = require("./openapi");
|
|
30
|
-
const inflector_1 = require("
|
|
30
|
+
const inflector_1 = require("../util/inflector");
|
|
31
31
|
const routeUrlMatch = /:([^/]*)/g;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Generate basic openApi Controller
|
|
34
34
|
*/
|
|
35
35
|
function generateController(route, response) {
|
|
36
36
|
if (route.controller !== undefined) {
|
|
@@ -47,7 +47,7 @@ function generateController(route, response) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Generate basic openApi Summary
|
|
51
51
|
*/
|
|
52
52
|
function generateSummary(route) {
|
|
53
53
|
if (route.openapi.description === undefined) {
|
|
@@ -58,7 +58,7 @@ function generateSummary(route) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Generate basic openApi Parameters
|
|
62
62
|
*/
|
|
63
63
|
function generateParameters(route) {
|
|
64
64
|
if (route.openapi.parameters === undefined) {
|
|
@@ -80,7 +80,7 @@ function generateParameters(route) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Generate basic openApi Response
|
|
84
84
|
*/
|
|
85
85
|
function generateResponse(route) {
|
|
86
86
|
if (route.openapi.responses === undefined) {
|
|
@@ -96,22 +96,20 @@ function generateResponse(route) {
|
|
|
96
96
|
*
|
|
97
97
|
* @returns {object} openApi object
|
|
98
98
|
*/
|
|
99
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
100
99
|
function generateOpenApi() {
|
|
101
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
102
100
|
const routes = [];
|
|
103
|
-
global.kuzzle.config.http.routes.forEach(
|
|
104
|
-
global.kuzzle.pluginsManager.routes.forEach(
|
|
101
|
+
global.kuzzle.config.http.routes.forEach(route => routes.push({ ...route }));
|
|
102
|
+
global.kuzzle.pluginsManager.routes.forEach(route => routes.push({ ...route }));
|
|
105
103
|
/* eslint-disable sort-keys */
|
|
106
104
|
const response = {
|
|
107
105
|
swagger: '2.0',
|
|
108
106
|
info: {
|
|
109
107
|
title: 'Kuzzle API',
|
|
110
|
-
description: '
|
|
108
|
+
description: 'Kuzzle HTTP API definition',
|
|
111
109
|
contact: {
|
|
112
110
|
name: 'Kuzzle team',
|
|
113
|
-
url: '
|
|
114
|
-
email: '
|
|
111
|
+
url: 'https://kuzzle.io',
|
|
112
|
+
email: 'support@kuzzle.io',
|
|
115
113
|
discord: 'http://join.discord.kuzzle.io'
|
|
116
114
|
},
|
|
117
115
|
license: {
|
|
@@ -141,9 +141,6 @@ class BackendController extends index_1.ApplicationManager {
|
|
|
141
141
|
this._add(controller.name, controller.definition);
|
|
142
142
|
}
|
|
143
143
|
_add(name, definition) {
|
|
144
|
-
// Check definition here to throw error early
|
|
145
|
-
// with the corresponding line number
|
|
146
|
-
this._application.PluginObject.checkControllerDefinition(name, definition, { application: true });
|
|
147
144
|
if (this._application._controllers[name]) {
|
|
148
145
|
throw assertionError.get('invalid_controller_definition', name, 'A controller with this name already exists');
|
|
149
146
|
}
|
|
@@ -264,7 +264,7 @@ class Plugin {
|
|
|
264
264
|
return PLUGIN_NAME_REGEX.test(name);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
static checkControllerDefinition (name, definition, { application=false } = {}) {
|
|
267
|
+
static async checkControllerDefinition (name, definition, { application=false } = {}) {
|
|
268
268
|
if (typeof name !== 'string') {
|
|
269
269
|
throw assertionError.get(
|
|
270
270
|
'invalid_controller_definition',
|
|
@@ -344,7 +344,7 @@ class Plugin {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
if (route.openapi) {
|
|
347
|
-
checkOpenAPISpecification(name, action, route);
|
|
347
|
+
await checkOpenAPISpecification(name, action, route);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -365,20 +365,24 @@ function checkHttpRouteProperties (route, action, name, application) {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
function checkOpenAPISpecification (controller, action, route) {
|
|
368
|
+
async function checkOpenAPISpecification (controller, action, route) {
|
|
369
369
|
if (! isPlainObject(route.openapi)) {
|
|
370
370
|
throw assertionError.get(
|
|
371
371
|
'invalid_controller_definition',
|
|
372
372
|
controller,
|
|
373
|
-
'The "openapi" property must be an object');
|
|
373
|
+
'The "openapi" property of the route definition must be an object');
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
+
const routePath = route.path.charAt(0) === '/'
|
|
377
|
+
? route.path
|
|
378
|
+
: `/_/${route.path}`;
|
|
379
|
+
|
|
376
380
|
// Set :param notation to {param}
|
|
377
|
-
const formattedPath =
|
|
381
|
+
const formattedPath = routePath.replace(/\/:([^/]*)/g,'/{$1}');
|
|
378
382
|
|
|
379
|
-
const { error, warning } = enforcer({
|
|
383
|
+
const { error, warning } = await enforcer({
|
|
380
384
|
/* eslint-disable sort-keys */
|
|
381
|
-
openapi: '3.0.
|
|
385
|
+
openapi: '3.0.0',
|
|
382
386
|
info: {
|
|
383
387
|
title: 'Kuzzle API',
|
|
384
388
|
version: require('../../../package').version
|
|
@@ -394,8 +398,14 @@ function checkOpenAPISpecification (controller, action, route) {
|
|
|
394
398
|
if (warning) {
|
|
395
399
|
global.kuzzle.log.warn(`Warning for OpenAPI specification in "${controller}:${action}", ${route.openapi} : ${warning}`);
|
|
396
400
|
}
|
|
401
|
+
|
|
397
402
|
if (error) {
|
|
398
|
-
throw controllerError.get(
|
|
403
|
+
throw controllerError.get(
|
|
404
|
+
'invalid_openapi_schema',
|
|
405
|
+
controller,
|
|
406
|
+
action,
|
|
407
|
+
route.openapi,
|
|
408
|
+
error);
|
|
399
409
|
}
|
|
400
410
|
}
|
|
401
411
|
|
|
@@ -678,7 +678,7 @@ class PluginsManager {
|
|
|
678
678
|
'Native controllers cannot be overriden');
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
Plugin.checkControllerDefinition(controller, definition);
|
|
681
|
+
await Plugin.checkControllerDefinition(controller, definition);
|
|
682
682
|
|
|
683
683
|
for (const [action, actionDefinition ] of Object.entries(definition.actions)) {
|
|
684
684
|
let apiController = this.controllers.get(controller);
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.4",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -730,9 +730,9 @@
|
|
|
730
730
|
"dev": true
|
|
731
731
|
},
|
|
732
732
|
"@types/lodash": {
|
|
733
|
-
"version": "4.14.
|
|
734
|
-
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.
|
|
735
|
-
"integrity": "sha512-
|
|
733
|
+
"version": "4.14.178",
|
|
734
|
+
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz",
|
|
735
|
+
"integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==",
|
|
736
736
|
"dev": true
|
|
737
737
|
},
|
|
738
738
|
"@types/long": {
|
|
@@ -883,9 +883,9 @@
|
|
|
883
883
|
"dev": true
|
|
884
884
|
},
|
|
885
885
|
"aedes": {
|
|
886
|
-
"version": "0.46.
|
|
887
|
-
"resolved": "https://registry.npmjs.org/aedes/-/aedes-0.46.
|
|
888
|
-
"integrity": "sha512-
|
|
886
|
+
"version": "0.46.2",
|
|
887
|
+
"resolved": "https://registry.npmjs.org/aedes/-/aedes-0.46.2.tgz",
|
|
888
|
+
"integrity": "sha512-bzDY5ZC1zEduKHBuAZW8Ccr46+42TB9lynP+Fw4Bl41kQYxUZBA8hQwp4Eba3gUM2EZHgj22Q83ib2UuvAWnkw==",
|
|
889
889
|
"requires": {
|
|
890
890
|
"aedes-packet": "^2.3.1",
|
|
891
891
|
"aedes-persistence": "^8.1.3",
|
|
@@ -904,9 +904,9 @@
|
|
|
904
904
|
},
|
|
905
905
|
"dependencies": {
|
|
906
906
|
"mqtt-packet": {
|
|
907
|
-
"version": "7.1.
|
|
908
|
-
"resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-7.1.
|
|
909
|
-
"integrity": "sha512-
|
|
907
|
+
"version": "7.1.1",
|
|
908
|
+
"resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-7.1.1.tgz",
|
|
909
|
+
"integrity": "sha512-xNNDZG169D2c96NJmkkoDdj3tj5z0jsZ1yv/vGBY9chg4JellV9wJwawKPXv4fyLetmXp50LtPNwL2u8qvLssw==",
|
|
910
910
|
"requires": {
|
|
911
911
|
"bl": "^4.0.2",
|
|
912
912
|
"debug": "^4.1.1",
|
|
@@ -2902,9 +2902,9 @@
|
|
|
2902
2902
|
"optional": true
|
|
2903
2903
|
},
|
|
2904
2904
|
"fastparallel": {
|
|
2905
|
-
"version": "2.4.
|
|
2906
|
-
"resolved": "https://registry.npmjs.org/fastparallel/-/fastparallel-2.4.
|
|
2907
|
-
"integrity": "sha512-
|
|
2905
|
+
"version": "2.4.1",
|
|
2906
|
+
"resolved": "https://registry.npmjs.org/fastparallel/-/fastparallel-2.4.1.tgz",
|
|
2907
|
+
"integrity": "sha512-qUmhxPgNHmvRjZKBFUNI0oZuuH9OlSIOXmJ98lhKPxMZZ7zS/Fi0wRHOihDSz0R1YiIOjxzOY4bq65YTcdBi2Q==",
|
|
2908
2908
|
"requires": {
|
|
2909
2909
|
"reusify": "^1.0.4",
|
|
2910
2910
|
"xtend": "^4.0.2"
|
|
@@ -4802,9 +4802,9 @@
|
|
|
4802
4802
|
"optional": true
|
|
4803
4803
|
},
|
|
4804
4804
|
"mqemitter": {
|
|
4805
|
-
"version": "4.
|
|
4806
|
-
"resolved": "https://registry.npmjs.org/mqemitter/-/mqemitter-4.
|
|
4807
|
-
"integrity": "sha512-
|
|
4805
|
+
"version": "4.5.0",
|
|
4806
|
+
"resolved": "https://registry.npmjs.org/mqemitter/-/mqemitter-4.5.0.tgz",
|
|
4807
|
+
"integrity": "sha512-Mp/zytFeIv6piJQkEKnncHcP4R/ErJc5C7dfonkhkNUT2LA/nTayrfNxbipp3M5iCJUTQSUtzfQAQA3XVcKz6w==",
|
|
4808
4808
|
"requires": {
|
|
4809
4809
|
"fastparallel": "^2.3.0",
|
|
4810
4810
|
"qlobber": "^5.0.0"
|
|
@@ -5424,9 +5424,9 @@
|
|
|
5424
5424
|
}
|
|
5425
5425
|
},
|
|
5426
5426
|
"openapi-enforcer": {
|
|
5427
|
-
"version": "1.16.
|
|
5428
|
-
"resolved": "https://registry.npmjs.org/openapi-enforcer/-/openapi-enforcer-1.16.
|
|
5429
|
-
"integrity": "sha512-
|
|
5427
|
+
"version": "1.16.1",
|
|
5428
|
+
"resolved": "https://registry.npmjs.org/openapi-enforcer/-/openapi-enforcer-1.16.1.tgz",
|
|
5429
|
+
"integrity": "sha512-MG3lwulSdL9Qo1p0r8QMLjX+jTcvEN+YgMIGDNjyOxe2sYuk4Iu1wWN/3rVtkudrU/AQXIAZZP31NcqTIWcE7Q==",
|
|
5430
5430
|
"requires": {
|
|
5431
5431
|
"js-yaml": "^4.1.0",
|
|
5432
5432
|
"randexp": "^0.5.3"
|
|
@@ -7653,9 +7653,9 @@
|
|
|
7653
7653
|
}
|
|
7654
7654
|
},
|
|
7655
7655
|
"typescript": {
|
|
7656
|
-
"version": "4.5.
|
|
7657
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.
|
|
7658
|
-
"integrity": "sha512-
|
|
7656
|
+
"version": "4.5.3",
|
|
7657
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.3.tgz",
|
|
7658
|
+
"integrity": "sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==",
|
|
7659
7659
|
"dev": true
|
|
7660
7660
|
},
|
|
7661
7661
|
"uWebSockets.js": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle",
|
|
3
3
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
4
|
-
"version": "2.16.
|
|
4
|
+
"version": "2.16.4",
|
|
5
5
|
"description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kuzzle": "bin/start-kuzzle-server"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@elastic/elasticsearch": "https://github.com/elastic/elasticsearch-js/archive/refs/tags/v7.13.0.tar.gz",
|
|
43
43
|
"@types/js-yaml": "^4.0.5",
|
|
44
|
-
"aedes": "^0.46.
|
|
44
|
+
"aedes": "^0.46.2",
|
|
45
45
|
"bluebird": "^3.7.2",
|
|
46
46
|
"cli-color": "^2.0.1",
|
|
47
47
|
"cookie": "^0.4.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"murmurhash-native": "^3.5.0",
|
|
69
69
|
"nanoid": "^3.1.30",
|
|
70
70
|
"node-segfault-handler": "^1.0.4",
|
|
71
|
-
"openapi-enforcer": "^1.16.
|
|
71
|
+
"openapi-enforcer": "^1.16.1",
|
|
72
72
|
"passport": "^0.5.0",
|
|
73
73
|
"protobufjs": "~6.11.2",
|
|
74
74
|
"rc": "1.2.8",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"url": "git://github.com/kuzzleio/kuzzle.git"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@types/lodash": "^4.14.
|
|
92
|
+
"@types/lodash": "^4.14.178",
|
|
93
93
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
94
94
|
"@typescript-eslint/parser": "^5.6.0",
|
|
95
95
|
"async": "^3.2.2",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"sinon": "^12.0.1",
|
|
111
111
|
"strip-json-comments": "https://github.com/sindresorhus/strip-json-comments/archive/refs/tags/v3.1.1.tar.gz",
|
|
112
112
|
"ts-node": "^10.4.0",
|
|
113
|
-
"typescript": "^4.5.
|
|
113
|
+
"typescript": "^4.5.3",
|
|
114
114
|
"yaml": "^1.10.2"
|
|
115
115
|
},
|
|
116
116
|
"engines": {
|