remult 0.16.0-exp.3 → 0.16.0-exp.4
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 +19 -17
- package/package.json +1 -1
- package/server/expressBridge.js +39 -35
|
@@ -153,23 +153,26 @@ class RemultServerImplementation {
|
|
|
153
153
|
let myRes = new ExpressResponseBridgeToDataApiResponse(res, req);
|
|
154
154
|
let remult = new Remult();
|
|
155
155
|
remult.setDataProvider(await this.dataProvider);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
user
|
|
156
|
+
await new Promise(res => {
|
|
157
|
+
remultObjectStorage.run(remult, async () => {
|
|
158
|
+
if (req) {
|
|
159
|
+
let user;
|
|
160
|
+
if (this.options.getUser)
|
|
161
|
+
user = await this.options.getUser(req);
|
|
162
|
+
else {
|
|
163
|
+
user = req['user'];
|
|
164
|
+
if (!user)
|
|
165
|
+
user = req['auth'];
|
|
166
|
+
}
|
|
167
|
+
if (user)
|
|
168
|
+
remult.setUser(user);
|
|
165
169
|
}
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
await what(remult, myReq, myRes, req);
|
|
170
|
+
if (this.options.initRequest) {
|
|
171
|
+
await this.options.initRequest(remult, req);
|
|
172
|
+
}
|
|
173
|
+
await what(remult, myReq, myRes, req);
|
|
174
|
+
res({});
|
|
175
|
+
});
|
|
173
176
|
});
|
|
174
177
|
};
|
|
175
178
|
}
|
|
@@ -177,7 +180,6 @@ class RemultServerImplementation {
|
|
|
177
180
|
async getRemult(req) {
|
|
178
181
|
let remult;
|
|
179
182
|
await this.process(async (c) => {
|
|
180
|
-
console.log("DEBUG ", c);
|
|
181
183
|
remult = c;
|
|
182
184
|
})(req, undefined);
|
|
183
185
|
return remult;
|
package/package.json
CHANGED
package/server/expressBridge.js
CHANGED
|
@@ -234,40 +234,45 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
234
234
|
return [4 /*yield*/, this.dataProvider];
|
|
235
235
|
case 1:
|
|
236
236
|
_b.apply(_a, [_c.sent()]);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
237
|
+
return [4 /*yield*/, new Promise(function (res) {
|
|
238
|
+
remultObjectStorage.run(remult, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
239
|
+
var user;
|
|
240
|
+
return tslib_1.__generator(this, function (_a) {
|
|
241
|
+
switch (_a.label) {
|
|
242
|
+
case 0:
|
|
243
|
+
if (!req) return [3 /*break*/, 4];
|
|
244
|
+
user = void 0;
|
|
245
|
+
if (!this.options.getUser) return [3 /*break*/, 2];
|
|
246
|
+
return [4 /*yield*/, this.options.getUser(req)];
|
|
247
|
+
case 1:
|
|
248
|
+
user = _a.sent();
|
|
249
|
+
return [3 /*break*/, 3];
|
|
250
|
+
case 2:
|
|
251
|
+
user = req['user'];
|
|
252
|
+
if (!user)
|
|
253
|
+
user = req['auth'];
|
|
254
|
+
_a.label = 3;
|
|
255
|
+
case 3:
|
|
256
|
+
if (user)
|
|
257
|
+
remult.setUser(user);
|
|
258
|
+
_a.label = 4;
|
|
259
|
+
case 4:
|
|
260
|
+
if (!this.options.initRequest) return [3 /*break*/, 6];
|
|
261
|
+
return [4 /*yield*/, this.options.initRequest(remult, req)];
|
|
262
|
+
case 5:
|
|
263
|
+
_a.sent();
|
|
264
|
+
_a.label = 6;
|
|
265
|
+
case 6: return [4 /*yield*/, what(remult, myReq, myRes, req)];
|
|
266
|
+
case 7:
|
|
267
|
+
_a.sent();
|
|
268
|
+
res({});
|
|
269
|
+
return [2 /*return*/];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}); });
|
|
273
|
+
})];
|
|
274
|
+
case 2:
|
|
275
|
+
_c.sent();
|
|
271
276
|
return [2 /*return*/];
|
|
272
277
|
}
|
|
273
278
|
});
|
|
@@ -282,7 +287,6 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
282
287
|
switch (_a.label) {
|
|
283
288
|
case 0: return [4 /*yield*/, this.process(function (c) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
284
289
|
return tslib_1.__generator(this, function (_a) {
|
|
285
|
-
console.log("DEBUG ", c);
|
|
286
290
|
remult = c;
|
|
287
291
|
return [2 /*return*/];
|
|
288
292
|
});
|