@grandlinex/kernel 1.3.6 → 1.3.7

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.
@@ -118,6 +118,18 @@ class BaseAction extends core_1.CoreAction {
118
118
  });
119
119
  }
120
120
  async secureHandler(req, res, next) {
121
+ const xPath = {};
122
+ Object.entries(req.params).forEach(([k, v]) => {
123
+ if (typeof v === 'string') {
124
+ xPath[k] = v;
125
+ }
126
+ });
127
+ const xQuery = {};
128
+ Object.entries(req.query).forEach(([k, v]) => {
129
+ if (typeof v === 'string' || v === undefined) {
130
+ xQuery[k] = v;
131
+ }
132
+ });
121
133
  const extension = this.initExtension(res);
122
134
  const auth = extension.timing.start('auth');
123
135
  res.on('finish', () => {
@@ -155,6 +167,8 @@ class BaseAction extends core_1.CoreAction {
155
167
  extension,
156
168
  agent: new BaseUserAgent_js_1.BaseUserAgent(req),
157
169
  body,
170
+ path: xPath,
171
+ query: xQuery,
158
172
  sendError: (code, error) => BaseAction.sendError(res, code, error),
159
173
  });
160
174
  }
@@ -192,6 +206,8 @@ class BaseAction extends core_1.CoreAction {
192
206
  extension,
193
207
  agent: new BaseUserAgent_js_1.BaseUserAgent(req),
194
208
  body,
209
+ path: xPath,
210
+ query: xQuery,
195
211
  sendError: (code, error) => BaseAction.sendError(res, code, error),
196
212
  });
197
213
  }
@@ -226,6 +242,8 @@ class BaseAction extends core_1.CoreAction {
226
242
  extension,
227
243
  agent: new BaseUserAgent_js_1.BaseUserAgent(req),
228
244
  body,
245
+ path: xPath,
246
+ query: xQuery,
229
247
  sendError: (code, error) => BaseAction.sendError(res, code, error),
230
248
  });
231
249
  }
@@ -6,11 +6,15 @@ export type XRequest = express.Request & {
6
6
  };
7
7
  export type XResponse = express.Response;
8
8
  export type XNextFc = express.NextFunction;
9
+ export type XPath = Record<string, string>;
10
+ export type XQuery = Record<string, string | undefined>;
9
11
  export type XActionEvent<G = JwtToken | null, B = any> = {
10
12
  req: XRequest;
11
13
  res: XResponse;
12
14
  next: XNextFc;
13
15
  data: G;
16
+ path: XPath;
17
+ query: XQuery;
14
18
  extension: IExtensionInterface;
15
19
  agent: BaseUserAgent;
16
20
  body: B;
@@ -116,6 +116,18 @@ export default class BaseAction extends CoreAction {
116
116
  });
117
117
  }
118
118
  async secureHandler(req, res, next) {
119
+ const xPath = {};
120
+ Object.entries(req.params).forEach(([k, v]) => {
121
+ if (typeof v === 'string') {
122
+ xPath[k] = v;
123
+ }
124
+ });
125
+ const xQuery = {};
126
+ Object.entries(req.query).forEach(([k, v]) => {
127
+ if (typeof v === 'string' || v === undefined) {
128
+ xQuery[k] = v;
129
+ }
130
+ });
119
131
  const extension = this.initExtension(res);
120
132
  const auth = extension.timing.start('auth');
121
133
  res.on('finish', () => {
@@ -153,6 +165,8 @@ export default class BaseAction extends CoreAction {
153
165
  extension,
154
166
  agent: new BaseUserAgent(req),
155
167
  body,
168
+ path: xPath,
169
+ query: xQuery,
156
170
  sendError: (code, error) => BaseAction.sendError(res, code, error),
157
171
  });
158
172
  }
@@ -190,6 +204,8 @@ export default class BaseAction extends CoreAction {
190
204
  extension,
191
205
  agent: new BaseUserAgent(req),
192
206
  body,
207
+ path: xPath,
208
+ query: xQuery,
193
209
  sendError: (code, error) => BaseAction.sendError(res, code, error),
194
210
  });
195
211
  }
@@ -224,6 +240,8 @@ export default class BaseAction extends CoreAction {
224
240
  extension,
225
241
  agent: new BaseUserAgent(req),
226
242
  body,
243
+ path: xPath,
244
+ query: xQuery,
227
245
  sendError: (code, error) => BaseAction.sendError(res, code, error),
228
246
  });
229
247
  }
@@ -6,11 +6,15 @@ export type XRequest = express.Request & {
6
6
  };
7
7
  export type XResponse = express.Response;
8
8
  export type XNextFc = express.NextFunction;
9
+ export type XPath = Record<string, string>;
10
+ export type XQuery = Record<string, string | undefined>;
9
11
  export type XActionEvent<G = JwtToken | null, B = any> = {
10
12
  req: XRequest;
11
13
  res: XResponse;
12
14
  next: XNextFc;
13
15
  data: G;
16
+ path: XPath;
17
+ query: XQuery;
14
18
  extension: IExtensionInterface;
15
19
  agent: BaseUserAgent;
16
20
  body: B;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grandlinex/kernel",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "GrandLineX is an out-of-the-box server framework on top of ExpressJs.",
5
5
  "type": "module",
6
6
  "exports": {