@lowdefy/build 0.0.0-experimental-20251203202233 → 0.0.0-experimental-20260112140412

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 (52) hide show
  1. package/dist/build/addKeys.js +2 -0
  2. package/dist/build/buildApi/buildEndpoint.js +6 -0
  3. package/dist/build/buildApi/buildRoutine/countStepTypes.js +1 -1
  4. package/dist/build/buildApi/validateStepReferences.js +65 -0
  5. package/dist/build/buildAuth/buildAuthPlugins.js +42 -12
  6. package/dist/build/buildAuth/validateAuthConfig.js +10 -2
  7. package/dist/build/buildAuth/validateMutualExclusivity.js +18 -4
  8. package/dist/build/buildConnections.js +25 -6
  9. package/dist/build/buildImports/buildIconImports.js +19 -36
  10. package/dist/build/buildLogger.js +41 -0
  11. package/dist/build/buildMenu.js +40 -13
  12. package/dist/build/buildPages/buildBlock/buildEvents.js +90 -9
  13. package/dist/build/buildPages/buildBlock/buildRequests.js +47 -7
  14. package/dist/build/buildPages/buildBlock/countBlockTypes.js +1 -1
  15. package/dist/build/buildPages/buildBlock/validateBlock.js +33 -7
  16. package/dist/build/buildPages/buildPage.js +28 -4
  17. package/dist/build/buildPages/buildPages.js +26 -1
  18. package/dist/build/buildPages/buildTestPage.js +9 -1
  19. package/dist/build/buildPages/validateLinkReferences.js +33 -0
  20. package/dist/build/buildPages/validatePayloadReferences.js +52 -0
  21. package/dist/build/buildPages/validateRequestReferences.js +33 -0
  22. package/dist/build/buildPages/validateStateReferences.js +52 -0
  23. package/dist/build/buildRefs/buildRefs.js +11 -30
  24. package/dist/build/buildRefs/evaluateBuildOperators.js +8 -2
  25. package/dist/build/buildRefs/getConfigFile.js +2 -1
  26. package/dist/build/buildRefs/getRefContent.js +17 -31
  27. package/dist/build/buildRefs/getRefsFromFile.js +8 -3
  28. package/dist/build/buildRefs/makeRefDefinition.js +9 -8
  29. package/dist/build/buildRefs/parseRefContent.js +61 -2
  30. package/dist/build/buildRefs/populateRefs.js +14 -11
  31. package/dist/build/buildRefs/recursiveBuild.js +64 -63
  32. package/dist/build/buildTypes.js +19 -2
  33. package/dist/build/formatBuildError.js +34 -0
  34. package/dist/build/writeLogger.js +19 -0
  35. package/dist/createContext.js +2 -15
  36. package/dist/defaultTypesMap.js +494 -487
  37. package/dist/index.js +130 -125
  38. package/dist/lowdefySchema.js +75 -0
  39. package/dist/test/testContext.js +2 -1
  40. package/dist/utils/countOperators.js +24 -11
  41. package/dist/utils/createCheckDuplicateId.js +30 -9
  42. package/dist/utils/createCounter.js +15 -2
  43. package/dist/utils/extractOperatorKey.js +36 -0
  44. package/dist/utils/findSimilarString.js +53 -0
  45. package/dist/utils/formatConfigError.js +24 -0
  46. package/dist/utils/formatConfigMessage.js +33 -0
  47. package/dist/utils/formatConfigWarning.js +24 -0
  48. package/dist/utils/traverseConfig.js +43 -0
  49. package/package.json +39 -39
  50. package/dist/utils/createBuildProfiler.js +0 -125
  51. package/dist/utils/invalidateChangedFiles.js +0 -74
  52. package/dist/utils/makeRefHash.js +0 -15
@@ -0,0 +1,24 @@
1
+ /*
2
+ Copyright 2020-2024 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 formatConfigMessage from './formatConfigMessage.js';
16
+ function formatConfigWarning({ message, configKey, context }) {
17
+ return formatConfigMessage({
18
+ prefix: '[Config Warning]',
19
+ message,
20
+ configKey,
21
+ context
22
+ });
23
+ }
24
+ export default formatConfigWarning;
@@ -0,0 +1,43 @@
1
+ /*
2
+ Copyright 2020-2024 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
+ /**
17
+ * Generic depth-first traversal of Lowdefy config objects.
18
+ * Visits every object and array in the tree, calling the visitor function for each.
19
+ *
20
+ * @param {Object} options
21
+ * @param {any} options.config - The config object to traverse
22
+ * @param {Function} options.visitor - Called for each object: visitor(obj) => void
23
+ */ function traverseConfig({ config, visitor }) {
24
+ if (!type.isObject(config) && !type.isArray(config)) return;
25
+ if (type.isObject(config)) {
26
+ visitor(config);
27
+ for (const value of Object.values(config)){
28
+ traverseConfig({
29
+ config: value,
30
+ visitor
31
+ });
32
+ }
33
+ }
34
+ if (type.isArray(config)) {
35
+ for (const item of config){
36
+ traverseConfig({
37
+ config: item,
38
+ visitor
39
+ });
40
+ }
41
+ }
42
+ }
43
+ export default traverseConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/build",
3
- "version": "0.0.0-experimental-20251203202233",
3
+ "version": "0.0.0-experimental-20260112140412",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -44,14 +44,14 @@
44
44
  "dist/*"
45
45
  ],
46
46
  "dependencies": {
47
- "@lowdefy/ajv": "0.0.0-experimental-20251203202233",
48
- "@lowdefy/blocks-basic": "0.0.0-experimental-20251203202233",
49
- "@lowdefy/blocks-loaders": "0.0.0-experimental-20251203202233",
50
- "@lowdefy/helpers": "0.0.0-experimental-20251203202233",
51
- "@lowdefy/node-utils": "0.0.0-experimental-20251203202233",
52
- "@lowdefy/nunjucks": "0.0.0-experimental-20251203202233",
53
- "@lowdefy/operators": "0.0.0-experimental-20251203202233",
54
- "@lowdefy/operators-js": "0.0.0-experimental-20251203202233",
47
+ "@lowdefy/ajv": "0.0.0-experimental-20260112140412",
48
+ "@lowdefy/blocks-basic": "0.0.0-experimental-20260112140412",
49
+ "@lowdefy/blocks-loaders": "0.0.0-experimental-20260112140412",
50
+ "@lowdefy/helpers": "0.0.0-experimental-20260112140412",
51
+ "@lowdefy/node-utils": "0.0.0-experimental-20260112140412",
52
+ "@lowdefy/nunjucks": "0.0.0-experimental-20260112140412",
53
+ "@lowdefy/operators": "0.0.0-experimental-20260112140412",
54
+ "@lowdefy/operators-js": "0.0.0-experimental-20260112140412",
55
55
  "ajv": "8.12.0",
56
56
  "json5": "2.2.3",
57
57
  "yaml": "2.3.4",
@@ -59,36 +59,36 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@jest/globals": "28.1.3",
62
- "@lowdefy/actions-core": "0.0.0-experimental-20251203202233",
63
- "@lowdefy/actions-pdf-make": "0.0.0-experimental-20251203202233",
64
- "@lowdefy/blocks-aggrid": "0.0.0-experimental-20251203202233",
65
- "@lowdefy/blocks-algolia": "0.0.0-experimental-20251203202233",
66
- "@lowdefy/blocks-antd": "0.0.0-experimental-20251203202233",
67
- "@lowdefy/blocks-color-selectors": "0.0.0-experimental-20251203202233",
68
- "@lowdefy/blocks-echarts": "0.0.0-experimental-20251203202233",
69
- "@lowdefy/blocks-google-maps": "0.0.0-experimental-20251203202233",
70
- "@lowdefy/blocks-markdown": "0.0.0-experimental-20251203202233",
71
- "@lowdefy/blocks-qr": "0.0.0-experimental-20251203202233",
72
- "@lowdefy/connection-axios-http": "0.0.0-experimental-20251203202233",
73
- "@lowdefy/connection-elasticsearch": "0.0.0-experimental-20251203202233",
74
- "@lowdefy/connection-google-sheets": "0.0.0-experimental-20251203202233",
75
- "@lowdefy/connection-knex": "0.0.0-experimental-20251203202233",
76
- "@lowdefy/connection-mongodb": "0.0.0-experimental-20251203202233",
77
- "@lowdefy/connection-redis": "0.0.0-experimental-20251203202233",
78
- "@lowdefy/connection-sendgrid": "0.0.0-experimental-20251203202233",
79
- "@lowdefy/connection-stripe": "0.0.0-experimental-20251203202233",
80
- "@lowdefy/operators-change-case": "0.0.0-experimental-20251203202233",
81
- "@lowdefy/operators-diff": "0.0.0-experimental-20251203202233",
82
- "@lowdefy/operators-jsonata": "0.0.0-experimental-20251203202233",
83
- "@lowdefy/operators-moment": "0.0.0-experimental-20251203202233",
84
- "@lowdefy/operators-mql": "0.0.0-experimental-20251203202233",
85
- "@lowdefy/operators-nunjucks": "0.0.0-experimental-20251203202233",
86
- "@lowdefy/operators-uuid": "0.0.0-experimental-20251203202233",
87
- "@lowdefy/operators-yaml": "0.0.0-experimental-20251203202233",
88
- "@lowdefy/plugin-auth0": "0.0.0-experimental-20251203202233",
89
- "@lowdefy/plugin-aws": "0.0.0-experimental-20251203202233",
90
- "@lowdefy/plugin-csv": "0.0.0-experimental-20251203202233",
91
- "@lowdefy/plugin-next-auth": "0.0.0-experimental-20251203202233",
62
+ "@lowdefy/actions-core": "0.0.0-experimental-20260112140412",
63
+ "@lowdefy/actions-pdf-make": "0.0.0-experimental-20260112140412",
64
+ "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260112140412",
65
+ "@lowdefy/blocks-algolia": "0.0.0-experimental-20260112140412",
66
+ "@lowdefy/blocks-antd": "0.0.0-experimental-20260112140412",
67
+ "@lowdefy/blocks-color-selectors": "0.0.0-experimental-20260112140412",
68
+ "@lowdefy/blocks-echarts": "0.0.0-experimental-20260112140412",
69
+ "@lowdefy/blocks-google-maps": "0.0.0-experimental-20260112140412",
70
+ "@lowdefy/blocks-markdown": "0.0.0-experimental-20260112140412",
71
+ "@lowdefy/blocks-qr": "0.0.0-experimental-20260112140412",
72
+ "@lowdefy/connection-axios-http": "0.0.0-experimental-20260112140412",
73
+ "@lowdefy/connection-elasticsearch": "0.0.0-experimental-20260112140412",
74
+ "@lowdefy/connection-google-sheets": "0.0.0-experimental-20260112140412",
75
+ "@lowdefy/connection-knex": "0.0.0-experimental-20260112140412",
76
+ "@lowdefy/connection-mongodb": "0.0.0-experimental-20260112140412",
77
+ "@lowdefy/connection-redis": "0.0.0-experimental-20260112140412",
78
+ "@lowdefy/connection-sendgrid": "0.0.0-experimental-20260112140412",
79
+ "@lowdefy/connection-stripe": "0.0.0-experimental-20260112140412",
80
+ "@lowdefy/operators-change-case": "0.0.0-experimental-20260112140412",
81
+ "@lowdefy/operators-diff": "0.0.0-experimental-20260112140412",
82
+ "@lowdefy/operators-jsonata": "0.0.0-experimental-20260112140412",
83
+ "@lowdefy/operators-moment": "0.0.0-experimental-20260112140412",
84
+ "@lowdefy/operators-mql": "0.0.0-experimental-20260112140412",
85
+ "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260112140412",
86
+ "@lowdefy/operators-uuid": "0.0.0-experimental-20260112140412",
87
+ "@lowdefy/operators-yaml": "0.0.0-experimental-20260112140412",
88
+ "@lowdefy/plugin-auth0": "0.0.0-experimental-20260112140412",
89
+ "@lowdefy/plugin-aws": "0.0.0-experimental-20260112140412",
90
+ "@lowdefy/plugin-csv": "0.0.0-experimental-20260112140412",
91
+ "@lowdefy/plugin-next-auth": "0.0.0-experimental-20260112140412",
92
92
  "@swc/cli": "0.1.63",
93
93
  "@swc/core": "1.3.99",
94
94
  "@swc/jest": "0.2.29",
@@ -1,125 +0,0 @@
1
- /*
2
- Copyright 2020-2024 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 createBuildProfiler({ logger, prefix = '' }) {
16
- const timings = new Map();
17
- const isDebug = logger?.level === 'debug';
18
- const track = (name)=>{
19
- if (!isDebug) {
20
- return;
21
- }
22
- if (!timings.has(name)) {
23
- timings.set(name, {
24
- total: 0,
25
- count: 0,
26
- min: Infinity,
27
- max: 0
28
- });
29
- }
30
- };
31
- const time = async (name, fn)=>{
32
- if (!isDebug) {
33
- return fn();
34
- }
35
- track(name);
36
- const start = performance.now();
37
- const result = await fn();
38
- const duration = performance.now() - start;
39
- const entry = timings.get(name);
40
- entry.total += duration;
41
- entry.count += 1;
42
- entry.min = Math.min(entry.min, duration);
43
- entry.max = Math.max(entry.max, duration);
44
- return result;
45
- };
46
- const timeSync = (name, fn)=>{
47
- if (!isDebug) {
48
- return fn();
49
- }
50
- track(name);
51
- const start = performance.now();
52
- const result = fn();
53
- const duration = performance.now() - start;
54
- const entry = timings.get(name);
55
- entry.total += duration;
56
- entry.count += 1;
57
- entry.min = Math.min(entry.min, duration);
58
- entry.max = Math.max(entry.max, duration);
59
- return result;
60
- };
61
- const getTimings = ()=>{
62
- const result = [];
63
- timings.forEach((value, name)=>{
64
- result.push({
65
- name,
66
- ...value,
67
- avg: value.total / value.count
68
- });
69
- });
70
- return result;
71
- };
72
- const printSummary = ()=>{
73
- if (!isDebug || timings.size === 0) {
74
- return;
75
- }
76
- const entries = getTimings();
77
- const total = entries.reduce((sum, t)=>sum + t.total, 0);
78
- const displayPrefix = prefix ? `[${prefix}] ` : '';
79
- logger.debug('');
80
- logger.debug(`⏱️ ${displayPrefix}Build Performance Summary:`);
81
- logger.debug('─'.repeat(90));
82
- const header = [
83
- 'Step'.padEnd(30),
84
- 'Total'.padStart(10),
85
- '%'.padStart(6),
86
- 'Count'.padStart(7),
87
- 'Avg'.padStart(10),
88
- 'Min'.padStart(10),
89
- 'Max'.padStart(10)
90
- ].join(' ');
91
- logger.debug(header);
92
- logger.debug('─'.repeat(90));
93
- entries.sort((a, b)=>b.total - a.total).forEach(({ name, total: stepTotal, count, avg, min, max })=>{
94
- const pct = (stepTotal / total * 100).toFixed(1);
95
- const displayName = name.length > 28 ? `${name.slice(0, 25)}...` : name;
96
- const row = [
97
- displayName.padEnd(30),
98
- `${stepTotal.toFixed(2).padStart(8)}ms`,
99
- `${pct.padStart(6)}%`,
100
- String(count).padStart(7),
101
- `${avg.toFixed(2).padStart(8)}ms`,
102
- `${min.toFixed(2).padStart(8)}ms`,
103
- `${max.toFixed(2).padStart(8)}ms`
104
- ].join(' ');
105
- logger.debug(row);
106
- });
107
- logger.debug('─'.repeat(90));
108
- logger.debug(`${'TOTAL'.padEnd(30)} ${total.toFixed(2).padStart(8)}ms`);
109
- };
110
- const createSubProfiler = (subPrefix)=>{
111
- return createBuildProfiler({
112
- logger,
113
- prefix: prefix ? `${prefix}::${subPrefix}` : subPrefix
114
- });
115
- };
116
- return {
117
- time,
118
- timeSync,
119
- getTimings,
120
- printSummary,
121
- createSubProfiler,
122
- isDebug
123
- };
124
- }
125
- export default createBuildProfiler;
@@ -1,74 +0,0 @@
1
- /*
2
- Copyright 2020-2024 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
- */ /**
16
- * Find all files affected by changes to the given files.
17
- * Traverses the dependency graph upward to find all transitive dependents.
18
- *
19
- * @param {string[]} changedFiles - Array of file paths that changed
20
- * @param {Map<string, Set<string>>} dependencyGraph - Map of file -> Set of files that depend on it
21
- * @returns {Set<string>} - Set of all affected file paths (including the changed files)
22
- */ function getAffectedFiles(changedFiles, dependencyGraph) {
23
- const affected = new Set();
24
- const queue = [
25
- ...changedFiles
26
- ];
27
- while(queue.length > 0){
28
- const file = queue.shift();
29
- if (affected.has(file)) {
30
- continue;
31
- }
32
- affected.add(file);
33
- // Find files that depend on this file
34
- const dependents = dependencyGraph.get(file);
35
- if (dependents) {
36
- for (const dependent of dependents){
37
- if (!affected.has(dependent)) {
38
- queue.push(dependent);
39
- }
40
- }
41
- }
42
- }
43
- return affected;
44
- }
45
- /**
46
- * Invalidate cache entries for changed files and their dependents.
47
- *
48
- * @param {Object} options
49
- * @param {string[]} options.changedFiles - Array of file paths that changed
50
- * @param {Map<string, Set<string>>} options.dependencyGraph - Dependency graph
51
- * @param {Map<string, any>} options.parsedContentCache - Cache of parsed file content
52
- * @param {Object} options.logger - Logger instance
53
- * @returns {Set<string>} - Set of affected file paths that were invalidated
54
- */ function invalidateChangedFiles({ changedFiles, dependencyGraph, parsedContentCache, logger }) {
55
- if (!changedFiles || changedFiles.length === 0) {
56
- return new Set();
57
- }
58
- const affectedFiles = getAffectedFiles(changedFiles, dependencyGraph);
59
- // Invalidate parsedContentCache entries for affected files
60
- // The cache keys may include vars suffix for nunjucks files, so we need to check prefixes
61
- for (const cacheKey of parsedContentCache.keys()){
62
- const filePath = cacheKey.split('::')[0]; // Remove vars suffix if present
63
- if (affectedFiles.has(filePath)) {
64
- parsedContentCache.delete(cacheKey);
65
- }
66
- }
67
- if (logger?.level === 'debug' && affectedFiles.size > 0) {
68
- logger.debug(`Incremental build: ${changedFiles.length} file(s) changed`);
69
- logger.debug(`Incremental build: ${affectedFiles.size} file(s) affected`);
70
- }
71
- return affectedFiles;
72
- }
73
- export default invalidateChangedFiles;
74
- export { getAffectedFiles };
@@ -1,15 +0,0 @@
1
- import { type } from '@lowdefy/helpers';
2
- import crypto from 'crypto';
3
- // Sort object keys to ensure stable stringification
4
- function stableStringify(obj) {
5
- if (type.isObject(obj)) {
6
- return '{' + Object.keys(obj).sort().map((k)=>`"${k}":${stableStringify(obj[k])}`).join(',') + '}';
7
- }
8
- if (type.isArray(obj)) {
9
- return '[' + obj.map(stableStringify).join(',') + ']';
10
- }
11
- return JSON.stringify(obj);
12
- }
13
- export default function makeRefHash(refDef) {
14
- return crypto.createHash('sha1').update(stableStringify(refDef) || '').digest('base64');
15
- }