kuzzle 2.15.2 → 2.16.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/lib/api/controllers/serverController.js +24 -4
- package/lib/api/funnel.js +19 -0
- package/lib/{config → api}/httpRoutes.js +29 -14
- package/lib/api/openApiGenerator.d.ts +6 -0
- package/lib/api/openApiGenerator.js +167 -126
- package/lib/api/openapi/documents/document.d.ts +21 -0
- package/lib/api/openapi/documents/document.js +57 -0
- package/lib/api/openapi/tools.d.ts +2 -0
- package/lib/api/openapi/tools.js +10 -0
- package/lib/api/request/kuzzleRequest.d.ts +30 -32
- package/lib/api/request/kuzzleRequest.js +30 -102
- package/lib/api/request/requestContext.d.ts +17 -22
- package/lib/api/request/requestContext.js +44 -109
- package/lib/api/request/requestInput.d.ts +19 -22
- package/lib/api/request/requestInput.js +115 -173
- package/lib/api/request/requestResponse.d.ts +12 -8
- package/lib/api/request/requestResponse.js +35 -29
- package/lib/config/default.config.js +1 -1
- package/lib/core/network/router.js +33 -0
- package/lib/core/plugin/pluginsManager.js +3 -1
- package/lib/core/realtime/hotelClerk.d.ts +7 -0
- package/lib/core/realtime/hotelClerk.js +14 -0
- package/lib/kuzzle/kuzzle.js +9 -5
- package/package-lock.json +160 -175
- package/package.json +10 -9
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JSONObject } from 'kuzzle-sdk';
|
|
2
2
|
import { RequestInput } from './requestInput';
|
|
3
|
-
import { RequestResponse } from './requestResponse';
|
|
4
3
|
import { RequestContext } from './requestContext';
|
|
5
4
|
import { KuzzleError } from '../../kerror/errors';
|
|
6
5
|
import { Deprecation, User } from '../../types';
|
|
@@ -13,47 +12,46 @@ import { Deprecation, User } from '../../types';
|
|
|
13
12
|
*/
|
|
14
13
|
export declare class KuzzleRequest {
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
* Deprecation warnings for the API action
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
|
-
constructor(data: any, options: any);
|
|
17
|
+
deprecations: Deprecation[] | undefined;
|
|
20
18
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
* Request timestamp (in Epoch-Micro)
|
|
20
|
+
*/
|
|
21
|
+
timestamp: number;
|
|
24
22
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
* Request HTTP status
|
|
24
|
+
*/
|
|
25
|
+
status: any;
|
|
28
26
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
* Request input
|
|
28
|
+
*/
|
|
29
|
+
input: RequestInput;
|
|
32
30
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
set status(i: number);
|
|
31
|
+
* Request context
|
|
32
|
+
*/
|
|
33
|
+
context: RequestContext;
|
|
37
34
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
* Request error
|
|
36
|
+
*/
|
|
37
|
+
error: KuzzleError;
|
|
41
38
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
* Request result
|
|
40
|
+
*/
|
|
41
|
+
result: any;
|
|
45
42
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
* Request response
|
|
44
|
+
*/
|
|
45
|
+
response: any;
|
|
49
46
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
* Request internal ID
|
|
48
|
+
*/
|
|
49
|
+
internalId: any;
|
|
53
50
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
* Request external ID (specified by "requestId" or random uuid)
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
constructor(data: any, options: any);
|
|
57
55
|
/**
|
|
58
56
|
* Adds an error to the request, and sets the request's status to the error one.
|
|
59
57
|
*/
|
|
@@ -53,17 +53,6 @@ const kerror_1 = __importDefault(require("../../kerror"));
|
|
|
53
53
|
const assert = __importStar(require("../../util/assertType"));
|
|
54
54
|
const safeObject_1 = require("../../util/safeObject");
|
|
55
55
|
const assertionError = kerror_1.default.wrap('api', 'assert');
|
|
56
|
-
// private properties
|
|
57
|
-
// \u200b is a zero width space, used to masquerade console.log output
|
|
58
|
-
const _internalId = 'internalId\u200b';
|
|
59
|
-
const _status = 'status\u200b';
|
|
60
|
-
const _input = 'input\u200b';
|
|
61
|
-
const _error = 'error\u200b';
|
|
62
|
-
const _result = 'result\u200b';
|
|
63
|
-
const _context = 'context\u200b';
|
|
64
|
-
const _timestamp = 'timestamp\u200b';
|
|
65
|
-
const _response = 'response\u200b';
|
|
66
|
-
const _deprecations = 'deprecations\u200b';
|
|
67
56
|
/**
|
|
68
57
|
* The `KuzzleRequest` class represents a request being processed by Kuzzle.
|
|
69
58
|
*
|
|
@@ -73,21 +62,21 @@ const _deprecations = 'deprecations\u200b';
|
|
|
73
62
|
*/
|
|
74
63
|
class KuzzleRequest {
|
|
75
64
|
constructor(data, options) {
|
|
76
|
-
this
|
|
77
|
-
this
|
|
78
|
-
this
|
|
79
|
-
this
|
|
80
|
-
this
|
|
81
|
-
this
|
|
82
|
-
this
|
|
83
|
-
this
|
|
65
|
+
this.internalId = (0, nanoid_1.nanoid)();
|
|
66
|
+
this.status = 102;
|
|
67
|
+
this.input = new requestInput_1.RequestInput(data);
|
|
68
|
+
this.context = new requestContext_1.RequestContext(options);
|
|
69
|
+
this.error = null;
|
|
70
|
+
this.result = null;
|
|
71
|
+
this.response = new requestResponse_1.RequestResponse(this);
|
|
72
|
+
this.deprecations = undefined;
|
|
84
73
|
// @deprecated - Backward compatibility with the RequestInput.headers
|
|
85
74
|
// property
|
|
86
|
-
this
|
|
75
|
+
this.input.headers = this.context.connection.misc.headers;
|
|
87
76
|
this.id = data.requestId
|
|
88
77
|
? assert.assertString('requestId', data.requestId)
|
|
89
78
|
: (0, nanoid_1.nanoid)();
|
|
90
|
-
this
|
|
79
|
+
this.timestamp = data.timestamp || Date.now();
|
|
91
80
|
// handling provided options
|
|
92
81
|
if (options !== undefined && options !== null) {
|
|
93
82
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
@@ -122,67 +111,6 @@ class KuzzleRequest {
|
|
|
122
111
|
this.status = options.status;
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
|
-
Object.seal(this);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Request internal ID
|
|
129
|
-
*/
|
|
130
|
-
get internalId() {
|
|
131
|
-
return this[_internalId];
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Deprecation warnings for the API action
|
|
135
|
-
*/
|
|
136
|
-
get deprecations() {
|
|
137
|
-
return this[_deprecations];
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Request timestamp (in Epoch-micro)
|
|
141
|
-
*/
|
|
142
|
-
get timestamp() {
|
|
143
|
-
return this[_timestamp];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Request HTTP status
|
|
147
|
-
*/
|
|
148
|
-
get status() {
|
|
149
|
-
return this[_status];
|
|
150
|
-
}
|
|
151
|
-
set status(i) {
|
|
152
|
-
this[_status] = assert.assertInteger('status', i);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Request input
|
|
156
|
-
*/
|
|
157
|
-
get input() {
|
|
158
|
-
return this[_input];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Request context
|
|
162
|
-
*/
|
|
163
|
-
get context() {
|
|
164
|
-
return this[_context];
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Request error
|
|
168
|
-
*/
|
|
169
|
-
get error() {
|
|
170
|
-
return this[_error];
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Request result
|
|
174
|
-
*/
|
|
175
|
-
get result() {
|
|
176
|
-
return this[_result];
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Request response
|
|
180
|
-
*/
|
|
181
|
-
get response() {
|
|
182
|
-
if (this[_response] === null) {
|
|
183
|
-
this[_response] = new requestResponse_1.RequestResponse(this);
|
|
184
|
-
}
|
|
185
|
-
return this[_response];
|
|
186
114
|
}
|
|
187
115
|
/**
|
|
188
116
|
* Adds an error to the request, and sets the request's status to the error one.
|
|
@@ -191,14 +119,14 @@ class KuzzleRequest {
|
|
|
191
119
|
if (!error || !(error instanceof Error)) {
|
|
192
120
|
throw new errors_1.InternalError('Cannot set non-error object as a request\'s error');
|
|
193
121
|
}
|
|
194
|
-
this
|
|
195
|
-
this.status = this
|
|
122
|
+
this.error = error instanceof errors_1.KuzzleError ? error : new errors_1.InternalError(error);
|
|
123
|
+
this.status = this.error.status;
|
|
196
124
|
}
|
|
197
125
|
/**
|
|
198
126
|
* Sets the request error to null and status to 200
|
|
199
127
|
*/
|
|
200
128
|
clearError() {
|
|
201
|
-
this
|
|
129
|
+
this.error = null;
|
|
202
130
|
this.status = 200;
|
|
203
131
|
}
|
|
204
132
|
/**
|
|
@@ -223,7 +151,7 @@ class KuzzleRequest {
|
|
|
223
151
|
if (options.raw !== undefined) {
|
|
224
152
|
this.response.raw = options.raw;
|
|
225
153
|
}
|
|
226
|
-
this
|
|
154
|
+
this.result = result;
|
|
227
155
|
}
|
|
228
156
|
/**
|
|
229
157
|
* Add a deprecation for a used component, this can be action/controller/parameters...
|
|
@@ -240,7 +168,7 @@ class KuzzleRequest {
|
|
|
240
168
|
version,
|
|
241
169
|
};
|
|
242
170
|
if (!this.deprecations) {
|
|
243
|
-
this
|
|
171
|
+
this.deprecations = [deprecation];
|
|
244
172
|
}
|
|
245
173
|
else {
|
|
246
174
|
this.deprecations.push(deprecation);
|
|
@@ -254,27 +182,27 @@ class KuzzleRequest {
|
|
|
254
182
|
serialize() {
|
|
255
183
|
const serialized = {
|
|
256
184
|
data: {
|
|
257
|
-
_id: this
|
|
258
|
-
action: this
|
|
259
|
-
body: this
|
|
260
|
-
collection: this
|
|
261
|
-
controller: this
|
|
262
|
-
index: this
|
|
263
|
-
jwt: this
|
|
185
|
+
_id: this.input.args._id,
|
|
186
|
+
action: this.input.action,
|
|
187
|
+
body: this.input.body,
|
|
188
|
+
collection: this.input.args.collection,
|
|
189
|
+
controller: this.input.controller,
|
|
190
|
+
index: this.input.args.index,
|
|
191
|
+
jwt: this.input.jwt,
|
|
264
192
|
requestId: this.id,
|
|
265
|
-
timestamp: this
|
|
266
|
-
volatile: this
|
|
193
|
+
timestamp: this.timestamp,
|
|
194
|
+
volatile: this.input.volatile,
|
|
267
195
|
},
|
|
268
196
|
// @deprecated - duplicate of options.connection.misc.headers
|
|
269
|
-
headers: this
|
|
197
|
+
headers: this.input.headers,
|
|
270
198
|
options: {
|
|
271
|
-
error: this
|
|
272
|
-
result: this
|
|
273
|
-
status: this
|
|
199
|
+
error: this.error,
|
|
200
|
+
result: this.result,
|
|
201
|
+
status: this.status,
|
|
274
202
|
},
|
|
275
203
|
};
|
|
276
|
-
Object.assign(serialized.data, this
|
|
277
|
-
Object.assign(serialized.options, this
|
|
204
|
+
Object.assign(serialized.data, this.input.args);
|
|
205
|
+
Object.assign(serialized.options, this.context.toJSON());
|
|
278
206
|
return serialized;
|
|
279
207
|
}
|
|
280
208
|
/**
|
|
@@ -24,26 +24,23 @@ export declare type ContextMisc = {
|
|
|
24
24
|
* Information about the connection at the origin of the request.
|
|
25
25
|
*/
|
|
26
26
|
export declare class Connection {
|
|
27
|
-
constructor(connection: any);
|
|
28
27
|
/**
|
|
29
28
|
* Unique identifier of the user connection
|
|
30
29
|
*/
|
|
31
|
-
|
|
32
|
-
get id(): string | null;
|
|
30
|
+
id: string;
|
|
33
31
|
/**
|
|
34
32
|
* Network protocol name
|
|
35
33
|
*/
|
|
36
|
-
|
|
37
|
-
get protocol(): string | null;
|
|
34
|
+
protocol: string;
|
|
38
35
|
/**
|
|
39
36
|
* Chain of IP addresses, starting from the client
|
|
40
37
|
*/
|
|
41
|
-
|
|
42
|
-
get ips(): string[];
|
|
38
|
+
ips: string[];
|
|
43
39
|
/**
|
|
44
40
|
* Additional informations about the connection
|
|
45
41
|
*/
|
|
46
|
-
|
|
42
|
+
misc: ContextMisc;
|
|
43
|
+
constructor(connection: any);
|
|
47
44
|
/**
|
|
48
45
|
* Serializes the Connection object
|
|
49
46
|
*/
|
|
@@ -56,6 +53,18 @@ export declare class Connection {
|
|
|
56
53
|
* and origin (connection, protocol).
|
|
57
54
|
*/
|
|
58
55
|
export declare class RequestContext {
|
|
56
|
+
/**
|
|
57
|
+
* Connection that initiated the request
|
|
58
|
+
*/
|
|
59
|
+
connection: Connection;
|
|
60
|
+
/**
|
|
61
|
+
* Authentication token
|
|
62
|
+
*/
|
|
63
|
+
token: Token | null;
|
|
64
|
+
/**
|
|
65
|
+
* Associated user
|
|
66
|
+
*/
|
|
67
|
+
user: User | null;
|
|
59
68
|
constructor(options?: any);
|
|
60
69
|
/**
|
|
61
70
|
* Serializes the RequestContext object
|
|
@@ -72,18 +81,4 @@ export declare class RequestContext {
|
|
|
72
81
|
*/
|
|
73
82
|
get protocol(): string | null;
|
|
74
83
|
set protocol(str: string);
|
|
75
|
-
/**
|
|
76
|
-
* Connection that initiated the request
|
|
77
|
-
*/
|
|
78
|
-
get connection(): Connection;
|
|
79
|
-
/**
|
|
80
|
-
* Authentication token
|
|
81
|
-
*/
|
|
82
|
-
get token(): Token | null;
|
|
83
|
-
set token(obj: Token | null);
|
|
84
|
-
/**
|
|
85
|
-
* Associated user
|
|
86
|
-
*/
|
|
87
|
-
get user(): User | null;
|
|
88
|
-
set user(obj: User | null);
|
|
89
84
|
}
|
|
@@ -19,48 +19,29 @@
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
-
if (k2 === undefined) k2 = k;
|
|
24
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
25
|
-
}) : (function(o, m, k, k2) {
|
|
26
|
-
if (k2 === undefined) k2 = k;
|
|
27
|
-
o[k2] = m[k];
|
|
28
|
-
}));
|
|
29
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
-
}) : function(o, v) {
|
|
32
|
-
o["default"] = v;
|
|
33
|
-
});
|
|
34
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
23
|
exports.RequestContext = exports.Connection = void 0;
|
|
43
|
-
const assert = __importStar(require("../../util/assertType"));
|
|
44
|
-
// private properties
|
|
45
|
-
// \u200b is a zero width space, used to masquerade console.log output
|
|
46
|
-
const _token = 'token\u200b';
|
|
47
|
-
const _user = 'user\u200b';
|
|
48
|
-
const _connection = 'connection\u200b';
|
|
49
|
-
// Connection class properties
|
|
50
|
-
const _c_id = 'id\u200b';
|
|
51
|
-
const _c_protocol = 'protocol\u200b';
|
|
52
|
-
const _c_ips = 'ips\u200b';
|
|
53
|
-
const _c_misc = 'misc\u200b';
|
|
54
24
|
/**
|
|
55
25
|
* Information about the connection at the origin of the request.
|
|
56
26
|
*/
|
|
57
27
|
class Connection {
|
|
58
28
|
constructor(connection) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this
|
|
63
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Unique identifier of the user connection
|
|
31
|
+
*/
|
|
32
|
+
this.id = null;
|
|
33
|
+
/**
|
|
34
|
+
* Network protocol name
|
|
35
|
+
*/
|
|
36
|
+
this.protocol = null;
|
|
37
|
+
/**
|
|
38
|
+
* Chain of IP addresses, starting from the client
|
|
39
|
+
*/
|
|
40
|
+
this.ips = [];
|
|
41
|
+
/**
|
|
42
|
+
* Additional informations about the connection
|
|
43
|
+
*/
|
|
44
|
+
this.misc = {};
|
|
64
45
|
if (typeof connection !== 'object' || connection === null) {
|
|
65
46
|
return;
|
|
66
47
|
}
|
|
@@ -73,48 +54,15 @@ class Connection {
|
|
|
73
54
|
}
|
|
74
55
|
}
|
|
75
56
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Unique identifier of the user connection
|
|
78
|
-
*/
|
|
79
|
-
set id(str) {
|
|
80
|
-
this[_c_id] = assert.assertString('connection.id', str);
|
|
81
|
-
}
|
|
82
|
-
get id() {
|
|
83
|
-
return this[_c_id];
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Network protocol name
|
|
87
|
-
*/
|
|
88
|
-
set protocol(str) {
|
|
89
|
-
this[_c_protocol] = assert.assertString('connection.protocol', str);
|
|
90
|
-
}
|
|
91
|
-
get protocol() {
|
|
92
|
-
return this[_c_protocol];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Chain of IP addresses, starting from the client
|
|
96
|
-
*/
|
|
97
|
-
set ips(arr) {
|
|
98
|
-
this[_c_ips] = assert.assertArray('connection.ips', arr, 'string');
|
|
99
|
-
}
|
|
100
|
-
get ips() {
|
|
101
|
-
return this[_c_ips];
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Additional informations about the connection
|
|
105
|
-
*/
|
|
106
|
-
get misc() {
|
|
107
|
-
return this[_c_misc];
|
|
108
|
-
}
|
|
109
57
|
/**
|
|
110
58
|
* Serializes the Connection object
|
|
111
59
|
*/
|
|
112
60
|
toJSON() {
|
|
113
61
|
return {
|
|
114
|
-
id: this
|
|
115
|
-
ips: this
|
|
116
|
-
protocol: this
|
|
117
|
-
...this
|
|
62
|
+
id: this.id,
|
|
63
|
+
ips: this.ips,
|
|
64
|
+
protocol: this.protocol,
|
|
65
|
+
...this.misc
|
|
118
66
|
};
|
|
119
67
|
}
|
|
120
68
|
}
|
|
@@ -127,12 +75,23 @@ exports.Connection = Connection;
|
|
|
127
75
|
*/
|
|
128
76
|
class RequestContext {
|
|
129
77
|
constructor(options = {}) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Authentication token
|
|
80
|
+
*/
|
|
81
|
+
this.token = null;
|
|
82
|
+
/**
|
|
83
|
+
* Associated user
|
|
84
|
+
*/
|
|
85
|
+
this.user = null;
|
|
86
|
+
this.token = null;
|
|
87
|
+
this.user = null;
|
|
88
|
+
this.connection = new Connection(options.connection);
|
|
89
|
+
if (options.token) {
|
|
90
|
+
this.token = options.token;
|
|
91
|
+
}
|
|
92
|
+
if (options.user) {
|
|
93
|
+
this.user = options.user;
|
|
94
|
+
}
|
|
136
95
|
// @deprecated - backward compatibility only
|
|
137
96
|
if (options.connectionId) {
|
|
138
97
|
this.connectionId = options.connectionId;
|
|
@@ -146,9 +105,9 @@ class RequestContext {
|
|
|
146
105
|
*/
|
|
147
106
|
toJSON() {
|
|
148
107
|
return {
|
|
149
|
-
connection: this
|
|
150
|
-
token: this
|
|
151
|
-
user: this
|
|
108
|
+
connection: this.connection.toJSON(),
|
|
109
|
+
token: this.token,
|
|
110
|
+
user: this.user,
|
|
152
111
|
};
|
|
153
112
|
}
|
|
154
113
|
/**
|
|
@@ -156,43 +115,19 @@ class RequestContext {
|
|
|
156
115
|
* Internal connection ID
|
|
157
116
|
*/
|
|
158
117
|
get connectionId() {
|
|
159
|
-
return this
|
|
118
|
+
return this.connection.id;
|
|
160
119
|
}
|
|
161
120
|
set connectionId(str) {
|
|
162
|
-
this
|
|
121
|
+
this.connection.id = str;
|
|
163
122
|
}
|
|
164
123
|
/**
|
|
165
124
|
* @deprecated use connection.protocol instead
|
|
166
125
|
*/
|
|
167
126
|
get protocol() {
|
|
168
|
-
return this
|
|
127
|
+
return this.connection.protocol;
|
|
169
128
|
}
|
|
170
129
|
set protocol(str) {
|
|
171
|
-
this
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Connection that initiated the request
|
|
175
|
-
*/
|
|
176
|
-
get connection() {
|
|
177
|
-
return this[_connection];
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Authentication token
|
|
181
|
-
*/
|
|
182
|
-
get token() {
|
|
183
|
-
return this[_token];
|
|
184
|
-
}
|
|
185
|
-
set token(obj) {
|
|
186
|
-
this[_token] = assert.assertObject('token', obj);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Associated user
|
|
190
|
-
*/
|
|
191
|
-
get user() {
|
|
192
|
-
return this[_user];
|
|
193
|
-
}
|
|
194
|
-
set user(obj) {
|
|
195
|
-
this[_user] = assert.assertObject('user', obj);
|
|
130
|
+
this.connection.protocol = str;
|
|
196
131
|
}
|
|
197
132
|
}
|
|
198
133
|
exports.RequestContext = RequestContext;
|
|
@@ -7,16 +7,19 @@ export declare class RequestResource {
|
|
|
7
7
|
constructor(args: JSONObject);
|
|
8
8
|
/**
|
|
9
9
|
* Document ID
|
|
10
|
+
* @deprecated
|
|
10
11
|
*/
|
|
11
12
|
get _id(): string | null;
|
|
12
13
|
set _id(str: string);
|
|
13
14
|
/**
|
|
14
15
|
* Index name
|
|
16
|
+
* @deprecated
|
|
15
17
|
*/
|
|
16
18
|
get index(): string | null;
|
|
17
19
|
set index(str: string);
|
|
18
20
|
/**
|
|
19
21
|
* Collection name
|
|
22
|
+
* @deprecated
|
|
20
23
|
*/
|
|
21
24
|
get collection(): string | null;
|
|
22
25
|
set collection(str: string);
|
|
@@ -52,7 +55,7 @@ export declare class RequestInput {
|
|
|
52
55
|
/**
|
|
53
56
|
* Common arguments that identify Kuzzle resources.
|
|
54
57
|
* (e.g: "_id", "index", "collection")
|
|
55
|
-
* @deprecated Use
|
|
58
|
+
* @deprecated Use`request.getId()|getIndex()|getCollection()>` instead
|
|
56
59
|
* @example
|
|
57
60
|
* // original JSON request sent to Kuzzle
|
|
58
61
|
* {
|
|
@@ -69,15 +72,6 @@ export declare class RequestInput {
|
|
|
69
72
|
* }
|
|
70
73
|
*/
|
|
71
74
|
resource: RequestResource;
|
|
72
|
-
/**
|
|
73
|
-
* Builds a Kuzzle normalized request input object
|
|
74
|
-
*
|
|
75
|
-
* The 'data' object accepts a request content using the same
|
|
76
|
-
* format as the one used, for instance, for the Websocket protocol
|
|
77
|
-
*
|
|
78
|
-
* Any undefined option is set to null
|
|
79
|
-
*/
|
|
80
|
-
constructor(data: any);
|
|
81
75
|
/**
|
|
82
76
|
* Authentication token.
|
|
83
77
|
* @example
|
|
@@ -95,8 +89,7 @@ export declare class RequestInput {
|
|
|
95
89
|
* body
|
|
96
90
|
* }
|
|
97
91
|
*/
|
|
98
|
-
|
|
99
|
-
set jwt(str: string);
|
|
92
|
+
jwt: string | null;
|
|
100
93
|
/**
|
|
101
94
|
* API controller name.
|
|
102
95
|
* @example
|
|
@@ -114,8 +107,7 @@ export declare class RequestInput {
|
|
|
114
107
|
* body
|
|
115
108
|
* }
|
|
116
109
|
*/
|
|
117
|
-
|
|
118
|
-
set controller(str: string);
|
|
110
|
+
controller: string | null;
|
|
119
111
|
/**
|
|
120
112
|
* API action name.
|
|
121
113
|
* @example
|
|
@@ -133,8 +125,7 @@ export declare class RequestInput {
|
|
|
133
125
|
* body
|
|
134
126
|
* }
|
|
135
127
|
*/
|
|
136
|
-
|
|
137
|
-
set action(str: string);
|
|
128
|
+
action: string | null;
|
|
138
129
|
/**
|
|
139
130
|
* Request body.
|
|
140
131
|
* In Http it's the request body parsed.
|
|
@@ -153,13 +144,11 @@ export declare class RequestInput {
|
|
|
153
144
|
* body <== that
|
|
154
145
|
* }
|
|
155
146
|
*/
|
|
156
|
-
|
|
157
|
-
set body(obj: JSONObject);
|
|
147
|
+
body: JSONObject | null;
|
|
158
148
|
/**
|
|
159
149
|
* Request headers (Http only).
|
|
160
150
|
*/
|
|
161
|
-
|
|
162
|
-
set headers(obj: JSONObject);
|
|
151
|
+
headers: JSONObject | null;
|
|
163
152
|
/**
|
|
164
153
|
* Volatile object.
|
|
165
154
|
* @example
|
|
@@ -177,6 +166,14 @@ export declare class RequestInput {
|
|
|
177
166
|
* body
|
|
178
167
|
* }
|
|
179
168
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
169
|
+
volatile: JSONObject | null;
|
|
170
|
+
/**
|
|
171
|
+
* Builds a Kuzzle normalized request input object
|
|
172
|
+
*
|
|
173
|
+
* The 'data' object accepts a request content using the same
|
|
174
|
+
* format as the one used, for instance, for the Websocket protocol
|
|
175
|
+
*
|
|
176
|
+
* Any undefined option is set to null
|
|
177
|
+
*/
|
|
178
|
+
constructor(data: any);
|
|
182
179
|
}
|