remult 0.27.17 → 0.27.19-next.0
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/remult-hapi.js +1 -1
- package/esm/remult-nuxt.js +1 -1
- package/esm/remult-sveltekit.js +1 -1
- package/esm/server/remult-api-server.js +7 -2
- package/esm/src/context.js +1 -1
- package/esm/src/remult3/remult3.js +2 -22
- package/package.json +1 -1
- package/remult-hapi.js +1 -1
- package/remult-nuxt.js +1 -1
- package/remult-sveltekit.js +1 -1
- package/server/remult-api-server.js +9 -2
- package/src/context.js +1 -1
- package/src/remult3/remult3.js +2 -22
package/esm/remult-hapi.js
CHANGED
package/esm/remult-nuxt.js
CHANGED
package/esm/remult-sveltekit.js
CHANGED
|
@@ -53,7 +53,7 @@ export function remultSveltekit(options) {
|
|
|
53
53
|
if (sseResponse !== undefined) {
|
|
54
54
|
return sseResponse;
|
|
55
55
|
}
|
|
56
|
-
if (responseFromRemultHandler) {
|
|
56
|
+
if (responseFromRemultHandler !== undefined) {
|
|
57
57
|
if (responseFromRemultHandler.html)
|
|
58
58
|
return new Response(responseFromRemultHandler.html, {
|
|
59
59
|
status: responseFromRemultHandler.statusCode,
|
|
@@ -316,6 +316,8 @@ export class RemultServerImplementation {
|
|
|
316
316
|
user = req['user'];
|
|
317
317
|
if (!user)
|
|
318
318
|
user = req['auth'];
|
|
319
|
+
if (!user?.id)
|
|
320
|
+
user = undefined;
|
|
319
321
|
}
|
|
320
322
|
if (user)
|
|
321
323
|
remult.user = user;
|
|
@@ -333,7 +335,7 @@ export class RemultServerImplementation {
|
|
|
333
335
|
await what(remult, myReq, myRes, genReq, origRes, req);
|
|
334
336
|
}
|
|
335
337
|
finally {
|
|
336
|
-
|
|
338
|
+
remultStatic.asyncContext.setInInitRequest(false);
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
});
|
|
@@ -1019,7 +1021,10 @@ export class RouteImplementation {
|
|
|
1019
1021
|
json(data) {
|
|
1020
1022
|
if (gRes !== undefined)
|
|
1021
1023
|
gRes.json(data);
|
|
1022
|
-
res({
|
|
1024
|
+
res({
|
|
1025
|
+
statusCode: this.statusCode,
|
|
1026
|
+
data,
|
|
1027
|
+
});
|
|
1023
1028
|
}
|
|
1024
1029
|
send(html) {
|
|
1025
1030
|
if (gRes !== undefined)
|
package/esm/src/context.js
CHANGED
|
@@ -85,7 +85,7 @@ export class Remult {
|
|
|
85
85
|
async initUser() {
|
|
86
86
|
const dp = buildRestDataProvider(this.apiClient.httpClient);
|
|
87
87
|
const data = await dp.get(buildFullUrl(this.apiClient.url, 'me'));
|
|
88
|
-
this.user = data
|
|
88
|
+
this.user = data?.id != undefined ? data : undefined;
|
|
89
89
|
return this.user;
|
|
90
90
|
}
|
|
91
91
|
/** Checks if a user was authenticated */
|
|
@@ -19,24 +19,11 @@ export const flags = {
|
|
|
19
19
|
};
|
|
20
20
|
/*p1 - create-remult discussion
|
|
21
21
|
|
|
22
|
-
p1 -
|
|
23
|
-
- yes, `remult.initUser` - the url will be /api/me
|
|
24
|
-
- ask to add a todo example
|
|
22
|
+
p1 - ask to add a todo example
|
|
25
23
|
- admin question
|
|
26
24
|
- ask to add a user table + password hash
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
- test angular with auth
|
|
30
|
-
- check nextauth if the env variable should be called NEXTAUTH_SECRET or just AUTH_SECRET
|
|
31
|
-
/** @type {import('next').NextConfig}
|
|
32
|
-
const nextConfig = {
|
|
33
|
-
experimental: {
|
|
34
|
-
serverComponentsExternalPackages: ["knex"],
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default nextConfig;
|
|
39
|
-
|
|
26
|
+
|
|
40
27
|
p1 - Landing page:
|
|
41
28
|
- p2 include the selections (react,vite, postgres,auth)
|
|
42
29
|
- include server is alive test (remind to run dev-node)
|
|
@@ -48,13 +35,6 @@ export default nextConfig;
|
|
|
48
35
|
- the selections
|
|
49
36
|
- how to run dev
|
|
50
37
|
- which environment variables to set
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- should we add admin? ensureSchema:false etc...
|
|
54
|
-
- should we read existing database?
|
|
55
|
-
- knex issue with next
|
|
56
|
-
|
|
57
|
-
|
|
58
38
|
*/
|
|
59
39
|
//p1 - add aggregate to query
|
|
60
40
|
//p1 - add parameter all to deleteMany, and updateMany
|
package/package.json
CHANGED
package/remult-hapi.js
CHANGED
|
@@ -40,7 +40,7 @@ function remultHapi(options) {
|
|
|
40
40
|
res(h.response(html).code(status));
|
|
41
41
|
},
|
|
42
42
|
json: function (data) {
|
|
43
|
-
res(h.response(data).code(status));
|
|
43
|
+
res(h.response(data === null ? 'null' : data).code(status));
|
|
44
44
|
},
|
|
45
45
|
write: function (data) {
|
|
46
46
|
stream.write(data);
|
package/remult-nuxt.js
CHANGED
|
@@ -62,7 +62,7 @@ function remultNuxt(options) {
|
|
|
62
62
|
(0, h3_1.setResponseStatus)(event, r.statusCode);
|
|
63
63
|
if (r.html)
|
|
64
64
|
return [2 /*return*/, r.html];
|
|
65
|
-
return [2 /*return*/, r.data];
|
|
65
|
+
return [2 /*return*/, r.data == null ? 'null' : r.data];
|
|
66
66
|
}
|
|
67
67
|
return [2 /*return*/];
|
|
68
68
|
}
|
package/remult-sveltekit.js
CHANGED
|
@@ -75,7 +75,7 @@ function remultSveltekit(options) {
|
|
|
75
75
|
if (sseResponse !== undefined) {
|
|
76
76
|
return [2 /*return*/, sseResponse];
|
|
77
77
|
}
|
|
78
|
-
if (responseFromRemultHandler) {
|
|
78
|
+
if (responseFromRemultHandler !== undefined) {
|
|
79
79
|
if (responseFromRemultHandler.html)
|
|
80
80
|
return [2 /*return*/, new Response(responseFromRemultHandler.html, {
|
|
81
81
|
status: responseFromRemultHandler.statusCode,
|
|
@@ -611,6 +611,8 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
611
611
|
user = req['user'];
|
|
612
612
|
if (!user)
|
|
613
613
|
user = req['auth'];
|
|
614
|
+
if (!(user === null || user === void 0 ? void 0 : user.id))
|
|
615
|
+
user = undefined;
|
|
614
616
|
_a.label = 4;
|
|
615
617
|
case 4:
|
|
616
618
|
if (user)
|
|
@@ -632,7 +634,9 @@ var RemultServerImplementation = /** @class */ (function () {
|
|
|
632
634
|
case 7:
|
|
633
635
|
_a.sent();
|
|
634
636
|
return [3 /*break*/, 9];
|
|
635
|
-
case 8:
|
|
637
|
+
case 8:
|
|
638
|
+
remult_static_js_1.remultStatic.asyncContext.setInInitRequest(false);
|
|
639
|
+
return [7 /*endfinally*/];
|
|
636
640
|
case 9: return [2 /*return*/];
|
|
637
641
|
}
|
|
638
642
|
});
|
|
@@ -1467,7 +1471,10 @@ var RouteImplementation = /** @class */ (function () {
|
|
|
1467
1471
|
class_1.prototype.json = function (data) {
|
|
1468
1472
|
if (gRes !== undefined)
|
|
1469
1473
|
gRes.json(data);
|
|
1470
|
-
res({
|
|
1474
|
+
res({
|
|
1475
|
+
statusCode: this.statusCode,
|
|
1476
|
+
data: data,
|
|
1477
|
+
});
|
|
1471
1478
|
};
|
|
1472
1479
|
class_1.prototype.send = function (html) {
|
|
1473
1480
|
if (gRes !== undefined)
|
package/src/context.js
CHANGED
|
@@ -148,7 +148,7 @@ var Remult = /** @class */ (function () {
|
|
|
148
148
|
return [4 /*yield*/, dp.get((0, rest_data_provider_js_1.buildFullUrl)(this.apiClient.url, 'me'))];
|
|
149
149
|
case 1:
|
|
150
150
|
data = _a.sent();
|
|
151
|
-
this.user = data
|
|
151
|
+
this.user = (data === null || data === void 0 ? void 0 : data.id) != undefined ? data : undefined;
|
|
152
152
|
return [2 /*return*/, this.user];
|
|
153
153
|
}
|
|
154
154
|
});
|
package/src/remult3/remult3.js
CHANGED
|
@@ -22,24 +22,11 @@ exports.flags = {
|
|
|
22
22
|
};
|
|
23
23
|
/*p1 - create-remult discussion
|
|
24
24
|
|
|
25
|
-
p1 -
|
|
26
|
-
- yes, `remult.initUser` - the url will be /api/me
|
|
27
|
-
- ask to add a todo example
|
|
25
|
+
p1 - ask to add a todo example
|
|
28
26
|
- admin question
|
|
29
27
|
- ask to add a user table + password hash
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
- test angular with auth
|
|
33
|
-
- check nextauth if the env variable should be called NEXTAUTH_SECRET or just AUTH_SECRET
|
|
34
|
-
/** @type {import('next').NextConfig}
|
|
35
|
-
const nextConfig = {
|
|
36
|
-
experimental: {
|
|
37
|
-
serverComponentsExternalPackages: ["knex"],
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default nextConfig;
|
|
42
|
-
|
|
29
|
+
|
|
43
30
|
p1 - Landing page:
|
|
44
31
|
- p2 include the selections (react,vite, postgres,auth)
|
|
45
32
|
- include server is alive test (remind to run dev-node)
|
|
@@ -51,13 +38,6 @@ export default nextConfig;
|
|
|
51
38
|
- the selections
|
|
52
39
|
- how to run dev
|
|
53
40
|
- which environment variables to set
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- should we add admin? ensureSchema:false etc...
|
|
57
|
-
- should we read existing database?
|
|
58
|
-
- knex issue with next
|
|
59
|
-
|
|
60
|
-
|
|
61
41
|
*/
|
|
62
42
|
//p1 - add aggregate to query
|
|
63
43
|
//p1 - add parameter all to deleteMany, and updateMany
|