@lowdefy/api 4.7.3 → 5.1.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.
@@ -15,8 +15,12 @@
15
15
  */ import path from 'path';
16
16
  import { cachedPromises, serializer } from '@lowdefy/helpers';
17
17
  import { getFileExtension, readFile } from '@lowdefy/node-utils';
18
+ const validPathPattern = /^[A-Za-z0-9\-_/.:]+$/;
18
19
  function createReadConfigFile({ buildDirectory, fileCache }) {
19
20
  async function readConfigFile(filePath) {
21
+ if (!validPathPattern.test(filePath) || filePath.includes('..')) {
22
+ return null;
23
+ }
20
24
  const fileContent = await readFile(path.resolve(buildDirectory, filePath));
21
25
  if (getFileExtension(filePath) === 'json') {
22
26
  return serializer.deserializeFromString(fileContent);
@@ -0,0 +1,19 @@
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
+ */ async function getLowdefyTheme({ readConfigFile }) {
16
+ const theme = await readConfigFile('theme.json');
17
+ return theme || {};
18
+ }
19
+ export default getLowdefyTheme;
@@ -14,15 +14,18 @@
14
14
  limitations under the License.
15
15
  */ import getHomeAndMenus from './getHomeAndMenus.js';
16
16
  import getLowdefyGlobal from './getLowdefyGlobal.js';
17
+ import getLowdefyTheme from './getLowdefyTheme.js';
17
18
  async function getRootConfig(context) {
18
- const [lowdefyGlobal, { home, menus }] = await Promise.all([
19
+ const [lowdefyGlobal, theme, { home, menus }] = await Promise.all([
19
20
  getLowdefyGlobal(context),
21
+ getLowdefyTheme(context),
20
22
  getHomeAndMenus(context)
21
23
  ]);
22
24
  return {
23
25
  home,
24
26
  lowdefyGlobal,
25
- menus
27
+ menus,
28
+ theme
26
29
  };
27
30
  }
28
31
  export default getRootConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/api",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -34,26 +34,26 @@
34
34
  "dist/*"
35
35
  ],
36
36
  "dependencies": {
37
- "@lowdefy/ajv": "4.7.3",
38
- "@lowdefy/errors": "4.7.3",
39
- "@lowdefy/helpers": "4.7.3",
40
- "@lowdefy/node-utils": "4.7.3",
41
- "@lowdefy/nunjucks": "4.7.3",
42
- "@lowdefy/operators": "4.7.3",
43
- "@lowdefy/operators-js": "4.7.3"
37
+ "@lowdefy/ajv": "5.1.0",
38
+ "@lowdefy/errors": "5.1.0",
39
+ "@lowdefy/helpers": "5.1.0",
40
+ "@lowdefy/node-utils": "5.1.0",
41
+ "@lowdefy/nunjucks": "5.1.0",
42
+ "@lowdefy/operators": "5.1.0",
43
+ "@lowdefy/operators-js": "5.1.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jest/globals": "28.1.3",
47
- "@swc/cli": "0.1.63",
48
- "@swc/core": "1.3.99",
49
- "@swc/jest": "0.2.29",
47
+ "@swc/cli": "0.8.0",
48
+ "@swc/core": "1.15.18",
49
+ "@swc/jest": "0.2.39",
50
50
  "jest": "28.1.3"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
55
  "scripts": {
56
- "build": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
56
+ "build": "swc src --out-dir dist --config-file ../../.swcrc --cli-config-file ../../.swc-cli.json",
57
57
  "clean": "rm -rf dist",
58
58
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
59
59
  }