@lowdefy/server 4.0.0-alpha.23 → 4.0.0-alpha.24
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.
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { unstable_getServerSession } from 'next-auth/next';
|
|
18
|
+
import { authOptions } from '../../pages/api/auth/[...nextauth].js';
|
|
18
19
|
import authJson from '../../build/auth.json';
|
|
19
20
|
|
|
20
|
-
async function getServerSession(
|
|
21
|
+
async function getServerSession({ req, res }) {
|
|
21
22
|
if (authJson.configured === true) {
|
|
22
|
-
return await
|
|
23
|
+
return await unstable_getServerSession(req, res, authOptions);
|
|
23
24
|
}
|
|
24
25
|
return undefined;
|
|
25
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.24",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
"next": "next"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lowdefy/actions-core": "4.0.0-alpha.
|
|
46
|
-
"@lowdefy/api": "4.0.0-alpha.
|
|
47
|
-
"@lowdefy/blocks-antd": "4.0.0-alpha.
|
|
48
|
-
"@lowdefy/blocks-basic": "4.0.0-alpha.
|
|
49
|
-
"@lowdefy/blocks-loaders": "4.0.0-alpha.
|
|
50
|
-
"@lowdefy/client": "4.0.0-alpha.
|
|
51
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
52
|
-
"@lowdefy/layout": "4.0.0-alpha.
|
|
53
|
-
"@lowdefy/node-utils": "4.0.0-alpha.
|
|
54
|
-
"@lowdefy/operators-js": "4.0.0-alpha.
|
|
55
|
-
"@lowdefy/plugin-next-auth": "4.0.0-alpha.
|
|
45
|
+
"@lowdefy/actions-core": "4.0.0-alpha.24",
|
|
46
|
+
"@lowdefy/api": "4.0.0-alpha.24",
|
|
47
|
+
"@lowdefy/blocks-antd": "4.0.0-alpha.24",
|
|
48
|
+
"@lowdefy/blocks-basic": "4.0.0-alpha.24",
|
|
49
|
+
"@lowdefy/blocks-loaders": "4.0.0-alpha.24",
|
|
50
|
+
"@lowdefy/client": "4.0.0-alpha.24",
|
|
51
|
+
"@lowdefy/helpers": "4.0.0-alpha.24",
|
|
52
|
+
"@lowdefy/layout": "4.0.0-alpha.24",
|
|
53
|
+
"@lowdefy/node-utils": "4.0.0-alpha.24",
|
|
54
|
+
"@lowdefy/operators-js": "4.0.0-alpha.24",
|
|
55
|
+
"@lowdefy/plugin-next-auth": "4.0.0-alpha.24",
|
|
56
56
|
"next": "12.1.6",
|
|
57
|
-
"next-auth": "4.
|
|
57
|
+
"next-auth": "4.10.3",
|
|
58
58
|
"process": "0.11.10",
|
|
59
59
|
"react": "18.1.0",
|
|
60
60
|
"react-dom": "18.1.0",
|
|
61
61
|
"react-icons": "4.3.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@lowdefy/build": "4.0.0-alpha.
|
|
64
|
+
"@lowdefy/build": "4.0.0-alpha.24",
|
|
65
65
|
"@next/eslint-plugin-next": "12.1.6",
|
|
66
66
|
"less": "4.1.2",
|
|
67
67
|
"less-loader": "11.0.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7ae69eeb9a93964e2fb0bf08b7a21bee2636a630"
|
|
76
76
|
}
|
|
@@ -23,15 +23,17 @@ import callbacks from '../../../build/plugins/auth/callbacks.js';
|
|
|
23
23
|
import events from '../../../build/plugins/auth/events.js';
|
|
24
24
|
import providers from '../../../build/plugins/auth/providers.js';
|
|
25
25
|
|
|
26
|
+
export const authOptions = getNextAuthConfig(
|
|
27
|
+
{ logger: console }, // TODO: make createApiContext synchronous
|
|
28
|
+
{ authJson, plugins: { adapters, callbacks, events, providers } }
|
|
29
|
+
)
|
|
30
|
+
|
|
26
31
|
export default async function auth(req, res) {
|
|
27
32
|
if (authJson.configured === true) {
|
|
28
33
|
return await NextAuth(
|
|
29
34
|
req,
|
|
30
35
|
res,
|
|
31
|
-
|
|
32
|
-
{ logger: console },
|
|
33
|
-
{ authJson, plugins: { adapters, callbacks, events, providers } }
|
|
34
|
-
)
|
|
36
|
+
authOptions
|
|
35
37
|
);
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -28,7 +28,7 @@ export default async function handler(req, res) {
|
|
|
28
28
|
if (req.method !== 'POST') {
|
|
29
29
|
throw new Error('Only POST requests are supported.');
|
|
30
30
|
}
|
|
31
|
-
const session = await getServerSession({ req });
|
|
31
|
+
const session = await getServerSession({ req, res });
|
|
32
32
|
// Important to give absolute path so Next can trace build files
|
|
33
33
|
const apiContext = await createApiContext({
|
|
34
34
|
buildDirectory: path.join(process.cwd(), 'build'),
|