@equinor/echo-framework 5.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/index.cjs.js +2 -2
  2. package/package.json +6 -6
  3. package/src/lib/feature/globalSelection/coordinate/coordinate.clean.d.ts +6 -0
  4. package/src/lib/feature/globalSelection/coordinate/coordinate.logic.d.ts +3 -0
  5. package/src/lib/feature/globalSelection/coordinate/coordinate.types.d.ts +19 -0
  6. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +32 -28
  7. package/src/lib/feature/globalSelection/globalSelectionStore/actions/setRelatedTo.action.d.ts +7 -0
  8. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +242 -0
  9. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.mutableSelectionItem.d.ts +2 -1
  10. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.testHelpers.d.ts +5 -0
  11. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +42 -5
  12. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +14 -12
  13. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +3 -1
  14. package/src/lib/feature/globalSelection/globalSelectionStore/itemIdTypeGuards.d.ts +3 -1
  15. package/src/lib/feature/globalSelection/globalSelectionStore/nullItems/createNullCoordinate.d.ts +3 -0
  16. package/src/lib/feature/globalSelection/hooks/useIsInGlobalSelection.d.ts +6 -1
  17. package/src/lib/feature/globalSelection/index.d.ts +2 -5
  18. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItems.action.d.ts +2 -2
  19. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItemsByType.action.d.ts +15 -0
  20. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/initialData.d.ts +0 -6
  21. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.load.utils.d.ts +1 -1
  22. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.api.types.d.ts +7 -1
  23. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +42 -5
  24. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +5 -10
  25. package/src/lib/feature/globalSelection/strategies/coordinateSelection.strategy.d.ts +3 -0
  26. package/src/lib/feature/globalSelection/strategies/selectionItemTypeStrategy.types.d.ts +2 -0
  27. package/src/lib/services/api/api-plantinfo.d.ts +1 -1
  28. package/src/lib/services/echoViewService/echoView.type.d.ts +0 -1
  29. package/src/lib/utils/plantInfo.d.ts +2 -2
  30. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionTags.d.ts +0 -6
  31. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionWorkOrders.d.ts +0 -6
  32. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addEquipments.action.d.ts +0 -2
  33. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addMeasuringPoints.action.d.ts +0 -2
  34. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTags.action.d.ts +0 -2
  35. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +0 -2
  36. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTreeLoader.service.d.ts +0 -42
@@ -1,31 +1,33 @@
1
1
  import { ResultArray } from '@equinor/echo-search';
2
2
  import { GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from './globalSelectionStore.types';
3
- import { isEquipmentId, isMeasuringPointId, isTagId, isWorkOrderId } from './itemIdTypeGuards';
3
+ import { isCoordinateId, isEquipmentId, isMeasuringPointId, isPdmsTagId, isTagId, isWorkOrderId } from './itemIdTypeGuards';
4
4
  declare function idsEqual(itemA: GlobalSelectionTypes.ItemId, itemB: GlobalSelectionTypes.ItemId): boolean;
5
5
  declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
6
6
  declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemIdString;
7
7
  export declare function mapIdToItemType(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionItemType;
8
8
  /**
9
- * A utility object that provides various functions for handling global selections.
10
- *
11
- * @namespace globalSelectionUtils
12
- * @property {Function} isMeasuringPointId - Checks if the passed object is a global selection MeasuringPointID.
13
- * @property {Function} isWorkOrderId - Checks if the passed object is a global selection WorkOrderID.
14
- * @property {Function} isEquipmentId - Checks if the passed object is a global selection EquipmentID.
15
- * @property {Function} isTagId - Checks if the passed object is a global selection TagID.
16
- * @property {Function} idsEqual - Compares two global selection item IDs for equality.
17
- * @property {Function} mapToId - Maps an object to its global selection item ID, preserving all properties (including PDMS).
18
- * @property {Function} mapIdToItemType - Returns the GlobalSelectionItemType enum value for a given ItemId.
19
- * @property {Function} itemIdToString - ONE-WAY conversion to string for Map keys. Cannot be reversed. For tags, uses only tagNo-instCode.
9
+ * Utility functions for handling global selection item IDs and types.
20
10
  */
21
11
  export declare const globalSelectionUtils: Readonly<{
12
+ /** Checks if the passed object is a global selection `MeasuringPointId`. */
22
13
  isMeasuringPointId: typeof isMeasuringPointId;
14
+ /** Checks if the passed object is a global selection `WorkOrderId`. */
23
15
  isWorkOrderId: typeof isWorkOrderId;
16
+ /** Checks if the passed object is a global selection `EquipmentId`. */
24
17
  isEquipmentId: typeof isEquipmentId;
18
+ /** Checks if the passed object is a global selection `TagId` (STID). */
25
19
  isTagId: typeof isTagId;
20
+ /** Checks if the passed object is a PDMS `TagId` — a `TagId` with `internalTagType`, `plantNo`, and `plantCode`. */
21
+ isPdmsTagId: typeof isPdmsTagId;
22
+ /** Checks if the passed object is a global selection `CoordinateId`. */
23
+ isCoordinateId: typeof isCoordinateId;
24
+ /** Compares two global selection item IDs for equality using the registered strategy for their type. */
26
25
  idsEqual: typeof idsEqual;
26
+ /** Normalizes an `ItemId` to its canonical form via the registered strategy (e.g. trims whitespace, uppercases instCode). Preserves all properties including PDMS fields. */
27
27
  mapToId: typeof mapToId;
28
+ /** Returns the `GlobalSelectionItemType` enum value for a given `ItemId`. */
28
29
  mapIdToItemType: typeof mapIdToItemType;
30
+ /** ONE-WAY conversion of an `ItemId` to a string suitable for use as a `Map` key. Cannot be reversed. For tags, uses only `tagNo-instCode` (PDMS fields are not included). */
29
31
  itemIdToString: typeof itemIdToString;
30
32
  }>;
31
33
  /**
@@ -1,15 +1,17 @@
1
- import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemSystemStatus } from './globalSelectionStore.types';
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes, RelatedToItem, SelectionItemSystemStatus } from './globalSelectionStore.types';
2
2
  export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(args: {
3
3
  item: T;
4
4
  type: K;
5
5
  systemStatus: SelectionItemSystemStatus;
6
6
  color?: string;
7
+ relatedTo?: ReadonlyArray<RelatedToItem>;
7
8
  }): GlobalSelectionTypes.GenericItem<K>;
8
9
  export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(args: {
9
10
  items: T[];
10
11
  type: K;
11
12
  systemStatus: SelectionItemSystemStatus;
12
13
  color?: string;
14
+ relatedTo?: ReadonlyArray<RelatedToItem>;
13
15
  }): GlobalSelectionTypes.GenericItem<K>[];
14
16
  export declare function setNotFoundStatusByItemIds(args: {
15
17
  itemType: GlobalSelectionItemType;
@@ -1,7 +1,9 @@
1
1
  import type { PdmsTagId } from '../pdmsTag/pdmsTag.types';
2
- import type { GlobalSelectionTypes } from './globalSelectionStore.types';
2
+ import type { CustomDataId, GlobalSelectionTypes } from './globalSelectionStore.types';
3
3
  export declare function isWorkOrderId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.WorkOrderId;
4
4
  export declare function isEquipmentId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.EquipmentId;
5
5
  export declare function isTagId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.TagId;
6
6
  export declare function isMeasuringPointId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.MeasuringPointId;
7
7
  export declare function isPdmsTagId(itemId: GlobalSelectionTypes.ItemId): itemId is PdmsTagId;
8
+ export declare function isCustomDataId(itemId: GlobalSelectionTypes.RelatedToItemId): itemId is CustomDataId;
9
+ export declare function isCoordinateId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.CoordinateId;
@@ -0,0 +1,3 @@
1
+ import type { CoordinateData } from '../../coordinate/coordinate.types';
2
+ import type { GlobalSelectionTypes } from '../globalSelectionStore.types';
3
+ export declare function createNullCoordinateData(itemId: GlobalSelectionTypes.CoordinateId): CoordinateData;
@@ -1,6 +1,11 @@
1
1
  import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
2
  /**
3
- * Hook to check if an item is in the global selection
3
+ * Hook to check if an item is in the global selection.
4
+ *
5
+ * The check runs inside the Zustand selector and returns a boolean.
6
+ * Zustand's `Object.is` comparison on the boolean means the component only
7
+ * re-renders when the actual in-selection status changes, not on every store mutation.
8
+ *
4
9
  * @param {GlobalSelectionTypes.ItemId} itemId - The itemId
5
10
  * @returns {boolean} - True if the item is in global selection, false otherwise
6
11
  */
@@ -1,16 +1,15 @@
1
1
  export * from './globalSelectionStore/globalSelectionStore.types';
2
2
  export * from './selectionMenu/selectionTreeStore/selectionTree.api.types';
3
3
  export * from './selectionMenu/selectionTreeStore/selectionTree.store.types';
4
- export { PDMS_INTERNAL_TAG_TYPES, isPdmsInternalTagType } from './pdmsTag/pdmsTag.types';
4
+ export { isPdmsInternalTagType, PDMS_INTERNAL_TAG_TYPES } from './pdmsTag/pdmsTag.types';
5
5
  export type { PdmsInternalTagType, PdmsTagId, PdmsTagSummaryDto, StidTagId } from './pdmsTag/pdmsTag.types';
6
+ export type { CoordinateData, CoordinateId } from './coordinate/coordinate.types';
6
7
  export { useAreAllItemsVisible } from './hooks/useAreAllItemsVisible';
7
8
  export { useGlobalSelectionByItemId } from './hooks/useGlobalSelectionByItemId';
8
9
  export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
9
10
  export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsByType';
10
11
  export { useGlobalSelectionItemsByTypeAsMap } from './hooks/useGlobalSelectionItemsByTypeAsMap';
11
12
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
12
- export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
13
- export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
14
13
  export { useIsInGlobalSelection } from './hooks/useIsInGlobalSelection';
15
14
  export { useItemGroupMembership } from './hooks/useItemGroupMembership';
16
15
  export { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
@@ -29,6 +28,4 @@ export { invalidateHistorySelectionQuery } from './selectionMenu/invalidateHisto
29
28
  export { saveEquipmentAsNewSelectionToApi } from './selectionMenu/selectionTreeStore/api/selectionTree.equipment';
30
29
  export { SelectionColorConflictDialog } from './selectionMenu/selectionTreeStore/colorConflictHandling/SelectionColorConflictDialog';
31
30
  export { simulatedSelectionTreeApiError } from './selectionMenu/selectionTreeStore/persist/devOnlySimulateOffline';
32
- export { isPdmsTagId } from './globalSelectionStore/itemIdTypeGuards';
33
- export { isPdmsTagInSelection } from './pdmsTag/pdmsTag.logic';
34
31
  export { createPdmsTagSummaryDto, isPdmsTagSummaryDto } from './pdmsTag/pdmsTag.utils';
@@ -7,8 +7,8 @@ export type AddItemsActionArgs = {
7
7
  readonly useDefaultSelectionTypeColors?: boolean;
8
8
  };
9
9
  /**
10
- * Adds items to the selection tree store by categorizing them into tags, work orders,
11
- * equipments, and measuring points, then dispatching the appropriate add actions for each type.
10
+ * Adds items to the selection tree store by categorizing them by type using the strategy registry,
11
+ * then dispatching addItemsByType for each type group.
12
12
  *
13
13
  * @param get - A function that returns the current instance of the SelectionTreeStore.
14
14
  * @param args - The arguments for adding items, including an array of item IDs and additional label arguments.
@@ -0,0 +1,15 @@
1
+ import { StoreApi } from 'zustand';
2
+ import { GlobalSelectionItemType, SelectionItemTypeToItemIdMap } from '../../../globalSelectionStore/globalSelectionStore.types';
3
+ import { SelectionTreeStore } from '../selectionTree.store.types';
4
+ import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
5
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace: boolean | undefined, action: string | undefined) => void;
6
+ /**
7
+ * Generic tree action for adding items of any registered type to the selection tree.
8
+ * Replaces the 4 per-type action files (addTags, addWorkOrders, addEquipments, addMeasuringPoints).
9
+ *
10
+ * Reads category config (categoryId, categoryOrderIndex) from the strategy registry so no
11
+ * per-type branching is needed here or in the store.
12
+ */
13
+ export declare function createAddItemsByTypeAction<T extends GlobalSelectionItemType>(itemType: T): (set: (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: StoreApi<SelectionTreeStore>["getState"], args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>) => Promise<AddItemsResponse<T>>;
14
+ export declare function addItemsByTypeAction<T extends GlobalSelectionItemType>(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], itemType: T, args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>): Promise<AddItemsResponse<T>>;
15
+ export {};
@@ -1,12 +1,6 @@
1
1
  import { SelectionCategory, SelectionGroup } from './selectionTree.store.types';
2
2
  export declare const selectionTreeInitialData: Readonly<{
3
3
  localSelectionGroup: SelectionGroup;
4
- categoryOrder: {
5
- tagIndex: number;
6
- workOrderIndex: number;
7
- equipmentIndex: number;
8
- measuringPointIndex: number;
9
- };
10
4
  localSelectionGroupIndex: 0;
11
5
  getInitialCategories: () => SelectionCategory[];
12
6
  }>;
@@ -7,7 +7,7 @@ import { SelectionGroup } from '../selectionTree.store.types';
7
7
  * This function takes the `data` property from an API selection tree root object,
8
8
  * extracts all items from the nested structure, and groups their normalized IDs
9
9
  * by their corresponding `GlobalSelectionItemType`. It then creates selection lists
10
- * for each type using the `selectionTreeLoader.createListByType` utility.
10
+ * for each type using the strategy registry (null/loading-state items).
11
11
  *
12
12
  * @param param0 - An object containing the `data` array from the API selection tree root.
13
13
  * @returns An object containing:
@@ -1,6 +1,7 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- import { GlobalSelectionItemType, SelectionItemTypeToItemIdMap } from '../../globalSelectionStore/globalSelectionStore.types';
2
+ import { GlobalSelectionItemType, RelatedToItemType, RelatedToItemTypeToIdMap, SelectionItemTypeToItemIdMap } from '../../globalSelectionStore/globalSelectionStore.types';
3
3
  export type ApiSelectionTreeItemId = SelectionItemTypeToItemIdMap[GlobalSelectionItemType];
4
+ export type ApiRelatedToItemId = RelatedToItemTypeToIdMap[RelatedToItemType];
4
5
  export interface ApiGlobalSelectionMetaData {
5
6
  readonly color: string | undefined;
6
7
  readonly isHiddenByUser: boolean | undefined;
@@ -29,10 +30,15 @@ export interface ApiSelectionGroup {
29
30
  export interface ApiSelectionCategory {
30
31
  readonly items: ApiSelectionTreeItem[];
31
32
  }
33
+ export interface ApiRelatedToItem {
34
+ readonly id: ApiRelatedToItemId;
35
+ readonly type: RelatedToItemType;
36
+ }
32
37
  export interface ApiSelectionTreeItem {
33
38
  readonly type: GlobalSelectionItemType;
34
39
  readonly id: ApiSelectionTreeItemId;
35
40
  readonly metaData?: ApiGlobalSelectionMetaData;
41
+ readonly relatedTo?: ReadonlyArray<ApiRelatedToItem>;
36
42
  }
37
43
  export interface ApiSelectionHistory {
38
44
  readonly id: Guid;
@@ -11,7 +11,7 @@ import { SelectionGroup, SelectionTreeStore } from './selectionTree.store.types'
11
11
  *
12
12
  * @example
13
13
  * const selectionTree = useSelectionTreeStore();
14
- * selectionTree.addTags({ ... });
14
+ * selectionTree.addItemsByType(GlobalSelectionItemType.Tag, { ... });
15
15
  *
16
16
  * @see SelectionTreeStore
17
17
  */
@@ -37,10 +37,7 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
37
37
  groupId?: Guid;
38
38
  useDefaultSelectionTypeColors?: boolean;
39
39
  }) => Promise<void>;
40
- addTags: (args: import("./actions/selectionTree.action.types").AddItemArgs<import("../..").GlobalSelectionTypes.TagId>) => import("./selectionTree.store.types").AddTagsReturnType;
41
- addWorkOrders: (args: import("./actions/selectionTree.action.types").AddItemArgs<import("../..").GlobalSelectionTypes.WorkOrderId>) => import("./selectionTree.store.types").AddWorkOrdersReturnType;
42
- addEquipments: (args: import("./actions/selectionTree.action.types").AddItemArgs<import("../..").GlobalSelectionTypes.EquipmentId>) => import("./selectionTree.store.types").AddEquipmentsReturnType;
43
- addMeasuringPoints: (args: import("./actions/selectionTree.action.types").AddItemArgs<import("../..").GlobalSelectionTypes.MeasuringPointId>) => import("./selectionTree.store.types").AddMeasuringPointsReturnType;
40
+ addItemsByType: <T extends import("../..").GlobalSelectionItemType>(itemType: T, args: import("./actions/selectionTree.action.types").AddItemArgs<import("../..").SelectionItemTypeToItemIdMap[T]>) => Promise<import("./actions/selectionTree.action.types").AddItemsResponse<T>>;
44
41
  createGroup: (args: {
45
42
  groupId?: string;
46
43
  label: string;
@@ -87,6 +84,15 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
87
84
  label: string;
88
85
  items: Map<import("../..").GlobalSelectionTypes.ItemIdString, {
89
86
  id: {
87
+ x: number;
88
+ y: number;
89
+ z: number;
90
+ name: string;
91
+ description: string | undefined;
92
+ instCode: string;
93
+ plantCode: string;
94
+ plantNo: string;
95
+ } | {
90
96
  workOrderId: string;
91
97
  } | {
92
98
  instCode: string;
@@ -103,6 +109,37 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
103
109
  measuringPointId: string;
104
110
  };
105
111
  type: import("../..").GlobalSelectionItemType;
112
+ relatedTo?: {
113
+ id: {
114
+ x: number;
115
+ y: number;
116
+ z: number;
117
+ name: string;
118
+ description: string | undefined;
119
+ instCode: string;
120
+ plantCode: string;
121
+ plantNo: string;
122
+ } | {
123
+ workOrderId: string;
124
+ } | {
125
+ instCode: string;
126
+ tagNo: string;
127
+ } | {
128
+ internalTagType: import("../..").PdmsInternalTagType;
129
+ plantNo: string;
130
+ plantCode: string;
131
+ instCode: string;
132
+ tagNo: string;
133
+ } | {
134
+ equipmentId: string;
135
+ } | {
136
+ measuringPointId: string;
137
+ } | {
138
+ key: string;
139
+ value: string;
140
+ };
141
+ type: import("../..").RelatedToItemType;
142
+ }[] | undefined;
106
143
  }>;
107
144
  }[];
108
145
  groupId: Guid;
@@ -1,16 +1,18 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from '../../globalSelectionStore/globalSelectionStore.types';
2
+ import { GlobalSelectionItemType, GlobalSelectionTypes, RelatedToItem, SelectionItemTypeToItemIdMap } from '../../globalSelectionStore/globalSelectionStore.types';
3
3
  import { AddItemArgs, AddItemsResponse, SelectionTreeActionResult } from './actions/selectionTree.action.types';
4
4
  export declare enum GlobalSelectionCategoryId {
5
5
  Tags = "DEFAULT_TAG_LIST_ID",
6
6
  WorkOrders = "DEFAULT_WORK_ORDER_LIST_ID",
7
7
  Equipments = "DEFAULT_EQUIPMENT_LIST_ID",
8
- MeasuringPoints = "DEFAULT_MEASURING_POINT_LIST_ID"
8
+ MeasuringPoints = "DEFAULT_MEASURING_POINT_LIST_ID",
9
+ Coordinates = "DEFAULT_COORDINATE_LIST_ID"
9
10
  }
10
11
  export declare const globalSelectionDefaultGroupId: Guid;
11
12
  export type SelectionTreeItem<T extends GlobalSelectionItemType> = {
12
13
  readonly id: SelectionItemTypeToItemIdMap[T];
13
14
  readonly type: T;
15
+ readonly relatedTo?: RelatedToItem[];
14
16
  };
15
17
  export interface SelectionBase {
16
18
  readonly groupId: Guid;
@@ -39,10 +41,7 @@ export interface SelectionTreeStore extends SelectionTreeData {
39
41
  groupId?: Guid;
40
42
  useDefaultSelectionTypeColors?: boolean;
41
43
  }) => Promise<void>;
42
- addTags: (args: AddItemArgs<GlobalSelectionTypes.TagId>) => AddTagsReturnType;
43
- addWorkOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => AddWorkOrdersReturnType;
44
- addEquipments: (args: AddItemArgs<GlobalSelectionTypes.EquipmentId>) => AddEquipmentsReturnType;
45
- addMeasuringPoints: (args: AddItemArgs<GlobalSelectionTypes.MeasuringPointId>) => AddMeasuringPointsReturnType;
44
+ addItemsByType: <T extends GlobalSelectionItemType>(itemType: T, args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>) => Promise<AddItemsResponse<T>>;
46
45
  createGroup: (args: {
47
46
  groupId?: string;
48
47
  label: string;
@@ -89,7 +88,3 @@ export declare namespace SelectionTreeTypes {
89
88
  type ActionResult = SelectionTreeActionResult;
90
89
  type Item = SelectionTreeItem<GlobalSelectionItemType>;
91
90
  }
92
- export type AddTagsReturnType = Promise<AddItemsResponse<GlobalSelectionItemType.Tag>>;
93
- export type AddWorkOrdersReturnType = Promise<AddItemsResponse<GlobalSelectionItemType.WorkOrder>>;
94
- export type AddEquipmentsReturnType = Promise<AddItemsResponse<GlobalSelectionItemType.Equipment>>;
95
- export type AddMeasuringPointsReturnType = Promise<AddItemsResponse<GlobalSelectionItemType.MeasuringPoint>>;
@@ -0,0 +1,3 @@
1
+ import { GlobalSelectionItemType } from '../globalSelectionStore/globalSelectionStore.types';
2
+ import type { SelectionItemTypeStrategy } from './selectionItemTypeStrategy.types';
3
+ export declare const coordinateSelectionStrategy: SelectionItemTypeStrategy<GlobalSelectionItemType.Coordinate>;
@@ -18,6 +18,8 @@ export interface SelectionItemTypeStrategy<T extends GlobalSelectionItemType> {
18
18
  idsEqual(itemA: SelectionItemTypeToItemIdMap[T], itemB: SelectionItemTypeToItemIdMap[T]): boolean;
19
19
  /** Create a placeholder item for loading state */
20
20
  createNullItem(itemId: SelectionItemTypeToItemIdMap[T]): GlobalSelectionItemTypeToDataMap[T];
21
+ /** Extract the canonical ItemId from a fetched data object. Used as a type-safe Map key. */
22
+ getItemId(data: GlobalSelectionItemTypeToDataMap[T]): SelectionItemTypeToItemIdMap[T];
21
23
  /**
22
24
  * Resolve items synchronously from the ID alone — no loading state, no API call.
23
25
  * Only implement when item data is embedded in the ID itself (e.g. PDMS tags).
@@ -1,5 +1,5 @@
1
1
  import { EchoHubPlant } from '../../types/echoHubPlant';
2
2
  import { ModelPermissions } from '../../types/modelPermissions';
3
3
  export declare function getPlantsInfo(instCode?: string): Promise<EchoHubPlant[]>;
4
- export declare function check3dPermissionForPlant(plantCode: string): Promise<ModelPermissions>;
4
+ export declare function check3dPermissionForPlant(plantCode: string): Promise<boolean>;
5
5
  export declare function getPermitted3dModels(): Promise<ModelPermissions>;
@@ -9,7 +9,6 @@ export interface EchoView extends EchoViewBaseItem {
9
9
  readonly tagNo: string | undefined;
10
10
  readonly search: string | undefined;
11
11
  readonly skipOnboarding: boolean | undefined;
12
- readonly useMaintenanceDevData: boolean | undefined;
13
12
  readonly syncSettings: EchoViewSyncSettings | undefined;
14
13
  readonly ecmPdfInspectionTool: EchoViewEcmPdfInspectionToolConfig | undefined;
15
14
  readonly echo3D: Record<string, unknown> | undefined;
@@ -46,8 +46,8 @@ export declare function allPlantCodesOnInstallation(instCode: string): Promise<s
46
46
  * Method for checking a users access to a given installation
47
47
  *
48
48
  * @export
49
- * @param {string} instCode installation code to check access for
50
- * @return {*} {Promise<boolean>} returns whether the user has access to that given installation
49
+ * @param instCode installation code to check access for
50
+ * @return returns whether the user has access to one or more 3d models on the given installation
51
51
  */
52
52
  export declare function check3dPermissionOnInstallation(instCode: string): Promise<boolean>;
53
53
  /**
@@ -1,6 +0,0 @@
1
- import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
- /**
3
- * Returns with the stored Tags from the global selection store
4
- * @returns {GlobalSelectionTypes.TagItem[]} Array of Tags with some global selection meta data.
5
- */
6
- export declare function useGlobalSelectionTags(): GlobalSelectionTypes.TagItem[];
@@ -1,6 +0,0 @@
1
- import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
- /**
3
- * Returns with the stored Work Orders from the global selection store
4
- * @returns {GlobalSelectionTypes.WorkOrderItem[]} Array of Work Orders
5
- */
6
- export declare function useGlobalSelectionWorkOrders(): GlobalSelectionTypes.WorkOrderItem[];
@@ -1,2 +0,0 @@
1
- import { GlobalSelectionItemType } from '../../../globalSelectionStore/globalSelectionStore.types';
2
- export declare const addEquipmentsAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<import("../../../globalSelectionStore/globalSelectionStore.types").GlobalSelectionTypes.EquipmentId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Equipment>>;
@@ -1,2 +0,0 @@
1
- import { GlobalSelectionItemType } from '../../../globalSelectionStore/globalSelectionStore.types';
2
- export declare const addMeasuringPointsAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<import("../../../globalSelectionStore/globalSelectionStore.types").GlobalSelectionTypes.MeasuringPointId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.MeasuringPoint>>;
@@ -1,2 +0,0 @@
1
- import { GlobalSelectionItemType } from '../../../globalSelectionStore/globalSelectionStore.types';
2
- export declare const addTagsAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<import("../../../globalSelectionStore/globalSelectionStore.types").GlobalSelectionTypes.TagId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Tag>>;
@@ -1,2 +0,0 @@
1
- import { GlobalSelectionItemType } from '../../../globalSelectionStore/globalSelectionStore.types';
2
- export declare const addWorkOrdersAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<import("../../../globalSelectionStore/globalSelectionStore.types").GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.WorkOrder>>;
@@ -1,42 +0,0 @@
1
- import { ResultArray } from '@equinor/echo-search';
2
- import { GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from '../../../globalSelectionStore/globalSelectionStore.types';
3
- type ListCreatorParams<T extends GlobalSelectionItemType> = {
4
- nullItemGenerator: (itemId: SelectionItemTypeToItemIdMap[T]) => GlobalSelectionItemTypeToDataMap[T];
5
- };
6
- /**
7
- * Service responsible for managing the registration and execution of list creators and API loaders
8
- * for different global selection item types within the selection tree.
9
- *
10
- * Mainly used for loading and setting huge amount of data when loading selections from API and or from disk.
11
- *
12
- * This service allows dynamic registration of functions that can create selection lists or fetch
13
- * and update selection data for specific item types. It provides methods to register these handlers,
14
- * create lists, and fetch/store data by type.
15
- *
16
- * @remarks
17
- * - `registerListCreator` associates a list creation function with a specific item type.
18
- * - `registerApiLoader` associates an asynchronous data loader with a specific item type.
19
- * - `createListByType` uses the registered creator to generate a selection list for the given type and item IDs.
20
- * - `fetchAndStoreDataByType` uses the registered loader to fetch and update data for the given type and item IDs.
21
- *
22
- * @template T - The global selection item type.
23
- */
24
- declare class SelectionTreeLoaderService {
25
- private listCreators;
26
- private apiLoaders;
27
- registerGroupCreator<T extends GlobalSelectionItemType>(type: T, params: ListCreatorParams<T>): void;
28
- registerApiLoader<T extends GlobalSelectionItemType>(type: T, fetchFunction: (itemIds: SelectionItemTypeToItemIdMap[T][]) => Promise<{
29
- result: ResultArray<GlobalSelectionItemTypeToDataMap[T]>;
30
- itemIdsUsed: SelectionItemTypeToItemIdMap[T][];
31
- }[]>): void;
32
- createListByType<T extends GlobalSelectionItemType>(type: T, itemIds: SelectionItemTypeToItemIdMap[T][]): GlobalSelectionTypes.List<T>;
33
- fetchAndStoreDataByType<T extends GlobalSelectionItemType>(type: T, itemIds: SelectionItemTypeToItemIdMap[T][]): Promise<void>;
34
- }
35
- /**
36
- * Service responsible for managing the registration and execution of list creators and API loaders
37
- * for different global selection item types within the selection tree.
38
- *
39
- * Used for loading and setting huge amount of data when loading selections from API and or from disk.
40
- */
41
- export declare const selectionTreeLoader: SelectionTreeLoaderService;
42
- export {};