remult 0.20.0-exp.5 → 0.20.0-exp.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/esm/server/expressBridge.js +24 -20
- package/package.json +1 -1
- package/server/expressBridge.js +24 -20
|
@@ -618,6 +618,22 @@ export class RemultServerImplementation {
|
|
|
618
618
|
class ExpressRequestBridgeToDataApiRequest {
|
|
619
619
|
constructor(r) {
|
|
620
620
|
this.r = r;
|
|
621
|
+
if (!this.r.query) {
|
|
622
|
+
let query = {};
|
|
623
|
+
getUrlFromReq(this.r).searchParams.forEach((val, key) => {
|
|
624
|
+
let current = query[key];
|
|
625
|
+
if (!current) {
|
|
626
|
+
query[key] = val;
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (Array.isArray(current)) {
|
|
630
|
+
current.push(val);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
query[key] = [current, val];
|
|
634
|
+
});
|
|
635
|
+
this.r.query = query;
|
|
636
|
+
}
|
|
621
637
|
}
|
|
622
638
|
get(key) {
|
|
623
639
|
return this.r.query[key];
|
|
@@ -853,27 +869,8 @@ class RouteImplementation {
|
|
|
853
869
|
}
|
|
854
870
|
middleware(origReq, res, next) {
|
|
855
871
|
const req = this.coreOptions.buildGenericRequest(origReq);
|
|
856
|
-
|
|
857
|
-
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
858
|
-
theUrl = 'http://stam' + theUrl;
|
|
859
|
-
const url = new URL(theUrl);
|
|
872
|
+
const url = getUrlFromReq(req);
|
|
860
873
|
const path = url.pathname;
|
|
861
|
-
if (!req.query) {
|
|
862
|
-
let query = {};
|
|
863
|
-
url.searchParams.forEach((val, key) => {
|
|
864
|
-
let current = query[key];
|
|
865
|
-
if (!current) {
|
|
866
|
-
query[key] = val;
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
if (Array.isArray(current)) {
|
|
870
|
-
current.push(val);
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
query[key] = [current, val];
|
|
874
|
-
});
|
|
875
|
-
req.query = query;
|
|
876
|
-
}
|
|
877
874
|
let lowerPath = path.toLowerCase();
|
|
878
875
|
let m = this.map.get(lowerPath);
|
|
879
876
|
if (m) {
|
|
@@ -942,3 +939,10 @@ JobsInQueueEntity = __decorate([
|
|
|
942
939
|
], JobsInQueueEntity);
|
|
943
940
|
export { JobsInQueueEntity };
|
|
944
941
|
allEntities.splice(allEntities.indexOf(JobsInQueueEntity), 1);
|
|
942
|
+
function getUrlFromReq(req) {
|
|
943
|
+
let theUrl = req.url;
|
|
944
|
+
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
945
|
+
theUrl = 'http://stam' + theUrl;
|
|
946
|
+
const url = new URL(theUrl);
|
|
947
|
+
return url;
|
|
948
|
+
}
|
package/package.json
CHANGED
package/server/expressBridge.js
CHANGED
|
@@ -902,6 +902,22 @@ exports.RemultServerImplementation = RemultServerImplementation;
|
|
|
902
902
|
var ExpressRequestBridgeToDataApiRequest = /** @class */ (function () {
|
|
903
903
|
function ExpressRequestBridgeToDataApiRequest(r) {
|
|
904
904
|
this.r = r;
|
|
905
|
+
if (!this.r.query) {
|
|
906
|
+
var query_1 = {};
|
|
907
|
+
getUrlFromReq(this.r).searchParams.forEach(function (val, key) {
|
|
908
|
+
var current = query_1[key];
|
|
909
|
+
if (!current) {
|
|
910
|
+
query_1[key] = val;
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
if (Array.isArray(current)) {
|
|
914
|
+
current.push(val);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
query_1[key] = [current, val];
|
|
918
|
+
});
|
|
919
|
+
this.r.query = query_1;
|
|
920
|
+
}
|
|
905
921
|
}
|
|
906
922
|
ExpressRequestBridgeToDataApiRequest.prototype.get = function (key) {
|
|
907
923
|
return this.r.query[key];
|
|
@@ -1227,27 +1243,8 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1227
1243
|
};
|
|
1228
1244
|
RouteImplementation.prototype.middleware = function (origReq, res, next) {
|
|
1229
1245
|
var req = this.coreOptions.buildGenericRequest(origReq);
|
|
1230
|
-
var
|
|
1231
|
-
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
1232
|
-
theUrl = 'http://stam' + theUrl;
|
|
1233
|
-
var url = new URL(theUrl);
|
|
1246
|
+
var url = getUrlFromReq(req);
|
|
1234
1247
|
var path = url.pathname;
|
|
1235
|
-
if (!req.query) {
|
|
1236
|
-
var query_1 = {};
|
|
1237
|
-
url.searchParams.forEach(function (val, key) {
|
|
1238
|
-
var current = query_1[key];
|
|
1239
|
-
if (!current) {
|
|
1240
|
-
query_1[key] = val;
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
if (Array.isArray(current)) {
|
|
1244
|
-
current.push(val);
|
|
1245
|
-
return;
|
|
1246
|
-
}
|
|
1247
|
-
query_1[key] = [current, val];
|
|
1248
|
-
});
|
|
1249
|
-
req.query = query_1;
|
|
1250
|
-
}
|
|
1251
1248
|
var lowerPath = path.toLowerCase();
|
|
1252
1249
|
var m = this.map.get(lowerPath);
|
|
1253
1250
|
if (m) {
|
|
@@ -1322,3 +1319,10 @@ var JobsInQueueEntity = /** @class */ (function (_super) {
|
|
|
1322
1319
|
}(id_entity_1.IdEntity));
|
|
1323
1320
|
exports.JobsInQueueEntity = JobsInQueueEntity;
|
|
1324
1321
|
context_1.allEntities.splice(context_1.allEntities.indexOf(JobsInQueueEntity), 1);
|
|
1322
|
+
function getUrlFromReq(req) {
|
|
1323
|
+
var theUrl = req.url;
|
|
1324
|
+
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
1325
|
+
theUrl = 'http://stam' + theUrl;
|
|
1326
|
+
var url = new URL(theUrl);
|
|
1327
|
+
return url;
|
|
1328
|
+
}
|