@lowdefy/server-dev 0.0.0-experimental-20231123101256 → 0.0.0-experimental-20240111121545
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/lib/server/validateLicense.js +40 -0
- package/manager/getContext.mjs +10 -5
- package/manager/processes/lowdefyBuild.mjs +2 -1
- package/package.json +28 -27
- package/package.original.json +28 -27
- package/pages/api/license.js +22 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2023 Lowdefy, Inc
|
|
3
|
+
Use of this software is governed by the Business Source License included in the LICENSE file and at www.mariadb.com/bsl11.
|
|
4
|
+
|
|
5
|
+
Change Date: 2027-10-09
|
|
6
|
+
|
|
7
|
+
On the date above, in accordance with the Business Source License, use
|
|
8
|
+
of this software will be governed by the Apache License, Version 2.0.
|
|
9
|
+
*/
|
|
10
|
+
import { keygenValidateLicense } from '@lowdefy/node-utils';
|
|
11
|
+
|
|
12
|
+
const config = {
|
|
13
|
+
dev: {
|
|
14
|
+
accountId: 'bf35f4ae-53a8-45c6-9eed-2d1fc9f53bd6',
|
|
15
|
+
productId: '4254760d-e760-4932-bb96-ba767e6ae780',
|
|
16
|
+
publicKey: 'MCowBQYDK2VwAyEAN27y1DiHiEDYFbNGjgfFdWygxrVSetq6rApWq3psJZI=',
|
|
17
|
+
},
|
|
18
|
+
prod: {
|
|
19
|
+
accountId: '',
|
|
20
|
+
productId: '',
|
|
21
|
+
publicKey: '',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let license;
|
|
26
|
+
|
|
27
|
+
async function validateLicense() {
|
|
28
|
+
if (license) {
|
|
29
|
+
// Check cached license every 24 hours
|
|
30
|
+
if (license?.timestamp?.valueOf?.() > Date.now() - 1000 * 60 * 60 * 24) {
|
|
31
|
+
return license;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
license = await keygenValidateLicense({
|
|
35
|
+
config: config[process.env.LOWDEFY_LICENSE_ENV ?? 'prod'],
|
|
36
|
+
});
|
|
37
|
+
return license;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default validateLicense;
|
package/manager/getContext.mjs
CHANGED
|
@@ -43,20 +43,25 @@ async function getContext() {
|
|
|
43
43
|
},
|
|
44
44
|
directories: {
|
|
45
45
|
build: path.resolve(process.cwd(), './build'),
|
|
46
|
-
config: path.resolve(argv.configDirectory
|
|
46
|
+
config: path.resolve(argv.configDirectory ?? env.LOWDEFY_DIRECTORY_CONFIG ?? process.cwd()),
|
|
47
47
|
server: process.cwd(),
|
|
48
48
|
},
|
|
49
49
|
logger: createLogger({ level: env.LOWDEFY_LOG_LEVEL }),
|
|
50
50
|
options: {
|
|
51
|
-
port: argv.port
|
|
52
|
-
refResolver: argv.refResolver
|
|
51
|
+
port: argv.port ?? env.PORT ?? 3000,
|
|
52
|
+
refResolver: argv.refResolver ?? env.LOWDEFY_BUILD_REF_RESOLVER,
|
|
53
53
|
watch:
|
|
54
|
-
argv.watch
|
|
54
|
+
argv.watch ?? env.LOWDEFY_SERVER_DEV_WATCH ? JSON.parse(env.LOWDEFY_SERVER_DEV_WATCH) : [],
|
|
55
55
|
watchIgnore:
|
|
56
|
-
argv.watchIgnore
|
|
56
|
+
argv.watchIgnore ?? env.LOWDEFY_SERVER_DEV_WATCH_IGNORE
|
|
57
57
|
? JSON.parse(env.LOWDEFY_SERVER_DEV_WATCH_IGNORE)
|
|
58
58
|
: [],
|
|
59
59
|
},
|
|
60
|
+
license: {
|
|
61
|
+
entitlements: env.LOWDEFY_LICENSE_ENTITLEMENTS
|
|
62
|
+
? JSON.parse(env.LOWDEFY_LICENSE_ENTITLEMENTS)
|
|
63
|
+
: [],
|
|
64
|
+
},
|
|
60
65
|
version: env.npm_package_version,
|
|
61
66
|
};
|
|
62
67
|
|
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
import build from '@lowdefy/build';
|
|
18
18
|
import createCustomPluginTypesMap from '../utils/createCustomPluginTypesMap.mjs';
|
|
19
19
|
|
|
20
|
-
function lowdefyBuild({ directories, logger, options }) {
|
|
20
|
+
function lowdefyBuild({ directories, logger, options, license }) {
|
|
21
21
|
return async () => {
|
|
22
22
|
logger.info({ print: 'spin' }, 'Building config...');
|
|
23
23
|
const customTypesMap = await createCustomPluginTypesMap({ directories, logger });
|
|
24
24
|
await build({
|
|
25
25
|
customTypesMap,
|
|
26
26
|
directories,
|
|
27
|
+
entitlements: license.entitlements,
|
|
27
28
|
logger,
|
|
28
29
|
refResolver: options.refResolver,
|
|
29
30
|
stage: 'dev',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20240111121545",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -36,32 +36,33 @@
|
|
|
36
36
|
".npmrc"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lowdefy/actions-core": "0.0.0-experimental-
|
|
40
|
-
"@lowdefy/api": "0.0.0-experimental-
|
|
41
|
-
"@lowdefy/
|
|
42
|
-
"@lowdefy/blocks-
|
|
43
|
-
"@lowdefy/blocks-
|
|
44
|
-
"@lowdefy/blocks-
|
|
45
|
-
"@lowdefy/blocks-
|
|
46
|
-
"@lowdefy/blocks-
|
|
47
|
-
"@lowdefy/blocks-
|
|
48
|
-
"@lowdefy/blocks-
|
|
49
|
-
"@lowdefy/
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/
|
|
52
|
-
"@lowdefy/
|
|
53
|
-
"@lowdefy/
|
|
54
|
-
"@lowdefy/
|
|
55
|
-
"@lowdefy/
|
|
56
|
-
"@lowdefy/
|
|
57
|
-
"@lowdefy/operators-
|
|
58
|
-
"@lowdefy/operators-
|
|
59
|
-
"@lowdefy/operators-
|
|
60
|
-
"@lowdefy/operators-
|
|
61
|
-
"@lowdefy/operators-
|
|
62
|
-
"@lowdefy/operators-
|
|
63
|
-
"@lowdefy/operators-
|
|
64
|
-
"@lowdefy/
|
|
39
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20240111121545",
|
|
40
|
+
"@lowdefy/api": "0.0.0-experimental-20240111121545",
|
|
41
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20240111121545",
|
|
42
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20240111121545",
|
|
43
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20240111121545",
|
|
44
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20240111121545",
|
|
45
|
+
"@lowdefy/blocks-color-selectors": "0.0.0-experimental-20240111121545",
|
|
46
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20240111121545",
|
|
47
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20240111121545",
|
|
48
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20240111121545",
|
|
49
|
+
"@lowdefy/blocks-qr": "0.0.0-experimental-20240111121545",
|
|
50
|
+
"@lowdefy/build": "0.0.0-experimental-20240111121545",
|
|
51
|
+
"@lowdefy/client": "0.0.0-experimental-20240111121545",
|
|
52
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20240111121545",
|
|
53
|
+
"@lowdefy/engine": "0.0.0-experimental-20240111121545",
|
|
54
|
+
"@lowdefy/helpers": "0.0.0-experimental-20240111121545",
|
|
55
|
+
"@lowdefy/layout": "0.0.0-experimental-20240111121545",
|
|
56
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20240111121545",
|
|
57
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20240111121545",
|
|
58
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20240111121545",
|
|
59
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20240111121545",
|
|
60
|
+
"@lowdefy/operators-moment": "0.0.0-experimental-20240111121545",
|
|
61
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20240111121545",
|
|
62
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20240111121545",
|
|
63
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20240111121545",
|
|
64
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20240111121545",
|
|
65
|
+
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20240111121545",
|
|
65
66
|
"chokidar": "3.5.3",
|
|
66
67
|
"dotenv": "16.3.1",
|
|
67
68
|
"next": "13.5.4",
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.0-experimental-20240111121545",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -42,32 +42,33 @@
|
|
|
42
42
|
"next": "next"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lowdefy/actions-core": "
|
|
46
|
-
"@lowdefy/api": "
|
|
47
|
-
"@lowdefy/
|
|
48
|
-
"@lowdefy/blocks-
|
|
49
|
-
"@lowdefy/blocks-
|
|
50
|
-
"@lowdefy/blocks-
|
|
51
|
-
"@lowdefy/blocks-
|
|
52
|
-
"@lowdefy/blocks-
|
|
53
|
-
"@lowdefy/blocks-
|
|
54
|
-
"@lowdefy/blocks-
|
|
55
|
-
"@lowdefy/
|
|
56
|
-
"@lowdefy/
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/
|
|
59
|
-
"@lowdefy/
|
|
60
|
-
"@lowdefy/
|
|
61
|
-
"@lowdefy/
|
|
62
|
-
"@lowdefy/
|
|
63
|
-
"@lowdefy/operators-
|
|
64
|
-
"@lowdefy/operators-
|
|
65
|
-
"@lowdefy/operators-
|
|
66
|
-
"@lowdefy/operators-
|
|
67
|
-
"@lowdefy/operators-
|
|
68
|
-
"@lowdefy/operators-
|
|
69
|
-
"@lowdefy/operators-
|
|
70
|
-
"@lowdefy/
|
|
45
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20240111121545",
|
|
46
|
+
"@lowdefy/api": "0.0.0-experimental-20240111121545",
|
|
47
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20240111121545",
|
|
48
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20240111121545",
|
|
49
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20240111121545",
|
|
50
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20240111121545",
|
|
51
|
+
"@lowdefy/blocks-color-selectors": "0.0.0-experimental-20240111121545",
|
|
52
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20240111121545",
|
|
53
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20240111121545",
|
|
54
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20240111121545",
|
|
55
|
+
"@lowdefy/blocks-qr": "0.0.0-experimental-20240111121545",
|
|
56
|
+
"@lowdefy/build": "0.0.0-experimental-20240111121545",
|
|
57
|
+
"@lowdefy/client": "0.0.0-experimental-20240111121545",
|
|
58
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20240111121545",
|
|
59
|
+
"@lowdefy/engine": "0.0.0-experimental-20240111121545",
|
|
60
|
+
"@lowdefy/helpers": "0.0.0-experimental-20240111121545",
|
|
61
|
+
"@lowdefy/layout": "0.0.0-experimental-20240111121545",
|
|
62
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20240111121545",
|
|
63
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20240111121545",
|
|
64
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20240111121545",
|
|
65
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20240111121545",
|
|
66
|
+
"@lowdefy/operators-moment": "0.0.0-experimental-20240111121545",
|
|
67
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20240111121545",
|
|
68
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20240111121545",
|
|
69
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20240111121545",
|
|
70
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20240111121545",
|
|
71
|
+
"@lowdefy/plugin-next-auth": "0.0.0-experimental-20240111121545",
|
|
71
72
|
"chokidar": "3.5.3",
|
|
72
73
|
"dotenv": "16.3.1",
|
|
73
74
|
"next": "13.5.4",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2023 Lowdefy, Inc
|
|
3
|
+
Use of this software is governed by the Business Source License included in the LICENSE file and at www.mariadb.com/bsl11.
|
|
4
|
+
|
|
5
|
+
Change Date: 2027-10-09
|
|
6
|
+
|
|
7
|
+
On the date above, in accordance with the Business Source License, use
|
|
8
|
+
of this software will be governed by the Apache License, Version 2.0.
|
|
9
|
+
*/
|
|
10
|
+
import apiWrapper from '../../lib/server/apiWrapper.js';
|
|
11
|
+
import validateLicense from '../../lib/server/validateLicense.js';
|
|
12
|
+
|
|
13
|
+
async function handler({ req, res }) {
|
|
14
|
+
if (req.method !== 'GET') {
|
|
15
|
+
throw new Error('Only GET requests are supported.');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const license = await validateLicense();
|
|
19
|
+
return res.status(200).json(license);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default apiWrapper(handler);
|