@equinor/echo-framework 5.0.0 → 6.0.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 (24) hide show
  1. package/index.cjs.js +2 -2
  2. package/package.json +6 -6
  3. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +28 -28
  4. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +18 -0
  5. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +12 -12
  6. package/src/lib/feature/globalSelection/hooks/useIsInGlobalSelection.d.ts +6 -1
  7. package/src/lib/feature/globalSelection/index.d.ts +1 -5
  8. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItems.action.d.ts +2 -2
  9. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItemsByType.action.d.ts +15 -0
  10. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/initialData.d.ts +0 -6
  11. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.load.utils.d.ts +1 -1
  12. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.api.types.d.ts +7 -1
  13. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +24 -5
  14. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +7 -9
  15. package/src/lib/feature/globalSelection/strategies/selectionItemTypeStrategy.types.d.ts +2 -0
  16. package/src/lib/services/api/api-plantinfo.d.ts +1 -1
  17. package/src/lib/utils/plantInfo.d.ts +2 -2
  18. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionTags.d.ts +0 -6
  19. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionWorkOrders.d.ts +0 -6
  20. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addEquipments.action.d.ts +0 -2
  21. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addMeasuringPoints.action.d.ts +0 -2
  22. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTags.action.d.ts +0 -2
  23. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +0 -2
  24. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTreeLoader.service.d.ts +0 -42
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 5.0.0 < 6.0.0",
6
- "@equinor/echo-components": ">= 5.0.0 < 6.0.0",
7
- "@equinor/echo-core": ">= 5.0.0 < 6.0.0",
8
- "@equinor/echo-search": ">= 5.0.0 < 6.0.0",
9
- "@equinor/echo-utils": ">= 5.0.0 < 6.0.0",
5
+ "@equinor/echo-base": ">= 6.0.0 < 7.0.0",
6
+ "@equinor/echo-components": ">= 6.0.0 < 7.0.0",
7
+ "@equinor/echo-core": ">= 6.0.0 < 7.0.0",
8
+ "@equinor/echo-search": ">= 6.0.0 < 7.0.0",
9
+ "@equinor/echo-utils": ">= 6.0.0 < 7.0.0",
10
10
  "@equinor/eds-core-react": "0.49.0",
11
11
  "@equinor/eds-icons": "0.22.0",
12
12
  "@equinor/eds-tokens": "2.1.0",
@@ -1,4 +1,6 @@
1
- import { GlobalSelectionTypes } from './globalSelectionStore/globalSelectionStore.types';
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from './globalSelectionStore/globalSelectionStore.types';
2
+ import { isPdmsTagInSelection } from './pdmsTag/pdmsTag.logic';
3
+ import { AddItemArgs } from './selectionMenu/selectionTreeStore/actions/selectionTree.action.types';
2
4
  import { GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionMenu/selectionTreeStore/selectionTree.store.types';
3
5
  export declare const globalSelectionApi: Readonly<{
4
6
  /**
@@ -75,31 +77,34 @@ export declare const globalSelectionApi: Readonly<{
75
77
  * - 'ItemsUpdated': Existing items were replaced with new tags.
76
78
  * - 'ItemsAdded': New tags were added to the existing items.
77
79
  */
78
- tags: (args: import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.TagId>) => import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddTagsReturnType;
79
80
  /**
80
- * Adds work orders to a specified list in the selection menu panel.
81
+ * Adds items of the given type to a specified list in the selection menu panel.
82
+ * This is the primary generic method. Per-type aliases (`tags`, `workOrders`, etc.) delegate to this.
81
83
  *
82
- * @param {Object} args - The arguments for adding work orders.
83
- * @param {Guid} args.groupId - Optional. The ID of the list to which the items should be added. If not provided, it will be added to the "Local Selection".
84
- * @param {Readonly<Readonly<GlobalSelectionTypes.WorkOrderId>[]>} args.items - An array of WorkOrderId objects representing the work orders to be added.
84
+ * @param {GlobalSelectionItemType} itemType - The type of items to add.
85
+ * @param {AddItemArgs} args - The arguments for adding items.
85
86
  */
86
- workOrders: (args: import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddWorkOrdersReturnType;
87
+ byType: <T extends GlobalSelectionItemType>(itemType: T, args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<T>>;
87
88
  /**
88
- * Adds equipments to a specified list in the selection menu panel.
89
- *
90
- * @param {Object} args - The arguments for adding equipments.
91
- * @param {Guid} args.groupId - Optional. The ID of the list to which the items should be added. If not provided, it will be added to the "Local Selection".
92
- * @param {Readonly<Readonly<GlobalSelectionTypes.EquipmentId>[]>} args.items - An array of EquipmentId objects representing the work orders to be added.
89
+ * @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.Tag, args)` instead.
90
+ * Tracked for removal once Echo3DWeb migrates: #447925
93
91
  */
94
- equipments: (args: import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.EquipmentId>) => import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddEquipmentsReturnType;
92
+ tags: (args: AddItemArgs<GlobalSelectionTypes.TagId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Tag>>;
95
93
  /**
96
- * Adds measuring points to a specified list in the selection menu panel.
97
- *
98
- * @param {Object} args - The arguments for adding measuring points.
99
- * @param {Guid} args.groupId - Optional. The ID of the list to which the items should be added. If not provided, it will be added to the "Local Selection".
100
- * @param {Readonly<Readonly<GlobalSelectionTypes.EquipmentId>[]>} args.items - An array of MeasuringPointId objects representing the work orders to be added.
94
+ * @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.WorkOrder, args)` instead.
95
+ * Tracked for removal once Echo3DWeb migrates: #447925
96
+ */
97
+ workOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.WorkOrder>>;
98
+ /**
99
+ * @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.Equipment, args)` instead.
100
+ * Tracked for removal once Echo3DWeb migrates: #447925
101
101
  */
102
- measuringPoints: (args: import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.MeasuringPointId>) => import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddMeasuringPointsReturnType;
102
+ equipments: (args: AddItemArgs<GlobalSelectionTypes.EquipmentId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Equipment>>;
103
+ /**
104
+ * @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.MeasuringPoint, args)` instead.
105
+ * Tracked for removal once Echo3DWeb migrates: #447925
106
+ */
107
+ measuringPoints: (args: AddItemArgs<GlobalSelectionTypes.MeasuringPointId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.MeasuringPoint>>;
103
108
  /**
104
109
  * Adds items to a specified list in the selection menu panel.
105
110
  *
@@ -128,11 +133,6 @@ export declare const globalSelectionApi: Readonly<{
128
133
  findGroupByLabel: (args: {
129
134
  label: string;
130
135
  }) => import("@equinor/echo-utils").Guid | undefined;
131
- /**
132
- * Retrieves a tag item from the selection by tagNo and instCode.
133
- * Returns undefined if the tag is not in the selection.
134
- */
135
- getTag: typeof getTag;
136
136
  };
137
137
  /**
138
138
  * Moves items, categories, or groups within the selection tree structure.
@@ -242,6 +242,10 @@ export declare const globalSelectionApi: Readonly<{
242
242
  * @returns {number} The total number of items in all categories of the given groups.
243
243
  */
244
244
  numberOfItemsInSelection: (groups?: SelectionTreeTypes.Group[]) => number;
245
+ /**
246
+ * Checks if a tag (by tagNo + instCode) is in the selection and is a PDMS tag.
247
+ */
248
+ isPdmsTagInSelection: typeof isPdmsTagInSelection;
245
249
  }>;
246
250
  /**
247
251
  * Removes all items from the selection menu panel.
@@ -263,8 +267,4 @@ export declare const globalSelectionApi: Readonly<{
263
267
  }>;
264
268
  declare function getStoreTagIds(): GlobalSelectionTypes.TagId[];
265
269
  declare function getStoreEquipmentIds(): GlobalSelectionTypes.EquipmentId[];
266
- declare function getTag(args: {
267
- readonly tagNo: string;
268
- readonly instCode: string;
269
- }): GlobalSelectionTypes.TagItem | undefined;
270
270
  export {};
@@ -23,6 +23,23 @@ export type SelectionItemTypeToItemIdMap = {
23
23
  [GlobalSelectionItemType.Equipment]: GlobalSelectionTypes.EquipmentId;
24
24
  [GlobalSelectionItemType.MeasuringPoint]: GlobalSelectionTypes.MeasuringPointId;
25
25
  };
26
+ /**
27
+ * CustomData is a flexible key-value pair type that can be used in the relatedTo field of selection tree items.
28
+ * It allows associating any arbitrary data with a selection item, as long as it follows the structure of having a string key and a string value.
29
+ * This is useful for scenarios where we want to link selection items to external systems or include additional metadata that doesn't fit into the predefined item types.
30
+ * Cannot be set as a top-level item in the global selection, it can only be used in relatedTo.
31
+ */
32
+ export interface CustomDataId {
33
+ readonly key: string;
34
+ readonly value: string;
35
+ }
36
+ /**
37
+ * Types allowed in relatedTo: all top-level types + CustomData (which is relatedTo-only).
38
+ */
39
+ export type RelatedToItemType = GlobalSelectionItemType | 'CustomData';
40
+ export type RelatedToItemTypeToIdMap = SelectionItemTypeToItemIdMap & {
41
+ readonly CustomData: CustomDataId;
42
+ };
26
43
  type GlobalSelectionList<T extends GlobalSelectionItemType> = {
27
44
  readonly items: Map<GlobalSelectionTypes.ItemIdString, GlobalSelectionGenericItem<T>>;
28
45
  };
@@ -109,6 +126,7 @@ export declare namespace GlobalSelectionTypes {
109
126
  */
110
127
  type TagId = StidTagId | PdmsTagId;
111
128
  type MeasuringPointId = Pick<GlobalSelectionMeasuringPointDto, 'measuringPointId'>;
129
+ type RelatedToItemId = WorkOrderId | EquipmentId | TagId | MeasuringPointId | CustomDataId;
112
130
  type ItemId = WorkOrderId | EquipmentId | TagId | MeasuringPointId;
113
131
  type ItemIdString = Brand<string, 'ItemIdString'>;
114
132
  type TagDto = GlobalSelectionTagDto;
@@ -1,31 +1,31 @@
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 { 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
+ /** Compares two global selection item IDs for equality using the registered strategy for their type. */
26
23
  idsEqual: typeof idsEqual;
24
+ /** Normalizes an `ItemId` to its canonical form via the registered strategy (e.g. trims whitespace, uppercases instCode). Preserves all properties including PDMS fields. */
27
25
  mapToId: typeof mapToId;
26
+ /** Returns the `GlobalSelectionItemType` enum value for a given `ItemId`. */
28
27
  mapIdToItemType: typeof mapIdToItemType;
28
+ /** 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
29
  itemIdToString: typeof itemIdToString;
30
30
  }>;
31
31
  /**
@@ -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,7 +1,7 @@
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
6
  export { useAreAllItemsVisible } from './hooks/useAreAllItemsVisible';
7
7
  export { useGlobalSelectionByItemId } from './hooks/useGlobalSelectionByItemId';
@@ -9,8 +9,6 @@ export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
9
9
  export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsByType';
10
10
  export { useGlobalSelectionItemsByTypeAsMap } from './hooks/useGlobalSelectionItemsByTypeAsMap';
11
11
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
12
- export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
13
- export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
14
12
  export { useIsInGlobalSelection } from './hooks/useIsInGlobalSelection';
15
13
  export { useItemGroupMembership } from './hooks/useItemGroupMembership';
16
14
  export { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
@@ -29,6 +27,4 @@ export { invalidateHistorySelectionQuery } from './selectionMenu/invalidateHisto
29
27
  export { saveEquipmentAsNewSelectionToApi } from './selectionMenu/selectionTreeStore/api/selectionTree.equipment';
30
28
  export { SelectionColorConflictDialog } from './selectionMenu/selectionTreeStore/colorConflictHandling/SelectionColorConflictDialog';
31
29
  export { simulatedSelectionTreeApiError } from './selectionMenu/selectionTreeStore/persist/devOnlySimulateOffline';
32
- export { isPdmsTagId } from './globalSelectionStore/itemIdTypeGuards';
33
- export { isPdmsTagInSelection } from './pdmsTag/pdmsTag.logic';
34
30
  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;
@@ -103,6 +100,28 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
103
100
  measuringPointId: string;
104
101
  };
105
102
  type: import("../..").GlobalSelectionItemType;
103
+ relatedTo?: {
104
+ id: {
105
+ workOrderId: string;
106
+ } | {
107
+ instCode: string;
108
+ tagNo: string;
109
+ } | {
110
+ internalTagType: import("../..").PdmsInternalTagType;
111
+ plantNo: string;
112
+ plantCode: string;
113
+ instCode: string;
114
+ tagNo: string;
115
+ } | {
116
+ equipmentId: string;
117
+ } | {
118
+ measuringPointId: string;
119
+ } | {
120
+ key: string;
121
+ value: string;
122
+ };
123
+ type: import("../..").RelatedToItemType;
124
+ }[] | undefined;
106
125
  }>;
107
126
  }[];
108
127
  groupId: Guid;
@@ -1,5 +1,5 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from '../../globalSelectionStore/globalSelectionStore.types';
2
+ import { GlobalSelectionItemType, GlobalSelectionTypes, RelatedToItemType, RelatedToItemTypeToIdMap, 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",
@@ -8,9 +8,14 @@ export declare enum GlobalSelectionCategoryId {
8
8
  MeasuringPoints = "DEFAULT_MEASURING_POINT_LIST_ID"
9
9
  }
10
10
  export declare const globalSelectionDefaultGroupId: Guid;
11
+ export interface RelatedToItem {
12
+ readonly id: RelatedToItemTypeToIdMap[RelatedToItemType];
13
+ readonly type: RelatedToItemType;
14
+ }
11
15
  export type SelectionTreeItem<T extends GlobalSelectionItemType> = {
12
16
  readonly id: SelectionItemTypeToItemIdMap[T];
13
17
  readonly type: T;
18
+ readonly relatedTo?: RelatedToItem[];
14
19
  };
15
20
  export interface SelectionBase {
16
21
  readonly groupId: Guid;
@@ -39,10 +44,7 @@ export interface SelectionTreeStore extends SelectionTreeData {
39
44
  groupId?: Guid;
40
45
  useDefaultSelectionTypeColors?: boolean;
41
46
  }) => 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;
47
+ addItemsByType: <T extends GlobalSelectionItemType>(itemType: T, args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>) => Promise<AddItemsResponse<T>>;
46
48
  createGroup: (args: {
47
49
  groupId?: string;
48
50
  label: string;
@@ -89,7 +91,3 @@ export declare namespace SelectionTreeTypes {
89
91
  type ActionResult = SelectionTreeActionResult;
90
92
  type Item = SelectionTreeItem<GlobalSelectionItemType>;
91
93
  }
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>>;
@@ -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>;
@@ -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 {};