@lowdefy/build 4.5.2 → 4.7.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.
Files changed (163) hide show
  1. package/dist/build/addDefaultPages/404.js +1 -1
  2. package/dist/build/addDefaultPages/addDefaultPages.js +10 -4
  3. package/dist/build/addKeys.js +85 -29
  4. package/dist/build/buildApi/buildApi.js +27 -8
  5. package/dist/build/buildApi/buildEndpoint.js +7 -1
  6. package/dist/build/buildApi/buildRoutine/buildControl.js +1 -1
  7. package/dist/build/buildApi/buildRoutine/buildRoutine.js +1 -1
  8. package/dist/build/buildApi/buildRoutine/buildStep.js +1 -1
  9. package/dist/build/buildApi/buildRoutine/controlTypes.js +34 -11
  10. package/dist/build/buildApi/buildRoutine/countControl.js +1 -1
  11. package/dist/build/buildApi/buildRoutine/countStepTypes.js +2 -2
  12. package/dist/build/buildApi/buildRoutine/setStepId.js +1 -1
  13. package/dist/build/buildApi/buildRoutine/validateStep.js +30 -9
  14. package/dist/build/buildApi/validateEndpoint.js +36 -7
  15. package/dist/build/buildApi/validateStepReferences.js +65 -0
  16. package/dist/build/buildApp.js +1 -1
  17. package/dist/build/buildAuth/buildApiAuth.js +7 -3
  18. package/dist/build/buildAuth/buildAuth.js +7 -4
  19. package/dist/build/buildAuth/buildAuthPlugins.js +42 -13
  20. package/dist/build/buildAuth/buildPageAuth.js +14 -3
  21. package/dist/build/buildAuth/getApiRoles.js +1 -1
  22. package/dist/build/buildAuth/getPageRoles.js +1 -1
  23. package/dist/build/buildAuth/getProtectedApi.js +1 -1
  24. package/dist/build/buildAuth/getProtectedPages.js +1 -1
  25. package/dist/build/buildAuth/validateAuthConfig.js +39 -5
  26. package/dist/build/buildAuth/validateMutualExclusivity.js +13 -5
  27. package/dist/build/buildConnections.js +23 -24
  28. package/dist/build/buildImports/buildIconImports.js +1 -1
  29. package/dist/build/buildImports/buildImports.js +1 -1
  30. package/dist/build/buildImports/buildImportsDev.js +1 -1
  31. package/dist/build/buildImports/buildImportsProd.js +1 -1
  32. package/dist/build/buildImports/buildStyleImports.js +1 -1
  33. package/dist/build/buildImports/defaultIconsDev.js +1 -1
  34. package/dist/build/buildImports/defaultIconsProd.js +1 -1
  35. package/dist/build/buildJs/generateJsFile.js +1 -1
  36. package/dist/build/buildJs/jsMapParser.js +1 -1
  37. package/dist/build/buildJs/writeJs.js +1 -1
  38. package/dist/build/buildLogger.js +41 -0
  39. package/dist/build/buildMenu.js +36 -12
  40. package/dist/build/buildPages/buildBlock/buildBlock.js +1 -1
  41. package/dist/build/buildPages/buildBlock/buildEvents.js +79 -9
  42. package/dist/build/buildPages/buildBlock/buildRequests.js +38 -8
  43. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +6 -2
  44. package/dist/build/buildPages/buildBlock/countBlockOperators.js +1 -1
  45. package/dist/build/buildPages/buildBlock/countBlockTypes.js +2 -2
  46. package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +6 -2
  47. package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +6 -2
  48. package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
  49. package/dist/build/buildPages/buildBlock/validateBlock.js +25 -7
  50. package/dist/build/buildPages/buildPage.js +35 -6
  51. package/dist/build/buildPages/validateLinkReferences.js +33 -0
  52. package/dist/build/buildPages/validatePayloadReferences.js +59 -0
  53. package/dist/build/buildPages/validateRequestReferences.js +33 -0
  54. package/dist/build/buildPages/validateServerStateReferences.js +41 -0
  55. package/dist/build/buildPages/validateStateReferences.js +79 -0
  56. package/dist/build/buildRefs/buildRefs.js +40 -7
  57. package/dist/build/buildRefs/evaluateStaticOperators.js +52 -0
  58. package/dist/build/buildRefs/getConfigFile.js +25 -6
  59. package/dist/build/buildRefs/getKey.js +1 -1
  60. package/dist/build/buildRefs/getRefContent.js +1 -1
  61. package/dist/build/buildRefs/getRefPath.js +1 -1
  62. package/dist/build/buildRefs/getUserJavascriptFunction.js +18 -4
  63. package/dist/build/buildRefs/makeRefDefinition.js +10 -5
  64. package/dist/build/buildRefs/parseNunjucks.js +1 -1
  65. package/dist/build/buildRefs/parseRefContent.js +108 -7
  66. package/dist/build/buildRefs/runRefResolver.js +11 -3
  67. package/dist/build/buildRefs/runTransformer.js +7 -3
  68. package/dist/build/buildRefs/walker.js +340 -0
  69. package/dist/build/buildTypes.js +22 -7
  70. package/dist/build/cleanBuildDirectory.js +1 -1
  71. package/dist/build/collectDynamicIdentifiers.js +35 -0
  72. package/dist/build/collectTypeNames.js +36 -0
  73. package/dist/build/copyPublicFolder.js +1 -1
  74. package/dist/build/{buildJs → full}/buildJs.js +3 -3
  75. package/dist/build/full/buildPages.js +87 -0
  76. package/dist/build/{buildPages → full}/buildTestPage.js +15 -3
  77. package/dist/build/{updateServerPackageJson.js → full/updateServerPackageJson.js} +1 -1
  78. package/dist/build/{writePages.js → full/writePages.js} +1 -1
  79. package/dist/build/{writeRequests.js → full/writeRequests.js} +11 -3
  80. package/dist/build/{writeTypes.js → full/writeTypes.js} +1 -1
  81. package/dist/build/jit/addInstalledTypes.js +51 -0
  82. package/dist/build/jit/buildJsShallow.js +41 -0
  83. package/dist/build/jit/buildPageJit.js +271 -0
  84. package/dist/build/jit/buildShallowPages.js +90 -0
  85. package/dist/build/jit/createPageRegistry.js +85 -0
  86. package/dist/build/jit/detectMissingPluginPackages.js +62 -0
  87. package/dist/build/jit/isPageContentPath.js +24 -0
  88. package/dist/build/jit/pageContentKeys.js +26 -0
  89. package/dist/build/jit/shallowBuild.js +242 -0
  90. package/dist/build/jit/updateServerPackageJsonJit.js +33 -0
  91. package/dist/build/jit/validatePageTypes.js +73 -0
  92. package/dist/build/jit/writePageJit.js +44 -0
  93. package/dist/build/jit/writePageRegistry.js +23 -0
  94. package/dist/build/jit/writeSourcelessPages.js +23 -0
  95. package/dist/build/testSchema.js +45 -7
  96. package/dist/build/validateConfig.js +2 -2
  97. package/dist/build/validateOperatorsDynamic.js +28 -0
  98. package/dist/build/writeApi.js +1 -1
  99. package/dist/build/writeApp.js +1 -1
  100. package/dist/build/writeAuth.js +1 -1
  101. package/dist/build/writeConfig.js +1 -1
  102. package/dist/build/writeConnections.js +1 -1
  103. package/dist/build/writeGlobal.js +1 -1
  104. package/dist/build/writeLogger.js +19 -0
  105. package/dist/build/writeMaps.js +1 -1
  106. package/dist/build/writeMenus.js +1 -1
  107. package/dist/build/writePluginImports/generateImportFile.js +1 -1
  108. package/dist/build/writePluginImports/writeActionImports.js +1 -1
  109. package/dist/build/writePluginImports/writeActionSchemaMap.js +42 -0
  110. package/dist/build/writePluginImports/writeAuthImports.js +1 -1
  111. package/dist/build/writePluginImports/writeBlockImports.js +1 -1
  112. package/dist/build/writePluginImports/writeBlockSchemaMap.js +42 -0
  113. package/dist/build/writePluginImports/writeConnectionImports.js +1 -1
  114. package/dist/build/writePluginImports/writeIconImports.js +1 -1
  115. package/dist/build/writePluginImports/writeOperatorImports.js +1 -1
  116. package/dist/build/writePluginImports/writeOperatorSchemaMap.js +49 -0
  117. package/dist/build/writePluginImports/writePluginImports.js +16 -1
  118. package/dist/build/writePluginImports/writeStyleImports.js +1 -1
  119. package/dist/createContext.js +16 -4
  120. package/dist/defaultTypesMap.js +479 -457
  121. package/dist/index.js +190 -127
  122. package/dist/indexDev.js +19 -0
  123. package/dist/lowdefySchema.js +588 -0
  124. package/dist/scripts/generateDefaultTypes.js +2 -1
  125. package/dist/scripts/run.js +1 -1
  126. package/dist/{test → test-utils}/buildRefs/testBuildRefsAsyncFunction.js +1 -1
  127. package/dist/{test → test-utils}/buildRefs/testBuildRefsErrorResolver.js +1 -1
  128. package/dist/{test → test-utils}/buildRefs/testBuildRefsNullResolver.js +1 -1
  129. package/dist/{test → test-utils}/buildRefs/testBuildRefsParsingResolver.js +1 -1
  130. package/dist/{test → test-utils}/buildRefs/testBuildRefsResolver.js +1 -1
  131. package/dist/{test → test-utils}/buildRefs/testBuildRefsTransform.js +1 -1
  132. package/dist/{test → test-utils}/buildRefs/testBuildRefsTransformIdentity.js +1 -1
  133. package/dist/test-utils/buildRefs/testJitPageResolver.js +24 -0
  134. package/dist/test-utils/createTestLogger.js +36 -0
  135. package/dist/test-utils/parseTestYaml.js +126 -0
  136. package/dist/test-utils/runBuild.js +228 -0
  137. package/dist/test-utils/runBuildForSnapshots.js +704 -0
  138. package/dist/{test → test-utils}/testContext.js +12 -2
  139. package/dist/utils/collectExceptions.js +34 -0
  140. package/dist/utils/countOperators.js +31 -12
  141. package/dist/utils/createBuildHandleError.js +38 -0
  142. package/dist/utils/createCheckDuplicateId.js +15 -9
  143. package/dist/utils/createCounter.js +16 -3
  144. package/dist/utils/createHandleWarning.js +41 -0
  145. package/dist/utils/createPluginTypesMap.js +1 -1
  146. package/dist/utils/extractOperatorKey.js +36 -0
  147. package/dist/utils/findConfigKey.js +37 -0
  148. package/dist/utils/findSimilarString.js +53 -0
  149. package/dist/utils/logCollectedErrors.js +30 -0
  150. package/dist/utils/makeId.js +16 -8
  151. package/dist/utils/preserveMetaProperties.js +27 -0
  152. package/dist/utils/readConfigFile.js +1 -1
  153. package/dist/utils/setNonEnumerableProperty.js +23 -0
  154. package/dist/utils/traverseConfig.js +43 -0
  155. package/dist/utils/tryBuildStep.js +46 -0
  156. package/dist/utils/writeBuildArtifact.js +1 -1
  157. package/package.json +46 -41
  158. package/dist/build/buildPages/buildPages.js +0 -31
  159. package/dist/build/buildRefs/evaluateBuildOperators.js +0 -34
  160. package/dist/build/buildRefs/getRefsFromFile.js +0 -37
  161. package/dist/build/buildRefs/populateRefs.js +0 -43
  162. package/dist/build/buildRefs/recursiveBuild.js +0 -85
  163. package/dist/utils/formatErrorMessage.js +0 -56
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- Copyright 2020-2024 Lowdefy, Inc
3
+ Copyright 2020-2026 Lowdefy, Inc
4
4
 
5
5
  Licensed under the Apache License, Version 2.0 (the "License");
6
6
  you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ const defaultPackages = [
31
31
  '@lowdefy/blocks-qr',
32
32
  '@lowdefy/connection-axios-http',
33
33
  '@lowdefy/connection-elasticsearch',
34
+ '@lowdefy/connection-test',
34
35
  '@lowdefy/connection-google-sheets',
35
36
  '@lowdefy/connection-knex',
36
37
  '@lowdefy/connection-mongodb',
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- Copyright 2020-2024 Lowdefy, Inc
3
+ Copyright 2020-2026 Lowdefy, Inc
4
4
 
5
5
  Licensed under the Apache License, Version 2.0 (the "License");
6
6
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -0,0 +1,24 @@
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
+ */ function resolver(path, vars) {
16
+ return {
17
+ id: vars.pageId ?? 'resolved-page',
18
+ type: 'PageHeaderMenu',
19
+ properties: {
20
+ title: vars.app_name ?? 'Default'
21
+ }
22
+ };
23
+ }
24
+ export default resolver;
@@ -0,0 +1,36 @@
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
+ */ import pino from 'pino';
16
+ import { createNodeLogger } from '@lowdefy/logger/node';
17
+ function createTestLogger() {
18
+ const lines = [];
19
+ const destination = pino.destination({
20
+ dest: 1,
21
+ sync: true
22
+ });
23
+ destination.write = (data)=>{
24
+ lines.push(JSON.parse(data));
25
+ return true;
26
+ };
27
+ const logger = createNodeLogger({
28
+ level: 'debug',
29
+ destination
30
+ });
31
+ return {
32
+ logger,
33
+ lines
34
+ };
35
+ }
36
+ export default createTestLogger;
@@ -0,0 +1,126 @@
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
+ */ import { type } from '@lowdefy/helpers';
16
+ import YAML, { isMap, isSeq, isPair, isScalar } from 'yaml';
17
+ function getLineNumber(content, offset) {
18
+ if (offset == null || offset < 0) return null;
19
+ return content.substring(0, offset).split('\n').length;
20
+ }
21
+ function addLineNumbersAndRefs(node, content, refCounter) {
22
+ if (isMap(node)) {
23
+ const obj = {};
24
+ const refId = String(refCounter.next++);
25
+ obj['~r'] = refId;
26
+ if (node.range) {
27
+ Object.defineProperty(obj, '~l', {
28
+ value: getLineNumber(content, node.range[0]),
29
+ enumerable: false,
30
+ writable: true,
31
+ configurable: true
32
+ });
33
+ }
34
+ for (const pair of node.items){
35
+ if (isPair(pair) && isScalar(pair.key)) {
36
+ const key = pair.key.value;
37
+ const value = pair.value;
38
+ const keyLineNumber = pair.key.range ? getLineNumber(content, pair.key.range[0]) : null;
39
+ if (isMap(value)) {
40
+ const mapResult = addLineNumbersAndRefs(value, content, refCounter);
41
+ if (keyLineNumber) {
42
+ Object.defineProperty(mapResult, '~l', {
43
+ value: keyLineNumber,
44
+ enumerable: false,
45
+ writable: true,
46
+ configurable: true
47
+ });
48
+ }
49
+ obj[key] = mapResult;
50
+ } else if (isSeq(value)) {
51
+ const arrResult = addLineNumbersAndRefs(value, content, refCounter);
52
+ if (keyLineNumber) {
53
+ Object.defineProperty(arrResult, '~l', {
54
+ value: keyLineNumber,
55
+ enumerable: false,
56
+ writable: true,
57
+ configurable: true
58
+ });
59
+ }
60
+ obj[key] = arrResult;
61
+ } else if (isScalar(value)) {
62
+ obj[key] = value.value;
63
+ } else {
64
+ obj[key] = value?.toJSON?.() ?? value;
65
+ }
66
+ }
67
+ }
68
+ return obj;
69
+ }
70
+ if (isSeq(node)) {
71
+ const arr = [];
72
+ const refId = String(refCounter.next++);
73
+ arr['~r'] = refId;
74
+ if (node.range) {
75
+ Object.defineProperty(arr, '~l', {
76
+ value: getLineNumber(content, node.range[0]),
77
+ enumerable: false,
78
+ writable: true,
79
+ configurable: true
80
+ });
81
+ }
82
+ for (const item of node.items){
83
+ if (isMap(item)) {
84
+ arr.push(addLineNumbersAndRefs(item, content, refCounter));
85
+ } else if (isSeq(item)) {
86
+ arr.push(addLineNumbersAndRefs(item, content, refCounter));
87
+ } else if (isScalar(item)) {
88
+ arr.push(item.value);
89
+ } else {
90
+ arr.push(item?.toJSON?.() ?? item);
91
+ }
92
+ }
93
+ return arr;
94
+ }
95
+ if (isScalar(node)) {
96
+ return node.value;
97
+ }
98
+ return node?.toJSON?.() ?? node;
99
+ }
100
+ /**
101
+ * Parse YAML string for testing, adding ~l (line numbers) and ~r (ref IDs)
102
+ * to simulate real buildRefs output.
103
+ *
104
+ * @param {string} yamlContent - YAML string to parse (use template literals for multiline)
105
+ * @returns {object} Parsed object with ~l and ~r properties
106
+ *
107
+ * @example
108
+ * const components = parseTestYaml(`
109
+ * pages:
110
+ * - id: home
111
+ * type: Box
112
+ * blocks:
113
+ * - id: title
114
+ * type: Title
115
+ * `);
116
+ */ function parseTestYaml(yamlContent) {
117
+ const doc = YAML.parseDocument(yamlContent);
118
+ if (doc.errors && doc.errors.length > 0) {
119
+ throw new Error(doc.errors[0].message);
120
+ }
121
+ const refCounter = {
122
+ next: 1
123
+ };
124
+ return addLineNumbersAndRefs(doc.contents, yamlContent, refCounter);
125
+ }
126
+ export default parseTestYaml;
@@ -0,0 +1,228 @@
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
+ */ import path from 'path';
16
+ import createTestLogger from './createTestLogger.js';
17
+ /**
18
+ * Custom types map for testing - includes common types used in fixtures.
19
+ * Contains all basic blocks, loaders, common actions, operators, and connections.
20
+ */ const testTypesMap = {
21
+ actions: {
22
+ Link: {
23
+ package: '@lowdefy/actions-core'
24
+ },
25
+ SetState: {
26
+ package: '@lowdefy/actions-core'
27
+ },
28
+ Request: {
29
+ package: '@lowdefy/actions-core'
30
+ },
31
+ Reset: {
32
+ package: '@lowdefy/actions-core'
33
+ },
34
+ Throw: {
35
+ package: '@lowdefy/actions-core'
36
+ },
37
+ Log: {
38
+ package: '@lowdefy/actions-core'
39
+ },
40
+ Return: {
41
+ package: '@lowdefy/api'
42
+ }
43
+ },
44
+ blocks: {
45
+ Anchor: {
46
+ package: '@lowdefy/blocks-basic'
47
+ },
48
+ Box: {
49
+ package: '@lowdefy/blocks-basic'
50
+ },
51
+ Button: {
52
+ package: '@lowdefy/blocks-basic'
53
+ },
54
+ DangerousHtml: {
55
+ package: '@lowdefy/blocks-basic'
56
+ },
57
+ Html: {
58
+ package: '@lowdefy/blocks-basic'
59
+ },
60
+ Icon: {
61
+ package: '@lowdefy/blocks-basic'
62
+ },
63
+ Img: {
64
+ package: '@lowdefy/blocks-basic'
65
+ },
66
+ List: {
67
+ package: '@lowdefy/blocks-basic'
68
+ },
69
+ Message: {
70
+ package: '@lowdefy/blocks-antd'
71
+ },
72
+ Paragraph: {
73
+ package: '@lowdefy/blocks-basic'
74
+ },
75
+ ProgressBar: {
76
+ package: '@lowdefy/blocks-loaders'
77
+ },
78
+ Result: {
79
+ package: '@lowdefy/blocks-antd'
80
+ },
81
+ Skeleton: {
82
+ package: '@lowdefy/blocks-loaders'
83
+ },
84
+ SkeletonAvatar: {
85
+ package: '@lowdefy/blocks-loaders'
86
+ },
87
+ SkeletonButton: {
88
+ package: '@lowdefy/blocks-loaders'
89
+ },
90
+ SkeletonInput: {
91
+ package: '@lowdefy/blocks-loaders'
92
+ },
93
+ SkeletonParagraph: {
94
+ package: '@lowdefy/blocks-loaders'
95
+ },
96
+ Span: {
97
+ package: '@lowdefy/blocks-basic'
98
+ },
99
+ Spinner: {
100
+ package: '@lowdefy/blocks-loaders'
101
+ },
102
+ TextInput: {
103
+ package: '@lowdefy/blocks-antd'
104
+ },
105
+ Throw: {
106
+ package: '@lowdefy/blocks-basic'
107
+ },
108
+ Title: {
109
+ package: '@lowdefy/blocks-basic'
110
+ }
111
+ },
112
+ connections: {
113
+ AxiosHttp: {
114
+ package: '@lowdefy/connection-axios-http'
115
+ },
116
+ MongoDBCollection: {
117
+ package: '@lowdefy/connection-mongodb'
118
+ }
119
+ },
120
+ requests: {
121
+ AxiosHttp: {
122
+ package: '@lowdefy/connection-axios-http'
123
+ },
124
+ MongoDBInsertOne: {
125
+ package: '@lowdefy/connection-mongodb'
126
+ }
127
+ },
128
+ auth: {
129
+ adapters: {},
130
+ callbacks: {},
131
+ events: {},
132
+ providers: {
133
+ GoogleProvider: {
134
+ package: 'next-auth'
135
+ }
136
+ }
137
+ },
138
+ operators: {
139
+ client: {
140
+ _state: {
141
+ package: '@lowdefy/operators-js'
142
+ },
143
+ _if: {
144
+ package: '@lowdefy/operators-js'
145
+ },
146
+ _eq: {
147
+ package: '@lowdefy/operators-js'
148
+ },
149
+ _not: {
150
+ package: '@lowdefy/operators-js'
151
+ },
152
+ _type: {
153
+ package: '@lowdefy/operators-js'
154
+ },
155
+ _payload: {
156
+ package: '@lowdefy/operators-js'
157
+ },
158
+ _step: {
159
+ package: '@lowdefy/operators-js'
160
+ }
161
+ },
162
+ server: {
163
+ _payload: {
164
+ package: '@lowdefy/operators-js'
165
+ },
166
+ _step: {
167
+ package: '@lowdefy/operators-js'
168
+ }
169
+ }
170
+ },
171
+ controls: {
172
+ Endpoint: {
173
+ package: '@lowdefy/api'
174
+ },
175
+ Log: {
176
+ package: '@lowdefy/api'
177
+ },
178
+ Return: {
179
+ package: '@lowdefy/api'
180
+ }
181
+ }
182
+ };
183
+ function formatLine(line) {
184
+ const source = line.err?.source ?? null;
185
+ const name = line.err?.name ?? null;
186
+ const message = name ? `[${name}] ${line.msg}` : line.msg;
187
+ return source ? `${source}\n${message}` : message;
188
+ }
189
+ /**
190
+ * Creates a runBuild helper function for testing build errors.
191
+ *
192
+ * @param {Function} build - The build function (imported after mocking writeBuildArtifact)
193
+ * @param {string} fixturesDir - Absolute path to the fixtures directory
194
+ * @returns {Function} runBuild helper function
195
+ */ function createRunBuild(build, fixturesDir) {
196
+ /**
197
+ * Runs build with a specific fixture directory and stage.
198
+ * Returns captured errors, warnings, and the thrown error (if any).
199
+ */ return async function runBuild(fixtureDir, stage = 'prod') {
200
+ const configDir = path.join(fixturesDir, fixtureDir);
201
+ const { logger, lines } = createTestLogger();
202
+ let thrownError = null;
203
+ try {
204
+ await build({
205
+ customTypesMap: testTypesMap,
206
+ directories: {
207
+ config: configDir,
208
+ build: path.join(configDir, '.lowdefy'),
209
+ server: path.join(configDir, '.lowdefy', 'server')
210
+ },
211
+ logger,
212
+ stage
213
+ });
214
+ } catch (err) {
215
+ thrownError = err;
216
+ }
217
+ // Pino levels: error=50, warn=40
218
+ const errors = lines.filter((l)=>l.level >= 50).map(formatLine);
219
+ const warnings = lines.filter((l)=>l.level >= 40 && l.level < 50).map(formatLine);
220
+ return {
221
+ errors,
222
+ warnings,
223
+ thrownError,
224
+ logger
225
+ };
226
+ };
227
+ }
228
+ export { testTypesMap, createRunBuild };