@lowdefy/build 0.0.0-experimental-20260113102133 → 0.0.0-experimental-20260122074446
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/addKeys.js +31 -18
- package/dist/build/buildApi/validateStepReferences.js +3 -4
- package/dist/build/buildAuth/buildAuth.js +2 -1
- package/dist/build/buildAuth/buildAuthPlugins.js +13 -13
- package/dist/build/buildAuth/validateAuthConfig.js +40 -8
- package/dist/build/buildAuth/validateMutualExclusivity.js +7 -7
- package/dist/build/buildConnections.js +20 -39
- package/dist/build/buildMenu.js +9 -14
- package/dist/build/buildPages/buildBlock/buildEvents.js +13 -13
- package/dist/build/buildPages/buildBlock/buildRequests.js +15 -15
- package/dist/build/buildPages/buildBlock/validateBlock.js +13 -13
- package/dist/build/buildPages/buildPage.js +5 -5
- package/dist/build/buildPages/validateLinkReferences.js +8 -9
- package/dist/build/buildPages/validatePayloadReferences.js +3 -4
- package/dist/build/buildPages/validateRequestReferences.js +7 -8
- package/dist/build/buildPages/validateStateReferences.js +14 -6
- package/dist/build/buildRefs/buildRefs.js +8 -0
- package/dist/build/buildRefs/evaluateBuildOperators.js +11 -1
- package/dist/build/buildRefs/evaluateStaticOperators.js +54 -0
- package/dist/build/buildRefs/getConfigFile.js +27 -6
- package/dist/build/buildRefs/getRefContent.js +15 -5
- package/dist/build/buildRefs/makeRefDefinition.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +32 -2
- package/dist/build/buildRefs/recursiveBuild.js +9 -7
- package/dist/build/buildRefs/runRefResolver.js +13 -2
- package/dist/build/buildTypes.js +9 -0
- package/dist/build/collectDynamicIdentifiers.js +35 -0
- package/dist/{utils/formatConfigError.js → build/collectTypeNames.js} +20 -8
- package/dist/build/formatBuildError.js +1 -1
- package/dist/build/testSchema.js +45 -6
- package/dist/build/validateOperatorsDynamic.js +28 -0
- package/dist/build/writeRequests.js +3 -3
- package/dist/createContext.js +42 -1
- package/dist/defaultTypesMap.js +480 -480
- package/dist/index.js +43 -4
- package/dist/lowdefySchema.js +60 -0
- package/dist/test-utils/parseTestYaml.js +110 -0
- package/dist/test-utils/runBuild.js +270 -0
- package/dist/test-utils/runBuildForSnapshots.js +698 -0
- package/dist/{test → test-utils}/testContext.js +15 -1
- package/dist/utils/collectConfigError.js +6 -6
- package/dist/utils/countOperators.js +5 -3
- package/dist/utils/createCheckDuplicateId.js +1 -1
- package/dist/utils/findConfigKey.js +37 -0
- package/dist/utils/makeId.js +12 -7
- package/dist/utils/tryBuildStep.js +12 -5
- package/package.json +39 -39
- package/dist/utils/formatConfigMessage.js +0 -33
- package/dist/utils/formatConfigWarning.js +0 -24
- package/dist/utils/formatErrorMessage.js +0 -56
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsAsyncFunction.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsErrorResolver.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsNullResolver.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsParsingResolver.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsResolver.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransform.js +0 -0
- /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransformIdentity.js +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
function validateOperatorsDynamic({ operators }) {
|
|
17
|
+
const missingDynamic = [];
|
|
18
|
+
Object.entries(operators).forEach(([operatorName, operatorFn])=>{
|
|
19
|
+
if (!type.isFunction(operatorFn)) return;
|
|
20
|
+
if (!type.isBoolean(operatorFn.dynamic)) {
|
|
21
|
+
missingDynamic.push(operatorName);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (missingDynamic.length > 0) {
|
|
25
|
+
throw new Error(`Operator validation failed: The following operators are missing the 'dynamic' property: ${missingDynamic.join(', ')}. ` + `All operators must have a 'dynamic' boolean property (true for runtime-only, false for build-time safe).`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default validateOperatorsDynamic;
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { serializer, type } from '@lowdefy/helpers';
|
|
16
|
-
import
|
|
16
|
+
import { ConfigError } from '@lowdefy/node-utils';
|
|
17
17
|
async function writeRequestsOnPage({ page, context }) {
|
|
18
18
|
const requests = page.requests ?? [];
|
|
19
19
|
if (!type.isArray(requests)) {
|
|
20
|
-
throw new
|
|
20
|
+
throw new ConfigError({
|
|
21
21
|
message: `Page requests must be an array. Received ${JSON.stringify(requests)}.`,
|
|
22
22
|
configKey: page['~k'],
|
|
23
23
|
context
|
|
24
|
-
})
|
|
24
|
+
});
|
|
25
25
|
}
|
|
26
26
|
return Promise.all(requests.map(async (request)=>{
|
|
27
27
|
await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, serializer.serializeToString(request ?? {}));
|
package/dist/createContext.js
CHANGED
|
@@ -13,18 +13,20 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { mergeObjects } from '@lowdefy/helpers';
|
|
16
|
+
import { ConfigError, ConfigWarning } from '@lowdefy/node-utils';
|
|
16
17
|
import createCounter from './utils/createCounter.js';
|
|
17
18
|
import createReadConfigFile from './utils/readConfigFile.js';
|
|
18
19
|
import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
|
|
19
20
|
import defaultTypesMap from './defaultTypesMap.js';
|
|
20
21
|
function createContext({ customTypesMap, directories, logger, refResolver, stage = 'prod' }) {
|
|
22
|
+
// Create context object first (needed for logger methods)
|
|
21
23
|
const context = {
|
|
22
24
|
connectionIds: new Set(),
|
|
23
25
|
directories,
|
|
24
26
|
errors: [],
|
|
25
27
|
jsMap: {},
|
|
26
28
|
keyMap: {},
|
|
27
|
-
logger,
|
|
29
|
+
logger: null,
|
|
28
30
|
readConfigFile: createReadConfigFile({
|
|
29
31
|
directories
|
|
30
32
|
}),
|
|
@@ -56,6 +58,45 @@ function createContext({ customTypesMap, directories, logger, refResolver, stage
|
|
|
56
58
|
directories
|
|
57
59
|
})
|
|
58
60
|
};
|
|
61
|
+
// Add config-aware methods to logger (don't spread - pino uses Symbol-keyed internals)
|
|
62
|
+
logger.configWarning = ({ message, configKey, operatorLocation, prodError })=>{
|
|
63
|
+
try {
|
|
64
|
+
// ConfigWarning.format throws ConfigError in prod mode when prodError is true
|
|
65
|
+
const formatted = ConfigWarning.format({
|
|
66
|
+
message,
|
|
67
|
+
configKey,
|
|
68
|
+
operatorLocation,
|
|
69
|
+
context,
|
|
70
|
+
prodError
|
|
71
|
+
});
|
|
72
|
+
if (formatted) {
|
|
73
|
+
logger.warn(formatted);
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
// ConfigError thrown in prod mode - collect instead of throwing
|
|
77
|
+
// This allows validation to continue and report all errors
|
|
78
|
+
if (err instanceof ConfigError) {
|
|
79
|
+
// Skip suppressed errors (empty message means ~ignoreBuildCheck: true)
|
|
80
|
+
if (!err.suppressed) {
|
|
81
|
+
context.errors.push(err.message);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
logger.configError = ({ message, configKey, operatorLocation })=>{
|
|
89
|
+
const formatted = ConfigError.format({
|
|
90
|
+
message,
|
|
91
|
+
configKey,
|
|
92
|
+
operatorLocation,
|
|
93
|
+
context
|
|
94
|
+
});
|
|
95
|
+
if (formatted) {
|
|
96
|
+
logger.error(formatted);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
context.logger = logger;
|
|
59
100
|
return context;
|
|
60
101
|
}
|
|
61
102
|
export default createContext;
|