@lowdefy/server-dev 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 { getSession } from 'next-auth/react';
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(context) {
21
+ async function getServerSession({ req, res }) {
21
22
  if (authJson.configured === true) {
22
- return await getSession(context);
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-dev",
3
- "version": "4.0.0-alpha.23",
3
+ "version": "4.0.0-alpha.24",
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.23",
43
- "@lowdefy/api": "4.0.0-alpha.23",
44
- "@lowdefy/blocks-antd": "4.0.0-alpha.23",
45
- "@lowdefy/blocks-basic": "4.0.0-alpha.23",
46
- "@lowdefy/blocks-color-selectors": "4.0.0-alpha.23",
47
- "@lowdefy/blocks-echarts": "4.0.0-alpha.23",
48
- "@lowdefy/blocks-loaders": "4.0.0-alpha.23",
49
- "@lowdefy/blocks-markdown": "4.0.0-alpha.23",
50
- "@lowdefy/build": "4.0.0-alpha.23",
51
- "@lowdefy/client": "4.0.0-alpha.23",
52
- "@lowdefy/connection-axios-http": "4.0.0-alpha.23",
53
- "@lowdefy/engine": "4.0.0-alpha.23",
54
- "@lowdefy/helpers": "4.0.0-alpha.23",
55
- "@lowdefy/layout": "4.0.0-alpha.23",
56
- "@lowdefy/node-utils": "4.0.0-alpha.23",
57
- "@lowdefy/operators-change-case": "4.0.0-alpha.23",
58
- "@lowdefy/operators-diff": "4.0.0-alpha.23",
59
- "@lowdefy/operators-js": "4.0.0-alpha.23",
60
- "@lowdefy/operators-mql": "4.0.0-alpha.23",
61
- "@lowdefy/operators-nunjucks": "4.0.0-alpha.23",
62
- "@lowdefy/operators-uuid": "4.0.0-alpha.23",
63
- "@lowdefy/operators-yaml": "4.0.0-alpha.23",
64
- "@lowdefy/plugin-next-auth": "4.0.0-alpha.23",
42
+ "@lowdefy/actions-core": "4.0.0-alpha.24",
43
+ "@lowdefy/api": "4.0.0-alpha.24",
44
+ "@lowdefy/blocks-antd": "4.0.0-alpha.24",
45
+ "@lowdefy/blocks-basic": "4.0.0-alpha.24",
46
+ "@lowdefy/blocks-color-selectors": "4.0.0-alpha.24",
47
+ "@lowdefy/blocks-echarts": "4.0.0-alpha.24",
48
+ "@lowdefy/blocks-loaders": "4.0.0-alpha.24",
49
+ "@lowdefy/blocks-markdown": "4.0.0-alpha.24",
50
+ "@lowdefy/build": "4.0.0-alpha.24",
51
+ "@lowdefy/client": "4.0.0-alpha.24",
52
+ "@lowdefy/connection-axios-http": "4.0.0-alpha.24",
53
+ "@lowdefy/engine": "4.0.0-alpha.24",
54
+ "@lowdefy/helpers": "4.0.0-alpha.24",
55
+ "@lowdefy/layout": "4.0.0-alpha.24",
56
+ "@lowdefy/node-utils": "4.0.0-alpha.24",
57
+ "@lowdefy/operators-change-case": "4.0.0-alpha.24",
58
+ "@lowdefy/operators-diff": "4.0.0-alpha.24",
59
+ "@lowdefy/operators-js": "4.0.0-alpha.24",
60
+ "@lowdefy/operators-mql": "4.0.0-alpha.24",
61
+ "@lowdefy/operators-nunjucks": "4.0.0-alpha.24",
62
+ "@lowdefy/operators-uuid": "4.0.0-alpha.24",
63
+ "@lowdefy/operators-yaml": "4.0.0-alpha.24",
64
+ "@lowdefy/plugin-next-auth": "4.0.0-alpha.24",
65
65
  "chokidar": "3.5.3",
66
66
  "dotenv": "16.0.1",
67
67
  "next": "12.1.6",
68
- "next-auth": "4.9.0",
68
+ "next-auth": "4.10.3",
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": "1bb110fb4432267efb199df926bae6bb735209ca"
87
+ "gitHead": "7ae69eeb9a93964e2fb0bf08b7a21bee2636a630"
88
88
  }
@@ -23,16 +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
- // TODO: make createApiContext synchronous
27
- export default async function auth(req, res) {
26
+ export const authOptions = getNextAuthConfig(
27
+ { logger: console }, // TODO: make createApiContext synchronous
28
+ { authJson, plugins: { adapters, callbacks, events, providers } }
29
+ )
30
+
31
+ export default async function auth({ req, res }) {
28
32
  if (authJson.configured === true) {
29
33
  return await NextAuth(
30
34
  req,
31
35
  res,
32
- getNextAuthConfig(
33
- { logger: console },
34
- { authJson, plugins: { adapters, callbacks, events, providers } }
35
- )
36
+ authOptions
36
37
  );
37
38
  }
38
39
 
@@ -18,7 +18,7 @@ import { createApiContext, getPageConfig } from '@lowdefy/api';
18
18
  import getServerSession from '../../../lib/auth/getServerSession.js';
19
19
 
20
20
  export default async function handler(req, res) {
21
- const session = await getServerSession({ req });
21
+ const session = await getServerSession({ req, res });
22
22
  const apiContext = await createApiContext({
23
23
  buildDirectory: './build',
24
24
  logger: console,
@@ -26,7 +26,7 @@ export default async function handler(req, res) {
26
26
  if (req.method !== 'POST') {
27
27
  throw new Error('Only POST requests are supported.');
28
28
  }
29
- const session = await getServerSession({ req });
29
+ const session = await getServerSession({ req, res });
30
30
  const apiContext = await createApiContext({
31
31
  buildDirectory: './build',
32
32
  connections,
package/pages/api/root.js CHANGED
@@ -19,7 +19,7 @@ import { createApiContext, getRootConfig } from '@lowdefy/api';
19
19
  import getServerSession from '../../lib/auth/getServerSession.js';
20
20
 
21
21
  export default async function handler(req, res) {
22
- const session = await getServerSession({ req });
22
+ const session = await getServerSession({ req, res });
23
23
  const apiContext = await createApiContext({
24
24
  buildDirectory: './build',
25
25
  logger: console,