@itwin/presentation-common 4.10.0-dev.32 → 4.10.0-dev.33

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.
Files changed (105) hide show
  1. package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
  2. package/lib/cjs/presentation-common/EC.js +4 -4
  3. package/lib/cjs/presentation-common/EC.js.map +1 -1
  4. package/lib/cjs/presentation-common/Error.d.ts.map +1 -1
  5. package/lib/cjs/presentation-common/Error.js +0 -1
  6. package/lib/cjs/presentation-common/Error.js.map +1 -1
  7. package/lib/cjs/presentation-common/KeySet.js +5 -5
  8. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  9. package/lib/cjs/presentation-common/LabelDefinition.js +4 -4
  10. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  11. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +3 -3
  12. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  13. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  14. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  15. package/lib/cjs/presentation-common/PresentationRpcInterface.js +4 -5
  16. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  17. package/lib/cjs/presentation-common/RpcRequestsHandler.js +5 -5
  18. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  19. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  20. package/lib/cjs/presentation-common/RulesetsFactory.js +0 -1
  21. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  22. package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
  23. package/lib/cjs/presentation-common/Update.js +14 -14
  24. package/lib/cjs/presentation-common/Update.js.map +1 -1
  25. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +1 -1
  26. package/lib/cjs/presentation-common/content/ContentTraverser.js +2 -2
  27. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  28. package/lib/cjs/presentation-common/content/Descriptor.js +6 -6
  29. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  30. package/lib/cjs/presentation-common/content/DisplayTypes.d.ts +1 -1
  31. package/lib/cjs/presentation-common/content/DisplayTypes.d.ts.map +1 -1
  32. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  33. package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
  34. package/lib/cjs/presentation-common/content/Fields.js +2 -2
  35. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  36. package/lib/cjs/presentation-common/content/Item.js +7 -7
  37. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  38. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  39. package/lib/cjs/presentation-common/content/Value.js +34 -34
  40. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  41. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +2 -2
  42. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  43. package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
  44. package/lib/cjs/presentation-common/hierarchy/Key.js +8 -8
  45. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  46. package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
  47. package/lib/cjs/presentation-common/hierarchy/Node.js +9 -9
  48. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  49. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +13 -13
  50. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  51. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  52. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  53. package/lib/esm/presentation-common/EC.d.ts.map +1 -1
  54. package/lib/esm/presentation-common/EC.js +4 -4
  55. package/lib/esm/presentation-common/EC.js.map +1 -1
  56. package/lib/esm/presentation-common/Error.d.ts.map +1 -1
  57. package/lib/esm/presentation-common/Error.js +0 -1
  58. package/lib/esm/presentation-common/Error.js.map +1 -1
  59. package/lib/esm/presentation-common/KeySet.js +5 -5
  60. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  61. package/lib/esm/presentation-common/LabelDefinition.js +4 -4
  62. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  63. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +3 -3
  64. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  65. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  66. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  67. package/lib/esm/presentation-common/PresentationRpcInterface.js +4 -5
  68. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  69. package/lib/esm/presentation-common/RpcRequestsHandler.js +5 -5
  70. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  71. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  72. package/lib/esm/presentation-common/RulesetsFactory.js +0 -1
  73. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  74. package/lib/esm/presentation-common/Update.d.ts.map +1 -1
  75. package/lib/esm/presentation-common/Update.js +14 -14
  76. package/lib/esm/presentation-common/Update.js.map +1 -1
  77. package/lib/esm/presentation-common/content/ContentTraverser.d.ts +1 -1
  78. package/lib/esm/presentation-common/content/ContentTraverser.js +2 -2
  79. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  80. package/lib/esm/presentation-common/content/Descriptor.js +6 -6
  81. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  82. package/lib/esm/presentation-common/content/DisplayTypes.d.ts +1 -1
  83. package/lib/esm/presentation-common/content/DisplayTypes.d.ts.map +1 -1
  84. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  85. package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
  86. package/lib/esm/presentation-common/content/Fields.js +2 -2
  87. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  88. package/lib/esm/presentation-common/content/Item.js +7 -7
  89. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  90. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  91. package/lib/esm/presentation-common/content/Value.js +34 -34
  92. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  93. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +2 -2
  94. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  95. package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
  96. package/lib/esm/presentation-common/hierarchy/Key.js +8 -8
  97. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  98. package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
  99. package/lib/esm/presentation-common/hierarchy/Node.js +9 -9
  100. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  101. package/lib/esm/presentation-common/hierarchy/NodePathElement.js +13 -13
  102. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  103. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  104. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  105. package/package.json +13 -13
@@ -23,29 +23,29 @@ var PartialHierarchyModification;
23
23
  * Serialize given object to JSON.
24
24
  * @deprecated in 3.x. Use [[PartialHierarchyModification]]
25
25
  */
26
- // eslint-disable-next-line deprecation/deprecation
26
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
27
27
  function toJSON(obj) {
28
28
  switch (obj.type) {
29
29
  case "Insert":
30
30
  return {
31
31
  type: "Insert",
32
- // eslint-disable-next-line deprecation/deprecation
32
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
33
33
  parent: obj.parent === undefined ? undefined : Key_1.NodeKey.toJSON(obj.parent),
34
34
  position: obj.position,
35
- // eslint-disable-next-line deprecation/deprecation
35
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
36
36
  node: Node_1.Node.toJSON(obj.node),
37
37
  };
38
38
  case "Update":
39
39
  return {
40
40
  type: "Update",
41
- // eslint-disable-next-line deprecation/deprecation
41
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
42
42
  target: Key_1.NodeKey.toJSON(obj.target),
43
43
  changes: Node_1.Node.toPartialJSON(obj.changes),
44
44
  };
45
45
  case "Delete":
46
46
  return {
47
47
  type: "Delete",
48
- // eslint-disable-next-line deprecation/deprecation
48
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
49
49
  parent: obj.parent === undefined ? undefined : Key_1.NodeKey.toJSON(obj.parent),
50
50
  position: obj.position,
51
51
  };
@@ -56,29 +56,29 @@ var PartialHierarchyModification;
56
56
  * Deserialize given object from JSON
57
57
  * @deprecated in 3.x. Use [[PartialHierarchyModification]]
58
58
  */
59
- // eslint-disable-next-line deprecation/deprecation
59
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
60
60
  function fromJSON(json) {
61
61
  switch (json.type) {
62
62
  case "Insert":
63
63
  return {
64
64
  type: "Insert",
65
- // eslint-disable-next-line deprecation/deprecation
65
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
66
66
  parent: json.parent === undefined ? undefined : Key_1.NodeKey.fromJSON(json.parent),
67
67
  position: json.position,
68
- // eslint-disable-next-line deprecation/deprecation
68
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
69
69
  node: Node_1.Node.fromJSON(json.node),
70
70
  };
71
71
  case "Update":
72
72
  return {
73
73
  type: "Update",
74
- // eslint-disable-next-line deprecation/deprecation
74
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
75
75
  target: Key_1.NodeKey.fromJSON(json.target),
76
76
  changes: Node_1.Node.fromPartialJSON(json.changes),
77
77
  };
78
78
  case "Delete":
79
79
  return {
80
80
  type: "Delete",
81
- // eslint-disable-next-line deprecation/deprecation
81
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
82
82
  parent: json.parent === undefined ? undefined : Key_1.NodeKey.fromJSON(json.parent),
83
83
  position: json.position,
84
84
  };
@@ -93,11 +93,11 @@ var HierarchyCompareInfo;
93
93
  * Serialize given object to JSON.
94
94
  * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
95
95
  */
96
- // eslint-disable-next-line deprecation/deprecation
96
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
97
97
  function toJSON(obj) {
98
98
  return {
99
99
  ...obj,
100
- // eslint-disable-next-line deprecation/deprecation
100
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
101
101
  changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),
102
102
  };
103
103
  }
@@ -106,11 +106,11 @@ var HierarchyCompareInfo;
106
106
  * Deserialize given object from JSON
107
107
  * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
108
108
  */
109
- // eslint-disable-next-line deprecation/deprecation
109
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
110
110
  function fromJSON(json) {
111
111
  return {
112
112
  ...json,
113
- // eslint-disable-next-line deprecation/deprecation
113
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
114
114
  changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),
115
115
  };
116
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,yCAAuD;AACvD,2CAAgF;AAEhF;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC;AA4ClC,cAAc;AACd,2DAA2D;AAC3D,IAAiB,4BAA4B,CAsE5C;AAtED,WAAiB,4BAA4B;IAC3C;;;OAGG;IACH,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAiC;QACtD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,mDAAmD;oBACnD,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,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AAoB,oCAApB,oBAAoB,QA0BpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey, NodeKeyJSON } from \"./hierarchy/Key\";\r\nimport { Node, NodeJSON, PartialNode, PartialNodeJSON } from \"./hierarchy/Node\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * JSON representation of [[PartialHierarchyModification]].\r\n * @public\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n// eslint-disable-next-line deprecation/deprecation\r\nexport type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n */\r\n// eslint-disable-next-line deprecation/deprecation\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace PartialHierarchyModification {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n export function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON {\r\n switch (obj.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n // eslint-disable-next-line deprecation/deprecation\r\n node: Node.toJSON(obj.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n target: NodeKey.toJSON(obj.target),\r\n changes: Node.toPartialJSON(obj.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n export function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification {\r\n switch (json.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n // eslint-disable-next-line deprecation/deprecation\r\n node: Node.fromJSON(json.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n target: NodeKey.fromJSON(json.target),\r\n changes: Node.fromPartialJSON(json.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeInsertionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeInsertionInfo]]\r\n */\r\nexport interface NodeInsertionInfoJSON {\r\n type: \"Insert\";\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent?: NodeKeyJSON;\r\n position: number;\r\n // eslint-disable-next-line deprecation/deprecation\r\n node: NodeJSON;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeDeletionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeDeletionInfo]]\r\n */\r\nexport interface NodeDeletionInfoJSON {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n // eslint-disable-next-line deprecation/deprecation\r\n parent?: NodeKeyJSON;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeUpdateInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeUpdateInfo]]\r\n */\r\nexport interface NodeUpdateInfoJSON {\r\n type: \"Update\";\r\n // eslint-disable-next-line deprecation/deprecation\r\n target: NodeKeyJSON;\r\n // eslint-disable-next-line deprecation/deprecation\r\n changes: PartialNodeJSON;\r\n}\r\n\r\n/**\r\n * JSON representation of [[HierarchyCompareInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]].\r\n */\r\nexport interface HierarchyCompareInfoJSON {\r\n // eslint-disable-next-line deprecation/deprecation\r\n changes: PartialHierarchyModificationJSON[];\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/** @public */\r\nexport namespace HierarchyCompareInfo {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n export function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON {\r\n return {\r\n ...obj,\r\n // eslint-disable-next-line deprecation/deprecation\r\n changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n export function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo {\r\n return {\r\n ...json,\r\n // eslint-disable-next-line deprecation/deprecation\r\n changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,yCAAuD;AACvD,2CAAgF;AAEhF;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC;AA2ClC,cAAc;AACd,2DAA2D;AAC3D,IAAiB,4BAA4B,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AAgB,QAAQ,CAAC,IAA8B;QACrD,OAAO;YACL,GAAG,IAAI;YACP,4DAA4D;YAC5D,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACrF,CAAC;IACJ,CAAC;IANe,6BAAQ,WAMvB,CAAA;AACH,CAAC,EA1BgB,oBAAoB,oCAApB,oBAAoB,QA0BpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey, NodeKeyJSON } from \"./hierarchy/Key\";\r\nimport { Node, NodeJSON, PartialNode, PartialNodeJSON } from \"./hierarchy/Node\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * JSON representation of [[PartialHierarchyModification]].\r\n * @public\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nexport type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n */\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace PartialHierarchyModification {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON {\r\n switch (obj.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.toJSON(obj.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.toJSON(obj.target),\r\n changes: Node.toPartialJSON(obj.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification {\r\n switch (json.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.fromJSON(json.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.fromJSON(json.target),\r\n changes: Node.fromPartialJSON(json.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeInsertionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeInsertionInfo]]\r\n */\r\nexport interface NodeInsertionInfoJSON {\r\n type: \"Insert\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n position: number;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: NodeJSON;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeDeletionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeDeletionInfo]]\r\n */\r\nexport interface NodeDeletionInfoJSON {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeUpdateInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeUpdateInfo]]\r\n */\r\nexport interface NodeUpdateInfoJSON {\r\n type: \"Update\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKeyJSON;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialNodeJSON;\r\n}\r\n\r\n/**\r\n * JSON representation of [[HierarchyCompareInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]].\r\n */\r\nexport interface HierarchyCompareInfoJSON {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialHierarchyModificationJSON[];\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/** @public */\r\nexport namespace HierarchyCompareInfo {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON {\r\n return {\r\n ...obj,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo {\r\n return {\r\n ...json,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),\r\n };\r\n }\r\n}\r\n"]}
@@ -254,7 +254,7 @@ export declare function traverseContentItem(visitor: IContentVisitor, descriptor
254
254
  *
255
255
  * @public
256
256
  */
257
- export declare function createFieldHierarchies(fields: Field[], ignoreCategories?: Boolean): FieldHierarchy[];
257
+ export declare function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean): FieldHierarchy[];
258
258
  /**
259
259
  * Adds a field hierarchy into root field hierarchies list. *
260
260
  * @public
@@ -389,7 +389,7 @@ function convertNestedContentItemToStructArrayItem(item, field, nextField) {
389
389
  nextFieldValues.display.push(nextDisplayValue);
390
390
  }
391
391
  });
392
- const convertedItem = new Item_1.Item(item.primaryKeys, item.label, item.imageId, // eslint-disable-line deprecation/deprecation
392
+ const convertedItem = new Item_1.Item(item.primaryKeys, item.label, item.imageId, // eslint-disable-line @typescript-eslint/no-deprecated
393
393
  item.classInfo, { [nextField.name]: nextFieldValues.raw }, { [nextField.name]: nextFieldValues.display }, item.mergedFieldNames, item.extendedData);
394
394
  return { emptyNestedItem: false, convertedItem };
395
395
  }
@@ -456,7 +456,7 @@ function convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHier
456
456
  return { emptyNestedItem: true, convertedItem: item };
457
457
  }
458
458
  const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);
459
- const convertedItem = new Item_1.Item(item.primaryKeys, item.label, item.imageId, // eslint-disable-line deprecation/deprecation
459
+ const convertedItem = new Item_1.Item(item.primaryKeys, item.label, item.imageId, // eslint-disable-line @typescript-eslint/no-deprecated
460
460
  item.classInfo, { [fieldName]: converted.raw }, { [fieldName]: converted.display }, converted.mergedFieldNames, item.extendedData);
461
461
  return { emptyNestedItem: false, convertedItem };
462
462
  }
@@ -1 +1 @@
1
- {"version":3,"file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,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,uDAAuD,CAAC,IAAoB,EAAE,cAA8B;IACnH,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACxC,IAAA,qBAAM,EAAC,aAAiB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,SAAS,GAAG,sDAAsD,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACnG,MAAM,aAAa,GAAG,IAAI,WAAI,CAC5B,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,OAAO,EAAE,8CAA8C;IAC5D,IAAI,CAAC,SAAS,EACd,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,EAC9B,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE,EAClC,SAAS,CAAC,gBAAgB,EAC1B,IAAI,CAAC,YAAY,CAClB,CAAC;IACF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { assert, IDisposable, using } from \"@itwin/core-bentley\";\r\nimport { CategoryDescription } from \"./Category\";\r\nimport { Content } from \"./Content\";\r\nimport { Descriptor } from \"./Descriptor\";\r\nimport { Field, NestedContentField } from \"./Fields\";\r\nimport { Item } from \"./Item\";\r\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription\";\r\nimport {\r\n DisplayValue,\r\n DisplayValuesArray,\r\n DisplayValuesMap,\r\n NestedContentValue,\r\n Value as PresentationValue,\r\n ValuesArray as PresentationValuesArray,\r\n ValuesMap as PresentationValuesMap,\r\n} from \"./Value\";\r\nimport { LabelDefinition } from \"../LabelDefinition\";\r\n\r\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\r\n\r\ntype ValuesMap = PresentationValuesMap & {\r\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\r\n};\r\n\r\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\r\n\r\ntype ValuesArray = Array<Value>;\r\n\r\n/**\r\n * A data structure to define a hierarchy of [[Field]] objects.\r\n * @public\r\n */\r\nexport interface FieldHierarchy {\r\n /** Parent field. */\r\n field: Field;\r\n /** Nested fields. */\r\n childFields: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startContent]] call.\r\n * @public\r\n */\r\nexport interface StartContentProps {\r\n /** Descriptor of the visited content. */\r\n descriptor: Descriptor;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\r\n * @public\r\n */\r\nexport interface ProcessFieldHierarchiesProps {\r\n /**\r\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\r\n * add new fields, etc.\r\n */\r\n hierarchies: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startItem]] call.\r\n * @public\r\n */\r\nexport interface StartItemProps {\r\n /** The content item that's about to be visited. */\r\n item: Item;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startCategory]] call.\r\n * @public\r\n */\r\nexport interface StartCategoryProps {\r\n /** The content category that's about to be visited. */\r\n category: CategoryDescription;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startField]] call.\r\n * @public\r\n */\r\nexport interface StartFieldProps {\r\n /** The field that's about to be visited. */\r\n hierarchy: FieldHierarchy;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startStruct]] call.\r\n * @public\r\n */\r\nexport interface StartStructProps {\r\n /** Field that describes the struct. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the struct. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Member raw values. */\r\n rawValues: PresentationValuesMap;\r\n /** Member display values. */\r\n displayValues: DisplayValuesMap;\r\n /** Label definition of the ECInstance that the struct represents. */\r\n label?: LabelDefinition;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startArray]] call.\r\n * @public\r\n */\r\nexport interface StartArrayProps {\r\n /** Field that describes the array. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the array. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Item raw values. */\r\n rawValues: PresentationValuesArray;\r\n /** Item display values. */\r\n displayValues: DisplayValuesArray;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processMergedValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessMergedValueProps {\r\n /** The field whose values are merged. */\r\n mergedField: Field;\r\n /**\r\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\r\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\r\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\r\n * process is going to be represented by [[requestedField]].\r\n */\r\n requestedField: Field;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessPrimitiveValueProps {\r\n /** Field whose value is being processed. */\r\n field: Field;\r\n /** Type of the value. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Raw value. */\r\n rawValue: PresentationValue;\r\n /** Display value. */\r\n displayValue: DisplayValue;\r\n}\r\n\r\n/**\r\n * An interface for a visitor that can be passed to the [[traverseContent]] function\r\n * to be called on each piece of content.\r\n *\r\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\r\n *\r\n * ```\r\n * startContent\r\n * processFieldHierarchies\r\n * for each content item:\r\n * startItem\r\n * for each field in root level:\r\n * for each category in field's category stack from root to field's category:\r\n * startCategory\r\n * startField\r\n * valueProcessing:\r\n * if item's value for this field is merged:\r\n * processMergedValue\r\n * else if the field is struct:\r\n * startStruct\r\n * for each struct member:\r\n * recurse into the valueProcessing step\r\n * finishStruct\r\n * else if the field is array:\r\n * startArray\r\n * for each array item:\r\n * recurse into the valueProcessing step\r\n * finishArray\r\n * else if the field is primitive:\r\n * processPrimitiveValue\r\n * finishField\r\n * finishItem\r\n * finishContent\r\n * ```\r\n * @public\r\n */\r\nexport interface IContentVisitor {\r\n /**\r\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\r\n * for parsing content.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\r\n */\r\n startContent(props: StartContentProps): boolean;\r\n /** Called after processing of [[Content]] is complete. */\r\n finishContent(): void;\r\n\r\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\r\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\r\n\r\n /**\r\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\r\n * set up a new row in table.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\r\n */\r\n startItem(props: StartItemProps): boolean;\r\n /**\r\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\r\n * values for one content item have been processed.\r\n */\r\n finishItem(): void;\r\n\r\n /**\r\n * Called before processing a content item field ([[startField]] call) for each category in the field's\r\n * category stack, starting from the root and finishing with the field's category.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\r\n */\r\n startCategory(props: StartCategoryProps): boolean;\r\n /** Called after processing of field is complete for every category in the field's category stack. */\r\n finishCategory(): void;\r\n\r\n /**\r\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\r\n * to skip a field if it doesn't need to be handled.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\r\n */\r\n startField(props: StartFieldProps): boolean;\r\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\r\n finishField(): void;\r\n\r\n /**\r\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\r\n * for struct member values handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\r\n */\r\n startStruct(props: StartStructProps): boolean;\r\n /** Called after processing of struct value is complete. */\r\n finishStruct(): void;\r\n\r\n /**\r\n * Called before processing an array value. This is a good callback to skip handling the value or set up\r\n * for array items handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\r\n */\r\n startArray(props: StartArrayProps): boolean;\r\n /** Called after processing of array value is complete. */\r\n finishArray(): void;\r\n\r\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\r\n processMergedValue(props: ProcessMergedValueProps): void;\r\n /** Called to process a primitive value. */\r\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\r\n}\r\n\r\n/**\r\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\r\n * @public\r\n */\r\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\r\n if (cb(hierarchy)) {\r\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\r\n }\r\n}\r\n\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n * @public\r\n */\r\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\r\n if (!visitor.startContent({ descriptor: content.descriptor })) {\r\n return;\r\n }\r\n\r\n try {\r\n const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);\r\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\r\n content.contentSet.forEach((item) => {\r\n traverseContentItemFields(visitor, fieldHierarchies, item);\r\n });\r\n } finally {\r\n visitor.finishContent();\r\n }\r\n}\r\n\r\n/**\r\n * An utility for calling [[traverseContent]] when there's only one content item.\r\n * @public\r\n */\r\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\r\n traverseContent(visitor, new Content(descriptor, [item]));\r\n}\r\n\r\nclass VisitedCategories implements IDisposable {\r\n private _visitedCategories: CategoryDescription[];\r\n private _didVisitAllHierarchy: boolean;\r\n constructor(\r\n private _visitor: IContentVisitor,\r\n category: CategoryDescription,\r\n ) {\r\n const stack: CategoryDescription[] = [];\r\n let curr: CategoryDescription | undefined = category;\r\n while (curr) {\r\n stack.push(curr);\r\n curr = curr.parent;\r\n }\r\n stack.reverse();\r\n\r\n this._didVisitAllHierarchy = true;\r\n this._visitedCategories = [];\r\n for (curr of stack) {\r\n if (this._visitor.startCategory({ category: curr })) {\r\n this._visitedCategories.push(curr);\r\n } else {\r\n this._didVisitAllHierarchy = false;\r\n break;\r\n }\r\n }\r\n }\r\n public dispose() {\r\n while (this._visitedCategories.pop()) {\r\n this._visitor.finishCategory();\r\n }\r\n }\r\n public get shouldContinue(): boolean {\r\n return this._didVisitAllHierarchy;\r\n }\r\n}\r\n\r\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\r\n if (!visitor.startItem({ item })) {\r\n return;\r\n }\r\n\r\n try {\r\n fieldHierarchies.forEach((fieldHierarchy) => {\r\n using(new VisitedCategories(visitor, fieldHierarchy.field.category), (res) => {\r\n if (res.shouldContinue) {\r\n traverseContentItemField(visitor, fieldHierarchy, item);\r\n }\r\n });\r\n });\r\n } finally {\r\n visitor.finishItem();\r\n }\r\n}\r\n\r\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\r\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\r\n return;\r\n }\r\n\r\n try {\r\n const rootToThisField = createFieldPath(fieldHierarchy.field);\r\n let parentFieldName: string | undefined;\r\n const pathUpToField = rootToThisField.slice(undefined, -1);\r\n for (let i = 0; i < pathUpToField.length; ++i) {\r\n const parentField = pathUpToField[i] as NestedContentField;\r\n const nextField = rootToThisField[i + 1];\r\n\r\n if (item.isFieldMerged(parentField.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\r\n return;\r\n }\r\n\r\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n\r\n item = convertedItem;\r\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\r\n }\r\n\r\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\r\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n item = convertedItem;\r\n } else if (pathUpToField.length > 0) {\r\n fieldHierarchy = {\r\n ...fieldHierarchy,\r\n field: Object.assign(fieldHierarchy.field.clone(), {\r\n type: {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: fieldHierarchy.field.type,\r\n },\r\n }),\r\n };\r\n }\r\n\r\n traverseContentItemFieldValue(\r\n visitor,\r\n fieldHierarchy,\r\n item.mergedFieldNames,\r\n fieldHierarchy.field.type,\r\n parentFieldName,\r\n item.values[fieldHierarchy.field.name],\r\n item.displayValues[fieldHierarchy.field.name],\r\n );\r\n } finally {\r\n visitor.finishField();\r\n }\r\n}\r\n\r\nfunction traverseContentItemFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (rawValue !== undefined) {\r\n if (valueType.valueFormat === PropertyValueFormat.Array) {\r\n assert(PresentationValue.isArray(rawValue));\r\n assert(DisplayValue.isArray(displayValue));\r\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\r\n assert(PresentationValue.isMap(rawValue));\r\n assert(DisplayValue.isMap(displayValue));\r\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n }\r\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n}\r\n\r\nfunction traverseContentItemArrayFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesArray,\r\n displayValues: DisplayValuesArray,\r\n) {\r\n assert(rawValues.length === displayValues.length);\r\n assert(valueType.valueFormat === PropertyValueFormat.Array);\r\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\r\n return;\r\n }\r\n\r\n try {\r\n const itemType = valueType.memberType;\r\n rawValues.forEach((_, i) => {\r\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\r\n });\r\n } finally {\r\n visitor.finishArray();\r\n }\r\n}\r\n\r\nfunction traverseContentItemStructFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesMap,\r\n displayValues: DisplayValuesMap,\r\n) {\r\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\r\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\r\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\r\n return;\r\n }\r\n\r\n try {\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\r\n }\r\n\r\n valueType.members.forEach((memberDescription) => {\r\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\r\n if (!memberField) {\r\n // Not finding a member field means we're traversing an ECStruct. We still need to carry member information, so we\r\n // create a fake field to represent the member\r\n memberField = {\r\n field: new Field(\r\n fieldHierarchy.field.category,\r\n memberDescription.name,\r\n memberDescription.label,\r\n memberDescription.type,\r\n fieldHierarchy.field.isReadonly,\r\n 0,\r\n ),\r\n childFields: [],\r\n };\r\n }\r\n traverseContentItemFieldValue(\r\n visitor,\r\n memberField,\r\n mergedFieldNames,\r\n memberDescription.type,\r\n parentFieldName,\r\n rawValues[memberDescription.name],\r\n displayValues[memberDescription.name],\r\n );\r\n });\r\n } finally {\r\n visitor.finishStruct();\r\n }\r\n}\r\n\r\nfunction traverseContentItemPrimitiveFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\r\n}\r\n\r\n/**\r\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\r\n *\r\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\r\n * without considering categories.\r\n *\r\n * @public\r\n */\r\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: Boolean) {\r\n const hierarchies = new Array<FieldHierarchy>();\r\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\r\n let childFields: FieldHierarchy[] = [];\r\n if (field.isNestedContentField()) {\r\n // visit all nested fields\r\n childFields = visitFields(field.nestedFields, field);\r\n if (0 === childFields.length) {\r\n return undefined;\r\n }\r\n }\r\n const fieldHierarchy = { field, childFields };\r\n if (category === parentField?.category || (ignoreCategories && parentField)) {\r\n // if categories of this field and its parent field match - return the field hierarchy without\r\n // including it as a top level field\r\n return fieldHierarchy;\r\n }\r\n addFieldHierarchy(hierarchies, fieldHierarchy);\r\n return undefined;\r\n };\r\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\r\n const includedFields: FieldHierarchy[] = [];\r\n visitedFields.forEach((field) => {\r\n const visitedField = visitField(field.category, field, parentField);\r\n if (visitedField) {\r\n includedFields.push(visitedField);\r\n }\r\n });\r\n return includedFields;\r\n };\r\n visitFields(fields, undefined);\r\n return hierarchies;\r\n}\r\n\r\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\r\n // build a list of parent fields in hierarchy\r\n const fields: Field[] = [];\r\n let currField: Field | undefined = hierarchy.field;\r\n while (currField) {\r\n fields.push(currField);\r\n currField = currField.parent;\r\n }\r\n\r\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\r\n const rootFieldHierarchy = rootFields[rootIndex];\r\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\r\n // only interested in fields with the same category\r\n continue;\r\n }\r\n\r\n let first = true;\r\n currField = rootFieldHierarchy.field;\r\n while (currField) {\r\n const index = fields.findIndex((f) => f.name === currField!.name);\r\n if (-1 !== index) {\r\n return {\r\n existing: {\r\n field: currField,\r\n hierarchy: first ? rootFieldHierarchy : undefined,\r\n index: rootIndex,\r\n },\r\n matchingField: fields[index],\r\n };\r\n }\r\n currField = currField.parent;\r\n first = false;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\r\n // note: parentField is found by walking up the parentship relationship\r\n // from hierarchy.field, so we expect to always find it here\r\n while (hierarchy.field !== parentField) {\r\n const hierarchyParent = hierarchy.field.parent;\r\n assert(hierarchyParent !== undefined);\r\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\r\n }\r\n return hierarchy;\r\n}\r\n\r\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\r\n assert(lhs.field.name === rhs.field.name);\r\n const result: FieldHierarchy = {\r\n field: lhs.field.clone(),\r\n childFields: [...lhs.childFields],\r\n };\r\n rhs.childFields.forEach((rhsChildHierarchy) => {\r\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\r\n if (indexInResult !== -1) {\r\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\r\n } else {\r\n result.childFields.push(rhsChildHierarchy);\r\n }\r\n });\r\n return result;\r\n}\r\n\r\n/**\r\n * Adds a field hierarchy into root field hierarchies list. *\r\n * @public\r\n */\r\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\r\n const match = findRelatedFields(rootHierarchies, hierarchy);\r\n if (!match) {\r\n rootHierarchies.push(hierarchy);\r\n return;\r\n }\r\n\r\n const targetHierarchy = rootHierarchies[match.existing.index];\r\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\r\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\r\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\r\n mergedHierarchy.field.category = hierarchy.field.category;\r\n rootHierarchies[match.existing.index] = mergedHierarchy;\r\n}\r\n\r\nfunction createFieldPath(field: Field): Field[] {\r\n const path = [field];\r\n let currField = field;\r\n while (currField.parent) {\r\n currField = currField.parent;\r\n path.push(currField);\r\n }\r\n path.reverse();\r\n return path;\r\n}\r\n\r\n/** @internal */\r\nexport const FIELD_NAMES_SEPARATOR = \"$\";\r\n/**\r\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\r\n * @public\r\n */\r\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\r\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\r\n}\r\n/**\r\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\r\n * @public\r\n */\r\nexport function parseCombinedFieldNames(combinedName: string) {\r\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\r\n}\r\n\r\ninterface NestedItemConversionResult {\r\n emptyNestedItem: boolean;\r\n convertedItem: Item;\r\n}\r\n\r\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\r\n const value = item.values[field.name] ?? [];\r\n assert(PresentationValue.isNestedContent(value));\r\n if (value.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const nextFieldValues: { raw: ValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\r\n value.forEach((ncv) => {\r\n const nextRawValue = ncv.values[nextField.name];\r\n const nextDisplayValue = ncv.displayValues[nextField.name];\r\n if (nextField.isNestedContentField()) {\r\n if (nextRawValue) {\r\n assert(PresentationValue.isNestedContent(nextRawValue));\r\n nextFieldValues.raw.push(...nextRawValue);\r\n }\r\n } else {\r\n nextFieldValues.raw.push(nextRawValue);\r\n nextFieldValues.display.push(nextDisplayValue);\r\n }\r\n });\r\n const convertedItem = new Item(\r\n item.primaryKeys,\r\n item.label,\r\n item.imageId, // eslint-disable-line deprecation/deprecation\r\n item.classInfo,\r\n { [nextField.name]: nextFieldValues.raw },\r\n { [nextField.name]: nextFieldValues.display },\r\n item.mergedFieldNames,\r\n item.extendedData,\r\n );\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\r\n const fieldName = fieldHierarchy.field.name;\r\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\r\n if (child.field.isNestedContentField()) {\r\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\r\n }\r\n return child;\r\n });\r\n const convertedFieldHierarchy: FieldHierarchy = {\r\n field: Object.assign(fieldHierarchy.field.clone(), {\r\n type: {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: {\r\n valueFormat: PropertyValueFormat.Struct,\r\n typeName: fieldHierarchy.field.type.typeName,\r\n members: convertedChildFieldHierarchies.map((member) => ({\r\n name: member.field.name,\r\n label: member.field.label,\r\n type: member.field.type,\r\n })),\r\n },\r\n } as TypeDescription,\r\n }),\r\n childFields: convertedChildFieldHierarchies,\r\n };\r\n return convertedFieldHierarchy;\r\n}\r\n\r\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\r\n const result: {\r\n raw: ValuesArray;\r\n display: DisplayValuesArray;\r\n mergedFieldNames: string[];\r\n } = { raw: [], display: [], mergedFieldNames: [] };\r\n\r\n ncvs.forEach((ncv) => {\r\n const values: ValuesMap = { ...ncv.values };\r\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\r\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\r\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.labelDefinition;\r\n\r\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\r\n const childFieldName = childFieldHierarchy.field.name;\r\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\r\n return;\r\n }\r\n if (childFieldHierarchy.field.isNestedContentField()) {\r\n const value = values[childFieldName];\r\n assert(PresentationValue.isNestedContent(value));\r\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\r\n values[childFieldName] = convertedValues.raw;\r\n displayValues[childFieldName] = convertedValues.display;\r\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\r\n }\r\n });\r\n result.raw.push(values);\r\n result.display.push(displayValues);\r\n result.mergedFieldNames.push(...mergedFieldNames);\r\n });\r\n return result;\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\r\n const fieldName = fieldHierarchy.field.name;\r\n const rawValue = item.values[fieldName];\r\n assert(PresentationValue.isNestedContent(rawValue));\r\n if (rawValue.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\r\n const convertedItem = new Item(\r\n item.primaryKeys,\r\n item.label,\r\n item.imageId, // eslint-disable-line deprecation/deprecation\r\n item.classInfo,\r\n { [fieldName]: converted.raw },\r\n { [fieldName]: converted.display },\r\n converted.mergedFieldNames,\r\n item.extendedData,\r\n );\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n"]}
1
+ {"version":3,"file":"ContentTraverser.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/ContentTraverser.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAiRH,wDAIC;AAOD,0CAcC;AAMD,kDAEC;AAwPD,wDAgCC;AAwED,8CAaC;AAmBD,8CAEC;AAKD,0DAEC;AAzrBD,sDAAiE;AAEjE,uCAAoC;AAEpC,qCAAqD;AACrD,iCAA8B;A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CAAC,CAAC;IACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,SAAS,GAAG,sDAAsD,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACnG,MAAM,aAAa,GAAG,IAAI,WAAI,CAC5B,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,OAAO,EAAE,uDAAuD;IACrE,IAAI,CAAC,SAAS,EACd,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,EAC9B,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE,EAClC,SAAS,CAAC,gBAAgB,EAC1B,IAAI,CAAC,YAAY,CAClB,CAAC;IACF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { assert, IDisposable, using } from \"@itwin/core-bentley\";\r\nimport { CategoryDescription } from \"./Category\";\r\nimport { Content } from \"./Content\";\r\nimport { Descriptor } from \"./Descriptor\";\r\nimport { Field, NestedContentField } from \"./Fields\";\r\nimport { Item } from \"./Item\";\r\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription\";\r\nimport {\r\n DisplayValue,\r\n DisplayValuesArray,\r\n DisplayValuesMap,\r\n NestedContentValue,\r\n Value as PresentationValue,\r\n ValuesArray as PresentationValuesArray,\r\n ValuesMap as PresentationValuesMap,\r\n} from \"./Value\";\r\nimport { LabelDefinition } from \"../LabelDefinition\";\r\n\r\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\r\n\r\ntype ValuesMap = PresentationValuesMap & {\r\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\r\n};\r\n\r\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\r\n\r\ntype ValuesArray = Array<Value>;\r\n\r\n/**\r\n * A data structure to define a hierarchy of [[Field]] objects.\r\n * @public\r\n */\r\nexport interface FieldHierarchy {\r\n /** Parent field. */\r\n field: Field;\r\n /** Nested fields. */\r\n childFields: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startContent]] call.\r\n * @public\r\n */\r\nexport interface StartContentProps {\r\n /** Descriptor of the visited content. */\r\n descriptor: Descriptor;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\r\n * @public\r\n */\r\nexport interface ProcessFieldHierarchiesProps {\r\n /**\r\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\r\n * add new fields, etc.\r\n */\r\n hierarchies: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startItem]] call.\r\n * @public\r\n */\r\nexport interface StartItemProps {\r\n /** The content item that's about to be visited. */\r\n item: Item;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startCategory]] call.\r\n * @public\r\n */\r\nexport interface StartCategoryProps {\r\n /** The content category that's about to be visited. */\r\n category: CategoryDescription;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startField]] call.\r\n * @public\r\n */\r\nexport interface StartFieldProps {\r\n /** The field that's about to be visited. */\r\n hierarchy: FieldHierarchy;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startStruct]] call.\r\n * @public\r\n */\r\nexport interface StartStructProps {\r\n /** Field that describes the struct. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the struct. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Member raw values. */\r\n rawValues: PresentationValuesMap;\r\n /** Member display values. */\r\n displayValues: DisplayValuesMap;\r\n /** Label definition of the ECInstance that the struct represents. */\r\n label?: LabelDefinition;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startArray]] call.\r\n * @public\r\n */\r\nexport interface StartArrayProps {\r\n /** Field that describes the array. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the array. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Item raw values. */\r\n rawValues: PresentationValuesArray;\r\n /** Item display values. */\r\n displayValues: DisplayValuesArray;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processMergedValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessMergedValueProps {\r\n /** The field whose values are merged. */\r\n mergedField: Field;\r\n /**\r\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\r\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\r\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\r\n * process is going to be represented by [[requestedField]].\r\n */\r\n requestedField: Field;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessPrimitiveValueProps {\r\n /** Field whose value is being processed. */\r\n field: Field;\r\n /** Type of the value. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Raw value. */\r\n rawValue: PresentationValue;\r\n /** Display value. */\r\n displayValue: DisplayValue;\r\n}\r\n\r\n/**\r\n * An interface for a visitor that can be passed to the [[traverseContent]] function\r\n * to be called on each piece of content.\r\n *\r\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\r\n *\r\n * ```\r\n * startContent\r\n * processFieldHierarchies\r\n * for each content item:\r\n * startItem\r\n * for each field in root level:\r\n * for each category in field's category stack from root to field's category:\r\n * startCategory\r\n * startField\r\n * valueProcessing:\r\n * if item's value for this field is merged:\r\n * processMergedValue\r\n * else if the field is struct:\r\n * startStruct\r\n * for each struct member:\r\n * recurse into the valueProcessing step\r\n * finishStruct\r\n * else if the field is array:\r\n * startArray\r\n * for each array item:\r\n * recurse into the valueProcessing step\r\n * finishArray\r\n * else if the field is primitive:\r\n * processPrimitiveValue\r\n * finishField\r\n * finishItem\r\n * finishContent\r\n * ```\r\n * @public\r\n */\r\nexport interface IContentVisitor {\r\n /**\r\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\r\n * for parsing content.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\r\n */\r\n startContent(props: StartContentProps): boolean;\r\n /** Called after processing of [[Content]] is complete. */\r\n finishContent(): void;\r\n\r\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\r\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\r\n\r\n /**\r\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\r\n * set up a new row in table.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\r\n */\r\n startItem(props: StartItemProps): boolean;\r\n /**\r\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\r\n * values for one content item have been processed.\r\n */\r\n finishItem(): void;\r\n\r\n /**\r\n * Called before processing a content item field ([[startField]] call) for each category in the field's\r\n * category stack, starting from the root and finishing with the field's category.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\r\n */\r\n startCategory(props: StartCategoryProps): boolean;\r\n /** Called after processing of field is complete for every category in the field's category stack. */\r\n finishCategory(): void;\r\n\r\n /**\r\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\r\n * to skip a field if it doesn't need to be handled.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\r\n */\r\n startField(props: StartFieldProps): boolean;\r\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\r\n finishField(): void;\r\n\r\n /**\r\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\r\n * for struct member values handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\r\n */\r\n startStruct(props: StartStructProps): boolean;\r\n /** Called after processing of struct value is complete. */\r\n finishStruct(): void;\r\n\r\n /**\r\n * Called before processing an array value. This is a good callback to skip handling the value or set up\r\n * for array items handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\r\n */\r\n startArray(props: StartArrayProps): boolean;\r\n /** Called after processing of array value is complete. */\r\n finishArray(): void;\r\n\r\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\r\n processMergedValue(props: ProcessMergedValueProps): void;\r\n /** Called to process a primitive value. */\r\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\r\n}\r\n\r\n/**\r\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\r\n * @public\r\n */\r\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\r\n if (cb(hierarchy)) {\r\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\r\n }\r\n}\r\n\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n * @public\r\n */\r\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\r\n if (!visitor.startContent({ descriptor: content.descriptor })) {\r\n return;\r\n }\r\n\r\n try {\r\n const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);\r\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\r\n content.contentSet.forEach((item) => {\r\n traverseContentItemFields(visitor, fieldHierarchies, item);\r\n });\r\n } finally {\r\n visitor.finishContent();\r\n }\r\n}\r\n\r\n/**\r\n * An utility for calling [[traverseContent]] when there's only one content item.\r\n * @public\r\n */\r\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\r\n traverseContent(visitor, new Content(descriptor, [item]));\r\n}\r\n\r\nclass VisitedCategories implements IDisposable {\r\n private _visitedCategories: CategoryDescription[];\r\n private _didVisitAllHierarchy: boolean;\r\n constructor(\r\n private _visitor: IContentVisitor,\r\n category: CategoryDescription,\r\n ) {\r\n const stack: CategoryDescription[] = [];\r\n let curr: CategoryDescription | undefined = category;\r\n while (curr) {\r\n stack.push(curr);\r\n curr = curr.parent;\r\n }\r\n stack.reverse();\r\n\r\n this._didVisitAllHierarchy = true;\r\n this._visitedCategories = [];\r\n for (curr of stack) {\r\n if (this._visitor.startCategory({ category: curr })) {\r\n this._visitedCategories.push(curr);\r\n } else {\r\n this._didVisitAllHierarchy = false;\r\n break;\r\n }\r\n }\r\n }\r\n public dispose() {\r\n while (this._visitedCategories.pop()) {\r\n this._visitor.finishCategory();\r\n }\r\n }\r\n public get shouldContinue(): boolean {\r\n return this._didVisitAllHierarchy;\r\n }\r\n}\r\n\r\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\r\n if (!visitor.startItem({ item })) {\r\n return;\r\n }\r\n\r\n try {\r\n fieldHierarchies.forEach((fieldHierarchy) => {\r\n using(new VisitedCategories(visitor, fieldHierarchy.field.category), (res) => {\r\n if (res.shouldContinue) {\r\n traverseContentItemField(visitor, fieldHierarchy, item);\r\n }\r\n });\r\n });\r\n } finally {\r\n visitor.finishItem();\r\n }\r\n}\r\n\r\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\r\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\r\n return;\r\n }\r\n\r\n try {\r\n const rootToThisField = createFieldPath(fieldHierarchy.field);\r\n let parentFieldName: string | undefined;\r\n const pathUpToField = rootToThisField.slice(undefined, -1);\r\n for (let i = 0; i < pathUpToField.length; ++i) {\r\n const parentField = pathUpToField[i] as NestedContentField;\r\n const nextField = rootToThisField[i + 1];\r\n\r\n if (item.isFieldMerged(parentField.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\r\n return;\r\n }\r\n\r\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n\r\n item = convertedItem;\r\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\r\n }\r\n\r\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\r\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n item = convertedItem;\r\n } else if (pathUpToField.length > 0) {\r\n fieldHierarchy = {\r\n ...fieldHierarchy,\r\n field: Object.assign(fieldHierarchy.field.clone(), {\r\n type: {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: fieldHierarchy.field.type,\r\n },\r\n }),\r\n };\r\n }\r\n\r\n traverseContentItemFieldValue(\r\n visitor,\r\n fieldHierarchy,\r\n item.mergedFieldNames,\r\n fieldHierarchy.field.type,\r\n parentFieldName,\r\n item.values[fieldHierarchy.field.name],\r\n item.displayValues[fieldHierarchy.field.name],\r\n );\r\n } finally {\r\n visitor.finishField();\r\n }\r\n}\r\n\r\nfunction traverseContentItemFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (rawValue !== undefined) {\r\n if (valueType.valueFormat === PropertyValueFormat.Array) {\r\n assert(PresentationValue.isArray(rawValue));\r\n assert(DisplayValue.isArray(displayValue));\r\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\r\n assert(PresentationValue.isMap(rawValue));\r\n assert(DisplayValue.isMap(displayValue));\r\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n }\r\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n}\r\n\r\nfunction traverseContentItemArrayFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesArray,\r\n displayValues: DisplayValuesArray,\r\n) {\r\n assert(rawValues.length === displayValues.length);\r\n assert(valueType.valueFormat === PropertyValueFormat.Array);\r\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\r\n return;\r\n }\r\n\r\n try {\r\n const itemType = valueType.memberType;\r\n rawValues.forEach((_, i) => {\r\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\r\n });\r\n } finally {\r\n visitor.finishArray();\r\n }\r\n}\r\n\r\nfunction traverseContentItemStructFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesMap,\r\n displayValues: DisplayValuesMap,\r\n) {\r\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\r\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\r\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\r\n return;\r\n }\r\n\r\n try {\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\r\n }\r\n\r\n valueType.members.forEach((memberDescription) => {\r\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\r\n if (!memberField) {\r\n // Not finding a member field means we're traversing an ECStruct. We still need to carry member information, so we\r\n // create a fake field to represent the member\r\n memberField = {\r\n field: new Field(\r\n fieldHierarchy.field.category,\r\n memberDescription.name,\r\n memberDescription.label,\r\n memberDescription.type,\r\n fieldHierarchy.field.isReadonly,\r\n 0,\r\n ),\r\n childFields: [],\r\n };\r\n }\r\n traverseContentItemFieldValue(\r\n visitor,\r\n memberField,\r\n mergedFieldNames,\r\n memberDescription.type,\r\n parentFieldName,\r\n rawValues[memberDescription.name],\r\n displayValues[memberDescription.name],\r\n );\r\n });\r\n } finally {\r\n visitor.finishStruct();\r\n }\r\n}\r\n\r\nfunction traverseContentItemPrimitiveFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\r\n}\r\n\r\n/**\r\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\r\n *\r\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\r\n * without considering categories.\r\n *\r\n * @public\r\n */\r\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean) {\r\n const hierarchies = new Array<FieldHierarchy>();\r\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\r\n let childFields: FieldHierarchy[] = [];\r\n if (field.isNestedContentField()) {\r\n // visit all nested fields\r\n childFields = visitFields(field.nestedFields, field);\r\n if (0 === childFields.length) {\r\n return undefined;\r\n }\r\n }\r\n const fieldHierarchy = { field, childFields };\r\n if (category === parentField?.category || (ignoreCategories && parentField)) {\r\n // if categories of this field and its parent field match - return the field hierarchy without\r\n // including it as a top level field\r\n return fieldHierarchy;\r\n }\r\n addFieldHierarchy(hierarchies, fieldHierarchy);\r\n return undefined;\r\n };\r\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\r\n const includedFields: FieldHierarchy[] = [];\r\n visitedFields.forEach((field) => {\r\n const visitedField = visitField(field.category, field, parentField);\r\n if (visitedField) {\r\n includedFields.push(visitedField);\r\n }\r\n });\r\n return includedFields;\r\n };\r\n visitFields(fields, undefined);\r\n return hierarchies;\r\n}\r\n\r\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\r\n // build a list of parent fields in hierarchy\r\n const fields: Field[] = [];\r\n let currField: Field | undefined = hierarchy.field;\r\n while (currField) {\r\n fields.push(currField);\r\n currField = currField.parent;\r\n }\r\n\r\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\r\n const rootFieldHierarchy = rootFields[rootIndex];\r\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\r\n // only interested in fields with the same category\r\n continue;\r\n }\r\n\r\n let first = true;\r\n currField = rootFieldHierarchy.field;\r\n while (currField) {\r\n const index = fields.findIndex((f) => f.name === currField!.name);\r\n if (-1 !== index) {\r\n return {\r\n existing: {\r\n field: currField,\r\n hierarchy: first ? rootFieldHierarchy : undefined,\r\n index: rootIndex,\r\n },\r\n matchingField: fields[index],\r\n };\r\n }\r\n currField = currField.parent;\r\n first = false;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\r\n // note: parentField is found by walking up the parentship relationship\r\n // from hierarchy.field, so we expect to always find it here\r\n while (hierarchy.field !== parentField) {\r\n const hierarchyParent = hierarchy.field.parent;\r\n assert(hierarchyParent !== undefined);\r\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\r\n }\r\n return hierarchy;\r\n}\r\n\r\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\r\n assert(lhs.field.name === rhs.field.name);\r\n const result: FieldHierarchy = {\r\n field: lhs.field.clone(),\r\n childFields: [...lhs.childFields],\r\n };\r\n rhs.childFields.forEach((rhsChildHierarchy) => {\r\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\r\n if (indexInResult !== -1) {\r\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\r\n } else {\r\n result.childFields.push(rhsChildHierarchy);\r\n }\r\n });\r\n return result;\r\n}\r\n\r\n/**\r\n * Adds a field hierarchy into root field hierarchies list. *\r\n * @public\r\n */\r\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\r\n const match = findRelatedFields(rootHierarchies, hierarchy);\r\n if (!match) {\r\n rootHierarchies.push(hierarchy);\r\n return;\r\n }\r\n\r\n const targetHierarchy = rootHierarchies[match.existing.index];\r\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\r\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\r\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\r\n mergedHierarchy.field.category = hierarchy.field.category;\r\n rootHierarchies[match.existing.index] = mergedHierarchy;\r\n}\r\n\r\nfunction createFieldPath(field: Field): Field[] {\r\n const path = [field];\r\n let currField = field;\r\n while (currField.parent) {\r\n currField = currField.parent;\r\n path.push(currField);\r\n }\r\n path.reverse();\r\n return path;\r\n}\r\n\r\n/** @internal */\r\nexport const FIELD_NAMES_SEPARATOR = \"$\";\r\n/**\r\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\r\n * @public\r\n */\r\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\r\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\r\n}\r\n/**\r\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\r\n * @public\r\n */\r\nexport function parseCombinedFieldNames(combinedName: string) {\r\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\r\n}\r\n\r\ninterface NestedItemConversionResult {\r\n emptyNestedItem: boolean;\r\n convertedItem: Item;\r\n}\r\n\r\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\r\n const value = item.values[field.name] ?? [];\r\n assert(PresentationValue.isNestedContent(value));\r\n if (value.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const nextFieldValues: { raw: ValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\r\n value.forEach((ncv) => {\r\n const nextRawValue = ncv.values[nextField.name];\r\n const nextDisplayValue = ncv.displayValues[nextField.name];\r\n if (nextField.isNestedContentField()) {\r\n if (nextRawValue) {\r\n assert(PresentationValue.isNestedContent(nextRawValue));\r\n nextFieldValues.raw.push(...nextRawValue);\r\n }\r\n } else {\r\n nextFieldValues.raw.push(nextRawValue);\r\n nextFieldValues.display.push(nextDisplayValue);\r\n }\r\n });\r\n const convertedItem = new Item(\r\n item.primaryKeys,\r\n item.label,\r\n item.imageId, // eslint-disable-line @typescript-eslint/no-deprecated\r\n item.classInfo,\r\n { [nextField.name]: nextFieldValues.raw },\r\n { [nextField.name]: nextFieldValues.display },\r\n item.mergedFieldNames,\r\n item.extendedData,\r\n );\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\r\n const fieldName = fieldHierarchy.field.name;\r\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\r\n if (child.field.isNestedContentField()) {\r\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\r\n }\r\n return child;\r\n });\r\n const convertedFieldHierarchy: FieldHierarchy = {\r\n field: Object.assign(fieldHierarchy.field.clone(), {\r\n type: {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: {\r\n valueFormat: PropertyValueFormat.Struct,\r\n typeName: fieldHierarchy.field.type.typeName,\r\n members: convertedChildFieldHierarchies.map((member) => ({\r\n name: member.field.name,\r\n label: member.field.label,\r\n type: member.field.type,\r\n })),\r\n },\r\n } as TypeDescription,\r\n }),\r\n childFields: convertedChildFieldHierarchies,\r\n };\r\n return convertedFieldHierarchy;\r\n}\r\n\r\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\r\n const result: {\r\n raw: ValuesArray;\r\n display: DisplayValuesArray;\r\n mergedFieldNames: string[];\r\n } = { raw: [], display: [], mergedFieldNames: [] };\r\n\r\n ncvs.forEach((ncv) => {\r\n const values: ValuesMap = { ...ncv.values };\r\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\r\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\r\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.labelDefinition;\r\n\r\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\r\n const childFieldName = childFieldHierarchy.field.name;\r\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\r\n return;\r\n }\r\n if (childFieldHierarchy.field.isNestedContentField()) {\r\n const value = values[childFieldName];\r\n assert(PresentationValue.isNestedContent(value));\r\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\r\n values[childFieldName] = convertedValues.raw;\r\n displayValues[childFieldName] = convertedValues.display;\r\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\r\n }\r\n });\r\n result.raw.push(values);\r\n result.display.push(displayValues);\r\n result.mergedFieldNames.push(...mergedFieldNames);\r\n });\r\n return result;\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\r\n const fieldName = fieldHierarchy.field.name;\r\n const rawValue = item.values[fieldName];\r\n assert(PresentationValue.isNestedContent(rawValue));\r\n if (rawValue.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\r\n const convertedItem = new Item(\r\n item.primaryKeys,\r\n item.label,\r\n item.imageId, // eslint-disable-line @typescript-eslint/no-deprecated\r\n item.classInfo,\r\n { [fieldName]: converted.raw },\r\n { [fieldName]: converted.display },\r\n converted.mergedFieldNames,\r\n item.extendedData,\r\n );\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n"]}
@@ -139,8 +139,8 @@ class Descriptor {
139
139
  this.fields = [...source.fields];
140
140
  this.sortingField = source.sortingField;
141
141
  this.sortDirection = source.sortDirection;
142
- this.filterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line deprecation/deprecation
143
- this.fieldsFilterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line deprecation/deprecation
142
+ this.filterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line @typescript-eslint/no-deprecated
143
+ this.fieldsFilterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line @typescript-eslint/no-deprecated
144
144
  this.instanceFilter = source.instanceFilter;
145
145
  this.ruleset = source.ruleset;
146
146
  }
@@ -158,8 +158,8 @@ class Descriptor {
158
158
  classesMap,
159
159
  }, this.connectionId !== undefined && { connectionId: this.connectionId }, this.inputKeysHash !== undefined && { inputKeysHash: this.inputKeysHash },
160
160
  // istanbul ignore next
161
- this.contentOptions !== undefined && { contentOptions: this.contentOptions }, // eslint-disable-line deprecation/deprecation
162
- this.sortingField !== undefined && { sortingFieldName: this.sortingField.name }, this.sortDirection !== undefined && { sortDirection: this.sortDirection }, this.filterExpression !== undefined && { filterExpression: this.filterExpression }, // eslint-disable-line deprecation/deprecation
161
+ this.contentOptions !== undefined && { contentOptions: this.contentOptions }, // eslint-disable-line @typescript-eslint/no-deprecated
162
+ this.sortingField !== undefined && { sortingFieldName: this.sortingField.name }, this.sortDirection !== undefined && { sortDirection: this.sortDirection }, this.filterExpression !== undefined && { filterExpression: this.filterExpression }, // eslint-disable-line @typescript-eslint/no-deprecated
163
163
  this.fieldsFilterExpression !== undefined && { fieldsFilterExpression: this.fieldsFilterExpression }, this.instanceFilter !== undefined && { instanceFilter: this.instanceFilter }, this.selectionInfo !== undefined && { selectionInfo: this.selectionInfo }, this.ruleset !== undefined && { ruleset: this.ruleset });
164
164
  }
165
165
  /** Deserialize [[Descriptor]] from JSON */
@@ -216,9 +216,9 @@ class Descriptor {
216
216
  if (this.contentFlags !== 0) {
217
217
  overrides.contentFlags = this.contentFlags;
218
218
  }
219
- // eslint-disable-next-line deprecation/deprecation
219
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
220
220
  if (this.filterExpression || this.fieldsFilterExpression) {
221
- // eslint-disable-next-line deprecation/deprecation
221
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
222
222
  overrides.fieldsFilterExpression = this.fieldsFilterExpression ?? this.filterExpression;
223
223
  }
224
224
  if (this.instanceFilter) {
@@ -1 +1 @@
1
- {"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Descriptor.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAyD;AACzD,8BAUe;AAGf,yCAA0E;AAC1E,qCAAmG;AAwCnG,cAAc;AACd,IAAiB,eAAe,CAsE/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Ac,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,eAAgC,EAAE,OAAiB;QAC7E,OAAO,IAAA,6BAAoB,EAAC,IAAI,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,yBAAyB;QAC9B,MAAM,SAAS,GAAwB,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;YAC5B,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,CAAC;QACD,mDAAmD;QACnD,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACzD,mDAAmD;YACnD,SAAS,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,gBAAgB,CAAC;QAC1F,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAClI,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjLD,gCAiLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n ClassInfo,\r\n ClassInfoJSON,\r\n CompressedClassInfoJSON,\r\n RelatedClassInfo,\r\n RelatedClassInfoJSON,\r\n RelatedClassInfoWithOptionalRelationship,\r\n RelatedClassInfoWithOptionalRelationshipJSON,\r\n RelationshipPath,\r\n RelationshipPathJSON,\r\n} from \"../EC\";\r\nimport { InstanceFilterDefinition } from \"../InstanceFilterDefinition\";\r\nimport { Ruleset } from \"../rules/Ruleset\";\r\nimport { CategoryDescription, CategoryDescriptionJSON } from \"./Category\";\r\nimport { Field, FieldDescriptor, FieldJSON, getFieldByDescriptor, getFieldByName } from \"./Fields\";\r\n\r\n/**\r\n * Data structure that describes an ECClass in content [[Descriptor]].\r\n * @public\r\n */\r\nexport interface SelectClassInfo {\r\n /** Information about the ECClass */\r\n selectClassInfo: ClassInfo;\r\n\r\n /** Is the class handled polymorphically */\r\n isSelectPolymorphic: boolean;\r\n\r\n /** Relationship path from input class to the select class. */\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationship[];\r\n\r\n /** Relationship paths to [related property]($docs/presentation/content/Terminology#related-properties) classes */\r\n relatedPropertyPaths?: RelationshipPath[];\r\n\r\n /** Relationship paths to navigation property classes */\r\n navigationPropertyClasses?: RelatedClassInfo[];\r\n\r\n /** Relationship paths to [related instance]($docs/presentation/content/Terminology#related-instance) classes. */\r\n relatedInstancePaths?: RelationshipPath[];\r\n}\r\n\r\n/**\r\n * Serialized [[SelectClassInfo]] JSON representation\r\n * @public\r\n */\r\n// eslint-disable-next-line deprecation/deprecation\r\nexport interface SelectClassInfoJSON<TClassInfoJSON = ClassInfoJSON> {\r\n selectClassInfo: TClassInfoJSON;\r\n isSelectPolymorphic: boolean;\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationshipJSON<TClassInfoJSON>[];\r\n relatedPropertyPaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n navigationPropertyClasses?: RelatedClassInfoJSON<TClassInfoJSON>[];\r\n relatedInstancePaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n}\r\n\r\n/** @public */\r\nexport namespace SelectClassInfo {\r\n /** Deserialize [[SelectClassInfo]] from compressed JSON */\r\n export function fromCompressedJSON(json: SelectClassInfoJSON<string>, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo {\r\n assert(classesMap.hasOwnProperty(json.selectClassInfo));\r\n return {\r\n selectClassInfo: { id: json.selectClassInfo, ...classesMap[json.selectClassInfo] },\r\n isSelectPolymorphic: json.isSelectPolymorphic,\r\n ...(json.navigationPropertyClasses\r\n ? { navigationPropertyClasses: json.navigationPropertyClasses.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap)) }\r\n : undefined),\r\n ...(json.relatedInstancePaths\r\n ? { relatedInstancePaths: json.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(json.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: json.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.fromCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(json.relatedPropertyPaths\r\n ? { relatedPropertyPaths: json.relatedPropertyPaths.map((path) => path.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n };\r\n }\r\n\r\n /** Serialize [[SelectClassInfo]] to compressed JSON */\r\n export function toCompressedJSON(selectClass: SelectClassInfo, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfoJSON<string> {\r\n const { id, ...leftOverClassInfo } = selectClass.selectClassInfo;\r\n classesMap[id] = leftOverClassInfo;\r\n return {\r\n selectClassInfo: id,\r\n isSelectPolymorphic: selectClass.isSelectPolymorphic,\r\n ...(selectClass.relatedInstancePaths\r\n ? { relatedInstancePaths: selectClass.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.toCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(selectClass.navigationPropertyClasses\r\n ? {\r\n navigationPropertyClasses: selectClass.navigationPropertyClasses.map((propertyClass) =>\r\n RelatedClassInfo.toCompressedJSON(propertyClass, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: selectClass.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.toCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.relatedPropertyPaths\r\n ? {\r\n relatedPropertyPaths: selectClass.relatedPropertyPaths.map((path) =>\r\n path.map((relatedClass) => RelatedClassInfo.toCompressedJSON(relatedClass, classesMap)),\r\n ),\r\n }\r\n : undefined),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize [[SelectClassInfo]] list from JSON\r\n * @param json JSON or JSON serialized to string to deserialize from\r\n * @returns Deserialized [[SelectClassInfo]] objects list\r\n *\r\n * @internal\r\n */\r\n export function listFromCompressedJSON(json: SelectClassInfoJSON<Id64String>[], classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo[] {\r\n return json.map((sci) => fromCompressedJSON(sci, classesMap));\r\n }\r\n}\r\n\r\n/**\r\n * Flags that control content format.\r\n * @public\r\n */\r\nexport enum ContentFlags {\r\n /** Each content record only has [[InstanceKey]] and no data */\r\n KeysOnly = 1 << 0,\r\n\r\n /**\r\n * Each content record additionally has an image id\r\n * @deprecated in 3.x. Use [[ExtendedDataRule]] instead. See [extended data usage page]($docs/presentation/customization/ExtendedDataUsage.md) for more details.\r\n */\r\n ShowImages = 1 << 1,\r\n\r\n /** Each content record additionally has a display label */\r\n ShowLabels = 1 << 2,\r\n\r\n /** All content records are merged into a single record (see [Merging values]($docs/presentation/content/terminology#value-merging)) */\r\n MergeResults = 1 << 3,\r\n\r\n /** Content has only distinct values */\r\n DistinctValues = 1 << 4,\r\n\r\n /** Doesn't create property or calculated fields. Can be used in conjunction with [[ShowLabels]]. */\r\n NoFields = 1 << 5,\r\n\r\n /**\r\n * Set related input keys on [[Item]] objects when creating content. This helps identify which [[Item]] is associated to which\r\n * given input key at the cost of performance creating those items.\r\n */\r\n IncludeInputKeys = 1 << 8,\r\n\r\n /**\r\n * Produce content descriptor that is not intended for querying content. Allows the implementation to omit certain\r\n * operations to make obtaining content descriptor faster.\r\n * @internal\r\n */\r\n DescriptorOnly = 1 << 9,\r\n}\r\n\r\n/**\r\n * Data sorting direction\r\n * @public\r\n */\r\nexport enum SortDirection {\r\n Ascending,\r\n Descending,\r\n}\r\n\r\n/**\r\n * Data structure that contains selection information. Used\r\n * for cases when requesting content after a selection change.\r\n *\r\n * @public\r\n */\r\nexport interface SelectionInfo {\r\n /** Name of selection provider which cause the selection change */\r\n providerName: string;\r\n /** Level of selection that changed */\r\n level?: number;\r\n}\r\n\r\n/**\r\n * Serialized [[Descriptor]] JSON representation.\r\n * @public\r\n */\r\nexport interface DescriptorJSON {\r\n classesMap: { [id: string]: CompressedClassInfoJSON };\r\n connectionId: string;\r\n inputKeysHash: string;\r\n /** @deprecated in 3.x. The attribute is not used anymore. */\r\n contentOptions: any;\r\n selectionInfo?: SelectionInfo;\r\n displayType: string;\r\n selectClasses: SelectClassInfoJSON<Id64String>[];\r\n categories: CategoryDescriptionJSON[];\r\n fields: FieldJSON<Id64String>[];\r\n sortingFieldName?: string;\r\n sortDirection?: SortDirection;\r\n contentFlags: number;\r\n /** @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]]. */\r\n filterExpression?: string;\r\n fieldsFilterExpression?: string;\r\n instanceFilter?: InstanceFilterDefinition;\r\n ruleset?: Ruleset;\r\n}\r\n\r\n/**\r\n * Descriptor overrides that can be used to customize content\r\n * @public\r\n */\r\nexport interface DescriptorOverrides {\r\n /**\r\n * Content display type. Can be accessed in presentation rules and used\r\n * to modify content in various ways. Defaults to empty string.\r\n */\r\n displayType?: string;\r\n\r\n /** Content flags used for content customization. See [[ContentFlags]] */\r\n contentFlags?: number;\r\n\r\n /** Fields selector that allows excluding or including only specified fields. */\r\n fieldsSelector?: {\r\n /** Should the specified fields be included or excluded */\r\n type: \"include\" | \"exclude\";\r\n /** A list of field descriptors that identify fields to include / exclude */\r\n fields: FieldDescriptor[];\r\n };\r\n\r\n /** Specification for sorting data. */\r\n sorting?: {\r\n /** Identifier of the field to use for sorting */\r\n field: FieldDescriptor;\r\n /** Sort direction */\r\n direction: SortDirection;\r\n };\r\n\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Descriptor properties\r\n * @public\r\n */\r\nexport interface DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n readonly inputKeysHash?: string;\r\n /** Selection info used to create the descriptor */\r\n readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n readonly displayType: string;\r\n /** A list of classes that will be selected from when creating content with this descriptor */\r\n readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n readonly contentFlags: number;\r\n /** Field used to sort the content */\r\n readonly sortingField?: Field;\r\n /** Sorting direction */\r\n readonly sortDirection?: SortDirection;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n readonly ruleset?: Ruleset;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Data structure that describes content: fields, sorting, filtering, format, etc.\r\n * Descriptor may be changed to control how content is created.\r\n *\r\n * @public\r\n */\r\nexport class Descriptor implements DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n public readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n public readonly inputKeysHash?: string;\r\n /**\r\n * Extended options used to create the descriptor.\r\n * @deprecated in 3.6. The attribute is not used anymore.\r\n */\r\n public readonly contentOptions: any;\r\n /** Selection info used to create the descriptor */\r\n public readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n public readonly displayType: string;\r\n /** A list of classes that will be selected when creating content with this descriptor */\r\n public readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n public readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n public readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n public readonly contentFlags: number;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n public readonly ruleset?: Ruleset;\r\n /** Field used to sort the content */\r\n public sortingField?: Field;\r\n /** Sorting direction */\r\n public sortDirection?: SortDirection;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n public filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n public fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n public instanceFilter?: InstanceFilterDefinition;\r\n\r\n /** Construct a new Descriptor using a [[DescriptorSource]] */\r\n public constructor(source: DescriptorSource) {\r\n this.connectionId = source.connectionId;\r\n this.inputKeysHash = source.inputKeysHash;\r\n this.selectionInfo = source.selectionInfo;\r\n this.displayType = source.displayType;\r\n this.contentFlags = source.contentFlags;\r\n this.selectClasses = [...source.selectClasses];\r\n this.categories = [...source.categories];\r\n this.fields = [...source.fields];\r\n this.sortingField = source.sortingField;\r\n this.sortDirection = source.sortDirection;\r\n this.filterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line deprecation/deprecation\r\n this.fieldsFilterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line deprecation/deprecation\r\n this.instanceFilter = source.instanceFilter;\r\n this.ruleset = source.ruleset;\r\n }\r\n\r\n /** Serialize [[Descriptor]] to JSON */\r\n public toJSON(): DescriptorJSON {\r\n const classesMap: { [id: string]: CompressedClassInfoJSON } = {};\r\n const selectClasses: SelectClassInfoJSON<string>[] = this.selectClasses.map((selectClass) => SelectClassInfo.toCompressedJSON(selectClass, classesMap));\r\n const fields: FieldJSON<string>[] = this.fields.map((field) => field.toCompressedJSON(classesMap));\r\n return Object.assign(\r\n {\r\n displayType: this.displayType,\r\n contentFlags: this.contentFlags,\r\n categories: this.categories.map(CategoryDescription.toJSON),\r\n fields,\r\n selectClasses,\r\n classesMap,\r\n },\r\n this.connectionId !== undefined && { connectionId: this.connectionId },\r\n this.inputKeysHash !== undefined && { inputKeysHash: this.inputKeysHash },\r\n // istanbul ignore next\r\n this.contentOptions !== undefined && { contentOptions: this.contentOptions }, // eslint-disable-line deprecation/deprecation\r\n this.sortingField !== undefined && { sortingFieldName: this.sortingField.name },\r\n this.sortDirection !== undefined && { sortDirection: this.sortDirection },\r\n this.filterExpression !== undefined && { filterExpression: this.filterExpression }, // eslint-disable-line deprecation/deprecation\r\n this.fieldsFilterExpression !== undefined && { fieldsFilterExpression: this.fieldsFilterExpression },\r\n this.instanceFilter !== undefined && { instanceFilter: this.instanceFilter },\r\n this.selectionInfo !== undefined && { selectionInfo: this.selectionInfo },\r\n this.ruleset !== undefined && { ruleset: this.ruleset },\r\n );\r\n }\r\n\r\n /** Deserialize [[Descriptor]] from JSON */\r\n public static fromJSON(json: DescriptorJSON | undefined): Descriptor | undefined {\r\n if (!json) {\r\n return undefined;\r\n }\r\n\r\n const { classesMap, ...leftOverJson } = json;\r\n const categories = CategoryDescription.listFromJSON(json.categories);\r\n const selectClasses = SelectClassInfo.listFromCompressedJSON(json.selectClasses, classesMap);\r\n const fields = this.getFieldsFromJSON(json.fields, (fieldJson) => Field.fromCompressedJSON(fieldJson, classesMap, categories));\r\n return new Descriptor({\r\n ...leftOverJson,\r\n selectClasses,\r\n categories,\r\n fields,\r\n sortingField: getFieldByName(fields, json.sortingFieldName, true),\r\n });\r\n }\r\n\r\n private static getFieldsFromJSON(json: FieldJSON[], factory: (json: FieldJSON) => Field | undefined): Field[] {\r\n return json\r\n .map((fieldJson: FieldJSON) => {\r\n const field = factory(fieldJson);\r\n if (field) {\r\n field.rebuildParentship();\r\n }\r\n return field;\r\n })\r\n .filter((field): field is Field => !!field);\r\n }\r\n\r\n /**\r\n * Get field by its name\r\n * @param name Name of the field to find\r\n * @param recurse Recurse into nested fields\r\n */\r\n public getFieldByName(name: string, recurse?: boolean): Field | undefined {\r\n return getFieldByName(this.fields, name, recurse);\r\n }\r\n\r\n /**\r\n * Get field by its descriptor.\r\n */\r\n public getFieldByDescriptor(fieldDescriptor: FieldDescriptor, recurse?: boolean): Field | undefined {\r\n return getFieldByDescriptor(this.fields, fieldDescriptor, recurse);\r\n }\r\n\r\n /**\r\n * Create descriptor overrides object from this descriptor.\r\n * @public\r\n */\r\n public createDescriptorOverrides(): DescriptorOverrides {\r\n const overrides: DescriptorOverrides = {};\r\n if (this.displayType) {\r\n overrides.displayType = this.displayType;\r\n }\r\n if (this.contentFlags !== 0) {\r\n overrides.contentFlags = this.contentFlags;\r\n }\r\n // eslint-disable-next-line deprecation/deprecation\r\n if (this.filterExpression || this.fieldsFilterExpression) {\r\n // eslint-disable-next-line deprecation/deprecation\r\n overrides.fieldsFilterExpression = this.fieldsFilterExpression ?? this.filterExpression;\r\n }\r\n if (this.instanceFilter) {\r\n overrides.instanceFilter = this.instanceFilter;\r\n }\r\n if (this.sortingField) {\r\n overrides.sorting = { field: this.sortingField.getFieldDescriptor(), direction: this.sortDirection ?? SortDirection.Ascending };\r\n }\r\n return overrides;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Descriptor.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAyD;AACzD,8BAUe;AAGf,yCAA0E;AAC1E,qCAAmG;AAwCnG,cAAc;AACd,IAAiB,eAAe,CAsE/B;AAtED,WAAiB,eAAe;IAC9B,2DAA2D;IAC3D,SAAgB,kBAAkB,CAAC,IAAiC,EAAE,UAAqD;QACzH,IAAA,qBAAM,EAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QACxD,OAAO;YACL,eAAe,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;YAClF,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,GAAG,CAAC,IAAI,CAAC,yBAAyB;gBAChC,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAgB,CAAC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE;gBACpI,CAAC,CAAC,SAAS,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,oBAAoB;gBAC3B,CAAC,CAAC,EAAE,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAA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,CAAC,gBAAgB,CAAC;QAC1F,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAClI,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjLD,gCAiLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n ClassInfo,\r\n ClassInfoJSON,\r\n CompressedClassInfoJSON,\r\n RelatedClassInfo,\r\n RelatedClassInfoJSON,\r\n RelatedClassInfoWithOptionalRelationship,\r\n RelatedClassInfoWithOptionalRelationshipJSON,\r\n RelationshipPath,\r\n RelationshipPathJSON,\r\n} from \"../EC\";\r\nimport { InstanceFilterDefinition } from \"../InstanceFilterDefinition\";\r\nimport { Ruleset } from \"../rules/Ruleset\";\r\nimport { CategoryDescription, CategoryDescriptionJSON } from \"./Category\";\r\nimport { Field, FieldDescriptor, FieldJSON, getFieldByDescriptor, getFieldByName } from \"./Fields\";\r\n\r\n/**\r\n * Data structure that describes an ECClass in content [[Descriptor]].\r\n * @public\r\n */\r\nexport interface SelectClassInfo {\r\n /** Information about the ECClass */\r\n selectClassInfo: ClassInfo;\r\n\r\n /** Is the class handled polymorphically */\r\n isSelectPolymorphic: boolean;\r\n\r\n /** Relationship path from input class to the select class. */\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationship[];\r\n\r\n /** Relationship paths to [related property]($docs/presentation/content/Terminology#related-properties) classes */\r\n relatedPropertyPaths?: RelationshipPath[];\r\n\r\n /** Relationship paths to navigation property classes */\r\n navigationPropertyClasses?: RelatedClassInfo[];\r\n\r\n /** Relationship paths to [related instance]($docs/presentation/content/Terminology#related-instance) classes. */\r\n relatedInstancePaths?: RelationshipPath[];\r\n}\r\n\r\n/**\r\n * Serialized [[SelectClassInfo]] JSON representation\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nexport interface SelectClassInfoJSON<TClassInfoJSON = ClassInfoJSON> {\r\n selectClassInfo: TClassInfoJSON;\r\n isSelectPolymorphic: boolean;\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationshipJSON<TClassInfoJSON>[];\r\n relatedPropertyPaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n navigationPropertyClasses?: RelatedClassInfoJSON<TClassInfoJSON>[];\r\n relatedInstancePaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n}\r\n\r\n/** @public */\r\nexport namespace SelectClassInfo {\r\n /** Deserialize [[SelectClassInfo]] from compressed JSON */\r\n export function fromCompressedJSON(json: SelectClassInfoJSON<string>, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo {\r\n assert(classesMap.hasOwnProperty(json.selectClassInfo));\r\n return {\r\n selectClassInfo: { id: json.selectClassInfo, ...classesMap[json.selectClassInfo] },\r\n isSelectPolymorphic: json.isSelectPolymorphic,\r\n ...(json.navigationPropertyClasses\r\n ? { navigationPropertyClasses: json.navigationPropertyClasses.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap)) }\r\n : undefined),\r\n ...(json.relatedInstancePaths\r\n ? { relatedInstancePaths: json.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(json.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: json.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.fromCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(json.relatedPropertyPaths\r\n ? { relatedPropertyPaths: json.relatedPropertyPaths.map((path) => path.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n };\r\n }\r\n\r\n /** Serialize [[SelectClassInfo]] to compressed JSON */\r\n export function toCompressedJSON(selectClass: SelectClassInfo, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfoJSON<string> {\r\n const { id, ...leftOverClassInfo } = selectClass.selectClassInfo;\r\n classesMap[id] = leftOverClassInfo;\r\n return {\r\n selectClassInfo: id,\r\n isSelectPolymorphic: selectClass.isSelectPolymorphic,\r\n ...(selectClass.relatedInstancePaths\r\n ? { relatedInstancePaths: selectClass.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.toCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(selectClass.navigationPropertyClasses\r\n ? {\r\n navigationPropertyClasses: selectClass.navigationPropertyClasses.map((propertyClass) =>\r\n RelatedClassInfo.toCompressedJSON(propertyClass, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: selectClass.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.toCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.relatedPropertyPaths\r\n ? {\r\n relatedPropertyPaths: selectClass.relatedPropertyPaths.map((path) =>\r\n path.map((relatedClass) => RelatedClassInfo.toCompressedJSON(relatedClass, classesMap)),\r\n ),\r\n }\r\n : undefined),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize [[SelectClassInfo]] list from JSON\r\n * @param json JSON or JSON serialized to string to deserialize from\r\n * @returns Deserialized [[SelectClassInfo]] objects list\r\n *\r\n * @internal\r\n */\r\n export function listFromCompressedJSON(json: SelectClassInfoJSON<Id64String>[], classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo[] {\r\n return json.map((sci) => fromCompressedJSON(sci, classesMap));\r\n }\r\n}\r\n\r\n/**\r\n * Flags that control content format.\r\n * @public\r\n */\r\nexport enum ContentFlags {\r\n /** Each content record only has [[InstanceKey]] and no data */\r\n KeysOnly = 1 << 0,\r\n\r\n /**\r\n * Each content record additionally has an image id\r\n * @deprecated in 3.x. Use [[ExtendedDataRule]] instead. See [extended data usage page]($docs/presentation/customization/ExtendedDataUsage.md) for more details.\r\n */\r\n ShowImages = 1 << 1,\r\n\r\n /** Each content record additionally has a display label */\r\n ShowLabels = 1 << 2,\r\n\r\n /** All content records are merged into a single record (see [Merging values]($docs/presentation/content/terminology#value-merging)) */\r\n MergeResults = 1 << 3,\r\n\r\n /** Content has only distinct values */\r\n DistinctValues = 1 << 4,\r\n\r\n /** Doesn't create property or calculated fields. Can be used in conjunction with [[ShowLabels]]. */\r\n NoFields = 1 << 5,\r\n\r\n /**\r\n * Set related input keys on [[Item]] objects when creating content. This helps identify which [[Item]] is associated to which\r\n * given input key at the cost of performance creating those items.\r\n */\r\n IncludeInputKeys = 1 << 8,\r\n\r\n /**\r\n * Produce content descriptor that is not intended for querying content. Allows the implementation to omit certain\r\n * operations to make obtaining content descriptor faster.\r\n * @internal\r\n */\r\n DescriptorOnly = 1 << 9,\r\n}\r\n\r\n/**\r\n * Data sorting direction\r\n * @public\r\n */\r\nexport enum SortDirection {\r\n Ascending,\r\n Descending,\r\n}\r\n\r\n/**\r\n * Data structure that contains selection information. Used\r\n * for cases when requesting content after a selection change.\r\n *\r\n * @public\r\n */\r\nexport interface SelectionInfo {\r\n /** Name of selection provider which cause the selection change */\r\n providerName: string;\r\n /** Level of selection that changed */\r\n level?: number;\r\n}\r\n\r\n/**\r\n * Serialized [[Descriptor]] JSON representation.\r\n * @public\r\n */\r\nexport interface DescriptorJSON {\r\n classesMap: { [id: string]: CompressedClassInfoJSON };\r\n connectionId: string;\r\n inputKeysHash: string;\r\n /** @deprecated in 3.x. The attribute is not used anymore. */\r\n contentOptions: any;\r\n selectionInfo?: SelectionInfo;\r\n displayType: string;\r\n selectClasses: SelectClassInfoJSON<Id64String>[];\r\n categories: CategoryDescriptionJSON[];\r\n fields: FieldJSON<Id64String>[];\r\n sortingFieldName?: string;\r\n sortDirection?: SortDirection;\r\n contentFlags: number;\r\n /** @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]]. */\r\n filterExpression?: string;\r\n fieldsFilterExpression?: string;\r\n instanceFilter?: InstanceFilterDefinition;\r\n ruleset?: Ruleset;\r\n}\r\n\r\n/**\r\n * Descriptor overrides that can be used to customize content\r\n * @public\r\n */\r\nexport interface DescriptorOverrides {\r\n /**\r\n * Content display type. Can be accessed in presentation rules and used\r\n * to modify content in various ways. Defaults to empty string.\r\n */\r\n displayType?: string;\r\n\r\n /** Content flags used for content customization. See [[ContentFlags]] */\r\n contentFlags?: number;\r\n\r\n /** Fields selector that allows excluding or including only specified fields. */\r\n fieldsSelector?: {\r\n /** Should the specified fields be included or excluded */\r\n type: \"include\" | \"exclude\";\r\n /** A list of field descriptors that identify fields to include / exclude */\r\n fields: FieldDescriptor[];\r\n };\r\n\r\n /** Specification for sorting data. */\r\n sorting?: {\r\n /** Identifier of the field to use for sorting */\r\n field: FieldDescriptor;\r\n /** Sort direction */\r\n direction: SortDirection;\r\n };\r\n\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Descriptor properties\r\n * @public\r\n */\r\nexport interface DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n readonly inputKeysHash?: string;\r\n /** Selection info used to create the descriptor */\r\n readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n readonly displayType: string;\r\n /** A list of classes that will be selected from when creating content with this descriptor */\r\n readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n readonly contentFlags: number;\r\n /** Field used to sort the content */\r\n readonly sortingField?: Field;\r\n /** Sorting direction */\r\n readonly sortDirection?: SortDirection;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n readonly ruleset?: Ruleset;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Data structure that describes content: fields, sorting, filtering, format, etc.\r\n * Descriptor may be changed to control how content is created.\r\n *\r\n * @public\r\n */\r\nexport class Descriptor implements DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n public readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n public readonly inputKeysHash?: string;\r\n /**\r\n * Extended options used to create the descriptor.\r\n * @deprecated in 3.6. The attribute is not used anymore.\r\n */\r\n public readonly contentOptions: any;\r\n /** Selection info used to create the descriptor */\r\n public readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n public readonly displayType: string;\r\n /** A list of classes that will be selected when creating content with this descriptor */\r\n public readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n public readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n public readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n public readonly contentFlags: number;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n public readonly ruleset?: Ruleset;\r\n /** Field used to sort the content */\r\n public sortingField?: Field;\r\n /** Sorting direction */\r\n public sortDirection?: SortDirection;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content\r\n * @deprecated in 3.x. The attribute was replaced with [[fieldsFilterExpression]].\r\n */\r\n public filterExpression?: string;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n public fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n public instanceFilter?: InstanceFilterDefinition;\r\n\r\n /** Construct a new Descriptor using a [[DescriptorSource]] */\r\n public constructor(source: DescriptorSource) {\r\n this.connectionId = source.connectionId;\r\n this.inputKeysHash = source.inputKeysHash;\r\n this.selectionInfo = source.selectionInfo;\r\n this.displayType = source.displayType;\r\n this.contentFlags = source.contentFlags;\r\n this.selectClasses = [...source.selectClasses];\r\n this.categories = [...source.categories];\r\n this.fields = [...source.fields];\r\n this.sortingField = source.sortingField;\r\n this.sortDirection = source.sortDirection;\r\n this.filterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line @typescript-eslint/no-deprecated\r\n this.fieldsFilterExpression = source.fieldsFilterExpression ?? source.filterExpression; // eslint-disable-line @typescript-eslint/no-deprecated\r\n this.instanceFilter = source.instanceFilter;\r\n this.ruleset = source.ruleset;\r\n }\r\n\r\n /** Serialize [[Descriptor]] to JSON */\r\n public toJSON(): DescriptorJSON {\r\n const classesMap: { [id: string]: CompressedClassInfoJSON } = {};\r\n const selectClasses: SelectClassInfoJSON<string>[] = this.selectClasses.map((selectClass) => SelectClassInfo.toCompressedJSON(selectClass, classesMap));\r\n const fields: FieldJSON<string>[] = this.fields.map((field) => field.toCompressedJSON(classesMap));\r\n return Object.assign(\r\n {\r\n displayType: this.displayType,\r\n contentFlags: this.contentFlags,\r\n categories: this.categories.map(CategoryDescription.toJSON),\r\n fields,\r\n selectClasses,\r\n classesMap,\r\n },\r\n this.connectionId !== undefined && { connectionId: this.connectionId },\r\n this.inputKeysHash !== undefined && { inputKeysHash: this.inputKeysHash },\r\n // istanbul ignore next\r\n this.contentOptions !== undefined && { contentOptions: this.contentOptions }, // eslint-disable-line @typescript-eslint/no-deprecated\r\n this.sortingField !== undefined && { sortingFieldName: this.sortingField.name },\r\n this.sortDirection !== undefined && { sortDirection: this.sortDirection },\r\n this.filterExpression !== undefined && { filterExpression: this.filterExpression }, // eslint-disable-line @typescript-eslint/no-deprecated\r\n this.fieldsFilterExpression !== undefined && { fieldsFilterExpression: this.fieldsFilterExpression },\r\n this.instanceFilter !== undefined && { instanceFilter: this.instanceFilter },\r\n this.selectionInfo !== undefined && { selectionInfo: this.selectionInfo },\r\n this.ruleset !== undefined && { ruleset: this.ruleset },\r\n );\r\n }\r\n\r\n /** Deserialize [[Descriptor]] from JSON */\r\n public static fromJSON(json: DescriptorJSON | undefined): Descriptor | undefined {\r\n if (!json) {\r\n return undefined;\r\n }\r\n\r\n const { classesMap, ...leftOverJson } = json;\r\n const categories = CategoryDescription.listFromJSON(json.categories);\r\n const selectClasses = SelectClassInfo.listFromCompressedJSON(json.selectClasses, classesMap);\r\n const fields = this.getFieldsFromJSON(json.fields, (fieldJson) => Field.fromCompressedJSON(fieldJson, classesMap, categories));\r\n return new Descriptor({\r\n ...leftOverJson,\r\n selectClasses,\r\n categories,\r\n fields,\r\n sortingField: getFieldByName(fields, json.sortingFieldName, true),\r\n });\r\n }\r\n\r\n private static getFieldsFromJSON(json: FieldJSON[], factory: (json: FieldJSON) => Field | undefined): Field[] {\r\n return json\r\n .map((fieldJson: FieldJSON) => {\r\n const field = factory(fieldJson);\r\n if (field) {\r\n field.rebuildParentship();\r\n }\r\n return field;\r\n })\r\n .filter((field): field is Field => !!field);\r\n }\r\n\r\n /**\r\n * Get field by its name\r\n * @param name Name of the field to find\r\n * @param recurse Recurse into nested fields\r\n */\r\n public getFieldByName(name: string, recurse?: boolean): Field | undefined {\r\n return getFieldByName(this.fields, name, recurse);\r\n }\r\n\r\n /**\r\n * Get field by its descriptor.\r\n */\r\n public getFieldByDescriptor(fieldDescriptor: FieldDescriptor, recurse?: boolean): Field | undefined {\r\n return getFieldByDescriptor(this.fields, fieldDescriptor, recurse);\r\n }\r\n\r\n /**\r\n * Create descriptor overrides object from this descriptor.\r\n * @public\r\n */\r\n public createDescriptorOverrides(): DescriptorOverrides {\r\n const overrides: DescriptorOverrides = {};\r\n if (this.displayType) {\r\n overrides.displayType = this.displayType;\r\n }\r\n if (this.contentFlags !== 0) {\r\n overrides.contentFlags = this.contentFlags;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n if (this.filterExpression || this.fieldsFilterExpression) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n overrides.fieldsFilterExpression = this.fieldsFilterExpression ?? this.filterExpression;\r\n }\r\n if (this.instanceFilter) {\r\n overrides.instanceFilter = this.instanceFilter;\r\n }\r\n if (this.sortingField) {\r\n overrides.sorting = { field: this.sortingField.getFieldDescriptor(), direction: this.sortDirection ?? SortDirection.Ascending };\r\n }\r\n return overrides;\r\n }\r\n}\r\n"]}