@next-core/brick-utils 2.28.10 → 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/dist/index.esm.js CHANGED
@@ -20406,32 +20406,26 @@ var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "t
20406
20406
 
20407
20407
  var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"]; // Fields started with `_` will be removed by default.
20408
20408
 
20409
- var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "instanceId", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
20410
- 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"];
20411
20413
  function normalizeBuilderNode(node) {
20412
20414
  if (isBrickNode(node)) {
20413
- return normalizeBuilderBrickNode(node);
20415
+ return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick, false);
20414
20416
  }
20415
20417
 
20416
20418
  if (isRouteNode(node)) {
20417
- return normalizeBuilderRouteNode(node);
20419
+ return normalize(node, fieldsToRemoveInRoute, jsonFieldsInRoute, yamlFieldsInRoute, true);
20418
20420
  }
20419
20421
 
20420
20422
  return null;
20421
20423
  }
20422
20424
 
20423
- function normalizeBuilderBrickNode(node) {
20424
- return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick);
20425
- }
20426
-
20427
- function normalizeBuilderRouteNode(node) {
20428
- return normalize(node, fieldsToRemoveInRoute, jsonFieldsInRoute, yamlFieldsInRoute, true);
20429
- }
20430
-
20431
20425
  function normalize(node, fieldsToRemove, jsonFields, yamlFields, cleanUpSegues) {
20432
20426
  return Object.fromEntries(Object.entries(node) // Remove unused fields from CMDB.
20433
20427
  // Consider fields started with `_` as unused.
20434
- .filter(([key]) => key[0] !== "_" && !fieldsToRemove.includes(key)) // Parse json fields.
20428
+ .filter(([key, value]) => !(key[0] === "_" || fieldsToRemove.includes(key) || value === null && disposableNullFields.includes(key))) // Parse specific fields.
20435
20429
  .map(([key, value]) => [key, cleanUpSegues && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ? safeJsonParse(value) : yamlFields.includes(key) ? safeYamlParse(value) : cloneDeep(value)]));
20436
20430
  } // Clear `segue._view` which is for development only.
20437
20431