@itwin/tree-widget-react 3.16.1 → 3.17.0

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 (120) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/lib/cjs/tree-widget-react/components/SelectableTree.js.map +1 -1
  3. package/lib/cjs/tree-widget-react/components/TreeSelector.js.map +1 -1
  4. package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
  5. package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
  6. package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
  7. package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js.map +1 -1
  8. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
  9. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -1
  10. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  11. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  12. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
  13. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  14. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +13 -0
  15. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +90 -73
  16. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  17. package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +3 -1
  18. package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +21 -8
  19. package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  20. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +21 -9
  21. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +290 -242
  22. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  23. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +2 -0
  24. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +16 -7
  25. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  26. package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js.map +1 -1
  27. package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  28. package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
  29. package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
  30. package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  31. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +1 -1
  32. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
  33. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
  34. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -2
  35. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
  36. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +3 -3
  37. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
  38. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
  39. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
  40. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
  41. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  42. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  43. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  44. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +8 -5
  45. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  46. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +2 -1
  47. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  48. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +1 -4
  49. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js +1 -4
  50. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  51. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +13 -12
  52. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +251 -278
  53. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  54. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +1 -1
  55. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
  56. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +47 -35
  57. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  58. package/lib/cjs/tree-widget-react-internal.d.ts +2 -1
  59. package/lib/cjs/tree-widget-react-internal.js +4 -1
  60. package/lib/cjs/tree-widget-react-internal.js.map +1 -1
  61. package/lib/esm/tree-widget-react/components/SelectableTree.js.map +1 -1
  62. package/lib/esm/tree-widget-react/components/TreeSelector.js.map +1 -1
  63. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
  64. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
  65. package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
  66. package/lib/esm/tree-widget-react/components/tree-header/TreeWithHeader.js.map +1 -1
  67. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
  68. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -1
  69. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  70. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  71. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
  72. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  73. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +13 -0
  74. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +90 -73
  75. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  76. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +3 -1
  77. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +22 -9
  78. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  79. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +21 -9
  80. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +290 -242
  81. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  82. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +2 -0
  83. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +16 -7
  84. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  85. package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +1 -1
  86. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  87. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
  88. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
  89. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  90. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +1 -1
  91. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
  92. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
  93. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -2
  94. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
  95. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +3 -3
  96. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
  97. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
  98. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
  99. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
  100. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  101. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  102. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  103. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +9 -6
  104. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  105. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +2 -1
  106. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  107. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +1 -4
  108. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +1 -4
  109. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  110. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +13 -12
  111. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +252 -279
  112. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  113. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +1 -1
  114. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
  115. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +47 -35
  116. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  117. package/lib/esm/tree-widget-react-internal.d.ts +2 -1
  118. package/lib/esm/tree-widget-react-internal.js +2 -1
  119. package/lib/esm/tree-widget-react-internal.js.map +1 -1
  120. package/package.json +1 -1
@@ -8,7 +8,6 @@ exports.ModelsTreeIdsCache = void 0;
8
8
  const rxjs_1 = require("rxjs");
9
9
  const core_bentley_1 = require("@itwin/core-bentley");
10
10
  const core_common_1 = require("@itwin/core-common");
11
- const Rxjs_js_1 = require("../../common/Rxjs.js");
12
11
  const Utils_js_1 = require("../../common/Utils.js");
13
12
  /** @internal */
14
13
  class ModelsTreeIdsCache {
@@ -27,7 +26,7 @@ class ModelsTreeIdsCache {
27
26
  constructor(queryExecutor, hierarchyConfig, componentId) {
28
27
  this.#hierarchyConfig = hierarchyConfig;
29
28
  this.#queryExecutor = queryExecutor;
30
- this.#categoryElementCounts = new ModelCategoryElementsCountCache(async (input) => this.queryCategoryElementCounts(input));
29
+ this.#categoryElementCounts = new ModelCategoryElementsCountCache((input) => this.queryCategoryElementCounts(input));
31
30
  this.#modelKeyPaths = new Map();
32
31
  this.#subjectKeyPaths = new Map();
33
32
  this.#categoryKeyPaths = new Map();
@@ -37,78 +36,77 @@ class ModelsTreeIdsCache {
37
36
  [Symbol.dispose]() {
38
37
  this.#categoryElementCounts[Symbol.dispose]();
39
38
  }
40
- async *querySubjects() {
41
- const subjectsQuery = `
42
- SELECT
43
- s.ECInstanceId id,
44
- s.Parent.Id parentId,
45
- (
46
- SELECT m.ECInstanceId
47
- FROM bis.GeometricModel3d m
48
- WHERE m.ECInstanceId = HexToId(json_extract(s.JsonProperties, '$.Subject.Model.TargetPartition'))
49
- AND NOT m.IsPrivate
50
- AND EXISTS (SELECT 1 FROM ${this.#hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)
51
- ) targetPartitionId,
52
- CASE
53
- WHEN (
54
- json_extract(s.JsonProperties, '$.Subject.Job.Bridge') IS NOT NULL
55
- OR json_extract(s.JsonProperties, '$.Subject.Model.Type') = 'Hierarchy'
56
- ) THEN 1
57
- ELSE 0
58
- END hideInHierarchy
59
- FROM bis.Subject s
60
- `;
61
- for await (const row of this.#queryExecutor.createQueryReader({ ecsql: subjectsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/subjects` })) {
62
- yield { id: row.id, parentId: row.parentId, targetPartitionId: row.targetPartitionId, hideInHierarchy: !!row.hideInHierarchy };
63
- }
39
+ querySubjects() {
40
+ return (0, rxjs_1.defer)(() => {
41
+ const subjectsQuery = `
42
+ SELECT
43
+ s.ECInstanceId id,
44
+ s.Parent.Id parentId,
45
+ (
46
+ SELECT m.ECInstanceId
47
+ FROM bis.GeometricModel3d m
48
+ WHERE m.ECInstanceId = HexToId(json_extract(s.JsonProperties, '$.Subject.Model.TargetPartition'))
49
+ AND NOT m.IsPrivate
50
+ AND EXISTS (SELECT 1 FROM ${this.#hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)
51
+ ) targetPartitionId,
52
+ CASE
53
+ WHEN (
54
+ json_extract(s.JsonProperties, '$.Subject.Job.Bridge') IS NOT NULL
55
+ OR json_extract(s.JsonProperties, '$.Subject.Model.Type') = 'Hierarchy'
56
+ ) THEN 1
57
+ ELSE 0
58
+ END hideInHierarchy
59
+ FROM bis.Subject s
60
+ `;
61
+ return this.#queryExecutor.createQueryReader({ ecsql: subjectsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/subjects` });
62
+ }).pipe((0, rxjs_1.map)((row) => {
63
+ return { id: row.id, parentId: row.parentId, targetPartitionId: row.targetPartitionId, hideInHierarchy: !!row.hideInHierarchy };
64
+ }));
64
65
  }
65
- async *queryModels() {
66
- const modelsQuery = `
66
+ queryModels() {
67
+ return (0, rxjs_1.defer)(() => {
68
+ const modelsQuery = `
67
69
  SELECT p.ECInstanceId id, p.Parent.Id parentId
68
- FROM bis.InformationPartitionElement p
69
- INNER JOIN bis.GeometricModel3d m ON m.ModeledElement.Id = p.ECInstanceId
70
- WHERE
71
- NOT m.IsPrivate
72
- ${this.#hierarchyConfig.showEmptyModels ? "" : `AND EXISTS (SELECT 1 FROM ${this.#hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)`}
73
- `;
74
- for await (const row of this.#queryExecutor.createQueryReader({ ecsql: modelsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/models` })) {
75
- yield { id: row.id, parentId: row.parentId };
76
- }
70
+ FROM bis.InformationPartitionElement p
71
+ INNER JOIN bis.GeometricModel3d m ON m.ModeledElement.Id = p.ECInstanceId
72
+ WHERE
73
+ NOT m.IsPrivate
74
+ ${this.#hierarchyConfig.showEmptyModels ? "" : `AND EXISTS (SELECT 1 FROM ${this.#hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)`}
75
+ `;
76
+ return this.#queryExecutor.createQueryReader({ ecsql: modelsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/models` });
77
+ }).pipe((0, rxjs_1.map)((row) => {
78
+ return { id: row.id, parentId: row.parentId };
79
+ }));
77
80
  }
78
- async getSubjectInfos() {
79
- this.#subjectInfos ??= (async () => {
80
- const [subjectInfos, targetPartitionSubjects] = await Promise.all([
81
- (async () => {
82
- const result = new Map();
83
- for await (const subject of this.querySubjects()) {
84
- const subjectInfo = {
85
- parentSubject: subject.parentId,
86
- hideInHierarchy: subject.hideInHierarchy,
87
- childSubjects: new Set(),
88
- childModels: new Set(),
89
- };
90
- if (subject.targetPartitionId) {
91
- subjectInfo.childModels.add(subject.targetPartitionId);
92
- }
93
- result.set(subject.id, subjectInfo);
94
- }
95
- return result;
96
- })(),
97
- (async () => {
98
- const result = new Map();
99
- for await (const model of this.queryModels()) {
100
- (0, Utils_js_1.pushToMap)(result, model.id, model.parentId);
81
+ getSubjectInfos() {
82
+ this.#subjectInfos ??= (0, rxjs_1.forkJoin)({
83
+ subjectInfos: this.querySubjects().pipe((0, rxjs_1.reduce)((acc, subject) => {
84
+ const subjectInfo = {
85
+ parentSubject: subject.parentId,
86
+ hideInHierarchy: subject.hideInHierarchy,
87
+ childSubjects: new Set(),
88
+ childModels: new Set(),
89
+ };
90
+ if (subject.targetPartitionId) {
91
+ subjectInfo.childModels.add(subject.targetPartitionId);
92
+ }
93
+ acc.set(subject.id, subjectInfo);
94
+ return acc;
95
+ }, new Map()), (0, rxjs_1.map)((subjectInfos) => {
96
+ for (const [subjectId, { parentSubject: parentSubjectId }] of subjectInfos.entries()) {
97
+ if (parentSubjectId) {
98
+ const parentSubjectInfo = subjectInfos.get(parentSubjectId);
99
+ (0, core_bentley_1.assert)(!!parentSubjectInfo);
100
+ parentSubjectInfo.childSubjects.add(subjectId);
101
101
  }
102
- return result;
103
- })(),
104
- ]);
105
- for (const [subjectId, { parentSubject: parentSubjectId }] of subjectInfos.entries()) {
106
- if (parentSubjectId) {
107
- const parentSubjectInfo = subjectInfos.get(parentSubjectId);
108
- (0, core_bentley_1.assert)(!!parentSubjectInfo);
109
- parentSubjectInfo.childSubjects.add(subjectId);
110
102
  }
111
- }
103
+ return subjectInfos;
104
+ })),
105
+ targetPartitionSubjects: this.queryModels().pipe((0, rxjs_1.reduce)((acc, model) => {
106
+ (0, Utils_js_1.pushToMap)(acc, model.id, model.parentId);
107
+ return acc;
108
+ }, new Map())),
109
+ }).pipe((0, rxjs_1.map)(({ subjectInfos, targetPartitionSubjects }) => {
112
110
  for (const [partitionId, subjectIds] of targetPartitionSubjects) {
113
111
  subjectIds.forEach((subjectId) => {
114
112
  const subjectInfo = subjectInfos.get(subjectId);
@@ -117,13 +115,12 @@ class ModelsTreeIdsCache {
117
115
  });
118
116
  }
119
117
  return subjectInfos;
120
- })();
118
+ }), (0, rxjs_1.shareReplay)());
121
119
  return this.#subjectInfos;
122
120
  }
123
121
  /** Returns ECInstanceIDs of Subjects that either have direct Model or at least one child Subject with a Model. */
124
- async getParentSubjectIds() {
125
- this.#parentSubjectIds ??= (async () => {
126
- const subjectInfos = await this.getSubjectInfos();
122
+ getParentSubjectIds() {
123
+ this.#parentSubjectIds ??= this.getSubjectInfos().pipe((0, rxjs_1.map)((subjectInfos) => {
127
124
  const parentSubjectIds = new Set();
128
125
  subjectInfos.forEach((subjectInfo, subjectId) => {
129
126
  if (subjectInfo.childModels.size > 0) {
@@ -136,71 +133,73 @@ class ModelsTreeIdsCache {
136
133
  }
137
134
  });
138
135
  return [...parentSubjectIds];
139
- })();
136
+ }), (0, rxjs_1.shareReplay)());
140
137
  return this.#parentSubjectIds;
141
138
  }
142
139
  /**
143
140
  * Returns child subjects of the specified parent subjects as they're displayed in the hierarchy - taking into
144
141
  * account `hideInHierarchy` flag.
145
142
  */
146
- async getChildSubjectIds(parentSubjectIds) {
147
- const childSubjectIds = new Array();
148
- const subjectInfos = await this.getSubjectInfos();
149
- parentSubjectIds.forEach((subjectId) => {
150
- forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
151
- if (!childSubjectInfo.hideInHierarchy) {
152
- childSubjectIds.push(childSubjectId);
153
- return "break";
154
- }
155
- return "continue";
143
+ getChildSubjectIds(parentSubjectIds) {
144
+ return this.getSubjectInfos().pipe((0, rxjs_1.map)((subjectInfos) => {
145
+ const childSubjectIds = new Array();
146
+ parentSubjectIds.forEach((subjectId) => {
147
+ forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
148
+ if (!childSubjectInfo.hideInHierarchy) {
149
+ childSubjectIds.push(childSubjectId);
150
+ return "break";
151
+ }
152
+ return "continue";
153
+ });
156
154
  });
157
- });
158
- return childSubjectIds;
155
+ return childSubjectIds;
156
+ }));
159
157
  }
160
158
  /** Returns ECInstanceIDs of all Models under specific parent Subjects, including their child Subjects, etc. */
161
- async getSubjectModelIds(subjectIds) {
162
- const subjectInfos = await this.getSubjectInfos();
163
- const subjectStack = [...subjectIds];
164
- const result = new Array();
165
- while (true) {
166
- const subjectId = subjectStack.pop();
167
- if (subjectId === undefined) {
168
- break;
169
- }
170
- const subjectInfo = subjectInfos.get(subjectId);
171
- if (!subjectInfo) {
172
- continue;
159
+ getSubjectModelIds(subjectIds) {
160
+ return this.getSubjectInfos().pipe((0, rxjs_1.map)((subjectInfos) => {
161
+ const subjectStack = [...subjectIds];
162
+ const result = new Array();
163
+ while (true) {
164
+ const subjectId = subjectStack.pop();
165
+ if (subjectId === undefined) {
166
+ break;
167
+ }
168
+ const subjectInfo = subjectInfos.get(subjectId);
169
+ if (!subjectInfo) {
170
+ continue;
171
+ }
172
+ result.push(...subjectInfo.childModels);
173
+ subjectStack.push(...subjectInfo.childSubjects);
173
174
  }
174
- result.push(...subjectInfo.childModels);
175
- subjectStack.push(...subjectInfo.childSubjects);
176
- }
177
- return result;
175
+ return result;
176
+ }));
178
177
  }
179
178
  /** Returns ECInstanceIDs of Models under specific parent Subjects as they are displayed in the hierarchy. */
180
- async getChildSubjectModelIds(parentSubjectIds) {
181
- const subjectInfos = await this.getSubjectInfos();
182
- const hiddenSubjectIds = new Array();
183
- parentSubjectIds.forEach((subjectId) => {
184
- forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
185
- if (childSubjectInfo.hideInHierarchy) {
186
- hiddenSubjectIds.push(childSubjectId);
187
- return "continue";
188
- }
189
- return "break";
179
+ getChildSubjectModelIds(parentSubjectIds) {
180
+ return this.getSubjectInfos().pipe((0, rxjs_1.map)((subjectInfos) => {
181
+ const hiddenSubjectIds = new Array();
182
+ parentSubjectIds.forEach((subjectId) => {
183
+ forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
184
+ if (childSubjectInfo.hideInHierarchy) {
185
+ hiddenSubjectIds.push(childSubjectId);
186
+ return "continue";
187
+ }
188
+ return "break";
189
+ });
190
190
  });
191
- });
192
- const modelIds = new Array();
193
- [...parentSubjectIds, ...hiddenSubjectIds].forEach((subjectId) => {
194
- const subjectInfo = subjectInfos.get(subjectId);
195
- subjectInfo && modelIds.push(...subjectInfo.childModels);
196
- });
197
- return modelIds;
191
+ const modelIds = new Array();
192
+ [...parentSubjectIds, ...hiddenSubjectIds].forEach((subjectId) => {
193
+ const subjectInfo = subjectInfos.get(subjectId);
194
+ subjectInfo && modelIds.push(...subjectInfo.childModels);
195
+ });
196
+ return modelIds;
197
+ }));
198
198
  }
199
- async createSubjectInstanceKeysPath(targetSubjectId) {
199
+ createSubjectInstanceKeysPath(targetSubjectId) {
200
200
  let entry = this.#subjectKeyPaths.get(targetSubjectId);
201
201
  if (!entry) {
202
- entry = (async () => {
203
- const subjectInfos = await this.getSubjectInfos();
202
+ entry = this.getSubjectInfos().pipe((0, rxjs_1.map)((subjectInfos) => {
204
203
  const result = new Array();
205
204
  let currParentId = targetSubjectId;
206
205
  while (currParentId) {
@@ -214,128 +213,111 @@ class ModelsTreeIdsCache {
214
213
  currParentId = parentInfo?.parentSubject;
215
214
  }
216
215
  return result.reverse();
217
- })();
216
+ }), (0, rxjs_1.shareReplay)());
218
217
  this.#subjectKeyPaths.set(targetSubjectId, entry);
219
218
  }
220
219
  return entry;
221
220
  }
222
- async *queryModelCategories() {
223
- const query = `
224
- SELECT
225
- this.Model.Id modelId,
226
- this.Category.Id categoryId,
227
- m.IsPrivate isModelPrivate,
228
- MAX(IIF(this.Parent.Id IS NULL, 1, 0)) isRootElementCategory
229
- FROM BisCore.Model m
230
- JOIN ${this.#hierarchyConfig.elementClassSpecification} this ON m.ECInstanceId = this.Model.Id
231
- GROUP BY modelId, categoryId, isModelPrivate
232
- `;
233
- for await (const row of this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/model-categories` })) {
234
- yield { modelId: row.modelId, categoryId: row.categoryId, isModelPrivate: !!row.isModelPrivate, isRootElementCategory: !!row.isRootElementCategory };
235
- }
221
+ queryModelCategories() {
222
+ return (0, rxjs_1.defer)(() => {
223
+ const query = `
224
+ SELECT
225
+ this.Model.Id modelId,
226
+ this.Category.Id categoryId,
227
+ m.IsPrivate isModelPrivate,
228
+ MAX(IIF(this.Parent.Id IS NULL, 1, 0)) isRootElementCategory
229
+ FROM BisCore.Model m
230
+ JOIN ${this.#hierarchyConfig.elementClassSpecification} this ON m.ECInstanceId = this.Model.Id
231
+ GROUP BY modelId, categoryId, isModelPrivate
232
+ `;
233
+ return this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/model-categories` });
234
+ }).pipe((0, rxjs_1.map)((row) => {
235
+ return { modelId: row.modelId, categoryId: row.categoryId, isModelPrivate: !!row.isModelPrivate, isRootElementCategory: !!row.isRootElementCategory };
236
+ }));
236
237
  }
237
- async *queryModeledElements() {
238
- const query = `
239
- SELECT
240
- pe.ECInstanceId modeledElementId,
241
- pe.Category.Id categoryId,
242
- pe.Model.Id modelId
243
- FROM BisCore.Model m
244
- JOIN ${this.#hierarchyConfig.elementClassSpecification} pe ON pe.ECInstanceId = m.ModeledElement.Id
245
- WHERE
246
- m.IsPrivate = false
247
- AND m.ECInstanceId IN (SELECT Model.Id FROM ${this.#hierarchyConfig.elementClassSpecification})
248
- `;
249
- for await (const row of this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/modeled-elements` })) {
250
- yield { modelId: row.modelId, categoryId: row.categoryId, modeledElementId: row.modeledElementId };
251
- }
238
+ queryModeledElements() {
239
+ return (0, rxjs_1.defer)(() => {
240
+ const query = `
241
+ SELECT
242
+ pe.ECInstanceId modeledElementId,
243
+ pe.Category.Id categoryId,
244
+ pe.Model.Id modelId
245
+ FROM BisCore.Model m
246
+ JOIN ${this.#hierarchyConfig.elementClassSpecification} pe ON pe.ECInstanceId = m.ModeledElement.Id
247
+ WHERE
248
+ m.IsPrivate = false
249
+ AND m.ECInstanceId IN (SELECT Model.Id FROM ${this.#hierarchyConfig.elementClassSpecification})
250
+ `;
251
+ return this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/modeled-elements` });
252
+ }).pipe((0, rxjs_1.map)((row) => {
253
+ return { modelId: row.modelId, categoryId: row.categoryId, modeledElementId: row.modeledElementId };
254
+ }));
252
255
  }
253
- async getModelWithCategoryModeledElements() {
254
- this.#modelWithCategoryModeledElements ??= (async () => {
255
- const modelWithCategoryModeledElements = new Map();
256
- for await (const { modelId, categoryId, modeledElementId } of this.queryModeledElements()) {
257
- const key = `${modelId}-${categoryId}`;
258
- const entry = modelWithCategoryModeledElements.get(key);
259
- if (entry === undefined) {
260
- modelWithCategoryModeledElements.set(key, new Set([modeledElementId]));
261
- }
262
- else {
263
- entry.add(modeledElementId);
264
- }
256
+ getModelWithCategoryModeledElements() {
257
+ this.#modelWithCategoryModeledElements ??= this.queryModeledElements().pipe((0, rxjs_1.reduce)((acc, { modelId, categoryId, modeledElementId }) => {
258
+ const key = `${modelId}-${categoryId}`;
259
+ const entry = acc.get(key);
260
+ if (entry === undefined) {
261
+ acc.set(key, new Set([modeledElementId]));
262
+ }
263
+ else {
264
+ entry.add(modeledElementId);
265
265
  }
266
- return modelWithCategoryModeledElements;
267
- })();
266
+ return acc;
267
+ }, new Map()), (0, rxjs_1.shareReplay)());
268
268
  return this.#modelWithCategoryModeledElements;
269
269
  }
270
- async getModelInfos() {
271
- this.#modelInfos ??= (async () => {
272
- const modelInfos = new Map();
273
- for await (const { modelId, categoryId, isModelPrivate, isRootElementCategory } of this.queryModelCategories()) {
274
- const entry = modelInfos.get(modelId);
275
- if (entry) {
276
- entry.categories.set(categoryId, { isRootElementCategory });
277
- entry.isModelPrivate = isModelPrivate;
278
- }
279
- else {
280
- modelInfos.set(modelId, { categories: new Map([[categoryId, { isRootElementCategory }]]), isModelPrivate });
281
- }
270
+ getModelInfos() {
271
+ this.#modelInfos ??= this.queryModelCategories().pipe((0, rxjs_1.reduce)((acc, { modelId, categoryId, isModelPrivate, isRootElementCategory }) => {
272
+ const entry = acc.get(modelId);
273
+ if (entry) {
274
+ entry.categories.set(categoryId, { isRootElementCategory });
275
+ entry.isModelPrivate = isModelPrivate;
276
+ }
277
+ else {
278
+ acc.set(modelId, { categories: new Map([[categoryId, { isRootElementCategory }]]), isModelPrivate });
282
279
  }
283
- return modelInfos;
284
- })();
280
+ return acc;
281
+ }, new Map()), (0, rxjs_1.shareReplay)());
285
282
  return this.#modelInfos;
286
283
  }
287
- async getAllCategories() {
288
- const modelInfos = await this.getModelInfos();
289
- const result = new Set();
290
- modelInfos.forEach(({ categories }) => {
291
- categories.forEach((_, categoryId) => result.add(categoryId));
292
- });
293
- return result;
284
+ getAllCategories() {
285
+ return this.getModelInfos().pipe((0, rxjs_1.mergeMap)((modelInfos) => modelInfos.values()), (0, rxjs_1.mergeMap)(({ categories }) => categories.keys()), (0, rxjs_1.reduce)((acc, categoryId) => {
286
+ acc.add(categoryId);
287
+ return acc;
288
+ }, new Set()));
294
289
  }
295
- async getModelCategories(modelId) {
296
- const modelInfos = await this.getModelInfos();
297
- const categories = modelInfos.get(modelId)?.categories.keys();
298
- return categories ? [...categories] : [];
290
+ getModelCategories(modelId) {
291
+ return this.getModelInfos().pipe((0, rxjs_1.mergeMap)((modelInfos) => modelInfos.get(modelId)?.categories.keys() ?? []), (0, rxjs_1.toArray)());
299
292
  }
300
- async hasSubModel(elementId) {
301
- const modelInfos = await this.getModelInfos();
302
- const modeledElementInfo = modelInfos.get(elementId);
303
- if (!modeledElementInfo) {
304
- return false;
305
- }
306
- return !modeledElementInfo.isModelPrivate;
293
+ hasSubModel(elementId) {
294
+ return this.getModelInfos().pipe((0, rxjs_1.map)((modelInfos) => {
295
+ const modeledElementInfo = modelInfos.get(elementId);
296
+ if (!modeledElementInfo) {
297
+ return false;
298
+ }
299
+ return !modeledElementInfo.isModelPrivate;
300
+ }));
307
301
  }
308
- async getCategoriesModeledElements(modelId, categoryIds) {
309
- const modelWithCategoryModeledElements = await this.getModelWithCategoryModeledElements();
310
- const result = new Array();
311
- for (const categoryId of core_bentley_1.Id64.iterable(categoryIds)) {
302
+ getCategoriesModeledElements(modelId, categoryIds) {
303
+ return this.getModelWithCategoryModeledElements().pipe((0, rxjs_1.mergeMap)((modelWithCategoryModeledElements) => (0, rxjs_1.from)(core_bentley_1.Id64.iterable(categoryIds)).pipe((0, rxjs_1.reduce)((acc, categoryId) => {
312
304
  const entry = modelWithCategoryModeledElements.get(`${modelId}-${categoryId}`);
313
305
  if (entry !== undefined) {
314
- result.push(...entry);
306
+ acc.push(...entry);
315
307
  }
316
- }
317
- return result;
308
+ return acc;
309
+ }, new Array()))));
318
310
  }
319
- async createModelInstanceKeyPaths(modelId) {
311
+ createModelInstanceKeyPaths(modelId) {
320
312
  let entry = this.#modelKeyPaths.get(modelId);
321
313
  if (!entry) {
322
- entry = (async () => {
323
- const result = new Array();
324
- const subjectInfos = (await this.getSubjectInfos()).entries();
325
- for (const [modelSubjectId, subjectInfo] of subjectInfos) {
326
- if (subjectInfo.childModels.has(modelId)) {
327
- const subjectPath = await this.createSubjectInstanceKeysPath(modelSubjectId);
328
- result.push([...subjectPath, { className: "BisCore.GeometricModel3d", id: modelId }]);
329
- }
330
- }
331
- return result;
332
- })();
314
+ entry = this.getSubjectInfos().pipe((0, rxjs_1.mergeMap)((subjectInfos) => subjectInfos.entries()), (0, rxjs_1.filter)(([_, subjectInfo]) => subjectInfo.childModels.has(modelId)), (0, rxjs_1.mergeMap)(([modelSubjectId]) => this.createSubjectInstanceKeysPath(modelSubjectId).pipe((0, rxjs_1.map)((path) => [...path, { className: "BisCore.GeometricModel3d", id: modelId }]))), (0, rxjs_1.toArray)(), (0, rxjs_1.shareReplay)());
333
315
  this.#modelKeyPaths.set(modelId, entry);
334
316
  }
335
317
  return entry;
336
318
  }
337
- async queryCategoryElementCounts(input) {
338
- return (0, Rxjs_js_1.collect)((0, rxjs_1.from)(input).pipe((0, rxjs_1.reduce)((acc, { modelId, categoryId }) => {
319
+ queryCategoryElementCounts(input) {
320
+ return (0, rxjs_1.from)(input).pipe((0, rxjs_1.reduce)((acc, { modelId, categoryId }) => {
339
321
  const entry = acc.get(modelId);
340
322
  if (!entry) {
341
323
  acc.set(modelId, new Set([categoryId]));
@@ -347,73 +329,64 @@ class ModelsTreeIdsCache {
347
329
  }, new Map()), (0, rxjs_1.mergeMap)((modelCategoryMap) => modelCategoryMap.entries()), (0, rxjs_1.map)(([modelId, categoryIds]) => `Model.Id = ${modelId} AND Category.Id IN (${[...categoryIds].join(", ")})`),
348
330
  // we may have thousands of where clauses here, and sending a single query with all of them could take a
349
331
  // long time - instead, split it into smaller chunks
350
- (0, rxjs_1.bufferCount)(100), (0, rxjs_1.mergeMap)(async (whereClauses) => {
351
- const reader = this.#queryExecutor.createQueryReader({
352
- ctes: [
353
- `
354
- CategoryElements(id, modelId, categoryId) AS (
355
- SELECT ECInstanceId, Model.Id, Category.Id
356
- FROM ${this.#hierarchyConfig.elementClassSpecification}
357
- WHERE
358
- Parent.Id IS NULL
359
- AND (
360
- ${whereClauses.join(" OR ")}
361
- )
332
+ (0, rxjs_1.bufferCount)(100), (0, rxjs_1.mergeMap)((whereClauses) => (0, rxjs_1.defer)(() => this.#queryExecutor.createQueryReader({
333
+ ctes: [
334
+ `
335
+ CategoryElements(id, modelId, categoryId) AS (
336
+ SELECT ECInstanceId, Model.Id, Category.Id
337
+ FROM ${this.#hierarchyConfig.elementClassSpecification}
338
+ WHERE
339
+ Parent.Id IS NULL
340
+ AND (
341
+ ${whereClauses.join(" OR ")}
342
+ )
362
343
 
363
- UNION ALL
344
+ UNION ALL
364
345
 
365
- SELECT c.ECInstanceId, p.modelId, p.categoryId
366
- FROM ${this.#hierarchyConfig.elementClassSpecification} c
367
- JOIN CategoryElements p ON c.Parent.Id = p.id
368
- )
346
+ SELECT c.ECInstanceId, p.modelId, p.categoryId
347
+ FROM ${this.#hierarchyConfig.elementClassSpecification} c
348
+ JOIN CategoryElements p ON c.Parent.Id = p.id
349
+ )
350
+ `,
351
+ ],
352
+ ecsql: `
353
+ SELECT modelId, categoryId, COUNT(id) elementsCount
354
+ FROM CategoryElements
355
+ GROUP BY modelId, categoryId
369
356
  `,
370
- ],
371
- ecsql: `
372
- SELECT modelId, categoryId, COUNT(id) elementsCount
373
- FROM CategoryElements
374
- GROUP BY modelId, categoryId
375
- `,
376
- }, {
377
- rowFormat: "ECSqlPropertyNames",
378
- limit: "unbounded",
379
- restartToken: `${this.#componentName}/${this.#componentId}/category-element-counts/${core_bentley_1.Guid.createValue()}`,
357
+ }, {
358
+ rowFormat: "ECSqlPropertyNames",
359
+ limit: "unbounded",
360
+ restartToken: `${this.#componentName}/${this.#componentId}/category-element-counts/${core_bentley_1.Guid.createValue()}`,
361
+ }))), (0, rxjs_1.reduce)(({ acc, createKey }, row) => {
362
+ acc.set(createKey({ modelId: row.modelId, categoryId: row.categoryId }), {
363
+ modelId: row.modelId,
364
+ categoryId: row.categoryId,
365
+ elementsCount: row.elementsCount,
380
366
  });
381
- const result = new Array();
382
- for await (const row of reader) {
383
- result.push({ modelId: row.modelId, categoryId: row.categoryId, elementsCount: row.elementsCount });
384
- }
367
+ return { acc, createKey };
368
+ }, {
369
+ acc: new Map(),
370
+ createKey: (keyProps) => `${keyProps.modelId}-${keyProps.categoryId}`,
371
+ }), (0, rxjs_1.mergeMap)(({ acc: result, createKey }) => {
385
372
  input.forEach(({ modelId, categoryId }) => {
386
- if (!result.some((queriedResult) => queriedResult.categoryId === categoryId && queriedResult.modelId === modelId)) {
387
- result.push({ categoryId, modelId, elementsCount: 0 });
373
+ if (!result.has(createKey({ modelId, categoryId }))) {
374
+ result.set(createKey({ modelId, categoryId }), { categoryId, modelId, elementsCount: 0 });
388
375
  }
389
376
  });
390
- return result;
391
- }), (0, rxjs_1.mergeAll)()));
377
+ return (0, rxjs_1.from)(result.values());
378
+ }), (0, rxjs_1.toArray)());
392
379
  }
393
- async getCategoryElementsCount(modelId, categoryId) {
380
+ getCategoryElementsCount(modelId, categoryId) {
394
381
  return this.#categoryElementCounts.getCategoryElementsCount(modelId, categoryId);
395
382
  }
396
- async createCategoryInstanceKeyPaths(categoryId) {
383
+ createCategoryInstanceKeyPaths(categoryId) {
397
384
  let entry = this.#categoryKeyPaths.get(categoryId);
398
385
  if (!entry) {
399
- entry = (async () => {
400
- const result = new Set();
401
- const modelInfos = await this.getModelInfos();
402
- modelInfos?.forEach((modelInfo, modelId) => {
403
- const categoryEntry = modelInfo.categories.get(categoryId);
404
- if (categoryEntry?.isRootElementCategory) {
405
- result.add(modelId);
406
- }
407
- });
408
- const categoryPaths = new Array();
409
- for (const categoryModelId of [...result]) {
410
- const modelPaths = await this.createModelInstanceKeyPaths(categoryModelId);
411
- for (const modelPath of modelPaths) {
412
- categoryPaths.push([...modelPath, { className: "BisCore.SpatialCategory", id: categoryId }]);
413
- }
414
- }
415
- return categoryPaths;
416
- })();
386
+ entry = this.getModelInfos().pipe((0, rxjs_1.mergeMap)((modelInfos) => modelInfos.entries()), (0, rxjs_1.filter)(([_, modelInfo]) => !!modelInfo.categories.get(categoryId)?.isRootElementCategory), (0, rxjs_1.mergeMap)(([categoryModelId]) => this.createModelInstanceKeyPaths(categoryModelId)), (0, rxjs_1.mergeMap)((modelPaths) => modelPaths), (0, rxjs_1.reduce)((acc, modelPath) => {
387
+ acc.push([...modelPath, { className: "BisCore.SpatialCategory", id: categoryId }]);
388
+ return acc;
389
+ }, new Array()), (0, rxjs_1.shareReplay)());
417
390
  this.#categoryKeyPaths.set(categoryId, entry);
418
391
  }
419
392
  return entry;
@@ -437,7 +410,7 @@ class ModelCategoryElementsCountCache {
437
410
  #subscription;
438
411
  constructor(loader) {
439
412
  this.#subscription = this.#requestsStream
440
- .pipe((0, rxjs_1.bufferTime)(20), (0, rxjs_1.filter)((requests) => requests.length > 0), (0, rxjs_1.mergeMap)(async (requests) => loader(requests)), (0, rxjs_1.mergeAll)())
413
+ .pipe((0, rxjs_1.bufferTime)(20), (0, rxjs_1.filter)((requests) => requests.length > 0), (0, rxjs_1.mergeMap)((requests) => loader(requests)), (0, rxjs_1.mergeAll)())
441
414
  .subscribe({
442
415
  next: ({ modelId, categoryId, elementsCount }) => {
443
416
  const subject = this.#cache.get(`${modelId}${categoryId}`);
@@ -449,16 +422,16 @@ class ModelCategoryElementsCountCache {
449
422
  [Symbol.dispose]() {
450
423
  this.#subscription.unsubscribe();
451
424
  }
452
- async getCategoryElementsCount(modelId, categoryId) {
425
+ getCategoryElementsCount(modelId, categoryId) {
453
426
  const cacheKey = `${modelId}${categoryId}`;
454
427
  let result = this.#cache.get(cacheKey);
455
428
  if (result !== undefined) {
456
- return (0, rxjs_1.firstValueFrom)(result);
429
+ return (0, rxjs_1.from)(result).pipe((0, rxjs_1.take)(1));
457
430
  }
458
431
  result = new rxjs_1.ReplaySubject(1);
459
432
  this.#cache.set(cacheKey, result);
460
433
  this.#requestsStream.next({ modelId, categoryId });
461
- return (0, rxjs_1.firstValueFrom)(result);
434
+ return (0, rxjs_1.from)(result).pipe((0, rxjs_1.take)(1));
462
435
  }
463
436
  }
464
437
  //# sourceMappingURL=ModelsTreeIdsCache.js.map