@lowdefy/server 4.0.0-alpha.5 → 4.0.0-alpha.6
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/README.md +17 -1
- package/next.config.js +6 -3
- package/package.json +14 -10
- package/public/.DS_Store +0 -0
- package/{src/public → public}/apple-touch-icon.png +0 -0
- package/public/favicon.ico +0 -0
- package/{src/public → public}/icon-512.png +0 -0
- package/{src/public → public}/icon.svg +0 -0
- package/{src/public → public}/logo-dark-theme.png +0 -0
- package/{src/public → public}/logo-light-theme.png +0 -0
- package/{src/public → public}/logo-square-dark-theme.png +0 -0
- package/{src/public → public}/logo-square-light-theme.png +0 -0
- package/{src/public → public}/manifest.webmanifest +0 -0
- package/src/components/block/CategorySwitch.js +2 -2
- package/src/components/block/Container.js +1 -1
- package/src/components/block/List.js +1 -1
- package/src/pages/404.js +38 -0
- package/src/pages/_document.js +38 -0
- package/src/pages/api/request/[pageId]/[requestId].js +2 -2
- package/src/pages/index.js +4 -10
- package/src/public/icon-32.png +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lowdefy/server
|
|
2
2
|
|
|
3
|
+
## Development
|
|
4
|
+
|
|
5
|
+
To run the server in locally as a development server, run the following:
|
|
6
|
+
|
|
7
|
+
- Run `yarn && yarn build` at the root of the repository.
|
|
8
|
+
- Add a `lowdefy.yaml` file in the server directory (`packages/server`).
|
|
9
|
+
- run `yarn dev` in the server directory.
|
|
10
|
+
|
|
11
|
+
To run the server in locally as a development server, with a next production build, run the following:
|
|
12
|
+
|
|
13
|
+
- Run `yarn && yarn build` at the root of the repository.
|
|
14
|
+
- Add a `lowdefy.yaml` file in the server directory (`packages/server`).
|
|
15
|
+
- run `yarn dev:prod` in the server directory.
|
|
16
|
+
|
|
17
|
+
> When running a development server, the `package.json` file is updated with the plugins used in the Lowdefy app. Please do not commit the changes made to the `package.json`, `.pnp.cjs` and `yarn.lock` files.
|
|
18
|
+
|
|
3
19
|
## Licence
|
|
4
20
|
|
|
5
|
-
[Apache-2.0](https://github.com/lowdefy/lowdefy/blob/main/LICENSE)
|
|
21
|
+
[Apache-2.0](https://github.com/lowdefy/lowdefy/blob/main/LICENSE)
|
package/next.config.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const withLess = require('next-with-less');
|
|
2
|
-
const
|
|
2
|
+
const lowdefyConfig = require('./build/config.json');
|
|
3
3
|
|
|
4
4
|
module.exports = withLess({
|
|
5
5
|
lessLoaderOptions: {
|
|
6
6
|
lessOptions: {
|
|
7
|
-
modifyVars:
|
|
7
|
+
modifyVars: lowdefyConfig.theme.lessVariables,
|
|
8
8
|
},
|
|
9
9
|
},
|
|
10
10
|
reactStrictMode: true,
|
|
@@ -17,7 +17,7 @@ module.exports = withLess({
|
|
|
17
17
|
events: false,
|
|
18
18
|
fs: false,
|
|
19
19
|
path: false,
|
|
20
|
-
process:
|
|
20
|
+
process: require.resolve('process/browser'),
|
|
21
21
|
util: false,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -28,4 +28,7 @@ module.exports = withLess({
|
|
|
28
28
|
// experimental: {
|
|
29
29
|
// concurrentFeatures: true,
|
|
30
30
|
// },
|
|
31
|
+
eslint: {
|
|
32
|
+
ignoreDuringBuilds: true,
|
|
33
|
+
},
|
|
31
34
|
});
|
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.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -27,32 +27,36 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src/*",
|
|
30
|
+
"public/*",
|
|
30
31
|
"next.config.js",
|
|
31
32
|
".eslintrc.yaml"
|
|
32
33
|
],
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build:lowdefy": "lowdefy-build",
|
|
35
36
|
"build:next": "next build",
|
|
36
|
-
"dev": "next dev",
|
|
37
|
+
"dev": "yarn build:lowdefy && yarn && next dev",
|
|
38
|
+
"dev:prod": "yarn build:lowdefy && yarn && yarn build:next && next start",
|
|
37
39
|
"start": "next start",
|
|
38
40
|
"lint": "next lint",
|
|
39
41
|
"next": "next"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"@lowdefy/api": "4.0.0-alpha.
|
|
43
|
-
"@lowdefy/block-utils": "4.0.0-alpha.
|
|
44
|
-
"@lowdefy/engine": "4.0.0-alpha.
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
46
|
-
"@lowdefy/layout": "4.0.0-alpha.
|
|
47
|
-
"@lowdefy/
|
|
44
|
+
"@lowdefy/api": "4.0.0-alpha.6",
|
|
45
|
+
"@lowdefy/block-utils": "4.0.0-alpha.6",
|
|
46
|
+
"@lowdefy/engine": "4.0.0-alpha.6",
|
|
47
|
+
"@lowdefy/helpers": "4.0.0-alpha.6",
|
|
48
|
+
"@lowdefy/layout": "4.0.0-alpha.6",
|
|
49
|
+
"@lowdefy/node-utils": "4.0.0-alpha.6",
|
|
50
|
+
"@lowdefy/operators-js": "4.0.0-alpha.6",
|
|
48
51
|
"next": "12.0.3",
|
|
49
52
|
"next-auth": "4.0.0-beta.6",
|
|
53
|
+
"process": "0.11.10",
|
|
50
54
|
"react": "18.0.0-alpha-327d5c484-20211106",
|
|
51
55
|
"react-dom": "18.0.0-alpha-327d5c484-20211106",
|
|
52
56
|
"react-icons": "4.3.1"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
|
-
"@lowdefy/build": "4.0.0-alpha.
|
|
59
|
+
"@lowdefy/build": "4.0.0-alpha.6",
|
|
56
60
|
"@next/eslint-plugin-next": "12.0.4",
|
|
57
61
|
"less": "4.1.2",
|
|
58
62
|
"less-loader": "10.2.0",
|
|
@@ -61,5 +65,5 @@
|
|
|
61
65
|
"publishConfig": {
|
|
62
66
|
"access": "public"
|
|
63
67
|
},
|
|
64
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
|
|
65
69
|
}
|
package/public/.DS_Store
ADDED
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -69,7 +69,7 @@ const CategorySwitch = ({ block, Blocks, context, lowdefy }) => {
|
|
|
69
69
|
blockId={block.blockId}
|
|
70
70
|
components={lowdefy._internal.components}
|
|
71
71
|
events={block.eval.events}
|
|
72
|
-
homePageId={lowdefy.
|
|
72
|
+
homePageId={lowdefy.home.pageId}
|
|
73
73
|
key={block.blockId}
|
|
74
74
|
loading={block.loading}
|
|
75
75
|
menus={lowdefy.menus}
|
|
@@ -102,7 +102,7 @@ const CategorySwitch = ({ block, Blocks, context, lowdefy }) => {
|
|
|
102
102
|
blockId={block.blockId}
|
|
103
103
|
components={lowdefy._internal.components}
|
|
104
104
|
events={block.eval.events}
|
|
105
|
-
homePageId={lowdefy.
|
|
105
|
+
homePageId={lowdefy.home.pageId}
|
|
106
106
|
key={block.blockId}
|
|
107
107
|
loading={block.loading}
|
|
108
108
|
menus={lowdefy.menus}
|
|
@@ -70,7 +70,7 @@ const Container = ({ block, Blocks, Component, context, lowdefy }) => {
|
|
|
70
70
|
components={lowdefy._internal.components}
|
|
71
71
|
content={content}
|
|
72
72
|
events={block.eval.events}
|
|
73
|
-
homePageId={lowdefy.
|
|
73
|
+
homePageId={lowdefy.home.pageId}
|
|
74
74
|
key={block.blockId}
|
|
75
75
|
loading={block.loading}
|
|
76
76
|
menus={lowdefy.menus}
|
|
@@ -76,7 +76,7 @@ const List = ({ block, Blocks, Component, context, lowdefy }) => {
|
|
|
76
76
|
blockId={block.blockId}
|
|
77
77
|
components={lowdefy._internal.components}
|
|
78
78
|
events={block.eval.events}
|
|
79
|
-
homePageId={lowdefy.
|
|
79
|
+
homePageId={lowdefy.home.pageId}
|
|
80
80
|
key={block.blockId}
|
|
81
81
|
list={contentList}
|
|
82
82
|
loading={block.loading}
|
package/src/pages/404.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
|
|
18
|
+
|
|
19
|
+
import Page from '../components/Page.js';
|
|
20
|
+
|
|
21
|
+
export async function getStaticProps() {
|
|
22
|
+
// TODO: get the right api context options
|
|
23
|
+
const apiContext = await createApiContext({ buildDirectory: './build' });
|
|
24
|
+
|
|
25
|
+
const [rootConfig, pageConfig] = await Promise.all([
|
|
26
|
+
getRootConfig(apiContext),
|
|
27
|
+
getPageConfig(apiContext, { pageId: '404' }),
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
props: {
|
|
32
|
+
pageConfig,
|
|
33
|
+
rootConfig,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default Page;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 React from 'react';
|
|
18
|
+
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
19
|
+
|
|
20
|
+
class LowdefyDocument extends Document {
|
|
21
|
+
render() {
|
|
22
|
+
return (
|
|
23
|
+
<Html>
|
|
24
|
+
<Head>
|
|
25
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
26
|
+
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
|
27
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
28
|
+
</Head>
|
|
29
|
+
<body>
|
|
30
|
+
<Main />
|
|
31
|
+
<NextScript />
|
|
32
|
+
</body>
|
|
33
|
+
</Html>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default LowdefyDocument;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { callRequest, createApiContext } from '@lowdefy/api';
|
|
18
|
+
import { getSecretsFromEnv } from '@lowdefy/node-utils';
|
|
18
19
|
import connections from '../../../../../build/plugins/connections.js';
|
|
19
20
|
import operators from '../../../../../build/plugins/operatorsServer.js';
|
|
20
21
|
|
|
@@ -30,8 +31,7 @@ export default async function handler(req, res) {
|
|
|
30
31
|
// TODO: use a logger like pino
|
|
31
32
|
logger: console,
|
|
32
33
|
operators,
|
|
33
|
-
|
|
34
|
-
secrets: {},
|
|
34
|
+
secrets: getSecretsFromEnv(),
|
|
35
35
|
});
|
|
36
36
|
const { pageId, requestId } = req.query;
|
|
37
37
|
const { payload } = req.body;
|
package/src/pages/index.js
CHANGED
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { createApiContext,
|
|
17
|
+
import { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
|
|
18
18
|
|
|
19
19
|
import Page from '../components/Page.js';
|
|
20
20
|
|
|
21
21
|
export async function getServerSideProps() {
|
|
22
22
|
const apiContext = await createApiContext({ buildDirectory: './build' });
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const rootConfig = await getRootConfig(apiContext);
|
|
24
|
+
const { home } = rootConfig;
|
|
25
25
|
if (home.configured === false) {
|
|
26
26
|
return {
|
|
27
27
|
redirect: {
|
|
@@ -30,12 +30,7 @@ export async function getServerSideProps() {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
const [rootConfig, pageConfig] = await Promise.all([
|
|
35
|
-
getRootConfig(apiContext),
|
|
36
|
-
getPageConfig(apiContext, { pageId: home.pageId }),
|
|
37
|
-
]);
|
|
38
|
-
|
|
33
|
+
const pageConfig = await getPageConfig(apiContext, { pageId: home.pageId });
|
|
39
34
|
if (!pageConfig) {
|
|
40
35
|
return {
|
|
41
36
|
redirect: {
|
|
@@ -44,7 +39,6 @@ export async function getServerSideProps() {
|
|
|
44
39
|
},
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
return {
|
|
49
43
|
props: {
|
|
50
44
|
pageConfig,
|
package/src/public/icon-32.png
DELETED
|
Binary file
|