@dative-gpi/foundation-core-services 1.0.128 → 1.0.130-maps2

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.
@@ -18,6 +18,7 @@ export * from "./useDataCategories";
18
18
  export * from "./useDataDefinitions";
19
19
  export * from "./useDataTables";
20
20
  export * from "./useDeviceConnectivities";
21
+ export * from "./useDeviceDataDefinitions";
21
22
  export * from "./useDeviceExplorerElements";
22
23
  export * from "./useDeviceOrganisations";
23
24
  export * from "./useDeviceStatuses";
@@ -0,0 +1,11 @@
1
+ import { DeviceDataDefinitionInfos, type DeviceDataDefinitionInfosDTO, type DeviceDataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
2
+ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
3
+
4
+ import { DEVICE_DATA_DEFINITIONS_URL } from "../../config";
5
+
6
+ const DeviceDataDefinitionServiceFactory = new ServiceFactory<DeviceDataDefinitionInfosDTO, DeviceDataDefinitionInfos>("deviceDataDefinition", DeviceDataDefinitionInfos).create(factory => factory.build(
7
+ factory.addGetMany<DeviceDataDefinitionInfosDTO, DeviceDataDefinitionInfos, DeviceDataDefinitionFilters>(DEVICE_DATA_DEFINITIONS_URL, DeviceDataDefinitionInfos),
8
+ factory.addNotify()
9
+ ));
10
+
11
+ export const useDeviceDataDefinitions = ComposableFactory.getMany(DeviceDataDefinitionServiceFactory);
@@ -2,7 +2,6 @@ import { ref } from "vue";
2
2
 
3
3
  import { DeviceExplorerElementDetails, type DeviceExplorerElementDetailsDTO, type DeviceExplorerElementFilters, DeviceExplorerElementInfos, type DeviceExplorerElementInfosDTO, type DeviceOrganisationDetails, type GroupDetails } from "@dative-gpi/foundation-core-domain/models";
4
4
  import { type AddOrUpdateCallback, type DeleteCallback, type NotifyEvent, onCollectionChanged } from "@dative-gpi/bones-ui";
5
- import { fromDeviceOrganisation, fromGroup } from "@dative-gpi/foundation-shared-domain/tools";
6
5
  import { ServiceFactory } from "@dative-gpi/bones-ui/core";
7
6
 
8
7
  import { DEVICE_EXPLORER_ELEMENTS_URL } from "../../config/urls";
@@ -57,7 +56,7 @@ export const useDeviceExplorerElements = () => {
57
56
  switch(ev) {
58
57
  case "add":
59
58
  case "update":
60
- (onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, fromDeviceOrganisation(el));
59
+ (onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, DeviceExplorerElementInfos.fromDeviceOrganisation(el));
61
60
  break;
62
61
  case "delete":
63
62
  (onCollectionChangedCustom as DeleteCallback)(ev, el);
@@ -69,7 +68,7 @@ export const useDeviceExplorerElements = () => {
69
68
  switch(ev) {
70
69
  case "add":
71
70
  case "update":
72
- (onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, fromGroup(el));
71
+ (onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, DeviceExplorerElementInfos.fromGroup(el));
73
72
  break;
74
73
  case "delete":
75
74
  (onCollectionChangedCustom as DeleteCallback)(ev, el);
@@ -24,7 +24,8 @@ const DeviceOrganisationServiceFactory = new ServiceFactory<DeviceOrganisationDe
24
24
  const result = new DeviceOrganisationDetails(dto);
25
25
  notifyService.notify("update", result);
26
26
  return result;
27
- })
27
+ }),
28
+ notifyReset: () => notifyService.notify("reset")
28
29
  }))
29
30
  ));
30
31
 
@@ -64,6 +65,8 @@ const trackDeviceOrganisations = () => {
64
65
 
65
66
  export const useSubscribeToDeviceOrganisations = ComposableFactory.subscribe(DeviceOrganisationServiceFactory);
66
67
 
68
+ export const resetDeviceOrganisations = DeviceOrganisationServiceFactory.notifyReset;
69
+
67
70
  export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
68
71
  export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisationServiceFactory, trackDeviceOrganisations);
69
72
  export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
@@ -3,11 +3,30 @@ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
3
3
 
4
4
  import { LOCATIONS_URL, LOCATION_URL } from "../../config/urls";
5
5
 
6
+ import { resetDeviceOrganisations } from "./useDeviceOrganisations";
7
+
6
8
  const LocationServiceFactory = new ServiceFactory<LocationDetailsDTO, LocationDetails>("location", LocationDetails)
7
9
  .createComplete<LocationInfos, LocationInfosDTO, CreateLocationDTO, UpdateLocationDTO, LocationFilters>(LOCATIONS_URL, LOCATION_URL, LocationInfos);
8
10
 
11
+ const updateLocation = ComposableFactory.update(LocationServiceFactory);
12
+
9
13
  export const useLocation = ComposableFactory.get(LocationServiceFactory);
10
14
  export const useLocations = ComposableFactory.getMany(LocationServiceFactory);
11
15
  export const useCreateLocation = ComposableFactory.create(LocationServiceFactory);
12
- export const useUpdateLocation = ComposableFactory.update(LocationServiceFactory);
13
- export const useRemoveLocation = ComposableFactory.remove(LocationServiceFactory);
16
+ export const useRemoveLocation = ComposableFactory.remove(LocationServiceFactory);
17
+
18
+ export const useUpdateLocation = () => {
19
+ const { update, updated, updating } = updateLocation();
20
+
21
+ const actualUpdate = async (...params: Parameters<typeof update>) => {
22
+ const result = await update(...params);
23
+ resetDeviceOrganisations();
24
+ return result;
25
+ }
26
+
27
+ return {
28
+ update: actualUpdate,
29
+ updated,
30
+ updating
31
+ }
32
+ }
@@ -0,0 +1,3 @@
1
+ import { CORE_URL } from "./base";
2
+
3
+ export const DEVICE_DATA_DEFINITIONS_URL = () => `${CORE_URL()}/device-data-definitions`;
@@ -16,6 +16,7 @@ export * from "./dashboards";
16
16
  export * from "./dataCategories";
17
17
  export * from "./dataDefinitions";
18
18
  export * from "./deviceConnectivities";
19
+ export * from "./deviceDataDefinitions";
19
20
  export * from "./deviceOrganisations";
20
21
  export * from "./deviceExplorerElements";
21
22
  export * from "./deviceStatuses";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-services",
3
3
  "sideEffects": false,
4
- "version": "1.0.128",
4
+ "version": "1.0.130-maps2",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,7 +10,7 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.128"
13
+ "@dative-gpi/foundation-core-domain": "1.0.130-maps2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -18,5 +18,5 @@
18
18
  "vue": "^3.4.38",
19
19
  "vue-router": "^4.3.0"
20
20
  },
21
- "gitHead": "ca2de0b5abd0fb4f1fdfaafbc4267182ab609336"
21
+ "gitHead": "a0739b48282166f721cf6c2376a430e4690d92ef"
22
22
  }