kuzzle 2.17.2 → 2.17.5
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/README.md +1 -1
- package/index.js +5 -1
- package/lib/api/controllers/serverController.js +0 -1
- package/lib/api/openapi/components/index.js +5 -1
- package/lib/api/openapi/index.js +5 -1
- package/lib/api/request/index.js +5 -1
- package/lib/api/request/kuzzleRequest.js +5 -1
- package/lib/api/request/requestContext.js +5 -1
- package/lib/api/request/requestInput.js +5 -1
- package/lib/api/request/requestResponse.js +11 -2
- package/lib/cluster/state.js +5 -1
- package/lib/core/backend/backend.js +5 -1
- package/lib/core/backend/backendConfig.js +5 -1
- package/lib/core/backend/backendController.js +5 -1
- package/lib/core/backend/backendErrors.d.ts +11 -8
- package/lib/core/backend/backendErrors.js +31 -23
- package/lib/core/backend/backendHook.js +5 -1
- package/lib/core/backend/backendImport.js +5 -1
- package/lib/core/backend/backendPipe.js +5 -1
- package/lib/core/backend/backendPlugin.js +5 -1
- package/lib/core/backend/backendVault.js +5 -1
- package/lib/core/backend/index.js +5 -1
- package/lib/core/network/protocols/httpMessage.js +2 -1
- package/lib/core/network/protocols/httpwsProtocol.js +7 -5
- package/lib/core/plugin/pluginContext.js +5 -1
- package/lib/core/realtime/channel.js +5 -1
- package/lib/core/realtime/hotelClerk.js +5 -1
- package/lib/core/security/profileRepository.js +5 -1
- package/lib/core/shared/sdk/embeddedSdk.js +5 -1
- package/lib/core/storage/indexCache.js +5 -1
- package/lib/kerror/codes/0-core.json +1 -1
- package/lib/kerror/codes/1-services.json +1 -1
- package/lib/kerror/codes/2-api.json +1 -1
- package/lib/kerror/codes/3-network.json +1 -1
- package/lib/kerror/codes/4-plugin.json +1 -1
- package/lib/kerror/codes/5-validation.json +1 -1
- package/lib/kerror/codes/6-protocol.json +1 -1
- package/lib/kerror/codes/7-security.json +1 -1
- package/lib/kerror/codes/8-cluster.json +1 -1
- package/lib/kerror/codes/index.js +7 -7
- package/lib/kerror/errors/index.js +5 -1
- package/lib/kerror/errors/kuzzleError.d.ts +4 -0
- package/lib/kerror/errors/kuzzleError.js +9 -2
- package/lib/kerror/index.d.ts +3 -3
- package/lib/kerror/index.js +16 -7
- package/lib/kuzzle/kuzzle.js +5 -1
- package/lib/model/security/profile.js +5 -1
- package/lib/model/security/role.js +5 -1
- package/lib/model/security/user.js +5 -1
- package/lib/types/Plugin.js +5 -1
- package/lib/types/errors/ErrorDefinition.d.ts +6 -0
- package/lib/types/errors/ErrorDomains.d.ts +2 -2
- package/lib/types/index.js +5 -1
- package/lib/util/dump-collection.js +5 -1
- package/lib/util/mutex.js +5 -1
- package/package-lock.json +478 -681
- package/package.json +22 -22
|
@@ -97,8 +97,8 @@ function checkErrors (subdomain, domain, options) {
|
|
|
97
97
|
function checkSubdomains (domain, options) {
|
|
98
98
|
const subdomainCodes = new Set();
|
|
99
99
|
|
|
100
|
-
for (const subdomainName of Object.keys(domain.
|
|
101
|
-
const subdomain = domain.
|
|
100
|
+
for (const subdomainName of Object.keys(domain.subDomains)) {
|
|
101
|
+
const subdomain = domain.subDomains[subdomainName];
|
|
102
102
|
|
|
103
103
|
// Subdomain code for plugins is not required and is automatically set to 0
|
|
104
104
|
if (! options.plugin) {
|
|
@@ -158,11 +158,11 @@ function checkDomains (errorCodesFiles, options = { plugin: false }) {
|
|
|
158
158
|
domainCodes.add(domain.code);
|
|
159
159
|
|
|
160
160
|
assert(
|
|
161
|
-
has(domain, '
|
|
162
|
-
`Error configuration file : Missing required '
|
|
161
|
+
has(domain, 'subDomains'),
|
|
162
|
+
`Error configuration file : Missing required 'subDomains' field. (domain: '${domainName}').`);
|
|
163
163
|
assert(
|
|
164
|
-
isPlainObject(domain.
|
|
165
|
-
`Error configuration file : Field '
|
|
164
|
+
isPlainObject(domain.subDomains),
|
|
165
|
+
`Error configuration file : Field 'subDomains' must be an object. (domain: '${domainName}').`);
|
|
166
166
|
|
|
167
167
|
checkSubdomains(domain, options);
|
|
168
168
|
}
|
|
@@ -170,7 +170,7 @@ function checkDomains (errorCodesFiles, options = { plugin: false }) {
|
|
|
170
170
|
|
|
171
171
|
function loadPluginsErrors (pluginManifest, pluginCode) {
|
|
172
172
|
// @todo this should be in its own, independant domain
|
|
173
|
-
domains.plugin.
|
|
173
|
+
domains.plugin.subDomains[pluginManifest.name] = {
|
|
174
174
|
code: pluginCode,
|
|
175
175
|
errors: pluginManifest.errors
|
|
176
176
|
};
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -17,6 +17,10 @@ export declare class KuzzleError extends Error {
|
|
|
17
17
|
* Error unique identifier
|
|
18
18
|
*/
|
|
19
19
|
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* Placeholders used to construct the error message.
|
|
22
|
+
*/
|
|
23
|
+
props: string[];
|
|
20
24
|
constructor(message: string, status: number, id?: string, code?: number);
|
|
21
25
|
/**
|
|
22
26
|
* Error class name (e.g: 'NotFoundError')
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -51,7 +55,9 @@ class KuzzleError extends Error {
|
|
|
51
55
|
this.status = status;
|
|
52
56
|
this.code = code;
|
|
53
57
|
this.id = id;
|
|
54
|
-
|
|
58
|
+
this.props = undefined;
|
|
59
|
+
this.stack = undefined;
|
|
60
|
+
if (util.types.isNativeError(message)) {
|
|
55
61
|
this.message = message.message;
|
|
56
62
|
this.stack = message.stack;
|
|
57
63
|
}
|
|
@@ -71,6 +77,7 @@ class KuzzleError extends Error {
|
|
|
71
77
|
code: this.code,
|
|
72
78
|
id: this.id,
|
|
73
79
|
message: this.message,
|
|
80
|
+
props: this.props,
|
|
74
81
|
stack: this.stack,
|
|
75
82
|
status: this.status,
|
|
76
83
|
};
|
package/lib/kerror/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ErrorDomains } from '../types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Construct and return the corresponding error
|
|
6
6
|
*
|
|
7
|
-
* @param domains - Domains object with
|
|
7
|
+
* @param domains - Domains object with subDomains and error names
|
|
8
8
|
* @param domain - Domain (eg: 'external')
|
|
9
9
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
|
10
10
|
* @param error - Error name: (eg: 'index_not_found')
|
|
@@ -15,7 +15,7 @@ export declare function rawGet(domains: ErrorDomains, domain: string, subdomain:
|
|
|
15
15
|
/**
|
|
16
16
|
* Returns a promise rejected with the corresponding error
|
|
17
17
|
*
|
|
18
|
-
* @param domains - Domains object with
|
|
18
|
+
* @param domains - Domains object with subDomains and error names
|
|
19
19
|
* @param domain - Domain (eg: 'external')
|
|
20
20
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
|
21
21
|
* @param error - Error name: (eg: 'index_not_found')
|
|
@@ -26,7 +26,7 @@ export declare function rawReject(domains: ErrorDomains, domain: string, subdoma
|
|
|
26
26
|
* Construct and return the corresponding error, with its stack
|
|
27
27
|
* trace derivated from a provided source error
|
|
28
28
|
*
|
|
29
|
-
* @param domains - Domains object with
|
|
29
|
+
* @param domains - Domains object with subDomains and error names
|
|
30
30
|
* @param source - Original error
|
|
31
31
|
* @param domain - Domain (eg: 'external')
|
|
32
32
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
package/lib/kerror/index.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -63,7 +67,7 @@ function _getCurrentFileName() {
|
|
|
63
67
|
/**
|
|
64
68
|
* Construct and return the corresponding error
|
|
65
69
|
*
|
|
66
|
-
* @param domains - Domains object with
|
|
70
|
+
* @param domains - Domains object with subDomains and error names
|
|
67
71
|
* @param domain - Domain (eg: 'external')
|
|
68
72
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
|
69
73
|
* @param error - Error name: (eg: 'index_not_found')
|
|
@@ -76,7 +80,7 @@ function rawGet(domains, domain, subdomain, error, ...placeholders) {
|
|
|
76
80
|
if (lodash_1.default.isPlainObject(placeholders[placeholders.length - 1])) {
|
|
77
81
|
options = placeholders.pop();
|
|
78
82
|
}
|
|
79
|
-
const kuzzleError = lodash_1.default.get(domains, `${domain}.
|
|
83
|
+
const kuzzleError = lodash_1.default.get(domains, `${domain}.subDomains.${subdomain}.errors.${error}`);
|
|
80
84
|
if (!kuzzleError) {
|
|
81
85
|
return get('core', 'fatal', 'unexpected_error', `${domain}.${subdomain}.${error}`);
|
|
82
86
|
}
|
|
@@ -87,15 +91,20 @@ function rawGet(domains, domain, subdomain, error, ...placeholders) {
|
|
|
87
91
|
const message = options.message || (0, util_1.format)(kuzzleError.message, ...placeholders);
|
|
88
92
|
const id = `${domain}.${subdomain}.${error}`;
|
|
89
93
|
const code = domains[domain].code << 24
|
|
90
|
-
| domains[domain].
|
|
91
|
-
| domains[domain].
|
|
94
|
+
| domains[domain].subDomains[subdomain].code << 16
|
|
95
|
+
| domains[domain].subDomains[subdomain].errors[error].code;
|
|
92
96
|
let kerror;
|
|
93
97
|
if (kuzzleError.class === 'PartialError' || kuzzleError.class === 'MultipleErrorsError') {
|
|
94
98
|
kerror = new errors[kuzzleError.class](message, body, id, code);
|
|
95
99
|
}
|
|
100
|
+
else if (kuzzleError.class === 'KuzzleError') {
|
|
101
|
+
const status = kuzzleError.status || 500;
|
|
102
|
+
kerror = new errors.KuzzleError(message, status, id, code);
|
|
103
|
+
}
|
|
96
104
|
else {
|
|
97
105
|
kerror = new errors[kuzzleError.class](message, id, code);
|
|
98
106
|
}
|
|
107
|
+
kerror.props = placeholders;
|
|
99
108
|
if (kuzzleError.class !== 'InternalError') {
|
|
100
109
|
cleanStackTrace(kerror);
|
|
101
110
|
}
|
|
@@ -136,7 +145,7 @@ function cleanStackTrace(error) {
|
|
|
136
145
|
/**
|
|
137
146
|
* Returns a promise rejected with the corresponding error
|
|
138
147
|
*
|
|
139
|
-
* @param domains - Domains object with
|
|
148
|
+
* @param domains - Domains object with subDomains and error names
|
|
140
149
|
* @param domain - Domain (eg: 'external')
|
|
141
150
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
|
142
151
|
* @param error - Error name: (eg: 'index_not_found')
|
|
@@ -150,7 +159,7 @@ exports.rawReject = rawReject;
|
|
|
150
159
|
* Construct and return the corresponding error, with its stack
|
|
151
160
|
* trace derivated from a provided source error
|
|
152
161
|
*
|
|
153
|
-
* @param domains - Domains object with
|
|
162
|
+
* @param domains - Domains object with subDomains and error names
|
|
154
163
|
* @param source - Original error
|
|
155
164
|
* @param domain - Domain (eg: 'external')
|
|
156
165
|
* @param subdomain - Subdomain (eg: 'elasticsearch')
|
package/lib/kuzzle/kuzzle.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
package/lib/types/Plugin.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ErrorDefinition } from './ErrorDefinition';
|
|
2
2
|
/**
|
|
3
|
-
* Represents the domains,
|
|
3
|
+
* Represents the domains, subDomains and error names with associated definitions
|
|
4
4
|
*/
|
|
5
5
|
export declare type ErrorDomains = {
|
|
6
6
|
[domain: string]: {
|
|
7
7
|
code: number;
|
|
8
|
-
|
|
8
|
+
subDomains?: {
|
|
9
9
|
[subDomain: string]: {
|
|
10
10
|
code: number;
|
|
11
11
|
errors: {
|
package/lib/types/index.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/util/mutex.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
23
|
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.
|
|
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]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
25
29
|
}) : (function(o, m, k, k2) {
|
|
26
30
|
if (k2 === undefined) k2 = k;
|
|
27
31
|
o[k2] = m[k];
|