@lowdefy/server-e2e 0.0.0-experimental-20260212090556
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/.npmrc +1 -0
- package/LICENSE +201 -0
- package/lib/build/app.js +19 -0
- package/lib/build/auth.js +19 -0
- package/lib/build/config.js +19 -0
- package/lib/build/logger.js +19 -0
- package/lib/client/Page.js +54 -0
- package/lib/client/auth/Auth.js +32 -0
- package/lib/client/auth/AuthE2E.js +38 -0
- package/lib/client/createLogUsage.js +59 -0
- package/lib/server/apiWrapper.js +66 -0
- package/lib/server/auth/getServerSession.js +33 -0
- package/lib/server/fileCache.js +21 -0
- package/lib/server/log/createLogger.js +30 -0
- package/lib/server/log/logError.js +141 -0
- package/lib/server/log/logRequest.js +66 -0
- package/lib/server/serverSidePropsWrapper.js +57 -0
- package/lowdefy/build.mjs +69 -0
- package/lowdefy/createCustomPluginTypesMap.mjs +72 -0
- package/next.config.js +30 -0
- package/package.json +92 -0
- package/package.original.json +93 -0
- package/pages/404.js +47 -0
- package/pages/[pageId].js +51 -0
- package/pages/_app.js +63 -0
- package/pages/_document.js +54 -0
- package/pages/api/auth/session.js +23 -0
- package/pages/api/client-error.js +40 -0
- package/pages/api/endpoints/[endpointId].js +32 -0
- package/pages/api/request/[pageId]/[requestId].js +32 -0
- package/pages/api/usage.js +68 -0
- package/pages/index.js +57 -0
- package/public_default/apple-touch-icon.png +0 -0
- package/public_default/favicon.ico +0 -0
- package/public_default/icon-512.png +0 -0
- package/public_default/icon.svg +17 -0
- package/public_default/logo-dark-theme.png +0 -0
- package/public_default/logo-light-theme.png +0 -0
- package/public_default/logo-square-dark-theme.png +0 -0
- package/public_default/logo-square-light-theme.png +0 -0
- package/public_default/manifest.webmanifest +16 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 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 {
|
|
18
|
+
ConfigError,
|
|
19
|
+
LowdefyError,
|
|
20
|
+
PluginError,
|
|
21
|
+
ServiceError,
|
|
22
|
+
} from '@lowdefy/errors/server';
|
|
23
|
+
import { resolveErrorConfigLocation } from '@lowdefy/errors/build';
|
|
24
|
+
|
|
25
|
+
import captureSentryError from '../sentry/captureSentryError.js';
|
|
26
|
+
|
|
27
|
+
function getEventType(error) {
|
|
28
|
+
if (error instanceof ServiceError || error?.isServiceError === true) {
|
|
29
|
+
return 'service_error';
|
|
30
|
+
}
|
|
31
|
+
if (error instanceof PluginError) {
|
|
32
|
+
return 'plugin_error';
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof ConfigError) {
|
|
35
|
+
return 'config_error';
|
|
36
|
+
}
|
|
37
|
+
if (error instanceof LowdefyError) {
|
|
38
|
+
return 'lowdefy_error';
|
|
39
|
+
}
|
|
40
|
+
return 'error';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function logError({ context, error }) {
|
|
44
|
+
try {
|
|
45
|
+
const { headers = {}, user = {} } = context;
|
|
46
|
+
const eventType = getEventType(error);
|
|
47
|
+
const isServiceError = error instanceof ServiceError || error?.isServiceError === true;
|
|
48
|
+
const isLowdefyError = error instanceof LowdefyError;
|
|
49
|
+
|
|
50
|
+
// For service errors and internal lowdefy errors, don't resolve config location
|
|
51
|
+
const location =
|
|
52
|
+
isServiceError || isLowdefyError
|
|
53
|
+
? null
|
|
54
|
+
: await resolveErrorConfigLocation({
|
|
55
|
+
error,
|
|
56
|
+
readConfigFile: context.readConfigFile,
|
|
57
|
+
configDirectory: context.configDirectory,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Attach resolved location to error for consistency
|
|
61
|
+
if (location) {
|
|
62
|
+
error.source = location.source;
|
|
63
|
+
error.config = location.config;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Human-readable output: source (info/blue) then message (error/red)
|
|
67
|
+
// LowdefyError shows with stack trace
|
|
68
|
+
if (isLowdefyError) {
|
|
69
|
+
context.logger.error(LowdefyError.format(error));
|
|
70
|
+
} else if (location) {
|
|
71
|
+
context.logger.info(location.source);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Structured logging (consistent with client error schema + production fields)
|
|
75
|
+
const errorName = error?.name || 'Error';
|
|
76
|
+
context.logger.error(
|
|
77
|
+
{
|
|
78
|
+
// Core error schema (consistent with client)
|
|
79
|
+
event: eventType,
|
|
80
|
+
errorName,
|
|
81
|
+
errorMessage: error.message,
|
|
82
|
+
isServiceError,
|
|
83
|
+
pageId: context.pageId || null,
|
|
84
|
+
timestamp: new Date().toISOString(),
|
|
85
|
+
source: error.source || null,
|
|
86
|
+
config: error.config || null,
|
|
87
|
+
link: location?.link || null,
|
|
88
|
+
// Production fields
|
|
89
|
+
user: {
|
|
90
|
+
id: user.id,
|
|
91
|
+
roles: user.roles,
|
|
92
|
+
sub: user.sub,
|
|
93
|
+
session_id: user.session_id,
|
|
94
|
+
},
|
|
95
|
+
url: context.req.url,
|
|
96
|
+
method: context.req.method,
|
|
97
|
+
resolvedUrl: context.nextContext?.resolvedUrl,
|
|
98
|
+
hostname: context.req.hostname,
|
|
99
|
+
headers: {
|
|
100
|
+
'accept-language': headers['accept-language'],
|
|
101
|
+
'sec-ch-ua-mobile': headers['sec-ch-ua-mobile'],
|
|
102
|
+
'sec-ch-ua-platform': headers['sec-ch-ua-platform'],
|
|
103
|
+
'sec-ch-ua': headers['sec-ch-ua'],
|
|
104
|
+
'user-agent': headers['user-agent'],
|
|
105
|
+
host: headers.host,
|
|
106
|
+
referer: headers.referer,
|
|
107
|
+
// Non localhost headers
|
|
108
|
+
'x-forward-for': headers['x-forward-for'],
|
|
109
|
+
// Vercel headers
|
|
110
|
+
'x-vercel-id': headers['x-vercel-id'],
|
|
111
|
+
'x-real-ip': headers['x-real-ip'],
|
|
112
|
+
'x-vercel-ip-country': headers['x-vercel-ip-country'],
|
|
113
|
+
'x-vercel-ip-country-region': headers['x-vercel-ip-country-region'],
|
|
114
|
+
'x-vercel-ip-city': headers['x-vercel-ip-city'],
|
|
115
|
+
'x-vercel-ip-latitude': headers['x-vercel-ip-latitude'],
|
|
116
|
+
'x-vercel-ip-longitude': headers['x-vercel-ip-longitude'],
|
|
117
|
+
'x-vercel-ip-timezone': headers['x-vercel-ip-timezone'],
|
|
118
|
+
// Cloudflare headers
|
|
119
|
+
'cf-connecting-ip': headers['cf-connecting-ip'],
|
|
120
|
+
'cf-ray': headers['cf-ray'],
|
|
121
|
+
'cf-ipcountry': headers['cf-ipcountry'],
|
|
122
|
+
'cf-visitor': headers['cf-visitor'],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
error.print ? error.print() : `[${errorName}] ${error.message}`
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// Capture error to Sentry (no-op if Sentry not configured)
|
|
129
|
+
captureSentryError({
|
|
130
|
+
error,
|
|
131
|
+
context,
|
|
132
|
+
configLocation: location,
|
|
133
|
+
});
|
|
134
|
+
} catch (e) {
|
|
135
|
+
console.error(error);
|
|
136
|
+
console.error('An error occurred while logging the error.');
|
|
137
|
+
console.error(e);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default logError;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 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
|
+
// TODO: Better name needed here maybe?
|
|
18
|
+
function logRequest({ context }) {
|
|
19
|
+
const { headers = {}, user = {} } = context;
|
|
20
|
+
context.logger.info({
|
|
21
|
+
// TODO:
|
|
22
|
+
// app_name
|
|
23
|
+
// app_version
|
|
24
|
+
// lowdefy_version
|
|
25
|
+
// build_hash
|
|
26
|
+
// config_hash
|
|
27
|
+
user: {
|
|
28
|
+
id: user.id,
|
|
29
|
+
roles: user.roles,
|
|
30
|
+
sub: user.sub,
|
|
31
|
+
session_id: user.session_id, // TODO: Implement session id
|
|
32
|
+
},
|
|
33
|
+
url: context.req.url,
|
|
34
|
+
method: context.req.method,
|
|
35
|
+
resolvedUrl: context.nextContext?.resolvedUrl,
|
|
36
|
+
hostname: context.req.hostname,
|
|
37
|
+
headers: {
|
|
38
|
+
'accept-language': headers['accept-language'],
|
|
39
|
+
'sec-ch-ua-mobile': headers['sec-ch-ua-mobile'],
|
|
40
|
+
'sec-ch-ua-platform': headers['sec-ch-ua-platform'],
|
|
41
|
+
'sec-ch-ua': headers['sec-ch-ua'],
|
|
42
|
+
'user-agent': headers['user-agent'],
|
|
43
|
+
host: headers.host,
|
|
44
|
+
referer: headers.referer,
|
|
45
|
+
'x-forward-for': headers['x-forward-for'],
|
|
46
|
+
// Vercel headers
|
|
47
|
+
'x-vercel-id': headers['x-vercel-id'],
|
|
48
|
+
'x-real-ip': headers['x-real-ip'],
|
|
49
|
+
'x-vercel-ip-country': headers['x-vercel-ip-country'],
|
|
50
|
+
'x-vercel-ip-country-region': headers['x-vercel-ip-country-region'],
|
|
51
|
+
'x-vercel-ip-city': headers['x-vercel-ip-city'],
|
|
52
|
+
'x-vercel-ip-latitude': headers['x-vercel-ip-latitude'],
|
|
53
|
+
'x-vercel-ip-longitude': headers['x-vercel-ip-longitude'],
|
|
54
|
+
'x-vercel-ip-timezone': headers['x-vercel-ip-timezone'],
|
|
55
|
+
// Cloudflare headers
|
|
56
|
+
'cf-connecting-ip': headers['cf-connecting-ip'],
|
|
57
|
+
'cf-ray': headers['cf-ray'],
|
|
58
|
+
'cf-ipcountry': headers['cf-ipcountry'],
|
|
59
|
+
'cf-visitor': headers['cf-visitor'],
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
// TODO:
|
|
63
|
+
// Next local? nextContext.locale, nextContext.locales, nextContext.defaultLocale
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default logRequest;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 path from 'path';
|
|
18
|
+
import { createApiContext } from '@lowdefy/api';
|
|
19
|
+
import { v4 as uuid } from 'uuid';
|
|
20
|
+
|
|
21
|
+
import config from '../build/config.js';
|
|
22
|
+
import createLogger from './log/createLogger.js';
|
|
23
|
+
import fileCache from './fileCache.js';
|
|
24
|
+
import getServerSession from './auth/getServerSession.js';
|
|
25
|
+
import logError from './log/logError.js';
|
|
26
|
+
import logRequest from './log/logRequest.js';
|
|
27
|
+
|
|
28
|
+
function serverSidePropsWrapper(handler) {
|
|
29
|
+
return async function wrappedHandler(nextContext) {
|
|
30
|
+
const context = {
|
|
31
|
+
// Important to give absolute path so Next can trace build files
|
|
32
|
+
rid: uuid(),
|
|
33
|
+
buildDirectory: path.join(process.cwd(), 'build'),
|
|
34
|
+
config,
|
|
35
|
+
fileCache,
|
|
36
|
+
headers: nextContext?.req?.headers,
|
|
37
|
+
logger: console,
|
|
38
|
+
nextContext,
|
|
39
|
+
req: nextContext?.req,
|
|
40
|
+
res: nextContext?.res,
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
context.logger = createLogger({ rid: context.rid });
|
|
44
|
+
context.session = getServerSession(context);
|
|
45
|
+
createApiContext(context);
|
|
46
|
+
logRequest({ context });
|
|
47
|
+
// Await here so that if handler throws it is caught.
|
|
48
|
+
const response = await handler({ context, nextContext });
|
|
49
|
+
return response;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
logError({ error, context });
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default serverSidePropsWrapper;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import path from 'path';
|
|
19
|
+
import yargs from 'yargs';
|
|
20
|
+
import { hideBin } from 'yargs/helpers';
|
|
21
|
+
|
|
22
|
+
import build from '@lowdefy/build';
|
|
23
|
+
import { createNodeLogger } from '@lowdefy/logger/node';
|
|
24
|
+
import createCustomPluginTypesMap from './createCustomPluginTypesMap.mjs';
|
|
25
|
+
|
|
26
|
+
const argv = yargs(hideBin(process.argv)).argv;
|
|
27
|
+
|
|
28
|
+
async function run() {
|
|
29
|
+
const serverDirectory = path.resolve(
|
|
30
|
+
argv.serverDirectory || process.env.LOWDEFY_DIRECTORY_SERVER || process.cwd()
|
|
31
|
+
);
|
|
32
|
+
const directories = {
|
|
33
|
+
build: path.join(serverDirectory, 'build'),
|
|
34
|
+
config: path.resolve(
|
|
35
|
+
argv.configDirectory || process.env.LOWDEFY_DIRECTORY_CONFIG || process.cwd()
|
|
36
|
+
),
|
|
37
|
+
server: serverDirectory,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const customTypesMap = await createCustomPluginTypesMap({ directories });
|
|
41
|
+
|
|
42
|
+
let logger;
|
|
43
|
+
logger = createNodeLogger({
|
|
44
|
+
name: 'lowdefy_build',
|
|
45
|
+
level: process.env.LOWDEFY_LOG_LEVEL ?? 'info',
|
|
46
|
+
base: { pid: undefined, hostname: undefined },
|
|
47
|
+
mixin: (context, level) => ({
|
|
48
|
+
...context,
|
|
49
|
+
print: context.print ?? logger.levels.labels[level],
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await build({
|
|
54
|
+
customTypesMap,
|
|
55
|
+
directories,
|
|
56
|
+
logger,
|
|
57
|
+
refResolver: argv.refResolver || process.env.LOWDEFY_BUILD_REF_RESOLVER,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
run().catch((error) => {
|
|
62
|
+
// If error is already formatted (from error collection), just show the message
|
|
63
|
+
if (error.isFormatted || error.hideStack) {
|
|
64
|
+
console.error(error.message);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
// Otherwise, show full error with stack trace
|
|
68
|
+
throw error;
|
|
69
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import path from 'path';
|
|
19
|
+
import { get } from '@lowdefy/helpers';
|
|
20
|
+
import { readFile } from '@lowdefy/node-utils';
|
|
21
|
+
import { createPluginTypesMap } from '@lowdefy/build';
|
|
22
|
+
import YAML from 'yaml';
|
|
23
|
+
|
|
24
|
+
async function getPluginDefinitions({ directories }) {
|
|
25
|
+
let lowdefyYaml = await readFile(path.join(directories.config, 'lowdefy.yaml'));
|
|
26
|
+
if (!lowdefyYaml) {
|
|
27
|
+
lowdefyYaml = await readFile(path.join(directories.config, 'lowdefy.yml'));
|
|
28
|
+
}
|
|
29
|
+
const lowdefy = YAML.parse(lowdefyYaml);
|
|
30
|
+
return get(lowdefy, 'plugins', { default: [] });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function createCustomPluginTypesMap({ directories }) {
|
|
34
|
+
const customTypesMap = {
|
|
35
|
+
actions: {},
|
|
36
|
+
auth: {
|
|
37
|
+
adapters: {},
|
|
38
|
+
callbacks: {},
|
|
39
|
+
events: {},
|
|
40
|
+
providers: {},
|
|
41
|
+
},
|
|
42
|
+
blocks: {},
|
|
43
|
+
connections: {},
|
|
44
|
+
icons: {},
|
|
45
|
+
operators: {
|
|
46
|
+
client: {},
|
|
47
|
+
server: {},
|
|
48
|
+
},
|
|
49
|
+
requests: {},
|
|
50
|
+
styles: {
|
|
51
|
+
packages: {},
|
|
52
|
+
blocks: {},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const pluginDefinitions = await getPluginDefinitions({ directories });
|
|
57
|
+
|
|
58
|
+
for (const plugin of pluginDefinitions) {
|
|
59
|
+
const { default: types } = await import(`${plugin.name}/types`);
|
|
60
|
+
createPluginTypesMap({
|
|
61
|
+
packageTypes: types,
|
|
62
|
+
typesMap: customTypesMap,
|
|
63
|
+
packageName: plugin.name,
|
|
64
|
+
version: plugin.version,
|
|
65
|
+
typePrefix: plugin.typePrefix,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return customTypesMap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default createCustomPluginTypesMap;
|
package/next.config.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const withLess = require('next-with-less');
|
|
2
|
+
const lowdefyConfig = require('./build/config.json');
|
|
3
|
+
|
|
4
|
+
const nextConfig = withLess({
|
|
5
|
+
basePath: lowdefyConfig.basePath,
|
|
6
|
+
reactStrictMode: true,
|
|
7
|
+
webpack: (config, { isServer }) => {
|
|
8
|
+
if (!isServer) {
|
|
9
|
+
config.resolve.fallback = {
|
|
10
|
+
assert: false,
|
|
11
|
+
buffer: false,
|
|
12
|
+
crypto: false,
|
|
13
|
+
events: false,
|
|
14
|
+
fs: false,
|
|
15
|
+
path: false,
|
|
16
|
+
process: require.resolve('process/browser'),
|
|
17
|
+
util: false,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return config;
|
|
21
|
+
},
|
|
22
|
+
poweredByHeader: false,
|
|
23
|
+
output: process.env.LOWDEFY_BUILD_OUTPUT_STANDALONE === '1' ? 'standalone' : undefined,
|
|
24
|
+
outputFileTracing: true,
|
|
25
|
+
eslint: {
|
|
26
|
+
ignoreDuringBuilds: true,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
module.exports = nextConfig;
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lowdefy/server-e2e",
|
|
3
|
+
"version": "0.0.0-experimental-20260212090556",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Lowdefy e2e testing server with cookie-based user injection",
|
|
6
|
+
"homepage": "https://lowdefy.com",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"lowdefy",
|
|
9
|
+
"server",
|
|
10
|
+
"e2e",
|
|
11
|
+
"testing"
|
|
12
|
+
],
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/lowdefy/lowdefy/issues"
|
|
15
|
+
},
|
|
16
|
+
"contributors": [
|
|
17
|
+
{
|
|
18
|
+
"name": "Sam Tolmay",
|
|
19
|
+
"url": "https://github.com/SamTolmay"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Gerrie van Wyk",
|
|
23
|
+
"url": "https://github.com/Gervwyk"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/lowdefy/lowdefy.git"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"lib/*",
|
|
32
|
+
"lowdefy/*",
|
|
33
|
+
"pages/*",
|
|
34
|
+
"public_default/*",
|
|
35
|
+
"next.config.js",
|
|
36
|
+
"package.original.json",
|
|
37
|
+
".eslintrc.yaml",
|
|
38
|
+
".npmrc"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260212090556",
|
|
42
|
+
"@lowdefy/api": "0.0.0-experimental-20260212090556",
|
|
43
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260212090556",
|
|
44
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260212090556",
|
|
45
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260212090556",
|
|
46
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260212090556",
|
|
47
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260212090556",
|
|
48
|
+
"@lowdefy/client": "0.0.0-experimental-20260212090556",
|
|
49
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260212090556",
|
|
50
|
+
"@lowdefy/connection-mongodb": "0.0.0-experimental-20260212090556",
|
|
51
|
+
"@lowdefy/errors": "0.0.0-experimental-20260212090556",
|
|
52
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260212090556",
|
|
53
|
+
"@lowdefy/layout": "0.0.0-experimental-20260212090556",
|
|
54
|
+
"@lowdefy/logger": "0.0.0-experimental-20260212090556",
|
|
55
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260212090556",
|
|
56
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260212090556",
|
|
57
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260212090556",
|
|
58
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260212090556",
|
|
59
|
+
"next": "13.5.4",
|
|
60
|
+
"pino": "8.16.2",
|
|
61
|
+
"process": "0.11.10",
|
|
62
|
+
"react": "18.2.0",
|
|
63
|
+
"react-dom": "18.2.0",
|
|
64
|
+
"react-icons": "4.12.0",
|
|
65
|
+
"uuid": "13.0.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@lowdefy/build": "0.0.0-experimental-20260212090556",
|
|
69
|
+
"@next/eslint-plugin-next": "13.5.4",
|
|
70
|
+
"less": "4.2.0",
|
|
71
|
+
"less-loader": "11.1.3",
|
|
72
|
+
"next-with-less": "3.0.1",
|
|
73
|
+
"webpack": "5.94.0",
|
|
74
|
+
"yaml": "2.3.4",
|
|
75
|
+
"yargs": "17.7.2"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=18"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "cp package.json package.original.json || copy package.json package.original.json",
|
|
85
|
+
"build:lowdefy": "node lowdefy/build.mjs",
|
|
86
|
+
"build:next": "next build",
|
|
87
|
+
"dev": "next dev",
|
|
88
|
+
"start": "next start",
|
|
89
|
+
"lint": "next lint",
|
|
90
|
+
"next": "next"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lowdefy/server-e2e",
|
|
3
|
+
"version": "0.0.0-experimental-20260212090556",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Lowdefy e2e testing server with cookie-based user injection",
|
|
6
|
+
"homepage": "https://lowdefy.com",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"lowdefy",
|
|
9
|
+
"server",
|
|
10
|
+
"e2e",
|
|
11
|
+
"testing"
|
|
12
|
+
],
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/lowdefy/lowdefy/issues"
|
|
15
|
+
},
|
|
16
|
+
"contributors": [
|
|
17
|
+
{
|
|
18
|
+
"name": "Sam Tolmay",
|
|
19
|
+
"url": "https://github.com/SamTolmay"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Gerrie van Wyk",
|
|
23
|
+
"url": "https://github.com/Gervwyk"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/lowdefy/lowdefy.git"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"lib/*",
|
|
32
|
+
"lowdefy/*",
|
|
33
|
+
"pages/*",
|
|
34
|
+
"public_default/*",
|
|
35
|
+
"next.config.js",
|
|
36
|
+
"package.original.json",
|
|
37
|
+
".eslintrc.yaml",
|
|
38
|
+
".npmrc"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "cp package.json package.original.json || copy package.json package.original.json",
|
|
42
|
+
"build:lowdefy": "node lowdefy/build.mjs",
|
|
43
|
+
"build:next": "next build",
|
|
44
|
+
"dev": "next dev",
|
|
45
|
+
"start": "next start",
|
|
46
|
+
"lint": "next lint",
|
|
47
|
+
"next": "next",
|
|
48
|
+
"prepublishOnly": "pnpm build"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260212090556",
|
|
52
|
+
"@lowdefy/api": "0.0.0-experimental-20260212090556",
|
|
53
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260212090556",
|
|
54
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260212090556",
|
|
55
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260212090556",
|
|
56
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260212090556",
|
|
57
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260212090556",
|
|
58
|
+
"@lowdefy/client": "0.0.0-experimental-20260212090556",
|
|
59
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260212090556",
|
|
60
|
+
"@lowdefy/connection-mongodb": "0.0.0-experimental-20260212090556",
|
|
61
|
+
"@lowdefy/errors": "0.0.0-experimental-20260212090556",
|
|
62
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260212090556",
|
|
63
|
+
"@lowdefy/layout": "0.0.0-experimental-20260212090556",
|
|
64
|
+
"@lowdefy/logger": "0.0.0-experimental-20260212090556",
|
|
65
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260212090556",
|
|
66
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260212090556",
|
|
67
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260212090556",
|
|
68
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260212090556",
|
|
69
|
+
"next": "13.5.4",
|
|
70
|
+
"pino": "8.16.2",
|
|
71
|
+
"process": "0.11.10",
|
|
72
|
+
"react": "18.2.0",
|
|
73
|
+
"react-dom": "18.2.0",
|
|
74
|
+
"react-icons": "4.12.0",
|
|
75
|
+
"uuid": "13.0.0"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@lowdefy/build": "0.0.0-experimental-20260212090556",
|
|
79
|
+
"@next/eslint-plugin-next": "13.5.4",
|
|
80
|
+
"less": "4.2.0",
|
|
81
|
+
"less-loader": "11.1.3",
|
|
82
|
+
"next-with-less": "3.0.1",
|
|
83
|
+
"webpack": "5.94.0",
|
|
84
|
+
"yaml": "2.3.4",
|
|
85
|
+
"yargs": "17.7.2"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=18"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/pages/404.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2024 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 path from 'path';
|
|
18
|
+
import { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
|
|
19
|
+
|
|
20
|
+
import config from '../lib/build/config.js';
|
|
21
|
+
import fileCache from '../lib/server/fileCache.js';
|
|
22
|
+
import Page from '../lib/client/Page.js';
|
|
23
|
+
|
|
24
|
+
export async function getStaticProps() {
|
|
25
|
+
// Important to give absolute path so Next can trace build files
|
|
26
|
+
const context = {
|
|
27
|
+
buildDirectory: path.join(process.cwd(), 'build'),
|
|
28
|
+
config,
|
|
29
|
+
fileCache,
|
|
30
|
+
logger: console, // TODO: pino or console or 🤷♂️?
|
|
31
|
+
};
|
|
32
|
+
createApiContext(context);
|
|
33
|
+
|
|
34
|
+
const [rootConfig, pageConfig] = await Promise.all([
|
|
35
|
+
getRootConfig(context),
|
|
36
|
+
getPageConfig(context, { pageId: '404' }),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
props: {
|
|
41
|
+
pageConfig,
|
|
42
|
+
rootConfig,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default Page;
|