@lowdefy/build 0.0.0-experimental-20260114142524 → 0.0.0-experimental-20260122121633

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 (58) hide show
  1. package/dist/build/addKeys.js +31 -18
  2. package/dist/build/buildApi/validateStepReferences.js +3 -4
  3. package/dist/build/buildAuth/buildAuth.js +2 -1
  4. package/dist/build/buildAuth/buildAuthPlugins.js +13 -13
  5. package/dist/build/buildAuth/validateAuthConfig.js +40 -8
  6. package/dist/build/buildAuth/validateMutualExclusivity.js +7 -7
  7. package/dist/build/buildConnections.js +20 -39
  8. package/dist/build/buildMenu.js +9 -14
  9. package/dist/build/buildPages/buildBlock/buildEvents.js +13 -13
  10. package/dist/build/buildPages/buildBlock/buildRequests.js +15 -15
  11. package/dist/build/buildPages/buildBlock/validateBlock.js +13 -13
  12. package/dist/build/buildPages/buildPage.js +5 -5
  13. package/dist/build/buildPages/validateLinkReferences.js +8 -9
  14. package/dist/build/buildPages/validatePayloadReferences.js +3 -4
  15. package/dist/build/buildPages/validateRequestReferences.js +7 -8
  16. package/dist/build/buildPages/validateStateReferences.js +3 -4
  17. package/dist/build/buildRefs/buildRefs.js +8 -0
  18. package/dist/build/buildRefs/evaluateBuildOperators.js +11 -1
  19. package/dist/build/buildRefs/evaluateStaticOperators.js +54 -0
  20. package/dist/build/buildRefs/getConfigFile.js +18 -13
  21. package/dist/build/buildRefs/getRefContent.js +15 -5
  22. package/dist/build/buildRefs/makeRefDefinition.js +1 -1
  23. package/dist/build/buildRefs/parseRefContent.js +32 -2
  24. package/dist/build/buildRefs/populateRefs.js +43 -5
  25. package/dist/build/buildRefs/recursiveBuild.js +9 -7
  26. package/dist/build/buildRefs/runRefResolver.js +13 -2
  27. package/dist/build/buildTypes.js +9 -0
  28. package/dist/build/collectDynamicIdentifiers.js +35 -0
  29. package/dist/{utils/formatConfigError.js → build/collectTypeNames.js} +20 -8
  30. package/dist/build/formatBuildError.js +1 -1
  31. package/dist/build/testSchema.js +45 -6
  32. package/dist/build/validateOperatorsDynamic.js +28 -0
  33. package/dist/build/writeRequests.js +3 -3
  34. package/dist/createContext.js +42 -1
  35. package/dist/defaultTypesMap.js +403 -403
  36. package/dist/index.js +43 -4
  37. package/dist/lowdefySchema.js +60 -0
  38. package/dist/test-utils/parseTestYaml.js +110 -0
  39. package/dist/test-utils/runBuild.js +270 -0
  40. package/dist/test-utils/runBuildForSnapshots.js +698 -0
  41. package/dist/{test → test-utils}/testContext.js +15 -1
  42. package/dist/utils/collectConfigError.js +6 -6
  43. package/dist/utils/countOperators.js +5 -3
  44. package/dist/utils/createCheckDuplicateId.js +1 -1
  45. package/dist/utils/findConfigKey.js +37 -0
  46. package/dist/utils/makeId.js +12 -7
  47. package/dist/utils/tryBuildStep.js +12 -5
  48. package/package.json +39 -39
  49. package/dist/utils/formatConfigMessage.js +0 -33
  50. package/dist/utils/formatConfigWarning.js +0 -24
  51. package/dist/utils/formatErrorMessage.js +0 -56
  52. /package/dist/{test → test-utils}/buildRefs/testBuildRefsAsyncFunction.js +0 -0
  53. /package/dist/{test → test-utils}/buildRefs/testBuildRefsErrorResolver.js +0 -0
  54. /package/dist/{test → test-utils}/buildRefs/testBuildRefsNullResolver.js +0 -0
  55. /package/dist/{test → test-utils}/buildRefs/testBuildRefsParsingResolver.js +0 -0
  56. /package/dist/{test → test-utils}/buildRefs/testBuildRefsResolver.js +0 -0
  57. /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransform.js +0 -0
  58. /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransformIdentity.js +0 -0
@@ -50,10 +50,24 @@ function testContext({ writeBuildArtifact, configDirectory, readConfigFile, logg
50
50
  jsMap: {},
51
51
  connectionIds: new Set()
52
52
  };
53
- context.logger = {
53
+ const mergedLogger = {
54
54
  ...defaultLogger,
55
55
  ...logger
56
56
  };
57
+ // Wrap logger with configWarning/configError methods that delegate to warn/error
58
+ context.logger = {
59
+ ...mergedLogger,
60
+ configWarning: ({ message, prodError })=>{
61
+ // Mirror ConfigWarning.format behavior: throw in prod mode when prodError is true
62
+ if (prodError && context.stage === 'prod') {
63
+ throw new Error(message);
64
+ }
65
+ mergedLogger.warn(message);
66
+ },
67
+ configError: ({ message })=>{
68
+ mergedLogger.error(message);
69
+ }
70
+ };
57
71
  return context;
58
72
  }
59
73
  export default testContext;
@@ -12,7 +12,7 @@
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 formatConfigError from './formatConfigError.js';
15
+ */ import { ConfigError } from '@lowdefy/node-utils';
16
16
  /**
17
17
  * Collects a config error instead of throwing immediately.
18
18
  * Allows the build to continue and collect all errors before stopping.
@@ -22,19 +22,19 @@
22
22
  * @param {string} params.configKey - Config key (~k) for location tracking
23
23
  * @param {Object} params.context - Build context
24
24
  */ function collectConfigError({ message, configKey, context }) {
25
- const errorMessage = formatConfigError({
25
+ const errorMessage = ConfigError.format({
26
26
  message,
27
27
  configKey,
28
28
  context
29
29
  });
30
+ if (!errorMessage) {
31
+ return; // Suppressed - don't collect or log
32
+ }
30
33
  if (!context.errors) {
31
34
  // If no error collection array, throw immediately (fallback for tests)
32
35
  throw new Error(errorMessage);
33
36
  }
34
- // Collect error to show all errors at once
37
+ // Collect error - logging happens at checkpoints in index.js
35
38
  context.errors.push(errorMessage);
36
- if (context.logger && context.logger.error) {
37
- context.logger.error(errorMessage);
38
- }
39
39
  }
40
40
  export default collectConfigError;
@@ -23,9 +23,11 @@ function walkAndCount(value, counter, parentConfigKey) {
23
23
  }
24
24
  const configKey = value['~k'] || parentConfigKey;
25
25
  const keys = Object.keys(value);
26
- // Check if this object is an operator (single key starting with _)
27
- if (keys.length === 1) {
28
- const key = keys[0];
26
+ // Check if this object is an operator (single key starting with _, ignoring ~ prefixed keys)
27
+ // This allows ~ignoreBuildCheck to be on the same object as an operator
28
+ const nonTildeKeys = keys.filter((k)=>!k.startsWith('~'));
29
+ if (nonTildeKeys.length === 1) {
30
+ const key = nonTildeKeys[0];
29
31
  const [op] = key.split('.');
30
32
  const operator = op.replace(/^(_+)/gm, '_');
31
33
  if (operator.length > 1 && operator[0] === '_') {
@@ -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 { nunjucksFunction } from '@lowdefy/nunjucks';
16
- import { resolveConfigLocation } from '@lowdefy/helpers';
16
+ import { resolveConfigLocation } from '@lowdefy/node-utils';
17
17
  function createCheckDuplicateId({ message, context }) {
18
18
  const template = nunjucksFunction(message);
19
19
  const ids = new Set();
@@ -0,0 +1,37 @@
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
+ * Finds the configKey (~k) for an object at a given instance path.
18
+ * Navigates through the components following the path and returns
19
+ * the deepest ~k value found.
20
+ *
21
+ * @param {Object} params
22
+ * @param {Object} params.components - The components object with ~k markers
23
+ * @param {string[]} params.instancePath - Array of path segments (e.g., ['pages', '0', 'blocks', '0'])
24
+ * @returns {string|undefined} The configKey (~k) value or undefined if not found
25
+ */ function findConfigKey({ components, instancePath }) {
26
+ let current = components;
27
+ let configKey = components['~k'];
28
+ for (const part of instancePath){
29
+ if (type.isNone(current)) break;
30
+ current = type.isArray(current) ? current[parseInt(part, 10)] : current[part];
31
+ if (current?.['~k']) {
32
+ configKey = current['~k'];
33
+ }
34
+ }
35
+ return configKey;
36
+ }
37
+ export default findConfigKey;
@@ -12,12 +12,17 @@
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
- */ let id_counter = 0;
16
- function makeId(reset) {
17
- if (reset) {
18
- id_counter = 0;
15
+ */ let MakeId = class MakeId {
16
+ next() {
17
+ this.counter++;
18
+ return this.counter.toString(36);
19
19
  }
20
- id_counter++;
21
- return id_counter.toString(36);
22
- }
20
+ reset() {
21
+ this.counter = 0;
22
+ }
23
+ constructor(){
24
+ this.counter = 0;
25
+ }
26
+ };
27
+ const makeId = new MakeId();
23
28
  export default makeId;
@@ -12,10 +12,14 @@
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
- */ /**
15
+ */ import { ConfigError } from '@lowdefy/node-utils';
16
+ /**
16
17
  * Wraps a build step to collect errors instead of stopping immediately.
17
- * Errors are collected in context.errors[] and logged, allowing the build to
18
- * continue and report all errors at once before stopping.
18
+ * Errors are collected in context.errors[], allowing the build to continue
19
+ * and report all errors at once. Errors are logged together at checkpoints
20
+ * in index.js to ensure proper ordering before the summary message.
21
+ *
22
+ * ConfigErrors with suppressed=true (via ~ignoreBuildCheck) are ignored.
19
23
  *
20
24
  * @param {Function} stepFn - Build step function to execute
21
25
  * @param {string} stepName - Name of the build step (for debugging)
@@ -30,9 +34,12 @@
30
34
  context
31
35
  });
32
36
  } catch (error) {
33
- // Collect error to show all errors at once
37
+ // Skip suppressed ConfigErrors (via ~ignoreBuildCheck: true)
38
+ if (error instanceof ConfigError && error.suppressed) {
39
+ return;
40
+ }
41
+ // Collect error - logging happens at checkpoints in index.js
34
42
  context.errors.push(error.message);
35
- context.logger.error(error.message);
36
43
  }
37
44
  }
38
45
  export default tryBuildStep;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/build",
3
- "version": "0.0.0-experimental-20260114142524",
3
+ "version": "0.0.0-experimental-20260122121633",
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-20260114142524",
48
- "@lowdefy/blocks-basic": "0.0.0-experimental-20260114142524",
49
- "@lowdefy/blocks-loaders": "0.0.0-experimental-20260114142524",
50
- "@lowdefy/helpers": "0.0.0-experimental-20260114142524",
51
- "@lowdefy/node-utils": "0.0.0-experimental-20260114142524",
52
- "@lowdefy/nunjucks": "0.0.0-experimental-20260114142524",
53
- "@lowdefy/operators": "0.0.0-experimental-20260114142524",
54
- "@lowdefy/operators-js": "0.0.0-experimental-20260114142524",
47
+ "@lowdefy/ajv": "0.0.0-experimental-20260122121633",
48
+ "@lowdefy/blocks-basic": "0.0.0-experimental-20260122121633",
49
+ "@lowdefy/blocks-loaders": "0.0.0-experimental-20260122121633",
50
+ "@lowdefy/helpers": "0.0.0-experimental-20260122121633",
51
+ "@lowdefy/node-utils": "0.0.0-experimental-20260122121633",
52
+ "@lowdefy/nunjucks": "0.0.0-experimental-20260122121633",
53
+ "@lowdefy/operators": "0.0.0-experimental-20260122121633",
54
+ "@lowdefy/operators-js": "0.0.0-experimental-20260122121633",
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-20260114142524",
63
- "@lowdefy/actions-pdf-make": "0.0.0-experimental-20260114142524",
64
- "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260114142524",
65
- "@lowdefy/blocks-algolia": "0.0.0-experimental-20260114142524",
66
- "@lowdefy/blocks-antd": "0.0.0-experimental-20260114142524",
67
- "@lowdefy/blocks-color-selectors": "0.0.0-experimental-20260114142524",
68
- "@lowdefy/blocks-echarts": "0.0.0-experimental-20260114142524",
69
- "@lowdefy/blocks-google-maps": "0.0.0-experimental-20260114142524",
70
- "@lowdefy/blocks-markdown": "0.0.0-experimental-20260114142524",
71
- "@lowdefy/blocks-qr": "0.0.0-experimental-20260114142524",
72
- "@lowdefy/connection-axios-http": "0.0.0-experimental-20260114142524",
73
- "@lowdefy/connection-elasticsearch": "0.0.0-experimental-20260114142524",
74
- "@lowdefy/connection-google-sheets": "0.0.0-experimental-20260114142524",
75
- "@lowdefy/connection-knex": "0.0.0-experimental-20260114142524",
76
- "@lowdefy/connection-mongodb": "0.0.0-experimental-20260114142524",
77
- "@lowdefy/connection-redis": "0.0.0-experimental-20260114142524",
78
- "@lowdefy/connection-sendgrid": "0.0.0-experimental-20260114142524",
79
- "@lowdefy/connection-stripe": "0.0.0-experimental-20260114142524",
80
- "@lowdefy/operators-change-case": "0.0.0-experimental-20260114142524",
81
- "@lowdefy/operators-diff": "0.0.0-experimental-20260114142524",
82
- "@lowdefy/operators-jsonata": "0.0.0-experimental-20260114142524",
83
- "@lowdefy/operators-moment": "0.0.0-experimental-20260114142524",
84
- "@lowdefy/operators-mql": "0.0.0-experimental-20260114142524",
85
- "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260114142524",
86
- "@lowdefy/operators-uuid": "0.0.0-experimental-20260114142524",
87
- "@lowdefy/operators-yaml": "0.0.0-experimental-20260114142524",
88
- "@lowdefy/plugin-auth0": "0.0.0-experimental-20260114142524",
89
- "@lowdefy/plugin-aws": "0.0.0-experimental-20260114142524",
90
- "@lowdefy/plugin-csv": "0.0.0-experimental-20260114142524",
91
- "@lowdefy/plugin-next-auth": "0.0.0-experimental-20260114142524",
62
+ "@lowdefy/actions-core": "0.0.0-experimental-20260122121633",
63
+ "@lowdefy/actions-pdf-make": "0.0.0-experimental-20260122121633",
64
+ "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260122121633",
65
+ "@lowdefy/blocks-algolia": "0.0.0-experimental-20260122121633",
66
+ "@lowdefy/blocks-antd": "0.0.0-experimental-20260122121633",
67
+ "@lowdefy/blocks-color-selectors": "0.0.0-experimental-20260122121633",
68
+ "@lowdefy/blocks-echarts": "0.0.0-experimental-20260122121633",
69
+ "@lowdefy/blocks-google-maps": "0.0.0-experimental-20260122121633",
70
+ "@lowdefy/blocks-markdown": "0.0.0-experimental-20260122121633",
71
+ "@lowdefy/blocks-qr": "0.0.0-experimental-20260122121633",
72
+ "@lowdefy/connection-axios-http": "0.0.0-experimental-20260122121633",
73
+ "@lowdefy/connection-elasticsearch": "0.0.0-experimental-20260122121633",
74
+ "@lowdefy/connection-google-sheets": "0.0.0-experimental-20260122121633",
75
+ "@lowdefy/connection-knex": "0.0.0-experimental-20260122121633",
76
+ "@lowdefy/connection-mongodb": "0.0.0-experimental-20260122121633",
77
+ "@lowdefy/connection-redis": "0.0.0-experimental-20260122121633",
78
+ "@lowdefy/connection-sendgrid": "0.0.0-experimental-20260122121633",
79
+ "@lowdefy/connection-stripe": "0.0.0-experimental-20260122121633",
80
+ "@lowdefy/operators-change-case": "0.0.0-experimental-20260122121633",
81
+ "@lowdefy/operators-diff": "0.0.0-experimental-20260122121633",
82
+ "@lowdefy/operators-jsonata": "0.0.0-experimental-20260122121633",
83
+ "@lowdefy/operators-moment": "0.0.0-experimental-20260122121633",
84
+ "@lowdefy/operators-mql": "0.0.0-experimental-20260122121633",
85
+ "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260122121633",
86
+ "@lowdefy/operators-uuid": "0.0.0-experimental-20260122121633",
87
+ "@lowdefy/operators-yaml": "0.0.0-experimental-20260122121633",
88
+ "@lowdefy/plugin-auth0": "0.0.0-experimental-20260122121633",
89
+ "@lowdefy/plugin-aws": "0.0.0-experimental-20260122121633",
90
+ "@lowdefy/plugin-csv": "0.0.0-experimental-20260122121633",
91
+ "@lowdefy/plugin-next-auth": "0.0.0-experimental-20260122121633",
92
92
  "@swc/cli": "0.1.63",
93
93
  "@swc/core": "1.3.99",
94
94
  "@swc/jest": "0.2.29",
@@ -1,33 +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
- */ import { resolveConfigLocation } from '@lowdefy/helpers';
16
- function formatConfigMessage({ prefix, message, configKey, context }) {
17
- if (!configKey || !context) {
18
- return `${prefix} ${message}`;
19
- }
20
- const location = resolveConfigLocation({
21
- configKey,
22
- keyMap: context.keyMap,
23
- refMap: context.refMap,
24
- configDirectory: context.directories.config
25
- });
26
- if (!location) {
27
- return `${prefix} ${message}`;
28
- }
29
- const source = location.source ? `${location.source} at ${location.config}` : '';
30
- const link = location.link || '';
31
- return `${prefix} ${message}\n ${source}\n ${link}`;
32
- }
33
- export default formatConfigMessage;
@@ -1,24 +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
- */ 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;
@@ -1,56 +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
- */ import { get, type } from '@lowdefy/helpers';
16
- function formatArrayKey({ index, object }) {
17
- if (type.isObject(object) && (!type.isNone(object.id) || !type.isNone(object.type))) {
18
- const objectId = type.isNone(object.id) ? '_ERROR_MISSING_ID_' : object.id;
19
- const objectType = type.isNone(object.type) ? '_ERROR_MISSING_TYPE_' : object.type;
20
- return `[${index}:${objectId}:${objectType}]`;
21
- }
22
- return `[${index}]`;
23
- }
24
- function recursiveFormatPath({ data, instancePath, formattedPath = '', gap = '', root = false }) {
25
- if (instancePath.length === 0) return formattedPath;
26
- const key = instancePath.shift();
27
- const newData = get(data, key);
28
- let newPath;
29
- if (type.isArray(data)) {
30
- gap += ' ';
31
- newPath = `${formattedPath}
32
- ${gap}- ${formatArrayKey({
33
- index: key,
34
- object: newData
35
- })}`;
36
- } else {
37
- newPath = `${formattedPath}${root ? '- ' : '.'}${key}`;
38
- }
39
- return recursiveFormatPath({
40
- data: newData,
41
- instancePath,
42
- formattedPath: newPath,
43
- gap
44
- });
45
- }
46
- function formatErrorMessage({ error, components }) {
47
- const formattedPath = recursiveFormatPath({
48
- data: components,
49
- instancePath: error.instancePath.split('/').slice(1),
50
- root: true
51
- });
52
- return `Schema Error
53
- ${error.message}
54
- ${formattedPath}`;
55
- }
56
- export default formatErrorMessage;