@lowdefy/server 5.1.0 → 5.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -38,20 +38,21 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@ant-design/cssinjs": "2.1.2",
41
- "@lowdefy/actions-core": "5.1.0",
42
- "@lowdefy/api": "5.1.0",
43
- "@lowdefy/block-utils": "5.1.0",
44
- "@lowdefy/blocks-antd": "5.1.0",
45
- "@lowdefy/blocks-basic": "5.1.0",
46
- "@lowdefy/blocks-loaders": "5.1.0",
47
- "@lowdefy/client": "5.1.0",
48
- "@lowdefy/errors": "5.1.0",
49
- "@lowdefy/helpers": "5.1.0",
50
- "@lowdefy/layout": "5.1.0",
51
- "@lowdefy/logger": "5.1.0",
52
- "@lowdefy/node-utils": "5.1.0",
53
- "@lowdefy/operators-js": "5.1.0",
54
- "@lowdefy/plugin-next-auth": "5.1.0",
41
+ "@lowdefy/actions-core": "5.2.0",
42
+ "@lowdefy/api": "5.2.0",
43
+ "@lowdefy/block-utils": "5.2.0",
44
+ "@lowdefy/blocks-antd": "5.2.0",
45
+ "@lowdefy/blocks-basic": "5.2.0",
46
+ "@lowdefy/blocks-loaders": "5.2.0",
47
+ "@lowdefy/blocks-tiptap": "5.2.0",
48
+ "@lowdefy/client": "5.2.0",
49
+ "@lowdefy/errors": "5.2.0",
50
+ "@lowdefy/helpers": "5.2.0",
51
+ "@lowdefy/layout": "5.2.0",
52
+ "@lowdefy/logger": "5.2.0",
53
+ "@lowdefy/node-utils": "5.2.0",
54
+ "@lowdefy/operators-js": "5.2.0",
55
+ "@lowdefy/plugin-next-auth": "5.2.0",
55
56
  "@sentry/nextjs": "8.53.0",
56
57
  "@tailwindcss/postcss": "4.2.1",
57
58
  "antd": "6.3.1",
@@ -66,7 +67,7 @@
66
67
  "uuid": "13.0.0"
67
68
  },
68
69
  "devDependencies": {
69
- "@lowdefy/build": "5.1.0",
70
+ "@lowdefy/build": "5.2.0",
70
71
  "@next/eslint-plugin-next": "16.1.6",
71
72
  "@tailwindcss/postcss": "4.2.1",
72
73
  "tailwindcss": "4.2.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -48,20 +48,21 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@ant-design/cssinjs": "2.1.2",
51
- "@lowdefy/actions-core": "5.1.0",
52
- "@lowdefy/api": "5.1.0",
53
- "@lowdefy/block-utils": "5.1.0",
54
- "@lowdefy/blocks-antd": "5.1.0",
55
- "@lowdefy/blocks-basic": "5.1.0",
56
- "@lowdefy/blocks-loaders": "5.1.0",
57
- "@lowdefy/client": "5.1.0",
58
- "@lowdefy/errors": "5.1.0",
59
- "@lowdefy/helpers": "5.1.0",
60
- "@lowdefy/layout": "5.1.0",
61
- "@lowdefy/logger": "5.1.0",
62
- "@lowdefy/node-utils": "5.1.0",
63
- "@lowdefy/operators-js": "5.1.0",
64
- "@lowdefy/plugin-next-auth": "5.1.0",
51
+ "@lowdefy/actions-core": "5.2.0",
52
+ "@lowdefy/api": "5.2.0",
53
+ "@lowdefy/block-utils": "5.2.0",
54
+ "@lowdefy/blocks-antd": "5.2.0",
55
+ "@lowdefy/blocks-basic": "5.2.0",
56
+ "@lowdefy/blocks-loaders": "5.2.0",
57
+ "@lowdefy/blocks-tiptap": "5.2.0",
58
+ "@lowdefy/client": "5.2.0",
59
+ "@lowdefy/errors": "5.2.0",
60
+ "@lowdefy/helpers": "5.2.0",
61
+ "@lowdefy/layout": "5.2.0",
62
+ "@lowdefy/logger": "5.2.0",
63
+ "@lowdefy/node-utils": "5.2.0",
64
+ "@lowdefy/operators-js": "5.2.0",
65
+ "@lowdefy/plugin-next-auth": "5.2.0",
65
66
  "@sentry/nextjs": "8.53.0",
66
67
  "@tailwindcss/postcss": "4.2.1",
67
68
  "antd": "6.3.1",
@@ -76,7 +77,7 @@
76
77
  "uuid": "13.0.0"
77
78
  },
78
79
  "devDependencies": {
79
- "@lowdefy/build": "5.1.0",
80
+ "@lowdefy/build": "5.2.0",
80
81
  "@next/eslint-plugin-next": "16.1.6",
81
82
  "@tailwindcss/postcss": "4.2.1",
82
83
  "tailwindcss": "4.2.1",
@@ -87,6 +88,11 @@
87
88
  "engines": {
88
89
  "node": ">=18"
89
90
  },
91
+ "pnpm": {
92
+ "onlyBuiltDependencies": [
93
+ "better-sqlite3"
94
+ ]
95
+ },
90
96
  "publishConfig": {
91
97
  "access": "public"
92
98
  }
@@ -20,8 +20,42 @@ import serverSidePropsWrapper from '../lib/server/serverSidePropsWrapper.js';
20
20
  import Page from '../lib/client/Page.js';
21
21
 
22
22
  async function getServerSidePropsHandler({ context, nextContext }) {
23
- const { pageId } = nextContext.params;
23
+ const segments = nextContext.params.pageId ?? [];
24
+ const pageId = segments.join('/');
24
25
  const { logger, session } = context;
26
+
27
+ if (!pageId) {
28
+ const rootConfig = await getRootConfig(context);
29
+ const { home } = rootConfig;
30
+ if (home.configured === false) {
31
+ logger.info({ event: 'redirect_to_homepage', pageId: home.pageId });
32
+ return {
33
+ redirect: {
34
+ destination: `/${home.pageId}`,
35
+ permanent: false,
36
+ },
37
+ };
38
+ }
39
+ const pageConfig = await getPageConfig(context, { pageId: home.pageId });
40
+ if (!pageConfig) {
41
+ logger.info({ event: 'redirect_page_not_found', pageId: home.pageId });
42
+ return {
43
+ redirect: {
44
+ destination: '/404',
45
+ permanent: false,
46
+ },
47
+ };
48
+ }
49
+ logger.info({ event: 'page_view', pageId: home.pageId });
50
+ return {
51
+ props: {
52
+ pageConfig,
53
+ rootConfig,
54
+ session,
55
+ },
56
+ };
57
+ }
58
+
25
59
  const [rootConfig, pageConfig] = await Promise.all([
26
60
  getRootConfig(context),
27
61
  getPageConfig(context, { pageId }),
@@ -22,7 +22,7 @@ async function handler({ context, req, res }) {
22
22
  if (req.method !== 'POST') {
23
23
  throw new Error('Only POST requests are supported.');
24
24
  }
25
- const { endpointId } = req.query;
25
+ const endpointId = req.query.endpointId.join('/');
26
26
  const { blockId, payload, pageId } = req.body;
27
27
  context.logger.info({ event: 'call_api_endpoint', blockId, endpointId, pageId });
28
28
  const response = await callEndpoint(context, { blockId, endpointId, pageId, payload });
@@ -16,13 +16,19 @@
16
16
 
17
17
  import { callRequest } from '@lowdefy/api';
18
18
 
19
- import apiWrapper from '../../../../lib/server/apiWrapper.js';
19
+ import apiWrapper from '../../../lib/server/apiWrapper.js';
20
20
 
21
21
  async function handler({ context, req, res }) {
22
22
  if (req.method !== 'POST') {
23
23
  throw new Error('Only POST requests are supported.');
24
24
  }
25
- const { pageId, requestId } = req.query;
25
+ const segments = req.query.path;
26
+ if (!Array.isArray(segments) || segments.length < 2) {
27
+ res.status(400).json({ error: 'Invalid request path' });
28
+ return;
29
+ }
30
+ const requestId = segments[segments.length - 1];
31
+ const pageId = segments.slice(0, -1).join('/');
26
32
  const { actionId, blockId, payload } = req.body;
27
33
  context.logger.info({ event: 'call_request', pageId, requestId, blockId, actionId });
28
34
  const response = await callRequest(context, { blockId, pageId, payload, requestId });
package/pages/index.js DELETED
@@ -1,57 +0,0 @@
1
- /*
2
- Copyright 2020-2026 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import { getPageConfig, getRootConfig } from '@lowdefy/api';
18
-
19
- import serverSidePropsWrapper from '../lib/server/serverSidePropsWrapper.js';
20
- import Page from '../lib/client/Page.js';
21
-
22
- async function getServerSidePropsHandler({ context }) {
23
- const rootConfig = await getRootConfig(context);
24
- const { home } = rootConfig;
25
- const { logger, session } = context;
26
- if (home.configured === false) {
27
- logger.info({ event: 'redirect_to_homepage', pageId: home.pageId });
28
- return {
29
- redirect: {
30
- destination: `/${home.pageId}`,
31
- permanent: false,
32
- },
33
- };
34
- }
35
- const pageConfig = await getPageConfig(context, { pageId: home.pageId });
36
- if (!pageConfig) {
37
- logger.info({ event: 'redirect_page_not_found', pageId: home.pageId });
38
- return {
39
- redirect: {
40
- destination: '/404',
41
- permanent: false,
42
- },
43
- };
44
- }
45
- logger.info({ event: 'page_view', pageId: home.pageId });
46
- return {
47
- props: {
48
- pageConfig,
49
- rootConfig,
50
- session,
51
- },
52
- };
53
- }
54
-
55
- export const getServerSideProps = serverSidePropsWrapper(getServerSidePropsHandler);
56
-
57
- export default Page;