@webtypen/webframez-core 0.0.47 → 0.0.49
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/ConsoleApplication.js +5 -1
- package/lib/Router/Router.js +19 -12
- package/package.json +1 -1
- package/src/ConsoleApplication.ts +6 -1
- package/src/Router/Router.ts +22 -14
|
@@ -51,7 +51,11 @@ class ConsoleApplication {
|
|
|
51
51
|
}
|
|
52
52
|
consoleCommand.action(() => __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
const service = yield new command();
|
|
54
|
-
|
|
54
|
+
const result = yield service.handle();
|
|
55
|
+
if (options && options.onEnd) {
|
|
56
|
+
yield options.onEnd(command.signature);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
55
59
|
}));
|
|
56
60
|
program.addCommand(consoleCommand);
|
|
57
61
|
}
|
package/lib/Router/Router.js
CHANGED
|
@@ -190,8 +190,12 @@ class RouterFacade {
|
|
|
190
190
|
if (!req && this.mode === "aws-lambda" && options && options.event) {
|
|
191
191
|
customRequest = {
|
|
192
192
|
method: options.event.requestContext.http.method,
|
|
193
|
-
url: options.event.
|
|
193
|
+
url: options.event.rawPath +
|
|
194
|
+
(options.event.rawQueryString && options.event.rawQueryString.trim() !== '' ?
|
|
195
|
+
"?" + options.event.rawQueryString
|
|
196
|
+
: ""),
|
|
194
197
|
headers: options.event.headers,
|
|
198
|
+
urlParams: options.event.queryStringParameters ? options.event.queryStringParameters : {},
|
|
195
199
|
};
|
|
196
200
|
}
|
|
197
201
|
if (!this.kernel) {
|
|
@@ -223,16 +227,18 @@ class RouterFacade {
|
|
|
223
227
|
})
|
|
224
228
|
: null;
|
|
225
229
|
const urlParams = {};
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
if (!customRequest) {
|
|
231
|
+
if (req && req.url && req.url.indexOf("?") > 0) {
|
|
232
|
+
const temp = req.url.substring(req.url.indexOf("?") + 1);
|
|
233
|
+
if (temp && temp.trim() !== "") {
|
|
234
|
+
const entries = temp.split("&");
|
|
235
|
+
for (let entry of entries) {
|
|
236
|
+
if (entry.indexOf("=") > 0) {
|
|
237
|
+
urlParams[entry.substring(0, entry.indexOf("="))] = entry.substring(entry.indexOf("=") + 1);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
urlParams[entry] = true;
|
|
241
|
+
}
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
}
|
|
@@ -251,7 +257,8 @@ class RouterFacade {
|
|
|
251
257
|
: {},
|
|
252
258
|
bodyPlain: bodyPlain,
|
|
253
259
|
params: route && route.params ? route.params : {},
|
|
254
|
-
|
|
260
|
+
url: customRequest.url,
|
|
261
|
+
urlParams: customRequest.urlParams,
|
|
255
262
|
headers: customRequest.headers,
|
|
256
263
|
method: customRequest.method,
|
|
257
264
|
}
|
package/package.json
CHANGED
|
@@ -45,7 +45,12 @@ export class ConsoleApplication {
|
|
|
45
45
|
}
|
|
46
46
|
consoleCommand.action(async () => {
|
|
47
47
|
const service = await new command();
|
|
48
|
-
|
|
48
|
+
const result = await service.handle();
|
|
49
|
+
|
|
50
|
+
if (options && options.onEnd) {
|
|
51
|
+
await options.onEnd(command.signature);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
49
54
|
});
|
|
50
55
|
program.addCommand(consoleCommand);
|
|
51
56
|
}
|
package/src/Router/Router.ts
CHANGED
|
@@ -227,8 +227,14 @@ class RouterFacade {
|
|
|
227
227
|
if (!req && this.mode === "aws-lambda" && options && options.event) {
|
|
228
228
|
customRequest = {
|
|
229
229
|
method: options.event.requestContext.http.method,
|
|
230
|
-
url:
|
|
230
|
+
url:
|
|
231
|
+
options.event.rawPath +
|
|
232
|
+
(options.event.rawQueryString && options.event.rawQueryString.trim() !== '' ?
|
|
233
|
+
"?" + options.event.rawQueryString
|
|
234
|
+
: ""
|
|
235
|
+
),
|
|
231
236
|
headers: options.event.headers,
|
|
237
|
+
urlParams: options.event.queryStringParameters ? options.event.queryStringParameters : {},
|
|
232
238
|
};
|
|
233
239
|
}
|
|
234
240
|
|
|
@@ -267,17 +273,19 @@ class RouterFacade {
|
|
|
267
273
|
: null;
|
|
268
274
|
|
|
269
275
|
const urlParams: any = {};
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
entry.indexOf("=")
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
if (!customRequest) {
|
|
277
|
+
if (req && req.url && req.url.indexOf("?") > 0) {
|
|
278
|
+
const temp = req.url.substring(req.url.indexOf("?") + 1);
|
|
279
|
+
if (temp && temp.trim() !== "") {
|
|
280
|
+
const entries = temp.split("&");
|
|
281
|
+
for (let entry of entries) {
|
|
282
|
+
if (entry.indexOf("=") > 0) {
|
|
283
|
+
urlParams[entry.substring(0, entry.indexOf("="))] = entry.substring(
|
|
284
|
+
entry.indexOf("=") + 1
|
|
285
|
+
);
|
|
286
|
+
} else {
|
|
287
|
+
urlParams[entry] = true;
|
|
288
|
+
}
|
|
281
289
|
}
|
|
282
290
|
}
|
|
283
291
|
}
|
|
@@ -299,10 +307,10 @@ class RouterFacade {
|
|
|
299
307
|
: bodyPlain
|
|
300
308
|
)
|
|
301
309
|
: {},
|
|
302
|
-
|
|
303
310
|
bodyPlain: bodyPlain,
|
|
304
311
|
params: route && route.params ? route.params : {},
|
|
305
|
-
|
|
312
|
+
url: customRequest.url,
|
|
313
|
+
urlParams: customRequest.urlParams,
|
|
306
314
|
headers: customRequest.headers,
|
|
307
315
|
method: customRequest.method,
|
|
308
316
|
}
|