@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.
- package/README.md +1 -1
- package/dist/assets/poi-markers/poi-create-cursor.js +4 -0
- package/dist/common/i18n/en/reveal-components.js +183 -178
- package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/FdmSDK.d.ts +8 -0
- package/dist/data-providers/FdmSDK.js +34 -21
- package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
- package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
- package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
- package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
- package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
- package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
- package/dist/data-providers/cache/annotationModelUtils.js +8 -6
- package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
- package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +9 -6
- package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
- package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
- package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
- package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
- package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
- package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
- package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
- package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
- package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
- package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
- package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
- package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
- package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
- package/dist/data-providers/index.d.ts +2 -1
- package/dist/data-providers/index.js +2 -0
- package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
- package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
- package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
- package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
- package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
- package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
- package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
- package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
- package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
- package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
- package/dist/domains/index.d.ts +4 -2
- package/dist/domains/index.js +3 -1
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
- package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
- package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
- package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
- package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
- package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
- package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
- package/dist/foundation/renderTarget/CdfCaches.js +24 -14
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
- package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
- package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
- package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
- package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +2 -5
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
- package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
- package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
- package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
- package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
- package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
- package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
- package/dist/ui/components/RevealContext/RevealContext.js +6 -6
- package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
- package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
- package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
- package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
- package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
- package/dist/ui/components/Widget/RevealWidget.js +35 -20
- package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
- package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
- package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
- package/dist/ui/components/Widget/index.d.ts +1 -1
- package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
- package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
- package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
- package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
- package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
- package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
- package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +27 -13
- package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
- package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
- package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
- package/dist/ui/components/i18n/I18n.js +3 -3
- package/dist/ui/components/index.d.ts +1 -1
- package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
- package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
- package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
- package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
- package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
- package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
- package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
- package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
- package/dist/ui/query/index.d.ts +1 -0
- package/dist/ui/query/index.js +17 -16
- package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
- package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
- package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
- package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
- package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
- package/dist/ui/query/useCadNode3DInfo.js +24 -0
- package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
- package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
- package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
- package/dist/ui/query/useInstanceNames.d.ts +11 -0
- package/dist/ui/query/useInstanceNames.js +17 -0
- package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
- package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
- package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
- package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
- package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
- package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
- package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
- package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
- package/dist/utilities/externalIndex.d.ts +2 -0
- package/dist/utilities/externalIndex.js +3 -1
- package/dist/utilities/getInstancesFromClick.js +9 -9
- package/dist/utilities/index.d.ts +2 -1
- package/dist/utilities/index.js +12 -9
- package/dist/utilities/queryKeys.d.ts +2 -0
- package/dist/utilities/queryKeys.js +7 -0
- package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
- package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
- package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
- package/dist/utilities/usageMetricsTracker.d.ts +4 -0
- package/dist/utilities/usageMetricsTracker.js +4 -0
- package/package.json +7 -3
- package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
- package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
- package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
- package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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:
|
|
14
|
+
queryKey: e.scenes(),
|
|
15
15
|
queryFn: async () => {
|
|
16
16
|
if (!await x(C)) return {};
|
|
17
|
-
let
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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: [
|
|
19
|
-
queryFn: async () => p === void 0 || p.length === 0 ?
|
|
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:
|
|
22
|
-
space:
|
|
21
|
+
externalId: e.asset.externalId,
|
|
22
|
+
space: e.asset.space
|
|
23
23
|
};
|
|
24
24
|
return {
|
|
25
|
-
views: (await
|
|
26
|
-
assetInstance:
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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:
|
|
13
|
+
let { useFdmSdk: t, getDMSModelsForIds: r, getDMSRevisionsForRevisionIdsAndModelRefs: i } = s(o), a = t();
|
|
14
14
|
return c({
|
|
15
|
-
queryKey: [
|
|
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,
|
|
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 (
|
|
30
|
-
let d = await u(await c([
|
|
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(
|
|
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(
|
|
49
|
+
}).filter(r);
|
|
50
50
|
return m.map((e) => {
|
|
51
51
|
let n = h.find((n) => t(n.object3D, e.object3D));
|
|
52
52
|
return {
|
package/dist/ui/query/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/ui/query/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
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 {
|
|
3
|
-
import {
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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:
|
|
14
|
-
let c =
|
|
13
|
+
function f({ timeseriesExternalIds: r, assetNodes: a }) {
|
|
14
|
+
let c = i(), d = ["asset"], f = e();
|
|
15
15
|
return u({
|
|
16
|
-
queryKey: [
|
|
16
|
+
queryKey: [t.assetsAndTimeseriesLinkageData(r, d, a.map((e) => e.externalId).filter(n))],
|
|
17
17
|
queryFn: async () => {
|
|
18
|
-
let
|
|
19
|
-
p(c,
|
|
20
|
-
o(c,
|
|
21
|
-
s(c,
|
|
22
|
-
]), g =
|
|
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:
|
|
25
|
-
timeseriesDatapoints:
|
|
24
|
+
assetIdsWithTimeseries: i?.map((e) => h([...v.values()], e, t)).flat().filter(n) ?? [],
|
|
25
|
+
timeseriesDatapoints: u
|
|
26
26
|
};
|
|
27
27
|
},
|
|
28
|
-
enabled:
|
|
28
|
+
enabled: r.length > 0
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
var p = async (
|
|
32
|
-
let o = c(
|
|
33
|
-
return (await
|
|
34
|
-
resourceExternalIds:
|
|
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(
|
|
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,
|
|
44
|
-
let i = e.find((e) => e.id ===
|
|
45
|
-
return ((r?.filter((e) => e.timeseriesIds.externalId ===
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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:
|
|
7
|
+
useSDK: t,
|
|
8
8
|
fetchLinkFromRelationshipsByTimeseries: n,
|
|
9
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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,
|
|
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(
|
|
12
|
+
}).filter(t)), [l]), _ = ["asset"];
|
|
13
13
|
return c({
|
|
14
14
|
queryKey: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
e.timeseriesLinkedToAssets(),
|
|
16
|
+
_,
|
|
17
|
+
h
|
|
18
18
|
],
|
|
19
19
|
queryFn: async () => {
|
|
20
|
-
let
|
|
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(
|
|
23
|
-
return s(u, "id").map((
|
|
24
|
-
asset:
|
|
25
|
-
timeseries: n(
|
|
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:
|
|
28
|
+
enabled: h.length > 0,
|
|
29
29
|
keepPreviousData: !0
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
7
|
-
let
|
|
8
|
-
return
|
|
9
|
-
queryKey:
|
|
10
|
-
queryFn: async () => await
|
|
11
|
-
enabled:
|
|
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 {
|
|
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 {
|
|
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:
|
|
12
|
+
queryKey: e.assetsByIdsWithFilter(p, r ?? {}),
|
|
13
13
|
queryFn: async () => {
|
|
14
|
-
let
|
|
15
|
-
return (await e
|
|
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 {
|
|
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
|
|
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(
|
|
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
|
|
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
|
-
...
|
|
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 {
|
|
3
|
-
import {
|
|
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:
|
|
11
|
+
queryKey: t.hybridDmAssetMappingsForInstances(o.map((e) => `${e.modelId}-${e.revisionId}`), s),
|
|
12
12
|
queryFn: async () => {
|
|
13
|
-
let
|
|
14
|
-
let r = await u.getNodesForInstanceIds(
|
|
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(
|
|
17
|
+
}).filter(n));
|
|
18
18
|
return {
|
|
19
|
-
modelId:
|
|
20
|
-
revisionId:
|
|
19
|
+
modelId: t.modelId,
|
|
20
|
+
revisionId: t.revisionId,
|
|
21
21
|
mappings: i
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
|
-
return await Promise.all(
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
import { useDmInstancesByIds } from './useDmsInstanceByIdsQuery';
|
|
2
|
+
import { PickDeep } from 'type-fest';
|
|
3
|
+
import { CdfCaches } from '../../foundation/renderTarget/CdfCaches';
|
|
5
4
|
export type UseInstancesByIdsQueryDependencies = {
|
|
6
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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 {
|
|
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 {
|
|
2
|
+
import { DmsDescribableNode } from '../../data-providers/assets/createDmsDescribableNodesCache';
|
|
4
3
|
import { InstanceReference, InstanceReferenceKey } from '../../utilities';
|
|
5
|
-
export type UseInstancesByIdsQueryResult =
|
|
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 |
|
|
8
|
-
}
|
|
9
|
-
export declare function useInstancesByIdsQuery(instances: InstanceReference[]): UseInstancesByIdsQueryResult;
|
|
11
|
+
asset: Asset | DmsDescribableNode;
|
|
12
|
+
}>>;
|