kuzzle 2.16.2 → 2.16.6
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 +27 -14
- package/lib/api/openApiGenerator.d.ts +2 -1
- package/lib/api/openApiGenerator.js +16 -18
- package/lib/api/request/kuzzleRequest.d.ts +64 -30
- package/lib/api/request/kuzzleRequest.js +135 -29
- package/lib/api/request/requestContext.d.ts +22 -17
- package/lib/api/request/requestContext.js +109 -44
- package/lib/api/request/requestInput.d.ts +24 -19
- package/lib/api/request/requestInput.js +175 -115
- package/lib/api/request/requestResponse.d.ts +8 -12
- package/lib/api/request/requestResponse.js +29 -35
- package/lib/core/backend/backendController.js +0 -3
- package/lib/core/plugin/plugin.js +18 -8
- package/lib/core/plugin/pluginsManager.js +2 -4
- package/lib/kuzzle/kuzzle.js +5 -9
- package/lib/service/storage/elasticsearch.js +6 -0
- package/package-lock.json +22 -22
- package/package.json +5 -5
|
@@ -19,29 +19,48 @@
|
|
|
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
|
+
};
|
|
22
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
42
|
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';
|
|
24
54
|
/**
|
|
25
55
|
* Information about the connection at the origin of the request.
|
|
26
56
|
*/
|
|
27
57
|
class Connection {
|
|
28
58
|
constructor(connection) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this
|
|
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 = {};
|
|
59
|
+
this[_c_id] = null;
|
|
60
|
+
this[_c_protocol] = null;
|
|
61
|
+
this[_c_ips] = [];
|
|
62
|
+
this[_c_misc] = {};
|
|
63
|
+
Object.seal(this);
|
|
45
64
|
if (typeof connection !== 'object' || connection === null) {
|
|
46
65
|
return;
|
|
47
66
|
}
|
|
@@ -54,15 +73,48 @@ class Connection {
|
|
|
54
73
|
}
|
|
55
74
|
}
|
|
56
75
|
}
|
|
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
|
+
}
|
|
57
109
|
/**
|
|
58
110
|
* Serializes the Connection object
|
|
59
111
|
*/
|
|
60
112
|
toJSON() {
|
|
61
113
|
return {
|
|
62
|
-
id: this
|
|
63
|
-
ips: this
|
|
64
|
-
protocol: this
|
|
65
|
-
...this
|
|
114
|
+
id: this[_c_id],
|
|
115
|
+
ips: this[_c_ips],
|
|
116
|
+
protocol: this[_c_protocol],
|
|
117
|
+
...this[_c_misc]
|
|
66
118
|
};
|
|
67
119
|
}
|
|
68
120
|
}
|
|
@@ -75,23 +127,12 @@ exports.Connection = Connection;
|
|
|
75
127
|
*/
|
|
76
128
|
class RequestContext {
|
|
77
129
|
constructor(options = {}) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
}
|
|
130
|
+
this[_token] = null;
|
|
131
|
+
this[_user] = null;
|
|
132
|
+
this[_connection] = new Connection(options.connection);
|
|
133
|
+
Object.seal(this);
|
|
134
|
+
this.token = options.token;
|
|
135
|
+
this.user = options.user;
|
|
95
136
|
// @deprecated - backward compatibility only
|
|
96
137
|
if (options.connectionId) {
|
|
97
138
|
this.connectionId = options.connectionId;
|
|
@@ -105,9 +146,9 @@ class RequestContext {
|
|
|
105
146
|
*/
|
|
106
147
|
toJSON() {
|
|
107
148
|
return {
|
|
108
|
-
connection: this.
|
|
109
|
-
token: this
|
|
110
|
-
user: this
|
|
149
|
+
connection: this[_connection].toJSON(),
|
|
150
|
+
token: this[_token],
|
|
151
|
+
user: this[_user],
|
|
111
152
|
};
|
|
112
153
|
}
|
|
113
154
|
/**
|
|
@@ -115,19 +156,43 @@ class RequestContext {
|
|
|
115
156
|
* Internal connection ID
|
|
116
157
|
*/
|
|
117
158
|
get connectionId() {
|
|
118
|
-
return this.
|
|
159
|
+
return this[_connection].id;
|
|
119
160
|
}
|
|
120
161
|
set connectionId(str) {
|
|
121
|
-
this.
|
|
162
|
+
this[_connection].id = assert.assertString('connectionId', str);
|
|
122
163
|
}
|
|
123
164
|
/**
|
|
124
165
|
* @deprecated use connection.protocol instead
|
|
125
166
|
*/
|
|
126
167
|
get protocol() {
|
|
127
|
-
return this.
|
|
168
|
+
return this[_connection].protocol;
|
|
128
169
|
}
|
|
129
170
|
set protocol(str) {
|
|
130
|
-
this.
|
|
171
|
+
this[_connection].protocol = assert.assertString('protocol', str);
|
|
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);
|
|
131
196
|
}
|
|
132
197
|
}
|
|
133
198
|
exports.RequestContext = RequestContext;
|
|
@@ -7,19 +7,16 @@ export declare class RequestResource {
|
|
|
7
7
|
constructor(args: JSONObject);
|
|
8
8
|
/**
|
|
9
9
|
* Document ID
|
|
10
|
-
* @deprecated
|
|
11
10
|
*/
|
|
12
11
|
get _id(): string | null;
|
|
13
12
|
set _id(str: string);
|
|
14
13
|
/**
|
|
15
14
|
* Index name
|
|
16
|
-
* @deprecated
|
|
17
15
|
*/
|
|
18
16
|
get index(): string | null;
|
|
19
17
|
set index(str: string);
|
|
20
18
|
/**
|
|
21
19
|
* Collection name
|
|
22
|
-
* @deprecated
|
|
23
20
|
*/
|
|
24
21
|
get collection(): string | null;
|
|
25
22
|
set collection(str: string);
|
|
@@ -55,7 +52,7 @@ export declare class RequestInput {
|
|
|
55
52
|
/**
|
|
56
53
|
* Common arguments that identify Kuzzle resources.
|
|
57
54
|
* (e.g: "_id", "index", "collection")
|
|
58
|
-
* @deprecated Use`request.
|
|
55
|
+
* @deprecated Use directly`request.input.args.<_id|index|collection>` instead
|
|
59
56
|
* @example
|
|
60
57
|
* // original JSON request sent to Kuzzle
|
|
61
58
|
* {
|
|
@@ -72,6 +69,15 @@ export declare class RequestInput {
|
|
|
72
69
|
* }
|
|
73
70
|
*/
|
|
74
71
|
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);
|
|
75
81
|
/**
|
|
76
82
|
* Authentication token.
|
|
77
83
|
* @example
|
|
@@ -89,7 +95,8 @@ export declare class RequestInput {
|
|
|
89
95
|
* body
|
|
90
96
|
* }
|
|
91
97
|
*/
|
|
92
|
-
jwt: string | null;
|
|
98
|
+
get jwt(): string | null;
|
|
99
|
+
set jwt(str: string);
|
|
93
100
|
/**
|
|
94
101
|
* API controller name.
|
|
95
102
|
* @example
|
|
@@ -107,7 +114,8 @@ export declare class RequestInput {
|
|
|
107
114
|
* body
|
|
108
115
|
* }
|
|
109
116
|
*/
|
|
110
|
-
controller: string | null;
|
|
117
|
+
get controller(): string | null;
|
|
118
|
+
set controller(str: string);
|
|
111
119
|
/**
|
|
112
120
|
* API action name.
|
|
113
121
|
* @example
|
|
@@ -125,7 +133,8 @@ export declare class RequestInput {
|
|
|
125
133
|
* body
|
|
126
134
|
* }
|
|
127
135
|
*/
|
|
128
|
-
action: string | null;
|
|
136
|
+
get action(): string | null;
|
|
137
|
+
set action(str: string);
|
|
129
138
|
/**
|
|
130
139
|
* Request body.
|
|
131
140
|
* In Http it's the request body parsed.
|
|
@@ -144,11 +153,15 @@ export declare class RequestInput {
|
|
|
144
153
|
* body <== that
|
|
145
154
|
* }
|
|
146
155
|
*/
|
|
147
|
-
body: JSONObject | null;
|
|
156
|
+
get body(): JSONObject | null;
|
|
157
|
+
set body(obj: JSONObject);
|
|
148
158
|
/**
|
|
149
159
|
* Request headers (Http only).
|
|
160
|
+
*
|
|
161
|
+
* @deprecated Use RequestContext.connection.misc.headers instead
|
|
150
162
|
*/
|
|
151
|
-
headers: JSONObject | null;
|
|
163
|
+
get headers(): JSONObject | null;
|
|
164
|
+
set headers(obj: JSONObject);
|
|
152
165
|
/**
|
|
153
166
|
* Volatile object.
|
|
154
167
|
* @example
|
|
@@ -166,14 +179,6 @@ export declare class RequestInput {
|
|
|
166
179
|
* body
|
|
167
180
|
* }
|
|
168
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
|
+
get volatile(): JSONObject | null;
|
|
183
|
+
set volatile(obj: JSONObject);
|
|
179
184
|
}
|
|
@@ -19,13 +19,37 @@
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
var
|
|
23
|
-
|
|
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;
|
|
24
40
|
};
|
|
25
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
42
|
exports.RequestInput = exports.RequestResource = void 0;
|
|
27
43
|
const internalError_1 = require("../../kerror/errors/internalError");
|
|
28
|
-
const
|
|
44
|
+
const assert = __importStar(require("../../util/assertType"));
|
|
45
|
+
// private properties
|
|
46
|
+
// \u200b is a zero width space, used to masquerade console.log output
|
|
47
|
+
const _jwt = 'jwt\u200b';
|
|
48
|
+
const _volatile = 'volatile\u200b';
|
|
49
|
+
const _body = 'body\u200b';
|
|
50
|
+
const _headers = 'headers\u200b';
|
|
51
|
+
const _controller = 'controller\u200b';
|
|
52
|
+
const _action = 'action\u200b';
|
|
29
53
|
// any property not listed here will be copied into
|
|
30
54
|
// RequestInput.args
|
|
31
55
|
const resourceProperties = new Set([
|
|
@@ -44,7 +68,6 @@ class RequestResource {
|
|
|
44
68
|
}
|
|
45
69
|
/**
|
|
46
70
|
* Document ID
|
|
47
|
-
* @deprecated
|
|
48
71
|
*/
|
|
49
72
|
get _id() {
|
|
50
73
|
return this.args._id;
|
|
@@ -54,7 +77,6 @@ class RequestResource {
|
|
|
54
77
|
}
|
|
55
78
|
/**
|
|
56
79
|
* Index name
|
|
57
|
-
* @deprecated
|
|
58
80
|
*/
|
|
59
81
|
get index() {
|
|
60
82
|
return this.args.index;
|
|
@@ -64,7 +86,6 @@ class RequestResource {
|
|
|
64
86
|
}
|
|
65
87
|
/**
|
|
66
88
|
* Collection name
|
|
67
|
-
* @deprecated
|
|
68
89
|
*/
|
|
69
90
|
get collection() {
|
|
70
91
|
return this.args.collection;
|
|
@@ -93,109 +114,14 @@ class RequestInput {
|
|
|
93
114
|
* Any undefined option is set to null
|
|
94
115
|
*/
|
|
95
116
|
constructor(data) {
|
|
96
|
-
/**
|
|
97
|
-
* Authentication token.
|
|
98
|
-
* @example
|
|
99
|
-
* // original JSON request sent to Kuzzle
|
|
100
|
-
* {
|
|
101
|
-
* controller
|
|
102
|
-
* action,
|
|
103
|
-
* _id,
|
|
104
|
-
* index,
|
|
105
|
-
* collection,
|
|
106
|
-
* jwt, <== that
|
|
107
|
-
* refresh,
|
|
108
|
-
* foobar,
|
|
109
|
-
* volatile,
|
|
110
|
-
* body
|
|
111
|
-
* }
|
|
112
|
-
*/
|
|
113
|
-
this.jwt = null;
|
|
114
|
-
/**
|
|
115
|
-
* API controller name.
|
|
116
|
-
* @example
|
|
117
|
-
* // original JSON request sent to Kuzzle
|
|
118
|
-
* {
|
|
119
|
-
* controller <== that
|
|
120
|
-
* action,
|
|
121
|
-
* _id,
|
|
122
|
-
* index,
|
|
123
|
-
* collection,
|
|
124
|
-
* jwt,
|
|
125
|
-
* refresh,
|
|
126
|
-
* foobar,
|
|
127
|
-
* volatile,
|
|
128
|
-
* body
|
|
129
|
-
* }
|
|
130
|
-
*/
|
|
131
|
-
this.controller = null;
|
|
132
|
-
/**
|
|
133
|
-
* API action name.
|
|
134
|
-
* @example
|
|
135
|
-
* // original JSON request sent to Kuzzle
|
|
136
|
-
* {
|
|
137
|
-
* controller
|
|
138
|
-
* action, <== that
|
|
139
|
-
* _id,
|
|
140
|
-
* index,
|
|
141
|
-
* collection,
|
|
142
|
-
* jwt,
|
|
143
|
-
* refresh,
|
|
144
|
-
* foobar,
|
|
145
|
-
* volatile,
|
|
146
|
-
* body
|
|
147
|
-
* }
|
|
148
|
-
*/
|
|
149
|
-
this.action = null;
|
|
150
|
-
/**
|
|
151
|
-
* Request body.
|
|
152
|
-
* In Http it's the request body parsed.
|
|
153
|
-
* @example
|
|
154
|
-
* // original JSON request sent to Kuzzle
|
|
155
|
-
* {
|
|
156
|
-
* controller
|
|
157
|
-
* action,
|
|
158
|
-
* _id,
|
|
159
|
-
* index,
|
|
160
|
-
* collection,
|
|
161
|
-
* jwt,
|
|
162
|
-
* refresh,
|
|
163
|
-
* foobar,
|
|
164
|
-
* volatile,
|
|
165
|
-
* body <== that
|
|
166
|
-
* }
|
|
167
|
-
*/
|
|
168
|
-
this.body = {};
|
|
169
|
-
/**
|
|
170
|
-
* Request headers (Http only).
|
|
171
|
-
*/
|
|
172
|
-
this.headers = null;
|
|
173
|
-
/**
|
|
174
|
-
* Volatile object.
|
|
175
|
-
* @example
|
|
176
|
-
* // original JSON request sent to Kuzzle
|
|
177
|
-
* {
|
|
178
|
-
* controller
|
|
179
|
-
* action,
|
|
180
|
-
* _id,
|
|
181
|
-
* index,
|
|
182
|
-
* collection,
|
|
183
|
-
* jwt,
|
|
184
|
-
* refresh,
|
|
185
|
-
* foobar,
|
|
186
|
-
* volatile, <== that
|
|
187
|
-
* body
|
|
188
|
-
* }
|
|
189
|
-
*/
|
|
190
|
-
this.volatile = null;
|
|
191
117
|
if (!data || typeof data !== 'object' || Array.isArray(data)) {
|
|
192
118
|
throw new internalError_1.InternalError('Input request data must be a non-null object');
|
|
193
119
|
}
|
|
194
|
-
this
|
|
195
|
-
this
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
-
this
|
|
120
|
+
this[_jwt] = null;
|
|
121
|
+
this[_volatile] = null;
|
|
122
|
+
this[_body] = null;
|
|
123
|
+
this[_controller] = null;
|
|
124
|
+
this[_action] = null;
|
|
199
125
|
// default value to null for former "resources" to avoid breaking
|
|
200
126
|
this.args = {};
|
|
201
127
|
this.resource = new RequestResource(this.args);
|
|
@@ -205,17 +131,151 @@ class RequestInput {
|
|
|
205
131
|
this.args[k] = data[k];
|
|
206
132
|
}
|
|
207
133
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
134
|
+
// @deprecated - RequestContext.connection.misc.headers should be used instead
|
|
135
|
+
// initialize `_headers` property after the population of `this.args` attribute
|
|
136
|
+
// `this.headers` can contain protocol specific headers and should be
|
|
137
|
+
// set after the Request construction
|
|
138
|
+
// `args.headers` can be an attribute coming from data itself.
|
|
139
|
+
this[_headers] = null;
|
|
140
|
+
Object.seal(this);
|
|
141
|
+
this.jwt = data.jwt;
|
|
142
|
+
this.volatile = data.volatile;
|
|
143
|
+
this.body = data.body;
|
|
144
|
+
this.controller = data.controller;
|
|
145
|
+
this.action = data.action;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Authentication token.
|
|
149
|
+
* @example
|
|
150
|
+
* // original JSON request sent to Kuzzle
|
|
151
|
+
* {
|
|
152
|
+
* controller
|
|
153
|
+
* action,
|
|
154
|
+
* _id,
|
|
155
|
+
* index,
|
|
156
|
+
* collection,
|
|
157
|
+
* jwt, <== that
|
|
158
|
+
* refresh,
|
|
159
|
+
* foobar,
|
|
160
|
+
* volatile,
|
|
161
|
+
* body
|
|
162
|
+
* }
|
|
163
|
+
*/
|
|
164
|
+
get jwt() {
|
|
165
|
+
return this[_jwt];
|
|
166
|
+
}
|
|
167
|
+
set jwt(str) {
|
|
168
|
+
this[_jwt] = assert.assertString('jwt', str);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* API controller name.
|
|
172
|
+
* @example
|
|
173
|
+
* // original JSON request sent to Kuzzle
|
|
174
|
+
* {
|
|
175
|
+
* controller <== that
|
|
176
|
+
* action,
|
|
177
|
+
* _id,
|
|
178
|
+
* index,
|
|
179
|
+
* collection,
|
|
180
|
+
* jwt,
|
|
181
|
+
* refresh,
|
|
182
|
+
* foobar,
|
|
183
|
+
* volatile,
|
|
184
|
+
* body
|
|
185
|
+
* }
|
|
186
|
+
*/
|
|
187
|
+
get controller() {
|
|
188
|
+
return this[_controller];
|
|
189
|
+
}
|
|
190
|
+
set controller(str) {
|
|
191
|
+
// can only be set once
|
|
192
|
+
if (!this[_controller]) {
|
|
193
|
+
this[_controller] = assert.assertString('controller', str);
|
|
213
194
|
}
|
|
214
|
-
|
|
215
|
-
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* API action name.
|
|
198
|
+
* @example
|
|
199
|
+
* // original JSON request sent to Kuzzle
|
|
200
|
+
* {
|
|
201
|
+
* controller
|
|
202
|
+
* action, <== that
|
|
203
|
+
* _id,
|
|
204
|
+
* index,
|
|
205
|
+
* collection,
|
|
206
|
+
* jwt,
|
|
207
|
+
* refresh,
|
|
208
|
+
* foobar,
|
|
209
|
+
* volatile,
|
|
210
|
+
* body
|
|
211
|
+
* }
|
|
212
|
+
*/
|
|
213
|
+
get action() {
|
|
214
|
+
return this[_action];
|
|
215
|
+
}
|
|
216
|
+
set action(str) {
|
|
217
|
+
// can only be set once
|
|
218
|
+
if (!this[_action]) {
|
|
219
|
+
this[_action] = assert.assertString('action', str);
|
|
216
220
|
}
|
|
217
|
-
|
|
218
|
-
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Request body.
|
|
224
|
+
* In Http it's the request body parsed.
|
|
225
|
+
* @example
|
|
226
|
+
* // original JSON request sent to Kuzzle
|
|
227
|
+
* {
|
|
228
|
+
* controller
|
|
229
|
+
* action,
|
|
230
|
+
* _id,
|
|
231
|
+
* index,
|
|
232
|
+
* collection,
|
|
233
|
+
* jwt,
|
|
234
|
+
* refresh,
|
|
235
|
+
* foobar,
|
|
236
|
+
* volatile,
|
|
237
|
+
* body <== that
|
|
238
|
+
* }
|
|
239
|
+
*/
|
|
240
|
+
get body() {
|
|
241
|
+
return this[_body];
|
|
242
|
+
}
|
|
243
|
+
set body(obj) {
|
|
244
|
+
this[_body] = assert.assertObject('body', obj);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Request headers (Http only).
|
|
248
|
+
*
|
|
249
|
+
* @deprecated Use RequestContext.connection.misc.headers instead
|
|
250
|
+
*/
|
|
251
|
+
get headers() {
|
|
252
|
+
return this[_headers];
|
|
253
|
+
}
|
|
254
|
+
set headers(obj) {
|
|
255
|
+
this[_headers] = assert.assertObject('headers', obj);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Volatile object.
|
|
259
|
+
* @example
|
|
260
|
+
* // original JSON request sent to Kuzzle
|
|
261
|
+
* {
|
|
262
|
+
* controller
|
|
263
|
+
* action,
|
|
264
|
+
* _id,
|
|
265
|
+
* index,
|
|
266
|
+
* collection,
|
|
267
|
+
* jwt,
|
|
268
|
+
* refresh,
|
|
269
|
+
* foobar,
|
|
270
|
+
* volatile, <== that
|
|
271
|
+
* body
|
|
272
|
+
* }
|
|
273
|
+
*/
|
|
274
|
+
get volatile() {
|
|
275
|
+
return this[_volatile];
|
|
276
|
+
}
|
|
277
|
+
set volatile(obj) {
|
|
278
|
+
this[_volatile] = assert.assertObject('volatile', obj);
|
|
219
279
|
}
|
|
220
280
|
}
|
|
221
281
|
exports.RequestInput = RequestInput;
|