@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.
Files changed (95) hide show
  1. package/dist/build/addDefaultPages/404.js +4 -4
  2. package/dist/build/addDefaultPages/addDefaultPages.js +2 -2
  3. package/dist/build/addKeys.js +48 -0
  4. package/dist/build/buildAuth/buildAuth.js +2 -2
  5. package/dist/build/buildAuth/buildAuthPlugins.js +5 -5
  6. package/dist/build/buildAuth/buildPageAuth.js +2 -2
  7. package/dist/build/buildAuth/getPageRoles.js +2 -2
  8. package/dist/build/buildAuth/getProtectedPages.js +2 -2
  9. package/dist/build/buildAuth/validateAuthConfig.js +2 -2
  10. package/dist/build/buildConnections.js +2 -2
  11. package/dist/build/buildImports/buildIconImports.js +14 -9
  12. package/dist/build/buildImports/buildImports.js +2 -2
  13. package/dist/build/buildImports/buildImportsDev.js +4 -4
  14. package/dist/build/buildImports/buildImportsProd.js +2 -2
  15. package/dist/build/buildImports/buildStyleImports.js +2 -2
  16. package/dist/build/buildImports/defaultIconsDev.js +2 -2
  17. package/dist/build/buildImports/defaultIconsProd.js +1 -1
  18. package/dist/build/buildMenu.js +5 -5
  19. package/dist/build/buildPages/buildBlock/buildBlock.js +1 -1
  20. package/dist/build/buildPages/buildBlock/buildEvents.js +2 -2
  21. package/dist/build/buildPages/buildBlock/buildRequests.js +2 -2
  22. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
  23. package/dist/build/buildPages/buildBlock/countBlockOperators.js +3 -3
  24. package/dist/build/buildPages/buildBlock/countBlockTypes.js +2 -2
  25. package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +9 -9
  26. package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
  27. package/dist/build/buildPages/buildBlock/setBlockId.js +2 -2
  28. package/dist/build/buildPages/buildBlock/validateBlock.js +2 -2
  29. package/dist/build/buildPages/buildPage.js +2 -2
  30. package/dist/build/buildPages/buildPages.js +2 -2
  31. package/dist/build/buildPages/buildTestPage.js +2 -2
  32. package/dist/build/buildRefs/buildRefs.js +3 -3
  33. package/dist/build/buildRefs/evaluateBuildOperators.js +5 -5
  34. package/dist/build/buildRefs/getConfigFile.js +2 -2
  35. package/dist/build/buildRefs/getKey.js +24 -0
  36. package/dist/build/buildRefs/getRefContent.js +2 -2
  37. package/dist/build/buildRefs/getRefPath.js +1 -1
  38. package/dist/build/buildRefs/getRefsFromFile.js +3 -3
  39. package/dist/build/buildRefs/getUserJavascriptFunction.js +2 -2
  40. package/dist/build/buildRefs/makeRefDefinition.js +11 -5
  41. package/dist/build/buildRefs/parseNunjucks.js +1 -1
  42. package/dist/build/buildRefs/parseRefContent.js +4 -9
  43. package/dist/build/buildRefs/populateRefs.js +2 -2
  44. package/dist/build/buildRefs/recursiveBuild.js +25 -8
  45. package/dist/build/buildRefs/runRefResolver.js +2 -2
  46. package/dist/build/buildRefs/runTransformer.js +2 -2
  47. package/dist/build/buildTypes.js +4 -4
  48. package/dist/build/cleanBuildDirectory.js +2 -2
  49. package/dist/build/copyPublicFolder.js +8 -5
  50. package/dist/build/testSchema.js +3 -3
  51. package/dist/build/updateServerPackageJson.js +3 -8
  52. package/dist/build/validateApp.js +2 -2
  53. package/dist/build/validateConfig.js +2 -2
  54. package/dist/build/writeApp.js +6 -3
  55. package/dist/build/writeAuth.js +6 -3
  56. package/dist/build/writeConfig.js +6 -3
  57. package/dist/build/writeConnections.js +6 -4
  58. package/dist/build/writeGlobal.js +6 -4
  59. package/dist/build/writeMaps.js +30 -0
  60. package/dist/build/writeMenus.js +6 -4
  61. package/dist/build/writePages.js +7 -4
  62. package/dist/build/writePluginImports/generateImportFile.js +2 -2
  63. package/dist/build/writePluginImports/writeActionImports.js +2 -2
  64. package/dist/build/writePluginImports/writeAuthImports.js +2 -2
  65. package/dist/build/writePluginImports/writeBlockImports.js +2 -2
  66. package/dist/build/writePluginImports/writeConnectionImports.js +2 -2
  67. package/dist/build/writePluginImports/writeIconImports.js +2 -2
  68. package/dist/build/writePluginImports/writeOperatorImports.js +2 -2
  69. package/dist/build/writePluginImports/writePluginImports.js +2 -2
  70. package/dist/build/writePluginImports/writeStyleImports.js +2 -2
  71. package/dist/build/writeRequests.js +7 -4
  72. package/dist/build/writeTypes.js +6 -3
  73. package/dist/createContext.js +4 -2
  74. package/dist/defaultTypesMap.js +363 -365
  75. package/dist/index.js +11 -1
  76. package/dist/lowdefySchema.js +8 -2
  77. package/dist/scripts/generateDefaultTypes.js +3 -3
  78. package/dist/scripts/run.js +1 -1
  79. package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +1 -1
  80. package/dist/test/buildRefs/testBuildRefsErrorResolver.js +1 -1
  81. package/dist/test/buildRefs/testBuildRefsNullResolver.js +1 -1
  82. package/dist/test/buildRefs/testBuildRefsParsingResolver.js +1 -1
  83. package/dist/test/buildRefs/testBuildRefsResolver.js +1 -1
  84. package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
  85. package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
  86. package/dist/test/testContext.js +5 -3
  87. package/dist/utils/countOperators.js +2 -2
  88. package/dist/utils/createCheckDuplicateId.js +3 -3
  89. package/dist/utils/createCounter.js +1 -1
  90. package/dist/utils/createPluginTypesMap.js +3 -3
  91. package/dist/utils/formatErrorMessage.js +4 -4
  92. package/dist/utils/makeId.js +20 -0
  93. package/dist/utils/readConfigFile.js +2 -2
  94. package/dist/utils/writeBuildArtifact.js +2 -2
  95. package/package.json +47 -48
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,11 +12,13 @@
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 writeMenus({ components , context }) {
15
+ */ import { type, serializer } from '@lowdefy/helpers';
16
+ async function writeMenus({ components, context }) {
17
17
  if (!type.isArray(components.menus)) {
18
18
  throw new Error('Menus is not an array.');
19
19
  }
20
- await context.writeBuildArtifact('menus.json', JSON.stringify(components.menus, null, 2));
20
+ await context.writeBuildArtifact('menus.json', serializer.serializeToString(components.menus, {
21
+ space: 2
22
+ }));
21
23
  }
22
24
  export default writeMenus;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,10 +12,13 @@
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
- */ async function writePage({ page , context }) {
16
- await context.writeBuildArtifact(`pages/${page.pageId}/${page.pageId}.json`, JSON.stringify(page, null, 2));
15
+ */ import { serializer } from '@lowdefy/helpers';
16
+ async function writePage({ page, context }) {
17
+ await context.writeBuildArtifact(`pages/${page.pageId}/${page.pageId}.json`, serializer.serializeToString(page ?? {}, {
18
+ space: 2
19
+ }));
17
20
  }
18
- async function writePages({ components , context }) {
21
+ async function writePages({ components, context }) {
19
22
  const writePromises = components.pages.map((page)=>writePage({
20
23
  page,
21
24
  context
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -21,7 +21,7 @@ export default {
21
21
  {{ import.typeName }},
22
22
  {% endfor -%}
23
23
  };`;
24
- function generateImportFile({ imports , importPath }) {
24
+ function generateImportFile({ imports, importPath }) {
25
25
  const templateFn = nunjucksFunction(template);
26
26
  return templateFn({
27
27
  imports,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 generateImportFile from './generateImportFile.js';
16
- async function writeActionImports({ components , context }) {
16
+ async function writeActionImports({ components, context }) {
17
17
  await context.writeBuildArtifact('plugins/actions.js', generateImportFile({
18
18
  imports: components.imports.actions,
19
19
  importPath: 'actions'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 generateImportFile from './generateImportFile.js';
16
- async function writeAuthImports({ components , context }) {
16
+ async function writeAuthImports({ components, context }) {
17
17
  await context.writeBuildArtifact('plugins/auth/adapters.js', generateImportFile({
18
18
  imports: components.imports.auth.adapters,
19
19
  importPath: 'auth/adapters'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 generateImportFile from './generateImportFile.js';
16
- async function writeBlockImports({ components , context }) {
16
+ async function writeBlockImports({ components, context }) {
17
17
  await context.writeBuildArtifact('plugins/blocks.js', generateImportFile({
18
18
  imports: components.imports.blocks,
19
19
  importPath: 'blocks'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 generateImportFile from './generateImportFile.js';
16
- async function writeConnectionImports({ components , context }) {
16
+ async function writeConnectionImports({ components, context }) {
17
17
  await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
18
18
  imports: components.imports.connections,
19
19
  importPath: 'connections'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 @@ export default {
22
22
  {{ icon }},{% endfor %}
23
23
  {%- endfor %}
24
24
  };`;
25
- async function writeIconImports({ components , context }) {
25
+ async function writeIconImports({ components, context }) {
26
26
  const templateFn = nunjucksFunction(template);
27
27
  await context.writeBuildArtifact('plugins/icons.js', templateFn({
28
28
  packages: components.imports.icons
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 generateImportFile from './generateImportFile.js';
16
- async function writeOperatorImports({ components , context }) {
16
+ async function writeOperatorImports({ components, context }) {
17
17
  await context.writeBuildArtifact('plugins/operators/client.js', generateImportFile({
18
18
  imports: components.imports.operators.client,
19
19
  importPath: 'operators/client'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 @@ import writeConnectionImports from './writeConnectionImports.js';
19
19
  import writeIconImports from './writeIconImports.js';
20
20
  import writeOperatorImports from './writeOperatorImports.js';
21
21
  import writeStyleImports from './writeStyleImports.js';
22
- async function writePluginImports({ components , context }) {
22
+ async function writePluginImports({ components, context }) {
23
23
  await writeActionImports({
24
24
  components,
25
25
  context
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -24,7 +24,7 @@ const template = `@import '@lowdefy/layout/style.less';
24
24
  @import '../../public/styles.less';
25
25
  {% endif %}
26
26
  `;
27
- async function writeStyleImports({ components , context }) {
27
+ async function writeStyleImports({ components, context }) {
28
28
  const templateFn = nunjucksFunction(template);
29
29
  await context.writeBuildArtifact('plugins/styles.less', templateFn({
30
30
  styles: components.imports.styles,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,16 +12,19 @@
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
- */ async function writeRequestsOnPage({ page , context }) {
15
+ */ import { serializer } from '@lowdefy/helpers';
16
+ async function writeRequestsOnPage({ page, context }) {
16
17
  return Promise.all(page.requests.map(async (request)=>{
17
- await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, JSON.stringify(request, null, 2));
18
+ await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, serializer.serializeToString(request ?? {}, {
19
+ space: 2
20
+ }));
18
21
  delete request.properties;
19
22
  delete request.type;
20
23
  delete request.connectionId;
21
24
  delete request.auth;
22
25
  }));
23
26
  }
24
- async function writeRequests({ components , context }) {
27
+ async function writeRequests({ components, context }) {
25
28
  const writePromises = components.pages.map((page)=>writeRequestsOnPage({
26
29
  page,
27
30
  context
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,10 @@
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
- */ async function writeTypes({ components , context }) {
16
- await context.writeBuildArtifact('types.json', JSON.stringify(components.types, null, 2));
15
+ */ import { serializer } from '@lowdefy/helpers';
16
+ async function writeTypes({ components, context }) {
17
+ await context.writeBuildArtifact('types.json', serializer.serializeToString(components.types ?? {}, {
18
+ space: 2
19
+ }));
17
20
  }
18
21
  export default writeTypes;
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-console */ /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -17,13 +17,15 @@ import createCounter from './utils/createCounter.js';
17
17
  import createReadConfigFile from './utils/readConfigFile.js';
18
18
  import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
19
19
  import defaultTypesMap from './defaultTypesMap.js';
20
- function createContext({ customTypesMap , directories , logger , refResolver , stage ='prod' }) {
20
+ function createContext({ customTypesMap, directories, logger, refResolver, stage = 'prod' }) {
21
21
  const context = {
22
22
  directories,
23
+ keyMap: {},
23
24
  logger,
24
25
  readConfigFile: createReadConfigFile({
25
26
  directories
26
27
  }),
28
+ refMap: {},
27
29
  refResolver,
28
30
  stage,
29
31
  typeCounters: {