@dative-gpi/foundation-core-services 0.0.53 → 0.0.54
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/composables/hubs/useAlertsHub.ts +3 -4
- package/composables/hubs/useConnectivityAlertsHub.ts +3 -4
- package/composables/hubs/useDeviceConnectivitiesHub.ts +1 -2
- package/composables/hubs/useDeviceStatusesHub.ts +1 -2
- package/composables/services/useAlerts.ts +8 -5
- package/composables/services/useCustomPropertyValues.ts +6 -37
- package/composables/services/useDeviceOrganisations.ts +15 -8
- package/composables/services/useGroups.ts +8 -3
- package/composables/services/useOrganisations.ts +8 -3
- package/composables/services/useUserOrganisations.ts +18 -5
- package/package.json +4 -4
|
@@ -2,7 +2,6 @@ import { onMounted, ref, watch } from "vue";
|
|
|
2
2
|
|
|
3
3
|
import * as signalR from "@microsoft/signalr";
|
|
4
4
|
|
|
5
|
-
import { useNotifyAlert, useNotifyRemoveAlert } from "../services/useAlerts";
|
|
6
5
|
import { ALERTS_HUB_URL } from "../../config/urls";
|
|
7
6
|
import { HUBS } from "../../config/literals";
|
|
8
7
|
|
|
@@ -24,9 +23,9 @@ export const useAlertsHub = () => {
|
|
|
24
23
|
await connection.value.start();
|
|
25
24
|
}
|
|
26
25
|
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
27
|
-
connection.value.on(HUBS.CREATE_ALERT, (alertId: string) => useNotifyAlert().fetch(alertId));
|
|
28
|
-
connection.value.on(HUBS.UPDATE_ALERT, (alertId: string) => useNotifyAlert().fetch(alertId));
|
|
29
|
-
connection.value.on(HUBS.REMOVE_ALERT, (alertId: string) => useNotifyRemoveAlert().remove(alertId));
|
|
26
|
+
// connection.value.on(HUBS.CREATE_ALERT, (alertId: string) => useNotifyAlert().fetch(alertId));
|
|
27
|
+
// connection.value.on(HUBS.UPDATE_ALERT, (alertId: string) => useNotifyAlert().fetch(alertId));
|
|
28
|
+
// connection.value.on(HUBS.REMOVE_ALERT, (alertId: string) => useNotifyRemoveAlert().remove(alertId));
|
|
30
29
|
});
|
|
31
30
|
|
|
32
31
|
initialized = true;
|
|
@@ -2,7 +2,6 @@ import { onMounted, ref, watch } from "vue";
|
|
|
2
2
|
|
|
3
3
|
import * as signalR from "@microsoft/signalr";
|
|
4
4
|
|
|
5
|
-
import { useNotifyConnectivityAlert, useNotifyRemoveConnectivityAlert } from "../services/useConnectivityAlerts";
|
|
6
5
|
import { CONNECTIVITY_ALERTS_HUB_URL } from "../../config/urls";
|
|
7
6
|
import { HUBS } from "../../config/literals";
|
|
8
7
|
|
|
@@ -24,9 +23,9 @@ export const useConnectivityAlertsHub = () => {
|
|
|
24
23
|
await connection.value.start();
|
|
25
24
|
}
|
|
26
25
|
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
27
|
-
connection.value.on(HUBS.CREATE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyConnectivityAlert().fetch(connectivityAlertId));
|
|
28
|
-
connection.value.on(HUBS.UPDATE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyConnectivityAlert().fetch(connectivityAlertId));
|
|
29
|
-
connection.value.on(HUBS.REMOVE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyRemoveConnectivityAlert().remove(connectivityAlertId));
|
|
26
|
+
// connection.value.on(HUBS.CREATE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyConnectivityAlert().fetch(connectivityAlertId));
|
|
27
|
+
// connection.value.on(HUBS.UPDATE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyConnectivityAlert().fetch(connectivityAlertId));
|
|
28
|
+
// connection.value.on(HUBS.REMOVE_CONNECTIVITY_ALERT, (connectivityAlertId: string) => useNotifyRemoveConnectivityAlert().remove(connectivityAlertId));
|
|
30
29
|
});
|
|
31
30
|
|
|
32
31
|
initialized = true;
|
|
@@ -2,7 +2,6 @@ import { onMounted, ref, watch } from "vue";
|
|
|
2
2
|
|
|
3
3
|
import * as signalR from "@microsoft/signalr";
|
|
4
4
|
|
|
5
|
-
import { useNotifyDeviceConnectivity } from "../services/useDeviceConnectivities";
|
|
6
5
|
import { DEVICE_CONNECTIVITIES_HUB_URL } from "../../config/urls";
|
|
7
6
|
import { HUBS } from "../../config/literals";
|
|
8
7
|
|
|
@@ -24,7 +23,7 @@ export const useDeviceConnectivitiesHub = () => {
|
|
|
24
23
|
await connection.value.start();
|
|
25
24
|
}
|
|
26
25
|
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
27
|
-
connection.value.on(HUBS.UPDATE_DEVICE_CONNECTIVITY, (deviceOrganisationId: string) => useNotifyDeviceConnectivity().fetch(deviceOrganisationId));
|
|
26
|
+
// connection.value.on(HUBS.UPDATE_DEVICE_CONNECTIVITY, (deviceOrganisationId: string) => useNotifyDeviceConnectivity().fetch(deviceOrganisationId));
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
initialized = true;
|
|
@@ -2,7 +2,6 @@ import { onMounted, ref, watch } from "vue";
|
|
|
2
2
|
|
|
3
3
|
import * as signalR from "@microsoft/signalr";
|
|
4
4
|
|
|
5
|
-
import { useNotifyDeviceStatus } from "../services/useDeviceStatuses";
|
|
6
5
|
import { DEVICE_STATUSES_HUB_URL } from "../../config/urls";
|
|
7
6
|
import { HUBS } from "../../config/literals";
|
|
8
7
|
|
|
@@ -24,7 +23,7 @@ export const useDeviceStatusesHub = () => {
|
|
|
24
23
|
await connection.value.start();
|
|
25
24
|
}
|
|
26
25
|
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
27
|
-
connection.value.on(HUBS.UPDATE_DEVICE_STATUS, (deviceOrganisationId: string) => useNotifyDeviceStatus().fetch(deviceOrganisationId));
|
|
26
|
+
// connection.value.on(HUBS.UPDATE_DEVICE_STATUS, (deviceOrganisationId: string) => useNotifyDeviceStatus().fetch(deviceOrganisationId));
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
initialized = true;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { AlertDetails, AlertDetailsDTO, AlertFilters, AlertInfos, AlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
@@ -9,11 +7,16 @@ const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("a
|
|
|
9
7
|
factory.addGet(ALERT_URL),
|
|
10
8
|
factory.addGetMany<AlertInfosDTO, AlertInfos, AlertFilters>(ALERTS_URL, AlertInfos),
|
|
11
9
|
factory.addRemove(ALERT_URL),
|
|
12
|
-
factory.
|
|
13
|
-
|
|
10
|
+
factory.addNotify(notify => ({
|
|
11
|
+
...ServiceFactory.addCustom("acknowledge", (axios, alertId: string) => axios.patch(ALERT_URL(alertId)), (dto: AlertDetailsDTO) => {
|
|
12
|
+
const result = new AlertDetails(dto);
|
|
13
|
+
notify.notify("update", result);
|
|
14
|
+
return result;
|
|
15
|
+
})
|
|
16
|
+
}))
|
|
14
17
|
));
|
|
15
18
|
|
|
16
19
|
export const useAlert = ComposableFactory.get(AlertServiceFactory);
|
|
17
20
|
export const useAlerts = ComposableFactory.getMany(AlertServiceFactory);
|
|
18
21
|
export const useRemoveAlert = ComposableFactory.remove(AlertServiceFactory);
|
|
19
|
-
export const useAcknowledgeAlert = ComposableFactory.custom(AlertServiceFactory
|
|
22
|
+
export const useAcknowledgeAlert = ComposableFactory.custom(AlertServiceFactory.acknowledge);
|
|
@@ -1,41 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { CustomPropertyValueDetails, CustomPropertyValueDetailsDTO, CustomPropertyValueInfos, CustomPropertyValueInfosDTO, PropertyEntity } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
1
|
+
import { CustomPropertyValueInfos, CustomPropertyValueInfosDTO, PropertyEntity } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
6
4
|
import { CUSTOM_PROPERTY_VALUES_URL } from "../../config/urls";
|
|
7
5
|
|
|
8
|
-
const CustomPropertyValueServiceFactory =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const response = await ServiceFactory.http.get(CUSTOM_PROPERTY_VALUES_URL(entity, entityId, code));
|
|
12
|
-
const result = response.data.map((dto: CustomPropertyValueInfosDTO) => new CustomPropertyValueInfos(dto));
|
|
13
|
-
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
}))
|
|
17
|
-
));
|
|
18
|
-
|
|
19
|
-
export const useCustomPropertyValues = () => {
|
|
20
|
-
const service = CustomPropertyValueServiceFactory();
|
|
21
|
-
|
|
22
|
-
const fetching = ref(false);
|
|
23
|
-
const fetched = ref<CustomPropertyValueInfos[] | null>(null);
|
|
24
|
-
|
|
25
|
-
const fetch = async (entity: PropertyEntity, entityId: string, code: string) => {
|
|
26
|
-
fetching.value = true;
|
|
27
|
-
try {
|
|
28
|
-
fetched.value = await service.getMany(entity, entityId, code);
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
fetching.value = false;
|
|
32
|
-
}
|
|
33
|
-
return fetched;
|
|
34
|
-
}
|
|
6
|
+
const CustomPropertyValueServiceFactory = {
|
|
7
|
+
...ServiceFactory.addCustom("getMany", (axios, entity: PropertyEntity, entityId: string, code: string) => axios.get(CUSTOM_PROPERTY_VALUES_URL(entity, entityId, code)), (dtos: CustomPropertyValueInfosDTO[]) => dtos.map((dto: CustomPropertyValueInfosDTO) => new CustomPropertyValueInfos(dto))),
|
|
8
|
+
};
|
|
35
9
|
|
|
36
|
-
|
|
37
|
-
fetching,
|
|
38
|
-
fetch,
|
|
39
|
-
fetched
|
|
40
|
-
}
|
|
41
|
-
}
|
|
10
|
+
export const useCustomPropertyValues = ComposableFactory.custom(CustomPropertyValueServiceFactory.getMany);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { ChangeDeviceOrganisationGroupDTO, ChangeDeviceOrganisationLocationDTO, CreateDeviceOrganisationDTO, DeviceOrganisationDetails, DeviceOrganisationDetailsDTO, DeviceOrganisationFilters, DeviceOrganisationInfos, DeviceOrganisationInfosDTO, UpdateDeviceOrganisationDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { ComposableFactory,
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
6
4
|
import { DEVICE_ORGANISATIONS_URL, DEVICE_ORGANISATION_URL, DEVICE_ORGANISATION_GROUP_URL, DEVICE_ORGANISATION_LOCATION_URL } from "../../config/urls";
|
|
7
5
|
|
|
@@ -11,9 +9,18 @@ const DeviceOrganisationServiceFactory = new ServiceFactory<DeviceOrganisationDe
|
|
|
11
9
|
factory.addCreate<CreateDeviceOrganisationDTO>(DEVICE_ORGANISATIONS_URL),
|
|
12
10
|
factory.addUpdate<UpdateDeviceOrganisationDTO>(DEVICE_ORGANISATION_URL),
|
|
13
11
|
factory.addRemove(DEVICE_ORGANISATION_URL),
|
|
14
|
-
factory.
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
factory.addNotify(notify => ({
|
|
13
|
+
...ServiceFactory.addCustom("changeGroup", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationGroupDTO) => axios.put(DEVICE_ORGANISATION_GROUP_URL(deviceOrganisationId), payload), (dto: DeviceOrganisationDetailsDTO) => {
|
|
14
|
+
const result = new DeviceOrganisationDetails(dto);
|
|
15
|
+
notify.notify("update", result);
|
|
16
|
+
return result;
|
|
17
|
+
}),
|
|
18
|
+
...ServiceFactory.addCustom("changeLocation", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationLocationDTO) => axios.put(DEVICE_ORGANISATION_LOCATION_URL(deviceOrganisationId), payload), (dto: DeviceOrganisationDetailsDTO) => {
|
|
19
|
+
const result = new DeviceOrganisationDetails(dto);
|
|
20
|
+
notify.notify("update", result);
|
|
21
|
+
return result;
|
|
22
|
+
})
|
|
23
|
+
}))
|
|
17
24
|
));
|
|
18
25
|
|
|
19
26
|
export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory);
|
|
@@ -21,5 +28,5 @@ export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisati
|
|
|
21
28
|
export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory);
|
|
22
29
|
export const useUpdateDeviceOrganisation = ComposableFactory.update(DeviceOrganisationServiceFactory);
|
|
23
30
|
export const useRemoveDeviceOrganisation = ComposableFactory.remove(DeviceOrganisationServiceFactory);
|
|
24
|
-
export const useChangeDeviceOrganisationGroup = ComposableFactory.custom(DeviceOrganisationServiceFactory
|
|
25
|
-
export const useChangeDeviceOrganisationLocation = ComposableFactory.custom(DeviceOrganisationServiceFactory
|
|
31
|
+
export const useChangeDeviceOrganisationGroup = ComposableFactory.custom(DeviceOrganisationServiceFactory.changeGroup);
|
|
32
|
+
export const useChangeDeviceOrganisationLocation = ComposableFactory.custom(DeviceOrganisationServiceFactory.changeLocation);
|
|
@@ -9,8 +9,13 @@ const GroupServiceFactory = new ServiceFactory<GroupDetailsDTO, GroupDetails>("g
|
|
|
9
9
|
factory.addCreate<CreateGroupDTO>(GROUPS_URL),
|
|
10
10
|
factory.addUpdate<UpdateGroupDTO>(GROUP_URL),
|
|
11
11
|
factory.addRemove(GROUP_URL),
|
|
12
|
-
factory.
|
|
13
|
-
|
|
12
|
+
factory.addNotify(notify => ({
|
|
13
|
+
...ServiceFactory.addCustom("changeParent", (axios, groupdId: string, payload: ChangeGroupParentDTO) => axios.put(GROUP_URL(groupdId), payload), (dto: GroupDetailsDTO) => {
|
|
14
|
+
const result = new GroupDetails(dto);
|
|
15
|
+
notify.notify("update", result);
|
|
16
|
+
return result;
|
|
17
|
+
})
|
|
18
|
+
}))
|
|
14
19
|
));
|
|
15
20
|
|
|
16
21
|
export const useGroup = ComposableFactory.get(GroupServiceFactory);
|
|
@@ -18,4 +23,4 @@ export const useGroups = ComposableFactory.getMany(GroupServiceFactory);
|
|
|
18
23
|
export const useCreateGroup = ComposableFactory.create(GroupServiceFactory);
|
|
19
24
|
export const useUpdateGroup = ComposableFactory.update(GroupServiceFactory);
|
|
20
25
|
export const useRemoveGroup = ComposableFactory.remove(GroupServiceFactory);
|
|
21
|
-
export const useChangeGroupParent = ComposableFactory.custom(GroupServiceFactory
|
|
26
|
+
export const useChangeGroupParent = ComposableFactory.custom(GroupServiceFactory.changeParent);
|
|
@@ -5,8 +5,13 @@ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
|
5
5
|
import { ORGANISATION_DASHBOARD_URL } from "../../config/urls";
|
|
6
6
|
|
|
7
7
|
const OrganisationServiceFactory = new ServiceFactory<OrganisationDetailsDTO, OrganisationDetails>("organisation", OrganisationDetails).create(factory => factory.build(
|
|
8
|
-
factory.
|
|
9
|
-
|
|
8
|
+
factory.addNotify(notify => ({
|
|
9
|
+
...ServiceFactory.addCustom("changeDashboard", (axios, payload: ChangeOrganisationDashboardDTO) => axios.put(ORGANISATION_DASHBOARD_URL(), payload), (dto: OrganisationDetailsDTO) => {
|
|
10
|
+
const result = new OrganisationDetails(dto);
|
|
11
|
+
notify.notify("update", result);
|
|
12
|
+
return result;
|
|
13
|
+
})
|
|
14
|
+
}))
|
|
10
15
|
));
|
|
11
16
|
|
|
12
|
-
export const useChangeDashboardOrganisation = ComposableFactory.custom(OrganisationServiceFactory
|
|
17
|
+
export const useChangeDashboardOrganisation = ComposableFactory.custom(OrganisationServiceFactory.changeDashboard);
|
|
@@ -9,15 +9,28 @@ const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetail
|
|
|
9
9
|
factory.addCreate<CreateUserOrganisationDTO>(USER_ORGANISATIONS_URL),
|
|
10
10
|
factory.addUpdate<UpdateUserOrganisationDTO>(USER_ORGANISATION_URL),
|
|
11
11
|
factory.addRemove(USER_ORGANISATION_URL),
|
|
12
|
-
|
|
13
|
-
factory.
|
|
14
|
-
|
|
12
|
+
ServiceFactory.addCustom("getCurrent", (axios) => axios.get(USER_ORGANISATION_CURRENT_URL()), (dto: UserOrganisationDetailsDTO) => new UserOrganisationDetails(dto)),
|
|
13
|
+
factory.addNotify(notify => ({
|
|
14
|
+
...ServiceFactory.addCustom("updateCurrent", (axios, payload: UpdateUserOrganisationDTO) => axios.post(USER_ORGANISATION_CURRENT_URL(), payload), (dto: UserOrganisationDetailsDTO) => {
|
|
15
|
+
const result = new UserOrganisationDetails(dto)
|
|
16
|
+
notify.notify("update", result);
|
|
17
|
+
return result;
|
|
18
|
+
}),
|
|
19
|
+
}))
|
|
15
20
|
));
|
|
16
21
|
|
|
22
|
+
export const useTrackUserOrganisation = ComposableFactory.track(UserOrganisationServiceFactory);
|
|
23
|
+
|
|
17
24
|
export const useUserOrganisation = ComposableFactory.get(UserOrganisationServiceFactory);
|
|
18
25
|
export const useUserOrganisations = ComposableFactory.getMany(UserOrganisationServiceFactory);
|
|
19
26
|
export const useCreateUserOrganisation = ComposableFactory.create(UserOrganisationServiceFactory);
|
|
20
27
|
export const useUpdateUserOrganisation = ComposableFactory.update(UserOrganisationServiceFactory);
|
|
21
28
|
export const useRemoveUserOrganisation = ComposableFactory.remove(UserOrganisationServiceFactory);
|
|
22
|
-
export const useCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory,
|
|
23
|
-
|
|
29
|
+
export const useCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory.getCurrent, () => {
|
|
30
|
+
const { track } = useTrackUserOrganisation();
|
|
31
|
+
|
|
32
|
+
return (userOrganisation) => {
|
|
33
|
+
track(userOrganisation);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export const useUpdateCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory.updateCurrent);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.54",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/bones-ui": "^0.0.
|
|
14
|
-
"@dative-gpi/foundation-core-domain": "0.0.
|
|
13
|
+
"@dative-gpi/bones-ui": "^0.0.70",
|
|
14
|
+
"@dative-gpi/foundation-core-domain": "0.0.54",
|
|
15
15
|
"@microsoft/signalr": "^8.0.0",
|
|
16
16
|
"vue": "^3.2.0",
|
|
17
17
|
"vue-router": "^4.2.5"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "391503e595cd9d731fca14b5bb2d3a10b6efee95"
|
|
20
20
|
}
|