@lowdefy/build 4.5.2 → 4.6.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.
- package/dist/build/addDefaultPages/404.js +1 -1
- package/dist/build/addDefaultPages/addDefaultPages.js +10 -4
- package/dist/build/addKeys.js +85 -29
- package/dist/build/buildApi/buildApi.js +27 -8
- package/dist/build/buildApi/buildEndpoint.js +7 -1
- package/dist/build/buildApi/buildRoutine/buildControl.js +1 -1
- package/dist/build/buildApi/buildRoutine/buildRoutine.js +1 -1
- package/dist/build/buildApi/buildRoutine/buildStep.js +1 -1
- package/dist/build/buildApi/buildRoutine/controlTypes.js +34 -11
- package/dist/build/buildApi/buildRoutine/countControl.js +1 -1
- package/dist/build/buildApi/buildRoutine/countStepTypes.js +2 -2
- package/dist/build/buildApi/buildRoutine/setStepId.js +1 -1
- package/dist/build/buildApi/buildRoutine/validateStep.js +30 -9
- package/dist/build/buildApi/validateEndpoint.js +36 -7
- package/dist/build/buildApi/validateStepReferences.js +65 -0
- package/dist/build/buildApp.js +1 -1
- package/dist/build/buildAuth/buildApiAuth.js +7 -3
- package/dist/build/buildAuth/buildAuth.js +7 -4
- package/dist/build/buildAuth/buildAuthPlugins.js +42 -13
- package/dist/build/buildAuth/buildPageAuth.js +14 -3
- package/dist/build/buildAuth/getApiRoles.js +1 -1
- package/dist/build/buildAuth/getPageRoles.js +1 -1
- package/dist/build/buildAuth/getProtectedApi.js +1 -1
- package/dist/build/buildAuth/getProtectedPages.js +1 -1
- package/dist/build/buildAuth/validateAuthConfig.js +39 -5
- package/dist/build/buildAuth/validateMutualExclusivity.js +13 -5
- package/dist/build/buildConnections.js +23 -24
- package/dist/build/buildImports/buildIconImports.js +1 -1
- package/dist/build/buildImports/buildImports.js +1 -1
- package/dist/build/buildImports/buildImportsDev.js +1 -1
- package/dist/build/buildImports/buildImportsProd.js +1 -1
- package/dist/build/buildImports/buildStyleImports.js +1 -1
- package/dist/build/buildImports/defaultIconsDev.js +1 -1
- package/dist/build/buildImports/defaultIconsProd.js +1 -1
- package/dist/build/buildJs/generateJsFile.js +1 -1
- package/dist/build/buildJs/jsMapParser.js +1 -1
- package/dist/build/buildJs/writeJs.js +1 -1
- package/dist/build/buildLogger.js +41 -0
- package/dist/build/buildMenu.js +36 -12
- package/dist/build/buildPages/buildBlock/buildBlock.js +1 -1
- package/dist/build/buildPages/buildBlock/buildEvents.js +79 -9
- package/dist/build/buildPages/buildBlock/buildRequests.js +38 -8
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +6 -2
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +2 -2
- package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +6 -2
- package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +6 -2
- package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
- package/dist/build/buildPages/buildBlock/validateBlock.js +25 -7
- package/dist/build/buildPages/buildPage.js +35 -6
- package/dist/build/buildPages/validateLinkReferences.js +33 -0
- package/dist/build/buildPages/validatePayloadReferences.js +59 -0
- package/dist/build/buildPages/validateRequestReferences.js +33 -0
- package/dist/build/buildPages/validateServerStateReferences.js +41 -0
- package/dist/build/buildPages/validateStateReferences.js +79 -0
- package/dist/build/buildRefs/buildRefs.js +20 -3
- package/dist/build/buildRefs/createRefReviver.js +28 -0
- package/dist/build/buildRefs/evaluateBuildOperators.js +26 -7
- package/dist/build/buildRefs/evaluateStaticOperators.js +56 -0
- package/dist/build/buildRefs/getConfigFile.js +25 -6
- package/dist/build/buildRefs/getKey.js +1 -1
- package/dist/build/buildRefs/getRefContent.js +1 -1
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +9 -4
- package/dist/build/buildRefs/getUserJavascriptFunction.js +18 -4
- package/dist/build/buildRefs/makeRefDefinition.js +10 -5
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +100 -6
- package/dist/build/buildRefs/populateRefs.js +75 -13
- package/dist/build/buildRefs/recursiveBuild.js +66 -18
- package/dist/build/buildRefs/runRefResolver.js +11 -3
- package/dist/build/buildRefs/runTransformer.js +7 -3
- package/dist/build/buildTypes.js +22 -7
- package/dist/build/cleanBuildDirectory.js +1 -1
- package/dist/build/collectDynamicIdentifiers.js +35 -0
- package/dist/build/collectTypeNames.js +36 -0
- package/dist/build/copyPublicFolder.js +1 -1
- package/dist/build/{buildJs → full}/buildJs.js +3 -3
- package/dist/build/full/buildPages.js +87 -0
- package/dist/build/{buildPages → full}/buildTestPage.js +15 -3
- package/dist/build/{updateServerPackageJson.js → full/updateServerPackageJson.js} +1 -1
- package/dist/build/{writePages.js → full/writePages.js} +1 -1
- package/dist/build/{writeRequests.js → full/writeRequests.js} +11 -3
- package/dist/build/{writeTypes.js → full/writeTypes.js} +1 -1
- package/dist/build/jit/addInstalledTypes.js +51 -0
- package/dist/build/jit/buildJsShallow.js +41 -0
- package/dist/build/jit/buildPageJit.js +252 -0
- package/dist/build/jit/buildShallowPages.js +90 -0
- package/dist/build/jit/createPageRegistry.js +80 -0
- package/dist/build/jit/detectMissingPluginPackages.js +62 -0
- package/dist/build/jit/getRefPositions.js +38 -0
- package/dist/build/jit/isPageContentPath.js +24 -0
- package/dist/build/jit/pageContentKeys.js +26 -0
- package/dist/build/jit/shallowBuild.js +245 -0
- package/dist/build/jit/stripPageContent.js +23 -0
- package/dist/build/jit/updateServerPackageJsonJit.js +33 -0
- package/dist/build/jit/validatePageTypes.js +73 -0
- package/dist/build/jit/writePageJit.js +44 -0
- package/dist/build/jit/writePageRegistry.js +23 -0
- package/dist/build/jit/writeSourcelessPages.js +23 -0
- package/dist/build/testSchema.js +45 -7
- package/dist/build/validateConfig.js +2 -2
- package/dist/build/validateOperatorsDynamic.js +28 -0
- package/dist/build/writeApi.js +1 -1
- package/dist/build/writeApp.js +1 -1
- package/dist/build/writeAuth.js +1 -1
- package/dist/build/writeConfig.js +1 -1
- package/dist/build/writeConnections.js +1 -1
- package/dist/build/writeGlobal.js +1 -1
- package/dist/build/writeLogger.js +19 -0
- package/dist/build/writeMaps.js +1 -1
- package/dist/build/writeMenus.js +1 -1
- package/dist/build/writePluginImports/generateImportFile.js +1 -1
- package/dist/build/writePluginImports/writeActionImports.js +1 -1
- package/dist/build/writePluginImports/writeActionSchemaMap.js +42 -0
- package/dist/build/writePluginImports/writeAuthImports.js +1 -1
- package/dist/build/writePluginImports/writeBlockImports.js +1 -1
- package/dist/build/writePluginImports/writeBlockSchemaMap.js +42 -0
- package/dist/build/writePluginImports/writeConnectionImports.js +1 -1
- package/dist/build/writePluginImports/writeIconImports.js +1 -1
- package/dist/build/writePluginImports/writeOperatorImports.js +1 -1
- package/dist/build/writePluginImports/writeOperatorSchemaMap.js +49 -0
- package/dist/build/writePluginImports/writePluginImports.js +16 -1
- package/dist/build/writePluginImports/writeStyleImports.js +1 -1
- package/dist/createContext.js +16 -4
- package/dist/defaultTypesMap.js +479 -457
- package/dist/index.js +188 -127
- package/dist/indexDev.js +18 -0
- package/dist/lowdefySchema.js +589 -0
- package/dist/scripts/generateDefaultTypes.js +2 -1
- package/dist/scripts/run.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsAsyncFunction.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsErrorResolver.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsNullResolver.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsParsingResolver.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsResolver.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/{test → test-utils}/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/test-utils/buildRefs/testJitPageResolver.js +24 -0
- package/dist/test-utils/createTestLogger.js +36 -0
- package/dist/test-utils/parseTestYaml.js +126 -0
- package/dist/test-utils/runBuild.js +228 -0
- package/dist/test-utils/runBuildForSnapshots.js +704 -0
- package/dist/{test → test-utils}/testContext.js +12 -2
- package/dist/utils/collectExceptions.js +34 -0
- package/dist/utils/countOperators.js +31 -12
- package/dist/utils/createBuildHandleError.js +38 -0
- package/dist/utils/createCheckDuplicateId.js +15 -9
- package/dist/utils/createCounter.js +16 -3
- package/dist/utils/createHandleWarning.js +41 -0
- package/dist/utils/createPluginTypesMap.js +1 -1
- package/dist/utils/extractOperatorKey.js +36 -0
- package/dist/utils/findConfigKey.js +37 -0
- package/dist/utils/findSimilarString.js +53 -0
- package/dist/utils/logCollectedErrors.js +30 -0
- package/dist/utils/makeId.js +13 -8
- package/dist/utils/preserveMetaProperties.js +27 -0
- package/dist/utils/readConfigFile.js +1 -1
- package/dist/utils/setNonEnumerableProperty.js +23 -0
- package/dist/utils/traverseConfig.js +43 -0
- package/dist/utils/tryBuildStep.js +46 -0
- package/dist/utils/writeBuildArtifact.js +1 -1
- package/package.json +46 -41
- package/dist/build/buildPages/buildPages.js +0 -31
- package/dist/utils/formatErrorMessage.js +0 -56
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
Copyright 2020-
|
|
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',
|
package/dist/scripts/run.js
CHANGED
|
@@ -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 };
|