@cognite/reveal-components 1.0.0 → 1.0.2

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/poi-markers/poi-create-cursor.js +4 -0
  3. package/dist/common/i18n/en/reveal-components.js +183 -178
  4. package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
  5. package/dist/data-providers/FdmSDK.d.ts +8 -0
  6. package/dist/data-providers/FdmSDK.js +34 -21
  7. package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
  8. package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
  9. package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
  10. package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
  11. package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
  12. package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
  13. package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
  14. package/dist/data-providers/cache/annotationModelUtils.js +8 -6
  15. package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
  16. package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +9 -6
  17. package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
  18. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
  19. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
  20. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
  21. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
  22. package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
  23. package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
  24. package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
  25. package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
  26. package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
  27. package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
  28. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
  29. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
  30. package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
  31. package/dist/data-providers/index.d.ts +2 -1
  32. package/dist/data-providers/index.js +2 -0
  33. package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
  34. package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
  35. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
  36. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
  37. package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
  38. package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
  39. package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
  40. package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
  41. package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
  42. package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
  43. package/dist/domains/index.d.ts +4 -2
  44. package/dist/domains/index.js +3 -1
  45. package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
  46. package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
  47. package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
  48. package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
  49. package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
  50. package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
  51. package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
  52. package/dist/foundation/renderTarget/CdfCaches.js +24 -14
  53. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
  54. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
  55. package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
  56. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
  57. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
  58. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +2 -5
  59. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
  60. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
  61. package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
  62. package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
  63. package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
  64. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
  65. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
  66. package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
  67. package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
  68. package/dist/ui/components/RevealContext/RevealContext.js +6 -6
  69. package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
  70. package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
  71. package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
  72. package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
  73. package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
  74. package/dist/ui/components/Widget/RevealWidget.js +35 -20
  75. package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
  76. package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
  77. package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
  78. package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
  79. package/dist/ui/components/Widget/index.d.ts +1 -1
  80. package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
  81. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
  82. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
  83. package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
  84. package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
  85. package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
  86. package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
  87. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
  88. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
  89. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
  90. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
  91. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
  92. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
  93. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
  94. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
  95. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +27 -13
  96. package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
  97. package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
  98. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
  99. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
  100. package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
  101. package/dist/ui/components/i18n/I18n.js +3 -3
  102. package/dist/ui/components/index.d.ts +1 -1
  103. package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
  104. package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
  105. package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
  106. package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
  107. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
  108. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
  109. package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
  110. package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
  111. package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
  112. package/dist/ui/query/index.d.ts +1 -0
  113. package/dist/ui/query/index.js +17 -16
  114. package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
  115. package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
  116. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
  117. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
  118. package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
  119. package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
  120. package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
  121. package/dist/ui/query/useCadNode3DInfo.js +24 -0
  122. package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
  123. package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
  124. package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
  125. package/dist/ui/query/useInstanceNames.d.ts +11 -0
  126. package/dist/ui/query/useInstanceNames.js +17 -0
  127. package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
  128. package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
  129. package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
  130. package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
  131. package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
  132. package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
  133. package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
  134. package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
  135. package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
  136. package/dist/utilities/externalIndex.d.ts +2 -0
  137. package/dist/utilities/externalIndex.js +3 -1
  138. package/dist/utilities/getInstancesFromClick.js +9 -9
  139. package/dist/utilities/index.d.ts +2 -1
  140. package/dist/utilities/index.js +12 -9
  141. package/dist/utilities/queryKeys.d.ts +2 -0
  142. package/dist/utilities/queryKeys.js +7 -0
  143. package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
  144. package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
  145. package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
  146. package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
  147. package/dist/utilities/usageMetricsTracker.d.ts +4 -0
  148. package/dist/utilities/usageMetricsTracker.js +4 -0
  149. package/package.json +7 -3
  150. package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
  151. package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
  152. package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
  153. package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
@@ -1,5 +1,5 @@
1
- import { createDmsQueryDataAccumulator as e } from "../../../utilities/dms-cursoring/dmsAccumulator.js";
2
- import { queryKeys as t } from "../../../utilities/queryKeys.js";
1
+ import { queryKeys as e } from "../../../utilities/queryKeys.js";
2
+ import { createDmsQueryDataAccumulator as t } from "../../../utilities/dms-cursoring/dmsAccumulator.js";
3
3
  import { isScene360CollectionEdge as n, isScene3dModelEdge as r } from "./sceneResponseTypeGuards.js";
4
4
  import { isCog3dModelExternalId as i, tryGetModelIdFromExternalId as a } from "../../../utilities/tryGetModelIdFromExternalId.js";
5
5
  import { createGetScenesQuery as o } from "./allScenesQuery.js";
@@ -11,10 +11,10 @@ import { CDF_TO_VIEWER_TRANSFORMATION as m } from "@cognite/reveal";
11
11
  //#region libs/shared/reveal-components/src/ui/hooks/scenes/use3dScenes.tsx
12
12
  function h(i, d, f) {
13
13
  let { useSDK: p, createFdmSdk: m, sceneLimit: h, sceneRelatedDataLimit: v, hasSceneDataModel: x, getRevisionExternalIdsAndSpaces: S } = c(s), C = p(i), w = l(() => m(C), [m, C]), { data: T, isLoading: E, isFetching: D, isFetched: O, error: k } = u({
14
- queryKey: t.scenes(),
14
+ queryKey: e.scenes(),
15
15
  queryFn: async () => {
16
16
  if (!await x(C)) return {};
17
- let t = o(h, v, {}), i = await e(w, t, { serial: ["scenes", { parallel: [
17
+ let e = o(h, v, {}), i = await t(w, e, { serial: ["scenes", { parallel: [
18
18
  "sceneModels",
19
19
  "scene360Collections",
20
20
  "sceneSkybox",
@@ -1,6 +1,6 @@
1
- import { inspectNodes as e } from "../../../data-providers/cache/requests.js";
2
- import { EMPTY_ARRAY as t } from "../../../utilities/constants.js";
3
- import { queryKeys as n } from "../../../utilities/queryKeys.js";
1
+ import { queryKeys as e } from "../../../utilities/queryKeys.js";
2
+ import { inspectNodes as t } from "../../../data-providers/cache/requests.js";
3
+ import { EMPTY_ARRAY as n } from "../../../utilities/constants.js";
4
4
  import { isPointCloudVolumeIntersection as r } from "./typeGuards.js";
5
5
  import { UsePointCloudDMVolumeMappingForIntersectionContext as i } from "./usePointCloudDMVolumeMappingForIntersection.context.js";
6
6
  import { useContext as a, useMemo as o } from "react";
@@ -15,15 +15,15 @@ var c = (c) => {
15
15
  return [];
16
16
  }, [c]), p = u(f);
17
17
  return s({
18
- queryKey: [n.pointCloudDMVolumeAssetMappingsWithViews(f.map((e) => `${e.externalId}/${e.space}`).sort())],
19
- queryFn: async () => p === void 0 || p.length === 0 ? t : await Promise.all(p.map(async (t) => {
18
+ queryKey: [e.pointCloudDMVolumeAssetMappingsWithViews(f.map((e) => `${e.externalId}/${e.space}`).sort())],
19
+ queryFn: async () => p === void 0 || p.length === 0 ? n : await Promise.all(p.map(async (e) => {
20
20
  let n = {
21
- externalId: t.asset.externalId,
22
- space: t.asset.space
21
+ externalId: e.asset.externalId,
22
+ space: e.asset.space
23
23
  };
24
24
  return {
25
- views: (await e(d, [n])).items[0].inspectionResults.involvedViews,
26
- assetInstance: t.asset
25
+ views: (await t(d, [n])).items[0].inspectionResults.involvedViews,
26
+ assetInstance: e.asset
27
27
  };
28
28
  })),
29
29
  enabled: p !== void 0 && p.length > 0
@@ -1,20 +1,20 @@
1
1
  import { isDmsInstance as e } from "../../../utilities/instanceIds/typeGuards.js";
2
2
  import { isSameDmsId as t } from "../../../utilities/instanceIds/equality.js";
3
3
  import "../../../utilities/instanceIds/index.js";
4
- import { isDefined as n } from "../../../utilities/isDefined.js";
5
- import { createDmsQueryDataAccumulator as r } from "../../../utilities/dms-cursoring/dmsAccumulator.js";
6
- import { queryKeys as i } from "../../../utilities/queryKeys.js";
4
+ import { queryKeys as n } from "../../../utilities/queryKeys.js";
5
+ import { isDefined as r } from "../../../utilities/isDefined.js";
6
+ import { createDmsQueryDataAccumulator as i } from "../../../utilities/dms-cursoring/dmsAccumulator.js";
7
7
  import { pointCloudDMVolumesQuery as a } from "./pointCloudDMVolumesQuery.js";
8
8
  import { UsePointCloudDMVolumesContext as o } from "./usePointCloudDMVolumes.context.js";
9
9
  import { useContext as s } from "react";
10
10
  import { useQuery as c } from "@tanstack/react-query";
11
11
  //#region libs/shared/reveal-components/src/ui/query/core-dm/usePointCloudDMVolumes.ts
12
12
  var l = "point_cloud_dm_volumes_query", u = (e) => {
13
- let { useFdmSdk: t, getDMSModelsForIds: n, getDMSRevisionsForRevisionIdsAndModelRefs: r } = s(o), a = t();
13
+ let { useFdmSdk: t, getDMSModelsForIds: r, getDMSRevisionsForRevisionIdsAndModelRefs: i } = s(o), a = t();
14
14
  return c({
15
- queryKey: [i.pointCloudDMVolumeMappings(e.map((e) => `${e.modelId}/${e.revisionId}`).sort())],
15
+ queryKey: [n.pointCloudDMVolumeMappings(e.map((e) => `${e.modelId}/${e.revisionId}`).sort())],
16
16
  queryFn: async () => await Promise.all(e.map(async (e) => {
17
- let t = await d(e.modelId, e.revisionId, a, n, r);
17
+ let t = await d(e.modelId, e.revisionId, a, r, i);
18
18
  return {
19
19
  model: {
20
20
  ...e,
@@ -26,8 +26,8 @@ var l = "point_cloud_dm_volumes_query", u = (e) => {
26
26
  staleTime: Infinity,
27
27
  enabled: e.length > 0
28
28
  });
29
- }, d = async (i, o, s, c, u) => {
30
- let d = await u(await c([i], s), [o], s), f = a(d), p = await r(s, f, { serial: ["pointCloudVolumes", "assets"] }, { metricsFeatureName: l }).accumulateAllData(), m = p.items.pointCloudVolumes.map((t) => {
29
+ }, d = async (n, o, s, c, u) => {
30
+ let d = await u(await c([n], s), [o], s), f = a(d), p = await i(s, f, { serial: ["pointCloudVolumes", "assets"] }, { metricsFeatureName: l }).accumulateAllData(), m = p.items.pointCloudVolumes.map((t) => {
31
31
  let n = t.properties.cdf_cdm["CognitePointCloudVolume/v1"], r = n.revisions.indexOf(d[0]), i = n.object3D;
32
32
  if (e(i)) return {
33
33
  externalId: t.externalId,
@@ -37,7 +37,7 @@ var l = "point_cloud_dm_volumes_query", u = (e) => {
37
37
  volumeType: n.volumeType,
38
38
  volume: n.volume
39
39
  };
40
- }).filter(n), h = p.items.assets.map((t) => {
40
+ }).filter(r), h = p.items.assets.map((t) => {
41
41
  let n = t.properties.cdf_cdm["CogniteAsset/v1"], r = n.object3D;
42
42
  if (e(r)) return {
43
43
  externalId: t.externalId,
@@ -46,7 +46,7 @@ var l = "point_cloud_dm_volumes_query", u = (e) => {
46
46
  name: n.name,
47
47
  description: n.description
48
48
  };
49
- }).filter(n);
49
+ }).filter(r);
50
50
  return m.map((e) => {
51
51
  let n = h.find((n) => t(n.object3D, e.object3D));
52
52
  return {
@@ -4,6 +4,7 @@ export { use3dRelatedEdgeConnections } from './use3dRelatedEdgeConnections';
4
4
  export { useAll3dDirectConnectionsWithProperties } from './useAll3dDirectConnectionsWithProperties';
5
5
  export { useAssetsAndTimeseriesLinkageDataQuery } from './useAssetsAndTimeseriesLinkageDataQuery';
6
6
  export { useAssetsByIdsQuery } from './useAssetsByIdsQuery';
7
+ export { useInstancesByIdsQuery } from './useInstancesByIdsQuery';
7
8
  export { useModelsForInstanceQuery, type ModelsForInstanceQueryResult, } from './useModelsForInstanceQuery';
8
9
  export { useAllAssetsMapped360Annotations, useSearchAssetsMapped360Annotations, } from './useSearchAssetsMapped360Annotations';
9
10
  export { useAllAssetsMappedPointCloudAnnotations, useSearchAssetsMappedPointCloudAnnotations, } from './useSearchAssetsMappedPointCloudAnnotations';
@@ -1,22 +1,23 @@
1
- import { useAssetsByIdsQuery as e } from "./useAssetsByIdsQuery.js";
1
+ import { useInstancesByIdsQuery as e } from "./useInstancesByIdsQuery.js";
2
2
  import { usePointCloudDMVolumeMappingForAssetInstances as t } from "./core-dm/usePointCloudDMVolumeMappingForAssetInstances.js";
3
3
  import { useAssetsAndTimeseriesLinkageDataQuery as n } from "./useAssetsAndTimeseriesLinkageDataQuery.js";
4
4
  import { use3DModelName as r } from "./use3DModelName.js";
5
5
  import { use3dRelatedDirectConnections as i } from "./use3dRelatedDirectConnections.js";
6
6
  import { use3dRelatedEdgeConnections as a } from "./use3dRelatedEdgeConnections.js";
7
7
  import { useAll3dDirectConnectionsWithProperties as o } from "./useAll3dDirectConnectionsWithProperties.js";
8
- import { findScenesContainingResources as s } from "./findScenesContainingResources.js";
9
- import { useModelsForInstanceQuery as c } from "./useModelsForInstanceQuery.js";
10
- import { useAllAssetsMapped360Annotations as l, useSearchAssetsMapped360Annotations as u } from "./useSearchAssetsMapped360Annotations.js";
11
- import { useAllAssetsMappedPointCloudAnnotations as d, useSearchAssetsMappedPointCloudAnnotations as f } from "./useSearchAssetsMappedPointCloudAnnotations.js";
12
- import { useAllMappedEquipmentAssetMappings as p, useMappingsForAssetIds as m } from "./useSearchMappedEquipmentAssetMappings.js";
13
- import { useHybridMappingsForAssetInstances as h } from "./useHybridMappingsForAssetInstances.js";
14
- import { useFilterNodesByMappedToModelsCallback as g } from "./useSearchMappedEquipmentFDM.js";
15
- import { useTimeseriesByIdsQuery as _ } from "./useTimeseriesByIdsQuery.js";
16
- import { useTimeseriesLatestDatapointQuery as v } from "./useTimeseriesLatestDatapointQuery.js";
17
- import { useFetchTimeseriesFromRelationshipByAsset as y } from "./useFetchTimeseriesFromRelationshipByAsset.js";
18
- import { useAssetsAndTimeseriesLinkages as b } from "./useAssetsAndTimeseriesLinkages.js";
19
- import { useFilterOnClassicAssetsInScene as x } from "./useFilterOnClassicAssetsInScene.js";
20
- import { searchClassicAssetsForModels as S } from "../../data-providers/network/searchClassicAssetsForModels.js";
21
- import { searchHybridDmAssetsForModels as C } from "../../data-providers/network/searchHybridDmAssetsForModels.js";
22
- export { s as findScenesContainingResources, S as searchClassicAssetsForModels, C as searchHybridDmAssetsForModels, r as use3DModelName, i as use3dRelatedDirectConnections, a as use3dRelatedEdgeConnections, o as useAll3dDirectConnectionsWithProperties, l as useAllAssetsMapped360Annotations, d as useAllAssetsMappedPointCloudAnnotations, p as useAllMappedEquipmentAssetMappings, n as useAssetsAndTimeseriesLinkageDataQuery, b as useAssetsAndTimeseriesLinkages, e as useAssetsByIdsQuery, y as useFetchTimeseriesFromRelationshipByAsset, g as useFilterNodesByMappedToModelsCallback, x as useFilterOnClassicAssetsInScene, h as useHybridMappingsForAssetInstances, m as useMappingsForAssetIds, c as useModelsForInstanceQuery, t as usePointCloudDMVolumeMappingForAssetInstances, u as useSearchAssetsMapped360Annotations, f as useSearchAssetsMappedPointCloudAnnotations, _ as useTimeseriesByIdsQuery, v as useTimeseriesLatestDatapointQuery };
8
+ import { useAssetsByIdsQuery as s } from "./useAssetsByIdsQuery.js";
9
+ import { findScenesContainingResources as c } from "./findScenesContainingResources.js";
10
+ import { useModelsForInstanceQuery as l } from "./useModelsForInstanceQuery.js";
11
+ import { useAllAssetsMapped360Annotations as u, useSearchAssetsMapped360Annotations as d } from "./useSearchAssetsMapped360Annotations.js";
12
+ import { useAllAssetsMappedPointCloudAnnotations as f, useSearchAssetsMappedPointCloudAnnotations as p } from "./useSearchAssetsMappedPointCloudAnnotations.js";
13
+ import { useAllMappedEquipmentAssetMappings as m, useMappingsForAssetIds as h } from "./useSearchMappedEquipmentAssetMappings.js";
14
+ import { useHybridMappingsForAssetInstances as g } from "./useHybridMappingsForAssetInstances.js";
15
+ import { useFilterNodesByMappedToModelsCallback as _ } from "./useSearchMappedEquipmentFDM.js";
16
+ import { useTimeseriesByIdsQuery as v } from "./useTimeseriesByIdsQuery.js";
17
+ import { useTimeseriesLatestDatapointQuery as y } from "./useTimeseriesLatestDatapointQuery.js";
18
+ import { useFetchTimeseriesFromRelationshipByAsset as b } from "./useFetchTimeseriesFromRelationshipByAsset.js";
19
+ import { useAssetsAndTimeseriesLinkages as x } from "./useAssetsAndTimeseriesLinkages.js";
20
+ import { useFilterOnClassicAssetsInScene as S } from "./useFilterOnClassicAssetsInScene.js";
21
+ import { searchClassicAssetsForModels as C } from "../../data-providers/network/searchClassicAssetsForModels.js";
22
+ import { searchHybridDmAssetsForModels as w } from "../../data-providers/network/searchHybridDmAssetsForModels.js";
23
+ export { c as findScenesContainingResources, C as searchClassicAssetsForModels, w as searchHybridDmAssetsForModels, r as use3DModelName, i as use3dRelatedDirectConnections, a as use3dRelatedEdgeConnections, o as useAll3dDirectConnectionsWithProperties, u as useAllAssetsMapped360Annotations, f as useAllAssetsMappedPointCloudAnnotations, m as useAllMappedEquipmentAssetMappings, n as useAssetsAndTimeseriesLinkageDataQuery, x as useAssetsAndTimeseriesLinkages, s as useAssetsByIdsQuery, b as useFetchTimeseriesFromRelationshipByAsset, _ as useFilterNodesByMappedToModelsCallback, S as useFilterOnClassicAssetsInScene, g as useHybridMappingsForAssetInstances, e as useInstancesByIdsQuery, h as useMappingsForAssetIds, l as useModelsForInstanceQuery, t as usePointCloudDMVolumeMappingForAssetInstances, d as useSearchAssetsMapped360Annotations, p as useSearchAssetsMappedPointCloudAnnotations, v as useTimeseriesByIdsQuery, y as useTimeseriesLatestDatapointQuery };
@@ -1,6 +1,6 @@
1
1
  import { createFdmKey as e } from "../../data-providers/cache/idAndKeyTranslation.js";
2
- import { executeParallel as t } from "../../utilities/executeParallel.js";
3
- import { isDefined as n } from "../../utilities/isDefined.js";
2
+ import { isDefined as t } from "../../utilities/isDefined.js";
3
+ import { executeParallel as n } from "../../utilities/executeParallel.js";
4
4
  import { concatenateMapValues as r } from "../../utilities/map/concatenateMapValues.js";
5
5
  import { UseAll3dDirectConnectionsWithPropertiesContext as i } from "./useAll3dDirectConnectionsWithProperties.context.js";
6
6
  import { useContext as a, useMemo as o } from "react";
@@ -27,26 +27,26 @@ function d(d) {
27
27
  })), i = d.flatMap((e) => e.views), a = c(i, (t) => t === void 0 ? "" : e(t)), o = s(r, 1e3).flatMap((e) => a.map((t) => ({
28
28
  chunk: e,
29
29
  view: t
30
- }))).flat().filter(n), l = await t(o.map((e) => async () => {
30
+ }))).flat().filter(t), l = await n(o.map((e) => async () => {
31
31
  let t = await p.getByExternalIds(e.chunk, e.view === void 0 ? void 0 : [e.view]);
32
32
  return {
33
33
  items: t.items,
34
34
  typing: t.typing
35
35
  };
36
- }), u), f = l.filter(n).flat();
36
+ }), u), f = l.filter(t).flat();
37
37
  if (l === void 0) return [];
38
38
  let m = f.flatMap((e) => e.items.map((t) => ({
39
39
  item: t,
40
40
  typing: e.typing
41
41
  }))), g = s(m, 1e3);
42
- return (await t(g.flatMap((e) => async () => await p.inspectInstances({
42
+ return (await n(g.flatMap((e) => async () => await p.inspectInstances({
43
43
  inspectionOperations: { involvedViews: {} },
44
44
  items: e.map((e) => ({
45
45
  instanceType: e.item.instanceType,
46
46
  externalId: e.item.externalId,
47
47
  space: e.item.space
48
48
  }))
49
- })), u)).filter(n).flatMap((e) => e.items.flatMap((e) => f.flatMap((t) => ({
49
+ })), u)).filter(t).flatMap((e) => e.items.flatMap((e) => f.flatMap((t) => ({
50
50
  items: t.items.filter((t) => t.space === e.space && t.externalId === e.externalId),
51
51
  typing: t.typing ?? {}
52
52
  })))).filter((e) => e.items.length > 0).flatMap((t) => t.items.flatMap((n) => {
@@ -1,8 +1,8 @@
1
- import { executeParallel as e } from "../../utilities/executeParallel.js";
2
- import { isDefined as t } from "../../utilities/isDefined.js";
3
- import { queryKeys as n } from "../../utilities/queryKeys.js";
4
- import { useSDK as r } from "../components/RevealCanvas/SDKProvider.js";
5
- import { getAssetsByIds as i } from "../hooks/network/getAssetsByIds.js";
1
+ import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
2
+ import { queryKeys as t } from "../../utilities/queryKeys.js";
3
+ import { isDefined as n } from "../../utilities/isDefined.js";
4
+ import { executeParallel as r } from "../../utilities/executeParallel.js";
5
+ import { useSDK as i } from "../components/RevealCanvas/SDKProvider.js";
6
6
  import { getRelationships as a } from "../hooks/network/getRelationships.js";
7
7
  import { getTimeseriesByIds as o } from "../hooks/network/getTimeseriesByIds.js";
8
8
  import { getTimeseriesLatestDatapoints as s } from "../hooks/network/getTimeseriesLatestDatapoints.js";
@@ -10,39 +10,39 @@ import { chunk as c, uniqBy as l } from "lodash-es";
10
10
  import { useQuery as u } from "@tanstack/react-query";
11
11
  //#region libs/shared/reveal-components/src/ui/query/useAssetsAndTimeseriesLinkageDataQuery.ts
12
12
  var d = 1e3;
13
- function f({ timeseriesExternalIds: e, assetNodes: a }) {
14
- let c = r(), d = ["asset"];
13
+ function f({ timeseriesExternalIds: r, assetNodes: a }) {
14
+ let c = i(), d = ["asset"], f = e();
15
15
  return u({
16
- queryKey: [n.assetsAndTimeseriesLinkageData(e, d, a.map((e) => e.externalId).filter(t))],
16
+ queryKey: [t.assetsAndTimeseriesLinkageData(r, d, a.map((e) => e.externalId).filter(n))],
17
17
  queryFn: async () => {
18
- let n = e.map((e) => ({ externalId: e })), [r, u, f] = await Promise.all([
19
- p(c, e, d),
20
- o(c, n),
21
- s(c, n)
22
- ]), g = u?.map((e) => m(a, e, r)).flat().filter(t) ?? [], _ = l(g, "externalId"), v = g.length > 0 ? await i(c, _) : [];
18
+ let e = r.map((e) => ({ externalId: e })), [t, i, u] = await Promise.all([
19
+ p(c, r, d),
20
+ o(c, e),
21
+ s(c, e)
22
+ ]), g = i?.map((e) => m(a, e, t)).flat().filter(n) ?? [], _ = l(g, "externalId"), v = g.length > 0 ? await f.classicAssetsCache.getEntities(_) : /* @__PURE__ */ new Map();
23
23
  return {
24
- assetIdsWithTimeseries: u?.map((e) => h(v, e, r)).flat().filter(t) ?? [],
25
- timeseriesDatapoints: f
24
+ assetIdsWithTimeseries: i?.map((e) => h([...v.values()], e, t)).flat().filter(n) ?? [],
25
+ timeseriesDatapoints: u
26
26
  };
27
27
  },
28
- enabled: e.length > 0
28
+ enabled: r.length > 0
29
29
  });
30
30
  }
31
- var p = async (n, r, i) => {
32
- let o = c(r, d);
33
- return (await e(o.map((e) => async () => await a(n, {
34
- resourceExternalIds: e,
31
+ var p = async (e, t, i) => {
32
+ let o = c(t, d);
33
+ return (await r(o.map((t) => async () => await a(e, {
34
+ resourceExternalIds: t,
35
35
  relationshipResourceTypes: i
36
- })), 2)).filter(t).flat()?.map((e) => {
36
+ })), 2)).filter(n).flat()?.map((e) => {
37
37
  let t = {
38
38
  assetIds: { externalId: "" },
39
39
  timeseriesIds: { externalId: "" }
40
40
  };
41
41
  return e.sourceType === "asset" ? t.assetIds.externalId = e.sourceExternalId : e.targetType === "asset" && (t.assetIds.externalId = e.targetExternalId), e.sourceType === "timeSeries" ? t.timeseriesIds.externalId = e.sourceExternalId : e.targetType === "timeSeries" && (t.timeseriesIds.externalId = e.targetExternalId), t;
42
42
  }) ?? [];
43
- }, m = (e, n, r) => {
44
- let i = e.find((e) => e.id === n.assetId), a = i?.externalId === void 0 ? void 0 : { externalId: i.externalId };
45
- return ((r?.filter((e) => e.timeseriesIds.externalId === n.externalId && e.assetIds.externalId !== a?.externalId))?.map((e) => e.assetIds.externalId === void 0 ? void 0 : { externalId: e.assetIds.externalId }))?.concat(a).filter(t);
43
+ }, m = (e, t, r) => {
44
+ let i = e.find((e) => e.id === t.assetId), a = i?.externalId === void 0 ? void 0 : { externalId: i.externalId };
45
+ return ((r?.filter((e) => e.timeseriesIds.externalId === t.externalId && e.assetIds.externalId !== a?.externalId))?.map((e) => e.assetIds.externalId === void 0 ? void 0 : { externalId: e.assetIds.externalId }))?.concat(a).filter(n);
46
46
  }, h = (e, t, n) => {
47
47
  let r = e?.find((e) => e.id === t.assetId), i = r === void 0 ? void 0 : {
48
48
  externalId: r.externalId,
@@ -1,11 +1,12 @@
1
1
  import { Context } from 'react';
2
+ import { PickDeep } from 'type-fest';
3
+ import { CdfCaches } from '../../foundation/renderTarget/CdfCaches';
2
4
  import { useSDK } from '../components/RevealCanvas/SDKProvider';
3
5
  import { fetchLinkFromRelationshipsByTimeseries } from '../hooks/network/fetchLinkFromRelationshipsByTimeseries';
4
- import { getAssetsByIds } from '../hooks/network/getAssetsByIds';
5
6
  export type UseAssetsAndTimeseriesLinkagesDependencies = {
6
7
  useSDK: typeof useSDK;
7
8
  fetchLinkFromRelationshipsByTimeseries: typeof fetchLinkFromRelationshipsByTimeseries;
8
- getAssetsByIds: typeof getAssetsByIds;
9
+ useCdfCaches: () => PickDeep<CdfCaches, 'classicAssetsCache.getEntities'>;
9
10
  };
10
11
  export declare const defaultUseAssetsAndTimeseriesLinkagesDependencies: UseAssetsAndTimeseriesLinkagesDependencies;
11
12
  export declare const UseAssetsAndTimeseriesLinkagesContext: Context<UseAssetsAndTimeseriesLinkagesDependencies>;
@@ -1,12 +1,12 @@
1
- import { useSDK as e } from "../components/RevealCanvas/SDKProvider.js";
2
- import { getAssetsByIds as t } from "../hooks/network/getAssetsByIds.js";
1
+ import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
2
+ import { useSDK as t } from "../components/RevealCanvas/SDKProvider.js";
3
3
  import { fetchLinkFromRelationshipsByTimeseries as n } from "../hooks/network/fetchLinkFromRelationshipsByTimeseries.js";
4
4
  import { createContext as r } from "react";
5
5
  //#region libs/shared/reveal-components/src/ui/query/useAssetsAndTimeseriesLinkages.context.ts
6
6
  var i = {
7
- useSDK: e,
7
+ useSDK: t,
8
8
  fetchLinkFromRelationshipsByTimeseries: n,
9
- getAssetsByIds: t
9
+ useCdfCaches: e
10
10
  }, a = r(i);
11
11
  //#endregion
12
12
  export { a as UseAssetsAndTimeseriesLinkagesContext, i as defaultUseAssetsAndTimeseriesLinkagesDependencies };
@@ -1,5 +1,5 @@
1
- import { isDefined as e } from "../../utilities/isDefined.js";
2
- import { queryKeys as t } from "../../utilities/queryKeys.js";
1
+ import { queryKeys as e } from "../../utilities/queryKeys.js";
2
+ import { isDefined as t } from "../../utilities/isDefined.js";
3
3
  import { getLinkedTimeseriesForAsset as n } from "../hooks/network/getLinkedTimeseriesForAsset.js";
4
4
  import { UseAssetsAndTimeseriesLinkagesContext as r } from "./useAssetsAndTimeseriesLinkages.context.js";
5
5
  import { useContext as i, useMemo as a } from "react";
@@ -7,25 +7,25 @@ import { uniq as o, uniqBy as s } from "lodash-es";
7
7
  import { useQuery as c } from "@tanstack/react-query";
8
8
  //#region libs/shared/reveal-components/src/ui/query/useAssetsAndTimeseriesLinkages.ts
9
9
  function l(l) {
10
- let { useSDK: u, fetchLinkFromRelationshipsByTimeseries: d, getAssetsByIds: f } = i(r), p = u(), m = a(() => o(l.map((e) => e.externalId).filter(e)), [l]), h = a(() => o(l?.map((e) => {
10
+ let { useSDK: u, fetchLinkFromRelationshipsByTimeseries: d, useCdfCaches: f } = i(r), p = u(), m = f(), h = a(() => o(l.map((e) => e.externalId).filter(t)), [l]), g = a(() => o(l?.map((e) => {
11
11
  if (e.assetId !== void 0) return { id: e.assetId };
12
- }).filter(e)), [l]), g = ["asset"];
12
+ }).filter(t)), [l]), _ = ["asset"];
13
13
  return c({
14
14
  queryKey: [
15
- t.timeseriesLinkedToAssets(),
16
- g,
17
- m
15
+ e.timeseriesLinkedToAssets(),
16
+ _,
17
+ h
18
18
  ],
19
19
  queryFn: async () => {
20
- let t = await d(p, m, g), r = t.map((e) => e.assetIds), i = s(h, "id"), a = s(r, "externalId").map((e) => {
20
+ let e = await d(p, h, _), r = e.map((e) => e.assetIds), i = s(g, "id"), a = s(r, "externalId").map((e) => {
21
21
  if (e.externalId !== void 0) return { externalId: e.externalId };
22
- }).filter(e), o = await f(p, i), c = await f(p, a), u = o.concat(c);
23
- return s(u, "id").map((e) => ({
24
- asset: e,
25
- timeseries: n(e, l, t)
22
+ }).filter(t), o = await m.classicAssetsCache.getEntities(i), c = await m.classicAssetsCache.getEntities(a), u = [...o.values(), ...c.values()];
23
+ return s(u, "id").filter(t).map((t) => ({
24
+ asset: t,
25
+ timeseries: n(t, l, e)
26
26
  }));
27
27
  },
28
- enabled: m.length > 0,
28
+ enabled: h.length > 0,
29
29
  keepPreviousData: !0
30
30
  });
31
31
  }
@@ -1,15 +1,14 @@
1
- import { queryKeys as e } from "../../utilities/queryKeys.js";
2
- import { useSDK as t } from "../components/RevealCanvas/SDKProvider.js";
3
- import { getAssetsByIds as n } from "../hooks/network/getAssetsByIds.js";
4
- import { useQuery as r } from "@tanstack/react-query";
1
+ import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
2
+ import { queryKeys as t } from "../../utilities/queryKeys.js";
3
+ import { useQuery as n } from "@tanstack/react-query";
5
4
  //#region libs/shared/reveal-components/src/ui/query/useAssetsByIdsQuery.ts
6
- var i = (i) => {
7
- let a = t();
8
- return r({
9
- queryKey: e.assetsById(i),
10
- queryFn: async () => await n(a, i),
11
- enabled: i.length > 0
5
+ var r = (r) => {
6
+ let i = e();
7
+ return n({
8
+ queryKey: t.assetsById(r),
9
+ queryFn: async () => await i.classicAssetsCache.getEntities(r),
10
+ enabled: r.length > 0
12
11
  });
13
12
  };
14
13
  //#endregion
15
- export { i as useAssetsByIdsQuery };
14
+ export { r as useAssetsByIdsQuery };
@@ -0,0 +1,8 @@
1
+ import { CogniteClient, Node3D } from '@cognite/sdk';
2
+ import { RevisionId } from '../../foundation/treeNodes/cad-tree-node/cad-types';
3
+ export type UseCadNode3DInfoResult = {
4
+ data: Node3D | undefined;
5
+ isLoading: boolean;
6
+ isError: boolean;
7
+ };
8
+ export declare function useCadNode3DInfo(sdk: CogniteClient, revisionId: RevisionId | undefined, nodeId: number | undefined): UseCadNode3DInfoResult;
@@ -0,0 +1,24 @@
1
+ import { queryKeys as e } from "../../utilities/queryKeys.js";
2
+ import { useQuery as t } from "@tanstack/react-query";
3
+ //#region libs/shared/reveal-components/src/ui/query/useCadNode3DInfo.ts
4
+ var n = {
5
+ modelId: -1,
6
+ revisionId: -1
7
+ };
8
+ function r(r, i, a) {
9
+ let o = t({
10
+ queryKey: e.cadNode3DInfo(i ?? n, a),
11
+ queryFn: async () => {
12
+ if (i !== void 0 && a !== void 0) return (await r.revisions3D.retrieve3DNodes(i.modelId, i.revisionId, [{ id: a }]))[0];
13
+ },
14
+ staleTime: Infinity,
15
+ enabled: i !== void 0 && a !== void 0
16
+ });
17
+ return {
18
+ data: o.data,
19
+ isLoading: i !== void 0 && o.isLoading,
20
+ isError: i === void 0 || o.isError
21
+ };
22
+ }
23
+ //#endregion
24
+ export { r as useCadNode3DInfo };
@@ -1,6 +1,6 @@
1
- import { executeParallel as e } from "../../utilities/executeParallel.js";
1
+ import { queryKeys as e } from "../../utilities/queryKeys.js";
2
+ import { executeParallel as t } from "../../utilities/executeParallel.js";
2
3
  import "../../data-providers/utils/getDMSModelRevisionRefs.js";
3
- import { queryKeys as t } from "../../utilities/queryKeys.js";
4
4
  import { useSDK as n } from "../components/RevealCanvas/SDKProvider.js";
5
5
  import { createContext as r, useContext as i, useMemo as a } from "react";
6
6
  import { chunk as o } from "lodash-es";
@@ -9,10 +9,10 @@ import { useQuery as s } from "@tanstack/react-query";
9
9
  var c = { useSDK: n }, l = r(c), u = 100, d = (n, r) => {
10
10
  let { useSDK: c } = i(l), d = c(), p = a(() => n.sort((e, t) => e.id - t.id), [n]);
11
11
  return s({
12
- queryKey: t.assetsByIdsWithFilter(p, r ?? {}),
12
+ queryKey: e.assetsByIdsWithFilter(p, r ?? {}),
13
13
  queryFn: async () => {
14
- let t = o(p, u);
15
- return (await e(t.map((e) => async () => {
14
+ let e = o(p, u);
15
+ return (await t(e.map((e) => async () => {
16
16
  let t = r ?? f(e), { items: n } = await d.assets.list({
17
17
  limit: u,
18
18
  ...t
@@ -1,7 +1,7 @@
1
- import { isDefined as e } from "../../utilities/isDefined.js";
2
- import { isClassicAsset as t } from "../../utilities/instances/typeGuards.js";
1
+ import { isClassicAsset as e } from "../../utilities/instances/typeGuards.js";
3
2
  import "../../utilities/instances/index.js";
4
- import { isImage360DMResource as n, isImage360EventsResource as r } from "../../data-providers/types/typeGuards.js";
3
+ import { isImage360DMResource as t, isImage360EventsResource as n } from "../../data-providers/types/typeGuards.js";
4
+ import { isDefined as r } from "../../utilities/isDefined.js";
5
5
  import { FilterOnClassicAssetsInSceneContext as i } from "./FilterOnClassicAssetsInScene.context.js";
6
6
  import { useCallback as a, useContext as o, useEffect as s, useMemo as c } from "react";
7
7
  //#region libs/shared/reveal-components/src/ui/query/useFilterOnClassicAssetsInScene.ts
@@ -9,7 +9,7 @@ var l = (l, u) => {
9
9
  let { useReveal3dResourcesFromScene: d, useAllMappedEquipmentAssetMappings: f, useAllAssetsMappedPointCloudAnnotations: p, useAllAssetsMapped360Annotations: m } = o(i), h = d(u.externalId, u.space), g = h.filter((e) => e.sourceType === "classic").map((e) => ({
10
10
  modelId: e.modelId,
11
11
  revisionId: e.revisionId
12
- })).filter(e), _ = [...h.filter(r).map((e) => e.siteId), ...h.filter(n).map((e) => e.externalId)].filter(e), { data: v, isFetching: y, hasNextPage: b = !1, fetchNextPage: x } = f(g, l), { data: S, isInitialLoading: C } = p(l, g), { data: w, isLoading: T } = m(l, _);
12
+ })).filter(r), _ = [...h.filter(n).map((e) => e.siteId), ...h.filter(t).map((e) => e.externalId)].filter(r), { data: v, isFetching: y, hasNextPage: b = !1, fetchNextPage: x } = f(g, l), { data: S, isInitialLoading: C } = p(l, g), { data: w, isLoading: T } = m(l, _);
13
13
  s(() => {
14
14
  b && !y && x();
15
15
  }, [
@@ -19,9 +19,9 @@ var l = (l, u) => {
19
19
  ]);
20
20
  let E = c(() => {
21
21
  if (y || b || C || T) return;
22
- let e = S?.filter((e) => t(e)), n = v?.pages.flat().map((e) => e.assets).flat() ?? [], r = w?.map((e) => e.asset).filter(t) ?? [], i = [
22
+ let t = S?.filter((t) => e(t)), n = v?.pages.flat().map((e) => e.assets).flat() ?? [], r = w?.map((e) => e.asset).filter(e) ?? [], i = [
23
23
  ...n,
24
- ...e ?? [],
24
+ ...t ?? [],
25
25
  ...r
26
26
  ], a = /* @__PURE__ */ new Map();
27
27
  for (let e of i) a.set(e.id, e);
@@ -1,6 +1,6 @@
1
1
  import { isFdmKey as e } from "../../data-providers/cache/idAndKeyTranslation.js";
2
- import { isDefined as t } from "../../utilities/isDefined.js";
3
- import { queryKeys as n } from "../../utilities/queryKeys.js";
2
+ import { queryKeys as t } from "../../utilities/queryKeys.js";
3
+ import { isDefined as n } from "../../utilities/isDefined.js";
4
4
  import { UseHybridMappingsForAssetInstancesContext as r } from "./useHybridMappingsForAssetInstances.context.js";
5
5
  import { useContext as i } from "react";
6
6
  import { useQuery as a } from "@tanstack/react-query";
@@ -8,20 +8,20 @@ import { useQuery as a } from "@tanstack/react-query";
8
8
  var o = (o, s) => {
9
9
  let { useClassicCadAssetMappingCache: c, useIsCoreDmOnly: l } = i(r), u = c(), d = l(), f = s.length > 0 && !d;
10
10
  return a({
11
- queryKey: n.hybridDmAssetMappingsForInstances(o.map((e) => `${e.modelId}-${e.revisionId}`), s),
11
+ queryKey: t.hybridDmAssetMappingsForInstances(o.map((e) => `${e.modelId}-${e.revisionId}`), s),
12
12
  queryFn: async () => {
13
- let n = o.map(async (n) => {
14
- let r = await u.getNodesForInstanceIds(n.modelId, n.revisionId, s), i = new Map([...r.keys()].filter(e).map((e) => {
13
+ let t = o.map(async (t) => {
14
+ let r = await u.getNodesForInstanceIds(t.modelId, t.revisionId, s), i = new Map([...r.keys()].filter(e).map((e) => {
15
15
  let t = r.get(e);
16
16
  return t === void 0 ? void 0 : [e, t];
17
- }).filter(t));
17
+ }).filter(n));
18
18
  return {
19
- modelId: n.modelId,
20
- revisionId: n.revisionId,
19
+ modelId: t.modelId,
20
+ revisionId: t.revisionId,
21
21
  mappings: i
22
22
  };
23
23
  });
24
- return await Promise.all(n);
24
+ return await Promise.all(t);
25
25
  },
26
26
  enabled: f,
27
27
  staleTime: Infinity
@@ -0,0 +1,11 @@
1
+ import { Context } from 'react';
2
+ import { PickDeep } from 'type-fest';
3
+ import { UseDerivedPromiseResult } from '@cognite/underscore/react';
4
+ import { CdfCaches } from '../../foundation/renderTarget/CdfCaches';
5
+ import { InstanceReferenceKey, InstanceReference } from '../../utilities';
6
+ export type UseInstanceNamesDependencies = {
7
+ useCdfCaches: () => PickDeep<CdfCaches, 'classicAssetsCache.getEntities' | 'dmsDescribableCache.getEntities'>;
8
+ };
9
+ export declare const defaultUseInstanceNamesDependencies: UseInstanceNamesDependencies;
10
+ export declare const UseInstanceNamesContext: Context<UseInstanceNamesDependencies>;
11
+ export declare function useInstanceNames(ids: InstanceReference[]): UseDerivedPromiseResult<Map<InstanceReferenceKey, string>>;
@@ -0,0 +1,17 @@
1
+ import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
2
+ import { isDmsInstance as t, isIdEither as n } from "../../utilities/instanceIds/typeGuards.js";
3
+ import { createInstanceReferenceKey as r } from "../../utilities/instanceIds/toKey.js";
4
+ import "../../utilities/index.js";
5
+ import { createContext as i, useContext as a } from "react";
6
+ import { useDerivedPromise as o } from "@cognite/underscore/react";
7
+ //#region libs/shared/reveal-components/src/ui/query/useInstanceNames.ts
8
+ var s = { useCdfCaches: e }, c = i(s);
9
+ function l(e) {
10
+ let { useCdfCaches: i } = a(c), s = i();
11
+ return o(async () => {
12
+ let i = /* @__PURE__ */ new Map(), a = e.filter(n), o = e.filter(t), c = s.classicAssetsCache.getEntities(a), l = s.dmsDescribableCache.getEntities(o), u = await c, d = await l;
13
+ return u.values().forEach((e) => i.set(r({ id: e.id }), e.name)), d.entries().forEach(([e, t]) => i.set(e, t.properties.cdf_cdm?.["CogniteDescribable/v1"]?.name ?? t.externalId)), i;
14
+ }, [s, e]);
15
+ }
16
+ //#endregion
17
+ export { c as UseInstanceNamesContext, s as defaultUseInstanceNamesDependencies, l as useInstanceNames };
@@ -1,10 +1,8 @@
1
1
  import { Context } from 'react';
2
- import { PickReturn } from '../../utilities/PickReturn';
3
- import { useAssetsByIdsQuery } from './useAssetsByIdsQuery';
4
- import { useDmInstancesByIds } from './useDmsInstanceByIdsQuery';
2
+ import { PickDeep } from 'type-fest';
3
+ import { CdfCaches } from '../../foundation/renderTarget/CdfCaches';
5
4
  export type UseInstancesByIdsQueryDependencies = {
6
- useAssetsByIdsQuery: PickReturn<typeof useAssetsByIdsQuery, 'data' | 'isLoading' | 'isError'>;
7
- useDmInstancesByIds: PickReturn<typeof useDmInstancesByIds, 'data' | 'isLoading' | 'isError'>;
5
+ useCdfCaches: () => PickDeep<CdfCaches, 'classicAssetsCache.getEntities' | 'dmsDescribableCache.getEntities'>;
8
6
  };
9
7
  export declare const defaultUseInstancesByIdsQueryDependencies: UseInstancesByIdsQueryDependencies;
10
8
  export declare const UseInstancesByIdsQueryContext: Context<UseInstancesByIdsQueryDependencies>;
@@ -1,10 +1,6 @@
1
- import { useAssetsByIdsQuery as e } from "./useAssetsByIdsQuery.js";
2
- import { useDmInstancesByIds as t } from "./useDmsInstanceByIdsQuery.js";
3
- import { createContext as n } from "react";
1
+ import { useCdfCaches as e } from "../components/RevealCanvas/ViewerContext.js";
2
+ import { createContext as t } from "react";
4
3
  //#region libs/shared/reveal-components/src/ui/query/useInstancesByIdsQuery.context.ts
5
- var r = {
6
- useAssetsByIdsQuery: e,
7
- useDmInstancesByIds: t
8
- }, i = n(r);
4
+ var n = { useCdfCaches: e }, r = t(n);
9
5
  //#endregion
10
- export { i as UseInstancesByIdsQueryContext, r as defaultUseInstancesByIdsQueryDependencies };
6
+ export { r as UseInstancesByIdsQueryContext, n as defaultUseInstancesByIdsQueryDependencies };
@@ -1,9 +1,12 @@
1
- import { UseQueryResult } from '@tanstack/react-query';
2
1
  import { Asset } from '@cognite/sdk';
3
- import { FdmNode } from '../../data-providers';
2
+ import { DmsDescribableNode } from '../../data-providers/assets/createDmsDescribableNodesCache';
4
3
  import { InstanceReference, InstanceReferenceKey } from '../../utilities';
5
- export type UseInstancesByIdsQueryResult = Pick<UseQueryResult<Map<InstanceReferenceKey, {
4
+ export type UseInstancesByIdsQueryResult<T> = {
5
+ data: T | undefined;
6
+ error: Error | undefined;
7
+ isLoading: boolean;
8
+ };
9
+ export declare function useInstancesByIdsQuery(instances: InstanceReference[]): UseInstancesByIdsQueryResult<Map<InstanceReferenceKey, {
6
10
  name: string;
7
- asset: Asset | FdmNode<Record<string, unknown>>;
8
- }>>, 'data' | 'isLoading' | 'isError'>;
9
- export declare function useInstancesByIdsQuery(instances: InstanceReference[]): UseInstancesByIdsQueryResult;
11
+ asset: Asset | DmsDescribableNode;
12
+ }>>;