@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.
- package/dist/index.bundle.js +15 -5
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +15 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -20115,12 +20115,12 @@ var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "t
|
|
|
20115
20115
|
var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"];
|
|
20116
20116
|
|
|
20117
20117
|
// Fields started with `_` will be removed by default.
|
|
20118
|
-
var fieldsToRemoveInRoute = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "screenshot", "lock", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
|
|
20118
|
+
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"];
|
|
20119
20119
|
var fieldsToRemoveInBrick = fieldsToRemoveInRoute.concat("type");
|
|
20120
20120
|
|
|
20121
20121
|
// Those fields can be disposed if value is null.
|
|
20122
20122
|
var disposableNullFields = ["alias", "documentId", "context", "exports", "ref", "analyticsData"];
|
|
20123
|
-
var disposableFalseOrNullFields = ["hybrid", "bg", "portal", "public", "exact"];
|
|
20123
|
+
var disposableFalseOrNullFields = ["hybrid", "bg", "portal", "public", "exact", "incrementalSubRoutes"];
|
|
20124
20124
|
function normalizeBuilderNode(node) {
|
|
20125
20125
|
if (isBrickNode(node)) {
|
|
20126
20126
|
return normalize(node, fieldsToRemoveInBrick, jsonFieldsInBrick, yamlFieldsInBrick, "brick");
|
|
@@ -20131,6 +20131,7 @@ function normalizeBuilderNode(node) {
|
|
|
20131
20131
|
return null;
|
|
20132
20132
|
}
|
|
20133
20133
|
function normalize(node, fieldsToRemove, jsonFields, yamlFields, type) {
|
|
20134
|
+
var temp;
|
|
20134
20135
|
return Object.fromEntries(Object.entries(node)
|
|
20135
20136
|
// Remove unused fields from CMDB.
|
|
20136
20137
|
// Consider fields started with `_` as unused.
|
|
@@ -20141,7 +20142,10 @@ function normalize(node, fieldsToRemove, jsonFields, yamlFields, type) {
|
|
|
20141
20142
|
// Parse specific fields.
|
|
20142
20143
|
.map(_ref2 => {
|
|
20143
20144
|
var [key, value] = _ref2;
|
|
20144
|
-
return [key === "instanceId" ? "iid" : key, type === "route" && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ?
|
|
20145
|
+
return [key === "instanceId" ? "iid" : key, type === "route" && key === "segues" ? getCleanSegues(value) : jsonFields.includes(key) ? (temp = safeJsonParse(value),
|
|
20146
|
+
// There is a bug to cause json fields in route to be stored as `""` when it's empty.
|
|
20147
|
+
// These `""` can be safely ignored.
|
|
20148
|
+
temp === "" && type === "route" ? undefined : temp) : yamlFields.includes(key) ? safeYamlParse(value) : cloneDeep(value)];
|
|
20145
20149
|
}));
|
|
20146
20150
|
}
|
|
20147
20151
|
|
|
@@ -20406,6 +20410,9 @@ function removeDeadConditionsByAst(ast, options) {
|
|
|
20406
20410
|
case "MetaMenuItem":
|
|
20407
20411
|
shakeConditionalNodes(node.children, node.raw, "children");
|
|
20408
20412
|
break;
|
|
20413
|
+
case "Context":
|
|
20414
|
+
shakeConditionalNodes(node.onChange, node.raw, "onChange");
|
|
20415
|
+
break;
|
|
20409
20416
|
}
|
|
20410
20417
|
|
|
20411
20418
|
// Remove unreachable context/state.
|
|
@@ -20425,8 +20432,8 @@ function shakeConditionalNodes(conditionalNodes, rawContainer, rawKey) {
|
|
|
20425
20432
|
var removedNodes = [];
|
|
20426
20433
|
if (Array.isArray(conditionalNodes)) {
|
|
20427
20434
|
for (var node of conditionalNodes) {
|
|
20428
|
-
var
|
|
20429
|
-
if ((
|
|
20435
|
+
var _node$else;
|
|
20436
|
+
if (isStoryboardNodeEventHandler(node) && (_node$else = node.else) !== null && _node$else !== void 0 && _node$else.length) {
|
|
20430
20437
|
switch (node.raw.if) {
|
|
20431
20438
|
case false:
|
|
20432
20439
|
node.then = node.else;
|
|
@@ -20463,6 +20470,9 @@ function shakeConditionalNodes(conditionalNodes, rawContainer, rawKey) {
|
|
|
20463
20470
|
}
|
|
20464
20471
|
}
|
|
20465
20472
|
}
|
|
20473
|
+
function isStoryboardNodeEventHandler(node) {
|
|
20474
|
+
return node.type === "EventHandler";
|
|
20475
|
+
}
|
|
20466
20476
|
|
|
20467
20477
|
/**
|
|
20468
20478
|
* Like `removeDeadConditions` but applied to a custom template.
|