@next-core/brick-utils 2.28.7 → 2.28.11
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/CHANGELOG.md +35 -0
- package/dist/index.bundle.js +15 -15
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +15 -15
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -18584,7 +18584,11 @@ function precookFunction(source, _ref = {}) {
|
|
|
18584
18584
|
}
|
|
18585
18585
|
|
|
18586
18586
|
function preevaluate(raw, options) {
|
|
18587
|
-
var
|
|
18587
|
+
var fixes = [];
|
|
18588
|
+
var source = raw.replace(/^\s*<%~?\s|\s%>\s*$/g, m => {
|
|
18589
|
+
fixes.push(m);
|
|
18590
|
+
return "";
|
|
18591
|
+
});
|
|
18588
18592
|
var expression = parseAsEstreeExpression(source);
|
|
18589
18593
|
var attemptToVisitGlobals = precook(expression, _objectSpread(_objectSpread({}, options), {}, {
|
|
18590
18594
|
expressionOnly: true
|
|
@@ -18592,7 +18596,9 @@ function preevaluate(raw, options) {
|
|
|
18592
18596
|
return {
|
|
18593
18597
|
expression,
|
|
18594
18598
|
attemptToVisitGlobals,
|
|
18595
|
-
source
|
|
18599
|
+
source,
|
|
18600
|
+
prefix: fixes[0],
|
|
18601
|
+
suffix: fixes[1]
|
|
18596
18602
|
};
|
|
18597
18603
|
}
|
|
18598
18604
|
function isEvaluable(raw) {
|
|
@@ -20400,32 +20406,26 @@ var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "t
|
|
|
20400
20406
|
|
|
20401
20407
|
var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"]; // Fields started with `_` will be removed by default.
|
|
20402
20408
|
|
|
20403
|
-
var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "instanceId", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
|
|
20404
|
-
var fieldsToRemoveInBrick = fieldsToRemoveInRoute.concat("type");
|
|
20409
|
+
var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "instanceId", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
|
|
20410
|
+
var fieldsToRemoveInBrick = fieldsToRemoveInRoute.concat("type", "alias"); // Those fields can be disposed if value is null.
|
|
20411
|
+
|
|
20412
|
+
var disposableNullFields = ["alias", "documentId", "hybrid", "bg", "context", "exports", "ref", "portal"];
|
|
20405
20413
|
function normalizeBuilderNode(node) {
|
|
20406
20414
|
if (isBrickNode(node)) {
|
|
20407
|
-
return
|
|
20415
|
+
return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick, false);
|
|
20408
20416
|
}
|
|
20409
20417
|
|
|
20410
20418
|
if (isRouteNode(node)) {
|
|
20411
|
-
return
|
|
20419
|
+
return normalize(node, fieldsToRemoveInRoute, jsonFieldsInRoute, yamlFieldsInRoute, true);
|
|
20412
20420
|
}
|
|
20413
20421
|
|
|
20414
20422
|
return null;
|
|
20415
20423
|
}
|
|
20416
20424
|
|
|
20417
|
-
function normalizeBuilderBrickNode(node) {
|
|
20418
|
-
return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick);
|
|
20419
|
-
}
|
|
20420
|
-
|
|
20421
|
-
function normalizeBuilderRouteNode(node) {
|
|
20422
|
-
return normalize(node, fieldsToRemoveInRoute, jsonFieldsInRoute, yamlFieldsInRoute, true);
|
|
20423
|
-
}
|
|
20424
|
-
|
|
20425
20425
|
function normalize(node, fieldsToRemove, jsonFields, yamlFields, cleanUpSegues) {
|
|
20426
20426
|
return Object.fromEntries(Object.entries(node) // Remove unused fields from CMDB.
|
|
20427
20427
|
// Consider fields started with `_` as unused.
|
|
20428
|
-
.filter(([key]) => key[0]
|
|
20428
|
+
.filter(([key, value]) => !(key[0] === "_" || fieldsToRemove.includes(key) || value === null && disposableNullFields.includes(key))) // Parse specific fields.
|
|
20429
20429
|
.map(([key, value]) => [key, cleanUpSegues && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ? safeJsonParse(value) : yamlFields.includes(key) ? safeYamlParse(value) : cloneDeep(value)]));
|
|
20430
20430
|
} // Clear `segue._view` which is for development only.
|
|
20431
20431
|
|