@lowdefy/server-dev 4.0.0-alpha.15 → 4.0.0-alpha.18
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/utils/waitForRestartedServer.js +7 -1
- package/manager/run.mjs +1 -0
- package/next.config.js +1 -1
- package/package.json +26 -26
- package/pages/api/auth/[...nextauth].js +17 -1
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
import request from './request.js';
|
|
18
18
|
|
|
19
|
+
const MAX_COUNT = 1200; // 10 mins
|
|
20
|
+
|
|
19
21
|
function waitForRestartedServer(basePath) {
|
|
22
|
+
let count = 0;
|
|
20
23
|
setTimeout(async () => {
|
|
21
24
|
try {
|
|
22
25
|
await request({
|
|
@@ -24,7 +27,10 @@ function waitForRestartedServer(basePath) {
|
|
|
24
27
|
});
|
|
25
28
|
window.location.reload();
|
|
26
29
|
} catch (error) {
|
|
27
|
-
|
|
30
|
+
count += 1;
|
|
31
|
+
if (count <= MAX_COUNT) {
|
|
32
|
+
waitForRestartedServer(basePath);
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
}, 500); // TODO: this ping should be shorter than rerender delay until we can pass a rebuild flag to reload.
|
|
30
36
|
}
|
package/manager/run.mjs
CHANGED
|
@@ -81,6 +81,7 @@ async function run() {
|
|
|
81
81
|
const serverPromise = startServer(context);
|
|
82
82
|
await wait(800);
|
|
83
83
|
if (process.env.LOWDEFY_SERVER_DEV_OPEN_BROWSER === 'true') {
|
|
84
|
+
// TODO: Wait 1 sec for a ping and don't open if a ping is seen
|
|
84
85
|
opener(`http://localhost:${context.options.port}`);
|
|
85
86
|
}
|
|
86
87
|
await serverPromise;
|
package/next.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -39,33 +39,33 @@
|
|
|
39
39
|
"next": "next"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lowdefy/actions-core": "4.0.0-alpha.
|
|
43
|
-
"@lowdefy/api": "4.0.0-alpha.
|
|
44
|
-
"@lowdefy/blocks-antd": "4.0.0-alpha.
|
|
45
|
-
"@lowdefy/blocks-basic": "4.0.0-alpha.
|
|
46
|
-
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.
|
|
47
|
-
"@lowdefy/blocks-echarts": "4.0.0-alpha.
|
|
48
|
-
"@lowdefy/blocks-loaders": "4.0.0-alpha.
|
|
49
|
-
"@lowdefy/blocks-markdown": "4.0.0-alpha.
|
|
50
|
-
"@lowdefy/build": "4.0.0-alpha.
|
|
51
|
-
"@lowdefy/client": "4.0.0-alpha.
|
|
52
|
-
"@lowdefy/connection-axios-http": "4.0.0-alpha.
|
|
53
|
-
"@lowdefy/engine": "4.0.0-alpha.
|
|
54
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
55
|
-
"@lowdefy/layout": "4.0.0-alpha.
|
|
56
|
-
"@lowdefy/node-utils": "4.0.0-alpha.
|
|
57
|
-
"@lowdefy/operators-change-case": "4.0.0-alpha.
|
|
58
|
-
"@lowdefy/operators-diff": "4.0.0-alpha.
|
|
59
|
-
"@lowdefy/operators-js": "4.0.0-alpha.
|
|
60
|
-
"@lowdefy/operators-mql": "4.0.0-alpha.
|
|
61
|
-
"@lowdefy/operators-nunjucks": "4.0.0-alpha.
|
|
62
|
-
"@lowdefy/operators-uuid": "4.0.0-alpha.
|
|
63
|
-
"@lowdefy/operators-yaml": "4.0.0-alpha.
|
|
64
|
-
"@lowdefy/plugin-next-auth": "4.0.0-alpha.
|
|
42
|
+
"@lowdefy/actions-core": "4.0.0-alpha.18",
|
|
43
|
+
"@lowdefy/api": "4.0.0-alpha.18",
|
|
44
|
+
"@lowdefy/blocks-antd": "4.0.0-alpha.18",
|
|
45
|
+
"@lowdefy/blocks-basic": "4.0.0-alpha.18",
|
|
46
|
+
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.18",
|
|
47
|
+
"@lowdefy/blocks-echarts": "4.0.0-alpha.18",
|
|
48
|
+
"@lowdefy/blocks-loaders": "4.0.0-alpha.18",
|
|
49
|
+
"@lowdefy/blocks-markdown": "4.0.0-alpha.18",
|
|
50
|
+
"@lowdefy/build": "4.0.0-alpha.18",
|
|
51
|
+
"@lowdefy/client": "4.0.0-alpha.18",
|
|
52
|
+
"@lowdefy/connection-axios-http": "4.0.0-alpha.18",
|
|
53
|
+
"@lowdefy/engine": "4.0.0-alpha.18",
|
|
54
|
+
"@lowdefy/helpers": "4.0.0-alpha.18",
|
|
55
|
+
"@lowdefy/layout": "4.0.0-alpha.18",
|
|
56
|
+
"@lowdefy/node-utils": "4.0.0-alpha.18",
|
|
57
|
+
"@lowdefy/operators-change-case": "4.0.0-alpha.18",
|
|
58
|
+
"@lowdefy/operators-diff": "4.0.0-alpha.18",
|
|
59
|
+
"@lowdefy/operators-js": "4.0.0-alpha.18",
|
|
60
|
+
"@lowdefy/operators-mql": "4.0.0-alpha.18",
|
|
61
|
+
"@lowdefy/operators-nunjucks": "4.0.0-alpha.18",
|
|
62
|
+
"@lowdefy/operators-uuid": "4.0.0-alpha.18",
|
|
63
|
+
"@lowdefy/operators-yaml": "4.0.0-alpha.18",
|
|
64
|
+
"@lowdefy/plugin-next-auth": "4.0.0-alpha.18",
|
|
65
65
|
"chokidar": "3.5.3",
|
|
66
66
|
"dotenv": "16.0.1",
|
|
67
67
|
"next": "12.1.6",
|
|
68
|
-
"next-auth": "4.
|
|
68
|
+
"next-auth": "4.5.0",
|
|
69
69
|
"opener": "1.5.2",
|
|
70
70
|
"process": "0.11.10",
|
|
71
71
|
"react": "18.1.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "9ba94a9ab39be2a165b3a58043fbb33f26b48ae3"
|
|
88
88
|
}
|
|
@@ -22,4 +22,20 @@ import callbacks from '../../../build/plugins/auth/callbacks.js';
|
|
|
22
22
|
import events from '../../../build/plugins/auth/events.js';
|
|
23
23
|
import providers from '../../../build/plugins/auth/providers.js';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// TODO: make createApiContext synchronous
|
|
26
|
+
export default async function auth(req, res) {
|
|
27
|
+
if (authJson.configured === true) {
|
|
28
|
+
return await NextAuth(
|
|
29
|
+
req,
|
|
30
|
+
res,
|
|
31
|
+
getNextAuthConfig(
|
|
32
|
+
{ logger: console },
|
|
33
|
+
{ authJson, plugins: { callbacks, events, providers } }
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return res.status(404).json({
|
|
39
|
+
message: 'Auth not configured',
|
|
40
|
+
});
|
|
41
|
+
}
|