@lowdefy/server-dev 3.23.3 → 4.0.0-alpha.12
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/.eslintrc.yaml +1 -0
- package/README.md +0 -24
- package/lib/App.js +66 -0
- package/lib/Page.js +57 -0
- package/lib/Reload.js +52 -0
- package/lib/RestartingPage.js +47 -0
- package/lib/setPageId.js +30 -0
- package/lib/utils/request.js +38 -0
- package/lib/utils/useMutateCache.js +34 -0
- package/lib/utils/usePageConfig.js +27 -0
- package/lib/utils/useRootConfig.js +26 -0
- package/lib/utils/waitForRestartedServer.js +32 -0
- package/manager/getContext.mjs +80 -0
- package/manager/processes/initialBuild.mjs +27 -0
- package/manager/processes/installPlugins.mjs +36 -0
- package/manager/processes/lowdefyBuild.mjs +33 -0
- package/manager/processes/nextBuild.mjs +31 -0
- package/manager/processes/readDotEnv.mjs +28 -0
- package/manager/processes/reloadClients.mjs +26 -0
- package/manager/processes/restartServer.mjs +27 -0
- package/manager/processes/shutdownServer.mjs +35 -0
- package/manager/processes/startNextServer.mjs +45 -0
- package/manager/processes/startServer.mjs +31 -0
- package/manager/processes/startWatchers.mjs +31 -0
- package/manager/run.mjs +92 -0
- package/manager/utils/BatchChanges.mjs +67 -0
- package/manager/utils/createCustomPluginTypesMap.mjs +71 -0
- package/manager/utils/getLowdefyVersion.mjs +51 -0
- package/manager/utils/getNextBin.mjs +36 -0
- package/manager/utils/setupWatcher.mjs +49 -0
- package/manager/utils/spawnProcess.mjs +55 -0
- package/manager/watchers/envWatcher.mjs +34 -0
- package/manager/watchers/lowdefyBuildWatcher.mjs +45 -0
- package/manager/watchers/nextBuildWatcher.mjs +100 -0
- package/next.config.js +36 -0
- package/package.json +50 -34
- package/pages/404.js +19 -0
- package/pages/[pageId].js +19 -0
- package/pages/_app.js +38 -0
- package/pages/_document.js +38 -0
- package/pages/api/auth/[...nextauth].js +25 -0
- package/pages/api/page/[pageId].js +35 -0
- package/pages/api/ping.js +19 -0
- package/pages/api/reload.js +50 -0
- package/pages/api/request/[pageId]/[requestId].js +45 -0
- package/pages/api/root.js +30 -0
- package/pages/index.js +19 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon.svg +17 -0
- package/public/logo-dark-theme.png +0 -0
- package/public/logo-light-theme.png +0 -0
- package/public/logo-square-dark-theme.png +0 -0
- package/public/logo-square-light-theme.png +0 -0
- package/public/manifest.webmanifest +16 -0
- package/dist/server.js +0 -47
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
/* eslint-disable no-console */
|
|
17
|
+
|
|
18
|
+
import getLowdefyVersion from '../utils/getLowdefyVersion.mjs';
|
|
19
|
+
import setupWatcher from '../utils/setupWatcher.mjs';
|
|
20
|
+
|
|
21
|
+
function lowdefyBuildWatcher(context) {
|
|
22
|
+
const callback = async (filePaths) => {
|
|
23
|
+
const lowdefyYamlModified = filePaths
|
|
24
|
+
.flat()
|
|
25
|
+
.some((filePath) => filePath.includes('lowdefy.yaml') || filePath.includes('lowdefy.yml'));
|
|
26
|
+
if (lowdefyYamlModified) {
|
|
27
|
+
const lowdefyVersion = await getLowdefyVersion(context);
|
|
28
|
+
if (lowdefyVersion !== context.version && lowdefyVersion !== 'local') {
|
|
29
|
+
context.shutdownServer();
|
|
30
|
+
console.warn('Lowdefy version changed. You should restart your development server.');
|
|
31
|
+
process.exit();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await context.lowdefyBuild();
|
|
36
|
+
context.reloadClients();
|
|
37
|
+
};
|
|
38
|
+
return setupWatcher({
|
|
39
|
+
callback,
|
|
40
|
+
ignorePaths: context.options.watchIgnore,
|
|
41
|
+
watchPaths: [context.directories.config, ...context.options.watch],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default lowdefyBuildWatcher;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
/* eslint-disable no-console */
|
|
17
|
+
|
|
18
|
+
import crypto from 'crypto';
|
|
19
|
+
import path from 'path';
|
|
20
|
+
import { readFile } from '@lowdefy/node-utils';
|
|
21
|
+
import setupWatcher from '../utils/setupWatcher.mjs';
|
|
22
|
+
|
|
23
|
+
const hashes = {};
|
|
24
|
+
|
|
25
|
+
const watchedFiles = [
|
|
26
|
+
'build/auth.json',
|
|
27
|
+
'build/config.json',
|
|
28
|
+
'build/plugins/actions.js',
|
|
29
|
+
'build/plugins/auth/callbacks.js',
|
|
30
|
+
'build/plugins/auth/events.js',
|
|
31
|
+
'build/plugins/auth/providers.js',
|
|
32
|
+
'build/plugins/blocks.js',
|
|
33
|
+
'build/plugins/connections.js',
|
|
34
|
+
'build/plugins/icons.js',
|
|
35
|
+
'build/plugins/operators/client.js',
|
|
36
|
+
'build/plugins/operators/server.js',
|
|
37
|
+
'build/plugins/styles.less',
|
|
38
|
+
'package.json',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
async function sha1(filePath) {
|
|
42
|
+
const content = await readFile(filePath);
|
|
43
|
+
return crypto
|
|
44
|
+
.createHash('sha1')
|
|
45
|
+
.update(content || '')
|
|
46
|
+
.digest('hex');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function nextBuildWatcher(context) {
|
|
50
|
+
// Initialize hashes so that app does not rebuild the first time
|
|
51
|
+
// Lowdefy build is run.
|
|
52
|
+
await Promise.all(
|
|
53
|
+
watchedFiles.map(async (filePath) => {
|
|
54
|
+
const fullPath = path.resolve(context.directories.server, filePath);
|
|
55
|
+
hashes[fullPath] = await sha1(fullPath);
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const callback = async (filePaths) => {
|
|
60
|
+
let install = false;
|
|
61
|
+
let build = false;
|
|
62
|
+
await Promise.all(
|
|
63
|
+
filePaths.flat().map(async (filePath) => {
|
|
64
|
+
const hash = await sha1(filePath);
|
|
65
|
+
if (hashes[filePath] === hash) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
build = true;
|
|
69
|
+
if (filePath.endsWith('package.json')) {
|
|
70
|
+
install = true;
|
|
71
|
+
}
|
|
72
|
+
hashes[filePath] = hash;
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (!build) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
context.shutdownServer();
|
|
81
|
+
if (install) {
|
|
82
|
+
await context.installPlugins();
|
|
83
|
+
}
|
|
84
|
+
await context.nextBuild();
|
|
85
|
+
context.restartServer();
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return setupWatcher({
|
|
89
|
+
callback,
|
|
90
|
+
watchDotfiles: true,
|
|
91
|
+
watchPaths: [
|
|
92
|
+
path.join(context.directories.build, 'plugins'),
|
|
93
|
+
path.join(context.directories.build, 'auth.json'),
|
|
94
|
+
path.join(context.directories.build, 'config.json'),
|
|
95
|
+
path.join(context.directories.server, 'package.json'),
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default nextBuildWatcher;
|
package/next.config.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const withLess = require('next-with-less');
|
|
2
|
+
const lowdefyConfig = require('./build/config.json');
|
|
3
|
+
|
|
4
|
+
module.exports = withLess({
|
|
5
|
+
lessLoaderOptions: {
|
|
6
|
+
lessOptions: {
|
|
7
|
+
modifyVars: lowdefyConfig.theme.lessVariables,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
basePath: process.env.LOWDEFY_BASE_PATH || lowdefyConfig.basePath,
|
|
11
|
+
// reactStrictMode: true,
|
|
12
|
+
webpack: (config, { isServer }) => {
|
|
13
|
+
if (!isServer) {
|
|
14
|
+
config.resolve.fallback = {
|
|
15
|
+
assert: false,
|
|
16
|
+
buffer: false,
|
|
17
|
+
crypto: false,
|
|
18
|
+
events: false,
|
|
19
|
+
fs: false,
|
|
20
|
+
path: false,
|
|
21
|
+
process: require.resolve('process/browser'),
|
|
22
|
+
util: false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return config;
|
|
26
|
+
},
|
|
27
|
+
swcMinify: true,
|
|
28
|
+
compress: false,
|
|
29
|
+
outputFileTracing: false,
|
|
30
|
+
poweredByHeader: false,
|
|
31
|
+
generateEtags: false,
|
|
32
|
+
optimizeFonts: false,
|
|
33
|
+
eslint: {
|
|
34
|
+
ignoreDuringBuilds: true,
|
|
35
|
+
},
|
|
36
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -26,47 +26,63 @@
|
|
|
26
26
|
"url": "https://github.com/lowdefy/lowdefy.git"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"
|
|
29
|
+
"lib/*",
|
|
30
|
+
"manager/*",
|
|
31
|
+
"pages/*",
|
|
32
|
+
"public/*",
|
|
33
|
+
"next.config.js",
|
|
34
|
+
".eslintrc.yaml"
|
|
30
35
|
],
|
|
31
36
|
"scripts": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"prepare": "yarn build",
|
|
36
|
-
"start": "nodemon dist/server.js"
|
|
37
|
+
"start": "node manager/run.mjs",
|
|
38
|
+
"lint": "next lint",
|
|
39
|
+
"next": "next"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@lowdefy/
|
|
40
|
-
"@lowdefy/
|
|
41
|
-
"@lowdefy/
|
|
42
|
-
"@lowdefy/
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@lowdefy/
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
42
|
+
"@lowdefy/actions-core": "4.0.0-alpha.12",
|
|
43
|
+
"@lowdefy/api": "4.0.0-alpha.12",
|
|
44
|
+
"@lowdefy/blocks-antd": "4.0.0-alpha.12",
|
|
45
|
+
"@lowdefy/blocks-basic": "4.0.0-alpha.12",
|
|
46
|
+
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.12",
|
|
47
|
+
"@lowdefy/blocks-echarts": "4.0.0-alpha.12",
|
|
48
|
+
"@lowdefy/blocks-loaders": "4.0.0-alpha.12",
|
|
49
|
+
"@lowdefy/blocks-markdown": "4.0.0-alpha.12",
|
|
50
|
+
"@lowdefy/build": "4.0.0-alpha.12",
|
|
51
|
+
"@lowdefy/client": "4.0.0-alpha.12",
|
|
52
|
+
"@lowdefy/connection-axios-http": "4.0.0-alpha.12",
|
|
53
|
+
"@lowdefy/engine": "4.0.0-alpha.12",
|
|
54
|
+
"@lowdefy/helpers": "4.0.0-alpha.12",
|
|
55
|
+
"@lowdefy/layout": "4.0.0-alpha.12",
|
|
56
|
+
"@lowdefy/node-utils": "4.0.0-alpha.12",
|
|
57
|
+
"@lowdefy/operators-change-case": "4.0.0-alpha.12",
|
|
58
|
+
"@lowdefy/operators-diff": "4.0.0-alpha.12",
|
|
59
|
+
"@lowdefy/operators-js": "4.0.0-alpha.12",
|
|
60
|
+
"@lowdefy/operators-mql": "4.0.0-alpha.12",
|
|
61
|
+
"@lowdefy/operators-nunjucks": "4.0.0-alpha.12",
|
|
62
|
+
"@lowdefy/operators-uuid": "4.0.0-alpha.12",
|
|
63
|
+
"@lowdefy/operators-yaml": "4.0.0-alpha.12",
|
|
64
|
+
"@lowdefy/plugin-next-auth": "4.0.0-alpha.12",
|
|
65
|
+
"chokidar": "3.5.3",
|
|
66
|
+
"dotenv": "15.0.0",
|
|
67
|
+
"next": "12.1.6",
|
|
68
|
+
"next-auth": "4.3.4",
|
|
69
|
+
"opener": "1.5.2",
|
|
70
|
+
"process": "0.11.10",
|
|
62
71
|
"react": "17.0.2",
|
|
63
72
|
"react-dom": "17.0.2",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
73
|
+
"react-icons": "4.3.1",
|
|
74
|
+
"swr": "1.1.2",
|
|
75
|
+
"yaml": "2.0.0-10",
|
|
76
|
+
"yargs": "17.3.1"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@next/eslint-plugin-next": "12.0.10",
|
|
80
|
+
"less": "4.1.2",
|
|
81
|
+
"less-loader": "10.2.0",
|
|
82
|
+
"next-with-less": "2.0.4"
|
|
67
83
|
},
|
|
68
84
|
"publishConfig": {
|
|
69
85
|
"access": "public"
|
|
70
86
|
},
|
|
71
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "41b6138a81bee7da362dad06345bc9f87b2c2133"
|
|
72
88
|
}
|
package/pages/404.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 App from '../lib/App.js';
|
|
18
|
+
|
|
19
|
+
export default App;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 App from '../lib/App.js';
|
|
18
|
+
|
|
19
|
+
export default App;
|
package/pages/_app.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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, { Suspense } from 'react';
|
|
18
|
+
import dynamic from 'next/dynamic';
|
|
19
|
+
import { SessionProvider } from 'next-auth/react';
|
|
20
|
+
|
|
21
|
+
// Must be in _app due to next specifications.
|
|
22
|
+
import '../build/plugins/styles.less';
|
|
23
|
+
|
|
24
|
+
function App({ Component }) {
|
|
25
|
+
return (
|
|
26
|
+
<Suspense fallback="">
|
|
27
|
+
<SessionProvider>
|
|
28
|
+
<Component />
|
|
29
|
+
</SessionProvider>
|
|
30
|
+
</Suspense>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DynamicApp = dynamic(() => Promise.resolve(App), {
|
|
35
|
+
ssr: false,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export default DynamicApp;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 NextAuth from 'next-auth';
|
|
18
|
+
import { getNextAuthConfig } from '@lowdefy/api';
|
|
19
|
+
|
|
20
|
+
import authJson from '../../../build/auth.json';
|
|
21
|
+
import callbacks from '../../../build/plugins/auth/callbacks.js';
|
|
22
|
+
import events from '../../../build/plugins/auth/events.js';
|
|
23
|
+
import providers from '../../../build/plugins/auth/providers.js';
|
|
24
|
+
|
|
25
|
+
export default NextAuth(getNextAuthConfig({ authJson, plugins: { callbacks, events, providers } }));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 } from '@lowdefy/api';
|
|
18
|
+
import { getSession } from 'next-auth/react';
|
|
19
|
+
|
|
20
|
+
export default async function handler(req, res) {
|
|
21
|
+
const session = await getSession({ req });
|
|
22
|
+
const apiContext = await createApiContext({
|
|
23
|
+
buildDirectory: './build',
|
|
24
|
+
logger: console,
|
|
25
|
+
session,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const { pageId } = req.query;
|
|
29
|
+
const pageConfig = await getPageConfig(apiContext, { pageId });
|
|
30
|
+
if (pageConfig === null) {
|
|
31
|
+
res.status(404).send('Page not found.');
|
|
32
|
+
} else {
|
|
33
|
+
res.status(200).json(pageConfig);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
export default async function handler(req, res) {
|
|
18
|
+
res.status(200).json({ timestamp: new Date().toISOString() });
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 chokidar from 'chokidar';
|
|
18
|
+
|
|
19
|
+
const handler = async (req, res) => {
|
|
20
|
+
res.setHeader('Content-Type', 'text/event-stream;charset=utf-8');
|
|
21
|
+
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
22
|
+
res.setHeader('X-Accel-Buffering', 'no');
|
|
23
|
+
res.setHeader('Connection', 'keep-alive');
|
|
24
|
+
|
|
25
|
+
const watcher = chokidar.watch(['./build/reload'], {
|
|
26
|
+
persistent: true,
|
|
27
|
+
ignoreInitial: true,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const reload = () => {
|
|
31
|
+
try {
|
|
32
|
+
res.write(`event: reload\ndata: ${JSON.stringify({})}\n\n`);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
watcher.on('add', () => reload());
|
|
38
|
+
watcher.on('change', () => reload());
|
|
39
|
+
watcher.on('unlink', () => reload());
|
|
40
|
+
|
|
41
|
+
// TODO: This isn't working.
|
|
42
|
+
req.on('close', () => {
|
|
43
|
+
console.log('req closed');
|
|
44
|
+
watcher.close().then(() => {
|
|
45
|
+
console.log('watcher closed');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default handler;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 { callRequest, createApiContext } from '@lowdefy/api';
|
|
18
|
+
import { getSecretsFromEnv } from '@lowdefy/node-utils';
|
|
19
|
+
import { getSession } from 'next-auth/react';
|
|
20
|
+
import connections from '../../../../build/plugins/connections.js';
|
|
21
|
+
import operators from '../../../../build/plugins/operators/server.js';
|
|
22
|
+
|
|
23
|
+
export default async function handler(req, res) {
|
|
24
|
+
try {
|
|
25
|
+
if (req.method !== 'POST') {
|
|
26
|
+
throw new Error('Only POST requests are supported.');
|
|
27
|
+
}
|
|
28
|
+
const session = await getSession({ req });
|
|
29
|
+
const apiContext = await createApiContext({
|
|
30
|
+
buildDirectory: './build',
|
|
31
|
+
connections,
|
|
32
|
+
logger: console,
|
|
33
|
+
operators,
|
|
34
|
+
secrets: getSecretsFromEnv(),
|
|
35
|
+
session,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const { pageId, requestId } = req.query;
|
|
39
|
+
const { payload } = req.body;
|
|
40
|
+
const response = await callRequest(apiContext, { pageId, payload, requestId });
|
|
41
|
+
res.status(200).json(response);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
res.status(500).json({ name: error.name, message: error.message });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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, getRootConfig } from '@lowdefy/api';
|
|
18
|
+
import { getSession } from 'next-auth/react';
|
|
19
|
+
|
|
20
|
+
export default async function handler(req, res) {
|
|
21
|
+
const session = await getSession({ req });
|
|
22
|
+
const apiContext = await createApiContext({
|
|
23
|
+
buildDirectory: './build',
|
|
24
|
+
logger: console,
|
|
25
|
+
session,
|
|
26
|
+
});
|
|
27
|
+
const rootConfig = await getRootConfig(apiContext);
|
|
28
|
+
|
|
29
|
+
res.status(200).json(rootConfig);
|
|
30
|
+
}
|
package/pages/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 App from '../lib/App.js';
|
|
18
|
+
|
|
19
|
+
export default App;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/icon.svg
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 94 94" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-979.672,-59.6924)">
|
|
5
|
+
<g transform="matrix(1,0,0,1.03297,-38.3284,-294.615)">
|
|
6
|
+
<g transform="matrix(1,0,0,1,952,232)">
|
|
7
|
+
<path d="M160,129.634C160,119.35 151.375,111 140.751,111L85.249,111C74.625,111 66,119.35 66,129.634L66,183.366C66,193.65 74.625,202 85.249,202L140.751,202C151.375,202 160,193.65 160,183.366L160,129.634Z"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g transform="matrix(0.872141,0,0,1,1002.6,346)">
|
|
10
|
+
<rect x="36" y="12" width="36" height="59" style="fill:white;"/>
|
|
11
|
+
</g>
|
|
12
|
+
<g transform="matrix(0.78125,0,0,0.862069,1010.84,356.663)">
|
|
13
|
+
<rect x="77" y="41" width="32" height="29" style="fill:rgb(24,144,255);"/>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
Binary file
|
|
Binary file
|