@lowdefy/build 4.0.0-rc.0 → 4.0.0-rc.10
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/dist/build/addDefaultPages/404.js +4 -4
- package/dist/build/addDefaultPages/addDefaultPages.js +2 -2
- package/dist/build/addKeys.js +48 -0
- package/dist/build/buildAuth/buildAuth.js +2 -2
- package/dist/build/buildAuth/buildAuthPlugins.js +5 -5
- package/dist/build/buildAuth/buildPageAuth.js +2 -2
- package/dist/build/buildAuth/getPageRoles.js +2 -2
- package/dist/build/buildAuth/getProtectedPages.js +2 -2
- package/dist/build/buildAuth/validateAuthConfig.js +2 -2
- package/dist/build/buildConnections.js +2 -2
- package/dist/build/buildImports/buildIconImports.js +14 -9
- package/dist/build/buildImports/buildImports.js +2 -2
- package/dist/build/buildImports/buildImportsDev.js +4 -4
- package/dist/build/buildImports/buildImportsProd.js +2 -2
- package/dist/build/buildImports/buildStyleImports.js +2 -2
- package/dist/build/buildImports/defaultIconsDev.js +2 -2
- package/dist/build/buildImports/defaultIconsProd.js +1 -1
- package/dist/build/buildMenu.js +5 -5
- package/dist/build/buildPages/buildBlock/buildBlock.js +1 -1
- package/dist/build/buildPages/buildBlock/buildEvents.js +2 -2
- package/dist/build/buildPages/buildBlock/buildRequests.js +2 -2
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +3 -3
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +2 -2
- package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +9 -9
- package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
- package/dist/build/buildPages/buildBlock/setBlockId.js +2 -2
- package/dist/build/buildPages/buildBlock/validateBlock.js +2 -2
- package/dist/build/buildPages/buildPage.js +2 -2
- package/dist/build/buildPages/buildPages.js +2 -2
- package/dist/build/buildPages/buildTestPage.js +2 -2
- package/dist/build/buildRefs/buildRefs.js +3 -3
- package/dist/build/buildRefs/evaluateBuildOperators.js +5 -5
- package/dist/build/buildRefs/getConfigFile.js +2 -2
- package/dist/build/buildRefs/getKey.js +24 -0
- package/dist/build/buildRefs/getRefContent.js +2 -2
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +3 -3
- package/dist/build/buildRefs/getUserJavascriptFunction.js +2 -2
- package/dist/build/buildRefs/makeRefDefinition.js +11 -5
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +4 -9
- package/dist/build/buildRefs/populateRefs.js +2 -2
- package/dist/build/buildRefs/recursiveBuild.js +25 -8
- package/dist/build/buildRefs/runRefResolver.js +2 -2
- package/dist/build/buildRefs/runTransformer.js +2 -2
- package/dist/build/buildTypes.js +4 -4
- package/dist/build/cleanBuildDirectory.js +2 -2
- package/dist/build/copyPublicFolder.js +8 -5
- package/dist/build/testSchema.js +3 -3
- package/dist/build/updateServerPackageJson.js +3 -8
- package/dist/build/validateApp.js +2 -2
- package/dist/build/validateConfig.js +2 -2
- package/dist/build/writeApp.js +6 -3
- package/dist/build/writeAuth.js +6 -3
- package/dist/build/writeConfig.js +6 -3
- package/dist/build/writeConnections.js +6 -4
- package/dist/build/writeGlobal.js +6 -4
- package/dist/build/writeMaps.js +30 -0
- package/dist/build/writeMenus.js +6 -4
- package/dist/build/writePages.js +7 -4
- package/dist/build/writePluginImports/generateImportFile.js +2 -2
- package/dist/build/writePluginImports/writeActionImports.js +2 -2
- package/dist/build/writePluginImports/writeAuthImports.js +2 -2
- package/dist/build/writePluginImports/writeBlockImports.js +2 -2
- package/dist/build/writePluginImports/writeConnectionImports.js +2 -2
- package/dist/build/writePluginImports/writeIconImports.js +2 -2
- package/dist/build/writePluginImports/writeOperatorImports.js +2 -2
- package/dist/build/writePluginImports/writePluginImports.js +2 -2
- package/dist/build/writePluginImports/writeStyleImports.js +2 -2
- package/dist/build/writeRequests.js +7 -4
- package/dist/build/writeTypes.js +6 -3
- package/dist/createContext.js +4 -2
- package/dist/defaultTypesMap.js +363 -365
- package/dist/index.js +11 -1
- package/dist/lowdefySchema.js +8 -2
- package/dist/scripts/generateDefaultTypes.js +3 -3
- package/dist/scripts/run.js +1 -1
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +1 -1
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/test/testContext.js +5 -3
- package/dist/utils/countOperators.js +2 -2
- package/dist/utils/createCheckDuplicateId.js +3 -3
- package/dist/utils/createCounter.js +1 -1
- package/dist/utils/createPluginTypesMap.js +3 -3
- package/dist/utils/formatErrorMessage.js +4 -4
- package/dist/utils/makeId.js +20 -0
- package/dist/utils/readConfigFile.js +2 -2
- package/dist/utils/writeBuildArtifact.js +2 -2
- package/package.json +47 -48
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
minHeight: '100vh'
|
|
20
20
|
},
|
|
21
21
|
properties: {
|
|
22
|
-
status:
|
|
22
|
+
status: 'info',
|
|
23
23
|
title: '404',
|
|
24
24
|
subTitle: 'Sorry, the page you are visiting does not exist.'
|
|
25
25
|
},
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
params: {
|
|
42
42
|
home: true
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
]
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import page404 from './404.js';
|
|
17
|
-
function addDefaultPages({ components
|
|
17
|
+
function addDefaultPages({ components }) {
|
|
18
18
|
// If not copied, the same object is mutated by build every time
|
|
19
19
|
// build runs for dev server. See #647
|
|
20
20
|
const defaultPages = [
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 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
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
import makeId from '../utils/makeId.js';
|
|
17
|
+
function recAddKeys(object, key, keyMap, parentId) {
|
|
18
|
+
const id = makeId();
|
|
19
|
+
keyMap[id] = {
|
|
20
|
+
key,
|
|
21
|
+
'~r': object['~r'],
|
|
22
|
+
'~k_parent': parentId
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(object, '~k', {
|
|
25
|
+
value: id,
|
|
26
|
+
enumerable: false,
|
|
27
|
+
writable: true,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
delete object['~r'];
|
|
31
|
+
Object.keys(object).forEach((nextKey)=>{
|
|
32
|
+
if (type.isObject(object[nextKey])) {
|
|
33
|
+
recAddKeys(object[nextKey], `${key}.${nextKey}`, keyMap, id);
|
|
34
|
+
}
|
|
35
|
+
if (type.isArray(object[nextKey])) {
|
|
36
|
+
object[nextKey].forEach((item, index)=>{
|
|
37
|
+
if (type.isObject(item)) {
|
|
38
|
+
recAddKeys(item, `${key}.${nextKey}[${index}:${item.blockId ?? item.menuId ?? item.menuItemId ?? item.requestId ?? item.connectionId ?? item.connectionId ?? item.id}:${item.type}]`, keyMap, id);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function addKeys({ components, context }) {
|
|
45
|
+
const id = makeId();
|
|
46
|
+
recAddKeys(components, 'root', context.keyMap, id);
|
|
47
|
+
}
|
|
48
|
+
export default addKeys;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import buildAuthPlugins from './buildAuthPlugins.js';
|
|
17
17
|
import buildPageAuth from './buildPageAuth.js';
|
|
18
18
|
import validateAuthConfig from './validateAuthConfig.js';
|
|
19
|
-
function buildAuth({ components
|
|
19
|
+
function buildAuth({ components, context }) {
|
|
20
20
|
const configured = !type.isNone(components.auth);
|
|
21
21
|
validateAuthConfig({
|
|
22
22
|
components
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function buildAuthPlugin({ counter
|
|
16
|
+
function buildAuthPlugin({ counter, pluginConfig, typeClass }) {
|
|
17
17
|
if (type.isArray(pluginConfig)) {
|
|
18
18
|
pluginConfig.forEach((plugin)=>{
|
|
19
19
|
if (type.isUndefined(plugin.id)) {
|
|
@@ -29,8 +29,8 @@ function buildAuthPlugin({ counter , pluginConfig , typeClass }) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function buildAdapter({ components
|
|
33
|
-
const { adapter
|
|
32
|
+
function buildAdapter({ components, context }) {
|
|
33
|
+
const { adapter } = components.auth;
|
|
34
34
|
if (type.isNone(adapter)) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -45,7 +45,7 @@ function buildAdapter({ components , context }) {
|
|
|
45
45
|
}
|
|
46
46
|
context.typeCounters.auth.adapters.increment(adapter.type);
|
|
47
47
|
}
|
|
48
|
-
function buildAuthPlugins({ components
|
|
48
|
+
function buildAuthPlugins({ components, context }) {
|
|
49
49
|
const counters = context.typeCounters.auth;
|
|
50
50
|
const authConfig = components.auth;
|
|
51
51
|
buildAdapter({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import getPageRoles from './getPageRoles.js';
|
|
17
17
|
import getProtectedPages from './getProtectedPages.js';
|
|
18
|
-
function buildPageAuth({ components
|
|
18
|
+
function buildPageAuth({ components }) {
|
|
19
19
|
const protectedPages = getProtectedPages({
|
|
20
20
|
components
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function getPageRoles({ components
|
|
15
|
+
*/ function getPageRoles({ components }) {
|
|
16
16
|
const roles = components.auth.pages.roles;
|
|
17
17
|
const pageRoles = {};
|
|
18
18
|
Object.keys(roles).forEach((roleName)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function getProtectedPages({ components
|
|
16
|
+
function getProtectedPages({ components }) {
|
|
17
17
|
const pageIds = (components.pages || []).map((page)=>page.id);
|
|
18
18
|
let protectedPages = [];
|
|
19
19
|
if (type.isArray(components.auth.pages.public)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import { validate } from '@lowdefy/ajv';
|
|
17
17
|
import lowdefySchema from '../../lowdefySchema.js';
|
|
18
|
-
async function validateAuthConfig({ components
|
|
18
|
+
async function validateAuthConfig({ components }) {
|
|
19
19
|
if (type.isNone(components.auth)) {
|
|
20
20
|
components.auth = {};
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import countOperators from '../utils/countOperators.js';
|
|
17
17
|
import createCheckDuplicateId from '../utils/createCheckDuplicateId.js';
|
|
18
|
-
function buildConnections({ components
|
|
18
|
+
function buildConnections({ components, context }) {
|
|
19
19
|
const checkDuplicateConnectionId = createCheckDuplicateId({
|
|
20
20
|
message: 'Duplicate connectionId "{{ id }}".'
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,12 +14,14 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ const iconPackages = {
|
|
16
16
|
'react-icons/ai': /"(Ai[A-Z0-9]\w*)"/gm,
|
|
17
|
-
'react-icons/bs': /"(Bs[A-Z0-9]\w*)"/gm,
|
|
18
17
|
'react-icons/bi': /"(Bi[A-Z0-9]\w*)"/gm,
|
|
18
|
+
'react-icons/bs': /"(Bs[A-Z0-9]\w*)"/gm,
|
|
19
|
+
'react-icons/cg': /"(Cg[A-Z0-9]\w*)"/gm,
|
|
20
|
+
'react-icons/ci': /"(Ci[A-Z0-9]\w*)"/gm,
|
|
19
21
|
'react-icons/di': /"(Di[A-Z0-9]\w*)"/gm,
|
|
20
|
-
'react-icons/fi': /"(Fi[A-Z0-9]\w*)"/gm,
|
|
21
|
-
'react-icons/fc': /"(Fc[A-Z0-9]\w*)"/gm,
|
|
22
22
|
'react-icons/fa': /"(Fa[A-Z0-9]\w*)"/gm,
|
|
23
|
+
'react-icons/fc': /"(Fc[A-Z0-9]\w*)"/gm,
|
|
24
|
+
'react-icons/fi': /"(Fi[A-Z0-9]\w*)"/gm,
|
|
23
25
|
'react-icons/gi': /"(Gi[A-Z0-9]\w*)"/gm,
|
|
24
26
|
'react-icons/go': /"(Go[A-Z0-9]\w*)"/gm,
|
|
25
27
|
'react-icons/gr': /"(Gr[A-Z0-9]\w*)"/gm,
|
|
@@ -29,13 +31,16 @@
|
|
|
29
31
|
'react-icons/io5': /"(Io[A-Z0-9]\w*)"/gm,
|
|
30
32
|
'react-icons/md': /"(Md[A-Z0-9]\w*)"/gm,
|
|
31
33
|
'react-icons/ri': /"(Ri[A-Z0-9]\w*)"/gm,
|
|
34
|
+
'react-icons/rx': /"(Rx[A-Z0-9]\w*)"/gm,
|
|
32
35
|
'react-icons/si': /"(Si[A-Z0-9]\w*)"/gm,
|
|
36
|
+
'react-icons/sl': /"(Sl[A-Z0-9]\w*)"/gm,
|
|
37
|
+
'react-icons/tb': /"(Tb[A-Z0-9]\w*)"/gm,
|
|
38
|
+
'react-icons/tfi': /"(Tfi[A-Z0-9]\w*)"/gm,
|
|
33
39
|
'react-icons/ti': /"(Ti[A-Z0-9]\w*)"/gm,
|
|
34
40
|
'react-icons/vsc': /"(Vsc[A-Z0-9]\w*)"/gm,
|
|
35
|
-
'react-icons/wi': /"(Wi[A-Z0-9]\w*)"/gm
|
|
36
|
-
'react-icons/cg': /"(Cg[A-Z0-9]\w*)"/gm
|
|
41
|
+
'react-icons/wi': /"(Wi[A-Z0-9]\w*)"/gm
|
|
37
42
|
};
|
|
38
|
-
function getConfigIcons({ components
|
|
43
|
+
function getConfigIcons({ components, icons, regex }) {
|
|
39
44
|
[
|
|
40
45
|
...JSON.stringify(components.global || {}).matchAll(regex)
|
|
41
46
|
].map((match)=>icons.add(match[1]));
|
|
@@ -46,7 +51,7 @@ function getConfigIcons({ components , icons , regex }) {
|
|
|
46
51
|
...JSON.stringify(components.pages || []).matchAll(regex)
|
|
47
52
|
].map((match)=>icons.add(match[1]));
|
|
48
53
|
}
|
|
49
|
-
function getBlockDefaultIcons({ blocks
|
|
54
|
+
function getBlockDefaultIcons({ blocks, context, icons, regex }) {
|
|
50
55
|
blocks.forEach((block)=>{
|
|
51
56
|
(context.typesMap.icons[block.typeName] || []).forEach((icon)=>{
|
|
52
57
|
[
|
|
@@ -55,7 +60,7 @@ function getBlockDefaultIcons({ blocks , context , icons , regex }) {
|
|
|
55
60
|
});
|
|
56
61
|
});
|
|
57
62
|
}
|
|
58
|
-
function buildIconImports({ blocks
|
|
63
|
+
function buildIconImports({ blocks, components, context, defaults = {} }) {
|
|
59
64
|
const iconImports = [];
|
|
60
65
|
Object.entries(iconPackages).forEach(([iconPackage, regex])=>{
|
|
61
66
|
defaults;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import buildImportsDev from './buildImportsDev.js';
|
|
16
16
|
import buildImportsProd from './buildImportsProd.js';
|
|
17
|
-
function buildImports({ components
|
|
17
|
+
function buildImports({ components, context }) {
|
|
18
18
|
if (context.stage === 'dev') {
|
|
19
19
|
components.imports = buildImportsDev({
|
|
20
20
|
components,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import buildIconImports from './buildIconImports.js';
|
|
16
16
|
import buildStyleImports from './buildStyleImports.js';
|
|
17
17
|
import defaultIconsDev from './defaultIconsDev.js';
|
|
18
|
-
function getPluginPackages({ components
|
|
18
|
+
function getPluginPackages({ components }) {
|
|
19
19
|
const pluginPackages = new Set();
|
|
20
20
|
function getPackages(types) {
|
|
21
21
|
Object.values(types).forEach((type)=>{
|
|
@@ -34,14 +34,14 @@ function getPluginPackages({ components }) {
|
|
|
34
34
|
getPackages(components.types.operators.server);
|
|
35
35
|
return pluginPackages;
|
|
36
36
|
}
|
|
37
|
-
function buildImportClassDev({ pluginPackages
|
|
37
|
+
function buildImportClassDev({ pluginPackages, map }) {
|
|
38
38
|
return Object.entries(map).map(([typeName, type])=>({
|
|
39
39
|
originalTypeName: type.originalTypeName,
|
|
40
40
|
package: type.package,
|
|
41
41
|
typeName
|
|
42
42
|
})).filter((type)=>pluginPackages.has(type.package));
|
|
43
43
|
}
|
|
44
|
-
function buildImportsDev({ components
|
|
44
|
+
function buildImportsDev({ components, context }) {
|
|
45
45
|
const pluginPackages = getPluginPackages({
|
|
46
46
|
components
|
|
47
47
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -22,7 +22,7 @@ function buildImportClassProd(types) {
|
|
|
22
22
|
typeName
|
|
23
23
|
}));
|
|
24
24
|
}
|
|
25
|
-
function buildImportsProd({ components
|
|
25
|
+
function buildImportsProd({ components, context }) {
|
|
26
26
|
const blocks = buildImportClassProd(components.types.blocks);
|
|
27
27
|
return {
|
|
28
28
|
actions: buildImportClassProd(components.types.actions),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function buildStyleImports({ blocks
|
|
15
|
+
*/ function buildStyleImports({ blocks, context }) {
|
|
16
16
|
const styles = new Set();
|
|
17
17
|
blocks.forEach((block)=>{
|
|
18
18
|
styles.add(...(context.typesMap.styles.packages[block.package] || []).map((style)=>`${block.package}/${style}`));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -578,7 +578,7 @@
|
|
|
578
578
|
'AiOutlineYoutube',
|
|
579
579
|
'AiOutlineYuque',
|
|
580
580
|
'AiOutlineZoomIn',
|
|
581
|
-
'AiOutlineZoomOut'
|
|
581
|
+
'AiOutlineZoomOut'
|
|
582
582
|
]
|
|
583
583
|
};
|
|
584
584
|
export default defaultIconsDev;
|
package/dist/build/buildMenu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import createCheckDuplicateId from '../utils/createCheckDuplicateId.js';
|
|
17
|
-
function buildDefaultMenu({ components
|
|
17
|
+
function buildDefaultMenu({ components, context }) {
|
|
18
18
|
context.logger.warn('No menus found. Building default menu.');
|
|
19
19
|
const pages = type.isArray(components.pages) ? components.pages : [];
|
|
20
20
|
const menus = [
|
|
@@ -26,11 +26,11 @@ function buildDefaultMenu({ components , context }) {
|
|
|
26
26
|
pageId: page.pageId,
|
|
27
27
|
auth: page.auth
|
|
28
28
|
})).filter((page)=>page.pageId !== '404')
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
];
|
|
31
31
|
return menus;
|
|
32
32
|
}
|
|
33
|
-
function loopItems({ parent
|
|
33
|
+
function loopItems({ parent, menuId, pages, missingPageWarnings, checkDuplicateMenuItemId }) {
|
|
34
34
|
if (type.isArray(parent.links)) {
|
|
35
35
|
parent.links.forEach((menuItem)=>{
|
|
36
36
|
if (menuItem.type === 'MenuLink') {
|
|
@@ -75,7 +75,7 @@ function loopItems({ parent , menuId , pages , missingPageWarnings , checkDuplic
|
|
|
75
75
|
parent.links = parent.links.filter((item)=>item.remove !== true);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
function buildMenu({ components
|
|
78
|
+
function buildMenu({ components, context }) {
|
|
79
79
|
const pages = type.isArray(components.pages) ? components.pages : [];
|
|
80
80
|
if (type.isUndefined(components.menus) || components.menus.length === 0) {
|
|
81
81
|
components.menus = buildDefaultMenu({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import createCheckDuplicateId from '../../../utils/createCheckDuplicateId.js';
|
|
17
|
-
function checkAction(action, { blockId
|
|
17
|
+
function checkAction(action, { blockId, checkDuplicateActionId, eventId, pageId, typeCounters }) {
|
|
18
18
|
if (type.isUndefined(action.id)) {
|
|
19
19
|
throw new Error(`Action id missing on event "${eventId}" on block "${blockId}" on page "${pageId}".`);
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
function buildRequest(request, pageContext) {
|
|
17
|
-
const { auth
|
|
17
|
+
const { auth, checkDuplicateRequestId, pageId, typeCounters } = pageContext;
|
|
18
18
|
if (type.isUndefined(request.id)) {
|
|
19
19
|
throw new Error(`Request id missing at page "${pageId}".`);
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import countOperators from '../../../utils/countOperators.js';
|
|
16
|
-
function countBlockOperators(block, { typeCounters
|
|
16
|
+
function countBlockOperators(block, { typeCounters }) {
|
|
17
17
|
// eslint-disable-next-line no-unused-vars
|
|
18
|
-
const { requests
|
|
18
|
+
const { requests, areas, blocks, ...webBlock } = block;
|
|
19
19
|
countOperators(webBlock, {
|
|
20
20
|
counter: typeCounters.operators.client
|
|
21
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function countBlockTypes(block, { typeCounters
|
|
15
|
+
*/ function countBlockTypes(block, { typeCounters }) {
|
|
16
16
|
typeCounters.blocks.increment(block.type);
|
|
17
17
|
}
|
|
18
18
|
export default countBlockTypes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { set, type } from '@lowdefy/helpers';
|
|
16
|
-
function recMoveSkeletonBlocksToArea(
|
|
17
|
-
if (!type.isNone(
|
|
18
|
-
if (!type.isArray(
|
|
19
|
-
throw new Error(`Skeleton blocks at ${blockId} on page ${pageId} is not an array. Received ${JSON.stringify(
|
|
16
|
+
function recMoveSkeletonBlocksToArea(block, blockId, pageId) {
|
|
17
|
+
if (!type.isNone(block.blocks)) {
|
|
18
|
+
if (!type.isArray(block.blocks)) {
|
|
19
|
+
throw new Error(`Skeleton blocks at ${blockId} on page ${pageId} is not an array. Received ${JSON.stringify(block.blocks)}`);
|
|
20
20
|
}
|
|
21
|
-
set(
|
|
22
|
-
delete
|
|
21
|
+
set(block, 'areas.content.blocks', block.blocks);
|
|
22
|
+
delete block.blocks;
|
|
23
23
|
}
|
|
24
|
-
Object.keys(
|
|
25
|
-
|
|
24
|
+
Object.keys(block.areas || {}).forEach((area)=>{
|
|
25
|
+
block.areas[area].blocks.forEach((block, i)=>{
|
|
26
26
|
recMoveSkeletonBlocksToArea(block, `${blockId}.areas.${area}.${i}.blocks`, pageId);
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function setBlockId(block, { pageId
|
|
15
|
+
*/ function setBlockId(block, { pageId, blockIdCounter }) {
|
|
16
16
|
block.blockId = block.id;
|
|
17
17
|
block.id = `block:${pageId}:${block.blockId}:${blockIdCounter.getCount(block.blockId)}`;
|
|
18
18
|
blockIdCounter.increment(block.blockId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function validateBlock(block, { pageId
|
|
16
|
+
function validateBlock(block, { pageId }) {
|
|
17
17
|
if (!type.isObject(block)) {
|
|
18
18
|
throw new Error(`Expected block to be an object on page "${pageId}". Received ${JSON.stringify(block)}.`);
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import buildBlock from './buildBlock/buildBlock.js';
|
|
17
17
|
import createCheckDuplicateId from '../../utils/createCheckDuplicateId.js';
|
|
18
18
|
import createCounter from '../../utils/createCounter.js';
|
|
19
|
-
function buildPage({ page
|
|
19
|
+
function buildPage({ page, index, context, checkDuplicatePageId }) {
|
|
20
20
|
if (type.isUndefined(page.id)) {
|
|
21
21
|
throw new Error(`Page id missing at page ${index}.`);
|
|
22
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import buildPage from './buildPage.js';
|
|
17
17
|
import createCheckDuplicateId from '../../utils/createCheckDuplicateId.js';
|
|
18
|
-
function buildPages({ components
|
|
18
|
+
function buildPages({ components, context }) {
|
|
19
19
|
const pages = type.isArray(components.pages) ? components.pages : [];
|
|
20
20
|
const checkDuplicatePageId = createCheckDuplicateId({
|
|
21
21
|
message: 'Duplicate pageId "{{ id }}".'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import buildAuth from '../buildAuth/buildAuth.js';
|
|
17
17
|
import buildPages from './buildPages.js';
|
|
18
18
|
import createContext from '../../createContext.js';
|
|
19
|
-
function buildTestPage({ pageConfig
|
|
19
|
+
function buildTestPage({ pageConfig }) {
|
|
20
20
|
const context = createContext({
|
|
21
21
|
customTypesMap: {},
|
|
22
22
|
directories: {},
|