@next-core/brick-utils 2.52.5 → 2.52.7

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.
@@ -20121,12 +20121,12 @@
20121
20121
  var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"];
20122
20122
 
20123
20123
  // Fields started with `_` will be removed by default.
20124
- var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "screenshot", "lock", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
20124
+ var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "screenshot", "lock", "urlQueryParams", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
20125
20125
  var fieldsToRemoveInBrick = fieldsToRemoveInRoute.concat("type");
20126
20126
 
20127
20127
  // Those fields can be disposed if value is null.
20128
20128
  var disposableNullFields = ["alias", "documentId", "context", "exports", "ref", "analyticsData"];
20129
- var disposableFalseOrNullFields = ["hybrid", "bg", "portal", "public", "exact"];
20129
+ var disposableFalseOrNullFields = ["hybrid", "bg", "portal", "public", "exact", "incrementalSubRoutes"];
20130
20130
  function normalizeBuilderNode(node) {
20131
20131
  if (isBrickNode(node)) {
20132
20132
  return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick, "brick");
@@ -20137,6 +20137,7 @@
20137
20137
  return null;
20138
20138
  }
20139
20139
  function normalize(node, fieldsToRemove, jsonFields, yamlFields, type) {
20140
+ var temp;
20140
20141
  return Object.fromEntries(Object.entries(node)
20141
20142
  // Remove unused fields from CMDB.
20142
20143
  // Consider fields started with `_` as unused.
@@ -20147,7 +20148,10 @@
20147
20148
  // Parse specific fields.
20148
20149
  .map(_ref2 => {
20149
20150
  var [key, value] = _ref2;
20150
- return [key === "instanceId" ? "iid" : key, type === "route" && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ? safeJsonParse(value) : yamlFields.includes(key) ? safeYamlParse(value) : lodash.cloneDeep(value)];
20151
+ return [key === "instanceId" ? "iid" : key, type === "route" && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ? (temp = safeJsonParse(value),
20152
+ // There is a bug to cause json fields in route to be stored as `""` when it's empty.
20153
+ // These `""` can be safely ignored.
20154
+ temp === "" && type === "route" ? undefined : temp) : yamlFields.includes(key) ? safeYamlParse(value) : lodash.cloneDeep(value)];
20151
20155
  }));
20152
20156
  }
20153
20157
 
@@ -20412,6 +20416,9 @@
20412
20416
  case "MetaMenuItem":
20413
20417
  shakeConditionalNodes(node.children, node.raw, "children");
20414
20418
  break;
20419
+ case "Context":
20420
+ shakeConditionalNodes(node.onChange, node.raw, "onChange");
20421
+ break;
20415
20422
  }
20416
20423
 
20417
20424
  // Remove unreachable context/state.
@@ -20431,8 +20438,8 @@
20431
20438
  var removedNodes = [];
20432
20439
  if (Array.isArray(conditionalNodes)) {
20433
20440
  for (var node of conditionalNodes) {
20434
- var _else;
20435
- if ((_else = node.else) !== null && _else !== void 0 && _else.length) {
20441
+ var _node$else;
20442
+ if (isStoryboardNodeEventHandler(node) && (_node$else = node.else) !== null && _node$else !== void 0 && _node$else.length) {
20436
20443
  switch (node.raw.if) {
20437
20444
  case false:
20438
20445
  node.then = node.else;
@@ -20469,6 +20476,9 @@
20469
20476
  }
20470
20477
  }
20471
20478
  }
20479
+ function isStoryboardNodeEventHandler(node) {
20480
+ return node.type === "EventHandler";
20481
+ }
20472
20482
 
20473
20483
  /**
20474
20484
  * Like `removeDeadConditions` but applied to a custom template.