@lowdefy/build 4.0.0-alpha.1 → 4.0.0-alpha.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.
Files changed (79) hide show
  1. package/dist/build/addDefaultPages/404.js +37 -42
  2. package/dist/build/addDefaultPages/addDefaultPages.js +7 -3
  3. package/dist/build/buildAuth/buildAuth.js +1 -1
  4. package/dist/build/buildAuth/getPageRoles.js +2 -3
  5. package/dist/build/buildAuth/getProtectedPages.js +1 -1
  6. package/dist/build/buildConnections.js +2 -3
  7. package/dist/build/buildIcons.js +91 -0
  8. package/dist/build/buildMenu.js +1 -1
  9. package/dist/build/buildPages/buildBlock/buildBlock.js +6 -2
  10. package/dist/build/buildPages/buildBlock/buildEvents.js +5 -2
  11. package/dist/build/buildPages/buildBlock/buildRequests.js +2 -3
  12. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
  13. package/dist/build/buildPages/buildBlock/countBlockOperators.js +4 -6
  14. package/dist/build/buildPages/buildBlock/countBlockTypes.js +18 -0
  15. package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +35 -0
  16. package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
  17. package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
  18. package/dist/build/buildPages/buildBlock/validateBlock.js +2 -3
  19. package/dist/build/buildPages/buildPage.js +1 -1
  20. package/dist/build/buildPages/buildPages.js +1 -1
  21. package/dist/build/buildRefs/buildRefs.js +3 -3
  22. package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
  23. package/dist/build/buildRefs/getConfigFile.js +1 -1
  24. package/dist/build/buildRefs/getRefContent.js +2 -2
  25. package/dist/build/buildRefs/getRefPath.js +1 -1
  26. package/dist/build/buildRefs/getRefsFromFile.js +1 -1
  27. package/dist/build/buildRefs/getUserJavascriptFunction.js +7 -4
  28. package/dist/build/buildRefs/makeRefDefinition.js +2 -3
  29. package/dist/build/buildRefs/parseNunjucks.js +1 -1
  30. package/dist/build/buildRefs/parseRefContent.js +3 -3
  31. package/dist/build/buildRefs/populateRefs.js +1 -1
  32. package/dist/build/buildRefs/recursiveBuild.js +10 -5
  33. package/dist/build/buildRefs/runRefResolver.js +1 -1
  34. package/dist/build/buildRefs/runTransformer.js +8 -4
  35. package/dist/build/buildStyles.js +29 -0
  36. package/dist/build/buildTypes.js +50 -44
  37. package/dist/build/cleanBuildDirectory.js +2 -2
  38. package/dist/build/copyPublicFolder.js +23 -0
  39. package/dist/build/testSchema.js +1 -1
  40. package/dist/build/updateServerPackageJson.js +46 -0
  41. package/dist/build/validateApp.js +3 -5
  42. package/dist/build/validateConfig.js +13 -9
  43. package/dist/build/writeApp.js +2 -6
  44. package/dist/build/writeConfig.js +2 -6
  45. package/dist/build/writeConnections.js +2 -5
  46. package/dist/build/writeGlobal.js +3 -7
  47. package/dist/build/writeMenus.js +2 -5
  48. package/dist/build/writePages.js +3 -14
  49. package/dist/build/writePluginImports/generateImportFile.js +36 -0
  50. package/dist/build/writePluginImports/writeActionImports.js +22 -0
  51. package/dist/build/writePluginImports/writeBlockImports.js +6 -23
  52. package/dist/build/writePluginImports/writeConnectionImports.js +6 -23
  53. package/dist/build/writePluginImports/writeIconImports.js +31 -0
  54. package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
  55. package/dist/build/writePluginImports/writeStyleImports.js +28 -0
  56. package/dist/build/writeRequests.js +3 -8
  57. package/dist/build/writeTypes.js +2 -5
  58. package/dist/defaultTypesMap.json +1598 -0
  59. package/dist/index.js +143 -111
  60. package/dist/lowdefySchema.js +72 -24
  61. package/dist/scripts/generateDefaultTypes.js +42 -76
  62. package/dist/scripts/run.js +13 -12
  63. package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +3 -6
  64. package/dist/test/buildRefs/testBuildRefsErrorResolver.js +2 -2
  65. package/dist/test/buildRefs/testBuildRefsNullResolver.js +2 -2
  66. package/dist/test/buildRefs/testBuildRefsParsingResolver.js +2 -2
  67. package/dist/test/buildRefs/testBuildRefsResolver.js +2 -2
  68. package/dist/test/buildRefs/testBuildRefsTransform.js +2 -2
  69. package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +2 -2
  70. package/dist/test/testContext.js +12 -19
  71. package/dist/utils/countOperators.js +1 -1
  72. package/dist/utils/createCheckDuplicateId.js +1 -1
  73. package/dist/utils/createCounter.js +1 -1
  74. package/dist/utils/createPluginTypesMap.js +85 -0
  75. package/dist/utils/formatErrorMessage.js +2 -2
  76. package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +3 -3
  77. package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +4 -7
  78. package/package.json +47 -16
  79. package/dist/defaultTypes.json +0 -60
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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,28 +12,11 @@
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
- */ import { nunjucksFunction } from '@lowdefy/nunjucks';
16
- const template = `{%- for connection in connections -%}
17
- import { {{ connection.type }} } from '{{ connection.package }}/connections';
18
- {% endfor -%}
19
- export default {
20
- {%- for connection in connections -%}
21
- {{ connection.type }},
22
- {% endfor -%}
23
- };
24
- `;
15
+ */ import generateImportFile from './generateImportFile.js';
25
16
  async function writeConnectionImports({ components , context }) {
26
- const templateFn = nunjucksFunction(template);
27
- const connections = Object.keys(components.types.connections).map((type)=>({
28
- type,
29
- ...components.types.connections[type]
30
- })
31
- );
32
- await context.writeBuildArtifact({
33
- filePath: 'plugins/connections.js',
34
- content: templateFn({
35
- connections
36
- })
37
- });
17
+ await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
18
+ types: components.types.connections,
19
+ importPath: 'connections'
20
+ }));
38
21
  }
39
22
  export default writeConnectionImports;
@@ -0,0 +1,31 @@
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
+ */ import { nunjucksFunction } from '@lowdefy/nunjucks';
16
+ const template = `{%- for package in packages -%}
17
+ {% if package.icons.length %}import { {% for icon in package.icons -%}{% if not loop.last -%} {{ icon }}, {% else -%} {{ icon }} } from '{{ package.package }}';
18
+ {% endif -%}{% endfor %}{% endif %}{% endfor -%}
19
+ export default {
20
+ {%- for package in packages -%}
21
+ {%- for icon in package.icons %}
22
+ {{ icon }},{% endfor %}
23
+ {%- endfor %}
24
+ };`;
25
+ async function writeIconImports({ components , context }) {
26
+ const templateFn = nunjucksFunction(template);
27
+ await context.writeBuildArtifact('plugins/icons.js', templateFn({
28
+ packages: components.icons
29
+ }));
30
+ }
31
+ export default writeIconImports;
@@ -0,0 +1,26 @@
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
+ */ import generateImportFile from './generateImportFile.js';
16
+ async function writeOperatorImports({ components , context }) {
17
+ await context.writeBuildArtifact('plugins/operatorsClient.js', generateImportFile({
18
+ types: components.types.operators.client,
19
+ importPath: 'operators/client'
20
+ }));
21
+ await context.writeBuildArtifact('plugins/operatorsServer.js', generateImportFile({
22
+ types: components.types.operators.server,
23
+ importPath: 'operators/server'
24
+ }));
25
+ }
26
+ export default writeOperatorImports;
@@ -0,0 +1,28 @@
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
+ */ import { nunjucksFunction } from '@lowdefy/nunjucks';
16
+ const template = `@import '@lowdefy/layout/style.less';
17
+ @import '@lowdefy/client/style.less';
18
+ {% for style in styles -%}
19
+ @import '{{ style }}';
20
+ {% endfor -%}
21
+ `;
22
+ async function writeStyleImports({ components , context }) {
23
+ const templateFn = nunjucksFunction(template);
24
+ await context.writeBuildArtifact('plugins/styles.less', templateFn({
25
+ styles: components.styles
26
+ }));
27
+ }
28
+ export default writeStyleImports;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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,13 +12,9 @@
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
- */ import { type } from '@lowdefy/helpers';
16
- async function writeRequestsOnPage({ page , context }) {
15
+ */ async function writeRequestsOnPage({ page , context }) {
17
16
  return Promise.all(page.requests.map(async (request)=>{
18
- await context.writeBuildArtifact({
19
- filePath: `pages/${page.pageId}/requests/${request.requestId}.json`,
20
- content: JSON.stringify(request, null, 2)
21
- });
17
+ await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, JSON.stringify(request, null, 2));
22
18
  delete request.properties;
23
19
  delete request.type;
24
20
  delete request.connectionId;
@@ -26,7 +22,6 @@ async function writeRequestsOnPage({ page , context }) {
26
22
  }));
27
23
  }
28
24
  async function writeRequests({ components , context }) {
29
- if (type.isNone(components.pages)) return;
30
25
  const writePromises = components.pages.map((page)=>writeRequestsOnPage({
31
26
  page,
32
27
  context
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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,6 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ async function writeTypes({ components , context }) {
16
- await context.writeBuildArtifact({
17
- filePath: 'types.json',
18
- content: JSON.stringify(components.types, null, 2)
19
- });
16
+ await context.writeBuildArtifact('types.json', JSON.stringify(components.types, null, 2));
20
17
  }
21
18
  export default writeTypes;