@dative-gpi/foundation-core-services 0.0.54 → 0.0.56
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/index.ts +0 -1
- package/composables/services/useAlerts.ts +40 -4
- package/composables/services/useConnectivityAlerts.ts +42 -5
- package/composables/services/useDeviceConnectivities.ts +20 -4
- package/composables/services/useDeviceOrganisations.ts +60 -19
- package/composables/services/useDeviceStatuses.ts +20 -4
- package/composables/services/useUserOrganisations.ts +14 -9
- package/package.json +4 -4
- package/composables/hubs/index.ts +0 -4
- package/composables/hubs/useAlertsHub.ts +0 -50
- package/composables/hubs/useConnectivityAlertsHub.ts +0 -50
- package/composables/hubs/useDeviceConnectivitiesHub.ts +0 -48
- package/composables/hubs/useDeviceStatusesHub.ts +0 -48
package/composables/index.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { AlertDetails, AlertDetailsDTO, AlertFilters, AlertInfos, AlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
1
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
|
+
import { AlertDetails, AlertDetailsDTO, AlertFilters, AlertInfos, AlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
|
+
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import { HUBS } from "../../config/literals";
|
|
6
|
+
import { ALERTS_HUB_URL, ALERTS_URL, ALERT_URL } from "../../config/urls";
|
|
5
7
|
|
|
6
8
|
const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("alert", AlertDetails).create(factory => factory.build(
|
|
7
9
|
factory.addGet(ALERT_URL),
|
|
8
10
|
factory.addGetMany<AlertInfosDTO, AlertInfos, AlertFilters>(ALERTS_URL, AlertInfos),
|
|
9
11
|
factory.addRemove(ALERT_URL),
|
|
10
12
|
factory.addNotify(notify => ({
|
|
13
|
+
notifyCreate: (alert: AlertDetails) => notify.notify("add", alert),
|
|
14
|
+
notifyUpdate: (alert: AlertDetails) => notify.notify("update", alert),
|
|
15
|
+
notifyRemove: (alertId: string) => notify.notify("delete", alertId),
|
|
11
16
|
...ServiceFactory.addCustom("acknowledge", (axios, alertId: string) => axios.patch(ALERT_URL(alertId)), (dto: AlertDetailsDTO) => {
|
|
12
17
|
const result = new AlertDetails(dto);
|
|
13
18
|
notify.notify("update", result);
|
|
@@ -16,7 +21,38 @@ const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("a
|
|
|
16
21
|
}))
|
|
17
22
|
));
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
const useAlertsHub = HubFactory.create(ALERTS_HUB_URL,
|
|
25
|
+
(connection, { isWatched, hasWatchers }) => {
|
|
26
|
+
connection.on(HUBS.CREATE_ALERT, (alertId: string) => hasWatchers()
|
|
27
|
+
? AlertServiceFactory.get(alertId).then(AlertServiceFactory.notifyCreate)
|
|
28
|
+
: null);
|
|
29
|
+
connection.on(HUBS.UPDATE_ALERT, (alertId: string) => isWatched(alertId) || hasWatchers()
|
|
30
|
+
? AlertServiceFactory.get(alertId).then(AlertServiceFactory.notifyUpdate)
|
|
31
|
+
: null);
|
|
32
|
+
connection.on(HUBS.REMOVE_ALERT, (alertId: string) => hasWatchers()
|
|
33
|
+
? AlertServiceFactory.notifyRemove(alertId)
|
|
34
|
+
: null);
|
|
35
|
+
},
|
|
36
|
+
async (connection) => {
|
|
37
|
+
await connection.invoke(HUBS.SUBSCRIBE);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const useWatchAlerts = HubFactory.createWatcher(useAlertsHub);
|
|
42
|
+
|
|
43
|
+
export const useAlert = ComposableFactory.get(AlertServiceFactory, () => {
|
|
44
|
+
const { watchOne } = useWatchAlerts();
|
|
45
|
+
return (alert) => {
|
|
46
|
+
watchOne(alert.value.id)
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const useAlerts = ComposableFactory.getMany(AlertServiceFactory, () => {
|
|
51
|
+
const { watchMany } = useWatchAlerts();
|
|
52
|
+
return (_alert) => {
|
|
53
|
+
watchMany();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
21
57
|
export const useRemoveAlert = ComposableFactory.remove(AlertServiceFactory);
|
|
22
58
|
export const useAcknowledgeAlert = ComposableFactory.custom(AlertServiceFactory.acknowledge);
|
|
@@ -1,15 +1,52 @@
|
|
|
1
|
-
import { ConnectivityAlertDetails, ConnectivityAlertDetailsDTO, ConnectivityAlertFilters, ConnectivityAlertInfos, ConnectivityAlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
1
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
|
+
import { ConnectivityAlertDetails, ConnectivityAlertDetailsDTO, ConnectivityAlertFilters, ConnectivityAlertInfos, ConnectivityAlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
|
+
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
4
|
|
|
4
|
-
import { CONNECTIVITY_ALERTS_URL, CONNECTIVITY_ALERT_URL } from "../../config/urls";
|
|
5
|
+
import { CONNECTIVITY_ALERTS_HUB_URL, CONNECTIVITY_ALERTS_URL, CONNECTIVITY_ALERT_URL } from "../../config/urls";
|
|
6
|
+
import { HUBS } from "../../config/literals";
|
|
5
7
|
|
|
6
8
|
const ConnectivityAlertServiceFactory = new ServiceFactory<ConnectivityAlertDetailsDTO, ConnectivityAlertDetails>("connectivityAlert", ConnectivityAlertDetails).create(factory => factory.build(
|
|
7
9
|
factory.addGet(CONNECTIVITY_ALERT_URL),
|
|
8
10
|
factory.addGetMany<ConnectivityAlertInfosDTO, ConnectivityAlertInfos, ConnectivityAlertFilters>(CONNECTIVITY_ALERTS_URL, ConnectivityAlertInfos),
|
|
9
11
|
factory.addRemove(CONNECTIVITY_ALERT_URL),
|
|
10
|
-
factory.addNotify(
|
|
12
|
+
factory.addNotify(notify => ({
|
|
13
|
+
notifyCreate: (alert: ConnectivityAlertDetails) => notify.notify("add", alert),
|
|
14
|
+
notifyUpdate: (alert: ConnectivityAlertDetails) => notify.notify("update", alert),
|
|
15
|
+
notifyRemove: (alertId: string) => notify.notify("delete", alertId),
|
|
16
|
+
}))
|
|
11
17
|
));
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
const useConnectivityAlertsHub = HubFactory.create(CONNECTIVITY_ALERTS_HUB_URL,
|
|
20
|
+
(connection, { isWatched, hasWatchers }) => {
|
|
21
|
+
connection.on(HUBS.CREATE_CONNECTIVITY_ALERT, (alertId: string) => hasWatchers()
|
|
22
|
+
? ConnectivityAlertServiceFactory.get(alertId).then(ConnectivityAlertServiceFactory.notifyCreate)
|
|
23
|
+
: null);
|
|
24
|
+
connection.on(HUBS.UPDATE_CONNECTIVITY_ALERT, (alertId: string) => isWatched(alertId) || hasWatchers()
|
|
25
|
+
? ConnectivityAlertServiceFactory.get(alertId).then(ConnectivityAlertServiceFactory.notifyCreate)
|
|
26
|
+
: null);
|
|
27
|
+
connection.on(HUBS.REMOVE_CONNECTIVITY_ALERT, (alertId: string) => hasWatchers()
|
|
28
|
+
? ConnectivityAlertServiceFactory.notifyRemove(alertId)
|
|
29
|
+
: null);
|
|
30
|
+
},
|
|
31
|
+
async (connection) => {
|
|
32
|
+
await connection.invoke(HUBS.SUBSCRIBE);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const useWatchConnectivityAlerts = HubFactory.createWatcher(useConnectivityAlertsHub);
|
|
37
|
+
|
|
38
|
+
export const useConnectivityAlert = ComposableFactory.get(ConnectivityAlertServiceFactory, () => {
|
|
39
|
+
const { watchOne } = useWatchConnectivityAlerts();
|
|
40
|
+
return (alert) => {
|
|
41
|
+
watchOne(alert.value.id)
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const useConnectivityAlerts = ComposableFactory.getMany(ConnectivityAlertServiceFactory, () => {
|
|
46
|
+
const { watchMany } = useWatchConnectivityAlerts();
|
|
47
|
+
return (_alerts) => {
|
|
48
|
+
watchMany();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
15
52
|
export const useRemoveConnectivityAlert = ComposableFactory.remove(ConnectivityAlertServiceFactory);
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import { DeviceConnectivityDetails, DeviceConnectivityDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
1
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
|
+
import { DeviceConnectivityDetails, DeviceConnectivityDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
|
+
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
4
|
|
|
4
|
-
import { DEVICE_CONNECTIVITY_URL } from "../../config/urls";
|
|
5
|
+
import { DEVICE_CONNECTIVITIES_HUB_URL, DEVICE_CONNECTIVITY_URL } from "../../config/urls";
|
|
6
|
+
import { HUBS } from "../../config/literals";
|
|
5
7
|
|
|
6
8
|
const DeviceConnectivityServiceFactory = new ServiceFactory<DeviceConnectivityDetailsDTO, DeviceConnectivityDetails>("deviceConnectivity", DeviceConnectivityDetails).create(factory => factory.build(
|
|
7
9
|
factory.addGet(DEVICE_CONNECTIVITY_URL),
|
|
8
|
-
factory.addNotify(
|
|
10
|
+
factory.addNotify(notify => ({
|
|
11
|
+
notifyUpdate: (connectivity: DeviceConnectivityDetails) => notify.notify("update", connectivity)
|
|
12
|
+
}))
|
|
9
13
|
));
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
const useDeviceConnectivityHub = HubFactory.create(DEVICE_CONNECTIVITIES_HUB_URL,
|
|
16
|
+
(connection) => {
|
|
17
|
+
connection.on(HUBS.UPDATE_DEVICE_CONNECTIVITY,
|
|
18
|
+
(payload: DeviceConnectivityDetailsDTO) => DeviceConnectivityServiceFactory.notifyUpdate(new DeviceConnectivityDetails(payload)));
|
|
19
|
+
},
|
|
20
|
+
async (connection) => {
|
|
21
|
+
await connection.invoke(HUBS.SUBSCRIBE);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const useDeviceConnectivity = ComposableFactory.get(DeviceConnectivityServiceFactory);
|
|
26
|
+
export const useTrackDeviceConnectivity = ComposableFactory.track(DeviceConnectivityServiceFactory);
|
|
27
|
+
export const useWatchDeviceConnectivity = HubFactory.createWatcher(useDeviceConnectivityHub);
|
|
@@ -1,32 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "vue";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
+
import { ChangeDeviceOrganisationGroupDTO, ChangeDeviceOrganisationLocationDTO, CreateDeviceOrganisationDTO, DeviceOrganisationDetails, DeviceOrganisationDetailsDTO, DeviceOrganisationFilters, DeviceOrganisationInfos, DeviceOrganisationInfosDTO, UpdateDeviceOrganisationDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
4
|
|
|
4
5
|
import { DEVICE_ORGANISATIONS_URL, DEVICE_ORGANISATION_URL, DEVICE_ORGANISATION_GROUP_URL, DEVICE_ORGANISATION_LOCATION_URL } from "../../config/urls";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
import { useTrackDeviceStatuses, useWatchDeviceStatuses } from "./useDeviceStatuses";
|
|
8
|
+
import { useTrackDeviceConnectivity, useWatchDeviceConnectivity } from "./useDeviceConnectivities";
|
|
9
|
+
|
|
10
|
+
const DeviceOrganisationServiceFactory = new ServiceFactory<DeviceOrganisationDetailsDTO, DeviceOrganisationDetails>("deviceOrganisation", DeviceOrganisationDetails)
|
|
11
|
+
.create(factory => factory.build(
|
|
7
12
|
factory.addGet(DEVICE_ORGANISATION_URL),
|
|
8
13
|
factory.addGetMany<DeviceOrganisationInfosDTO, DeviceOrganisationInfos, DeviceOrganisationFilters>(DEVICE_ORGANISATIONS_URL, DeviceOrganisationInfos),
|
|
9
14
|
factory.addCreate<CreateDeviceOrganisationDTO>(DEVICE_ORGANISATIONS_URL),
|
|
10
15
|
factory.addUpdate<UpdateDeviceOrganisationDTO>(DEVICE_ORGANISATION_URL),
|
|
11
16
|
factory.addRemove(DEVICE_ORGANISATION_URL),
|
|
12
17
|
factory.addNotify(notify => ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
...ServiceFactory.addCustom("changeGroup", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationGroupDTO) => axios.put(DEVICE_ORGANISATION_GROUP_URL(deviceOrganisationId), payload), (dto: DeviceOrganisationDetailsDTO) => {
|
|
19
|
+
const result = new DeviceOrganisationDetails(dto);
|
|
20
|
+
notify.notify("update", result);
|
|
21
|
+
return result;
|
|
22
|
+
}),
|
|
23
|
+
...ServiceFactory.addCustom("changeLocation", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationLocationDTO) => axios.put(DEVICE_ORGANISATION_LOCATION_URL(deviceOrganisationId), payload), (dto: DeviceOrganisationDetailsDTO) => {
|
|
24
|
+
const result = new DeviceOrganisationDetails(dto);
|
|
25
|
+
notify.notify("update", result);
|
|
26
|
+
return result;
|
|
27
|
+
})
|
|
23
28
|
}))
|
|
24
|
-
));
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
const trackDeviceOrganisation = () => {
|
|
32
|
+
const { track: trackDeviceStatuses } = useTrackDeviceStatuses();
|
|
33
|
+
const { track: trackDeviceConnectivity } = useTrackDeviceConnectivity();
|
|
34
|
+
|
|
35
|
+
const { watchOne: watchDeviceStatuses } = useWatchDeviceStatuses();
|
|
36
|
+
const { watchOne: watchDeviceConnectivity } = useWatchDeviceConnectivity();
|
|
37
|
+
|
|
38
|
+
return (deviceOrganisation: Ref<DeviceOrganisationDetails>) => {
|
|
39
|
+
watchDeviceStatuses(deviceOrganisation.value.status.id);
|
|
40
|
+
watchDeviceConnectivity(deviceOrganisation.value.connectivity.id);
|
|
41
|
+
|
|
42
|
+
trackDeviceStatuses(deviceOrganisation.value.status, s => deviceOrganisation.value.status = s);
|
|
43
|
+
trackDeviceConnectivity(deviceOrganisation.value.connectivity, c => deviceOrganisation.value.connectivity = c);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const trackDeviceOrganisations = () => {
|
|
48
|
+
const { track: trackDeviceStatuses } = useTrackDeviceStatuses();
|
|
49
|
+
const { track: trackDeviceConnectivity } = useTrackDeviceConnectivity();
|
|
50
|
+
|
|
51
|
+
const { watchMany: watchDevicesStatuses } = useWatchDeviceStatuses();
|
|
52
|
+
const { watchMany: watchDevicesConnectivity } = useWatchDeviceConnectivity();
|
|
53
|
+
|
|
54
|
+
return (deviceOrganisations: Ref<DeviceOrganisationInfos[]>) => {
|
|
55
|
+
watchDevicesStatuses();
|
|
56
|
+
watchDevicesConnectivity();
|
|
57
|
+
|
|
58
|
+
for (const deviceOrganisation of deviceOrganisations.value) {
|
|
59
|
+
trackDeviceStatuses(deviceOrganisation.status, s => deviceOrganisation.status = s);
|
|
60
|
+
trackDeviceConnectivity(deviceOrganisation.connectivity, c => deviceOrganisation.connectivity = c);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
|
|
66
|
+
export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisationServiceFactory, trackDeviceOrganisations);
|
|
67
|
+
export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
|
|
68
|
+
export const useUpdateDeviceOrganisation = ComposableFactory.update(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
|
|
25
69
|
|
|
26
|
-
export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory);
|
|
27
|
-
export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisationServiceFactory);
|
|
28
|
-
export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory);
|
|
29
|
-
export const useUpdateDeviceOrganisation = ComposableFactory.update(DeviceOrganisationServiceFactory);
|
|
30
70
|
export const useRemoveDeviceOrganisation = ComposableFactory.remove(DeviceOrganisationServiceFactory);
|
|
31
|
-
|
|
32
|
-
export const
|
|
71
|
+
|
|
72
|
+
export const useChangeDeviceOrganisationGroup = ComposableFactory.custom(DeviceOrganisationServiceFactory.changeGroup, trackDeviceOrganisation);
|
|
73
|
+
export const useChangeDeviceOrganisationLocation = ComposableFactory.custom(DeviceOrganisationServiceFactory.changeLocation, trackDeviceOrganisation);
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import { DeviceStatusDetails, DeviceStatusDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
1
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
|
+
import { DeviceStatusDetails, DeviceStatusDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
|
+
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
4
|
|
|
4
|
-
import { DEVICE_STATUS_URL } from "../../config/urls";
|
|
5
|
+
import { DEVICE_STATUSES_HUB_URL, DEVICE_STATUS_URL } from "../../config/urls";
|
|
6
|
+
import { HUBS } from "../../config/literals";
|
|
5
7
|
|
|
6
8
|
const DeviceStatusServiceFactory = new ServiceFactory<DeviceStatusDetailsDTO, DeviceStatusDetails>("deviceStatus", DeviceStatusDetails).create(factory => factory.build(
|
|
7
9
|
factory.addGet(DEVICE_STATUS_URL),
|
|
8
|
-
factory.addNotify(
|
|
10
|
+
factory.addNotify(notify => ({
|
|
11
|
+
notifyUpdate: (status: DeviceStatusDetails) => notify.notify("update", status)
|
|
12
|
+
}))
|
|
9
13
|
));
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
const useDeviceStatusesHub = HubFactory.create(DEVICE_STATUSES_HUB_URL,
|
|
16
|
+
(connection) => {
|
|
17
|
+
connection.on(HUBS.UPDATE_DEVICE_STATUS,
|
|
18
|
+
(payload: DeviceStatusDetailsDTO) => DeviceStatusServiceFactory.notifyUpdate(new DeviceStatusDetails(payload)));
|
|
19
|
+
},
|
|
20
|
+
async (connection) => {
|
|
21
|
+
await connection.invoke(HUBS.SUBSCRIBE);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const useDeviceStatus = ComposableFactory.get(DeviceStatusServiceFactory);
|
|
26
|
+
export const useTrackDeviceStatuses = ComposableFactory.track(DeviceStatusServiceFactory);
|
|
27
|
+
export const useWatchDeviceStatuses = HubFactory.createWatcher(useDeviceStatusesHub);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "vue";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
+
import { CreateUserOrganisationDTO, UpdateUserOrganisationDTO, UserOrganisationDetails, UserOrganisationDetailsDTO, UserOrganisationFilters, UserOrganisationInfos, UserOrganisationInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
4
|
|
|
4
5
|
import { USER_ORGANISATIONS_URL, USER_ORGANISATION_CURRENT_URL, USER_ORGANISATION_URL } from "../../config/urls";
|
|
5
6
|
|
|
@@ -20,17 +21,21 @@ const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetail
|
|
|
20
21
|
));
|
|
21
22
|
|
|
22
23
|
export const useTrackUserOrganisation = ComposableFactory.track(UserOrganisationServiceFactory);
|
|
24
|
+
export const useTrackUserOrganisationRef = ComposableFactory.trackRef(UserOrganisationServiceFactory);
|
|
25
|
+
|
|
26
|
+
const trackUserOrganisation = () => {
|
|
27
|
+
const { track } = useTrackUserOrganisationRef();
|
|
28
|
+
|
|
29
|
+
return (userOrganisation: Ref<UserOrganisationDetails>) => {
|
|
30
|
+
track(userOrganisation);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
23
33
|
|
|
24
34
|
export const useUserOrganisation = ComposableFactory.get(UserOrganisationServiceFactory);
|
|
25
35
|
export const useUserOrganisations = ComposableFactory.getMany(UserOrganisationServiceFactory);
|
|
26
36
|
export const useCreateUserOrganisation = ComposableFactory.create(UserOrganisationServiceFactory);
|
|
27
37
|
export const useUpdateUserOrganisation = ComposableFactory.update(UserOrganisationServiceFactory);
|
|
28
38
|
export const useRemoveUserOrganisation = ComposableFactory.remove(UserOrganisationServiceFactory);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return (userOrganisation) => {
|
|
33
|
-
track(userOrganisation);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
export const useUpdateCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory.updateCurrent);
|
|
39
|
+
|
|
40
|
+
export const useCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory.getCurrent, trackUserOrganisation);
|
|
41
|
+
export const useUpdateCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory.updateCurrent, trackUserOrganisation);
|
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.56",
|
|
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.73",
|
|
14
|
+
"@dative-gpi/foundation-core-domain": "0.0.56",
|
|
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": "abad32205d89f93f2cfd5c83aae50f2d9248ecc0"
|
|
20
20
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onMounted, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import * as signalR from "@microsoft/signalr";
|
|
4
|
-
|
|
5
|
-
import { ALERTS_HUB_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
let initialized = false;
|
|
9
|
-
|
|
10
|
-
const connection = ref<signalR.HubConnection | null>(null);
|
|
11
|
-
|
|
12
|
-
export const useAlertsHub = () => {
|
|
13
|
-
if (!initialized) {
|
|
14
|
-
onMounted(async () => {
|
|
15
|
-
if (!connection.value) {
|
|
16
|
-
connection.value = new signalR.HubConnectionBuilder()
|
|
17
|
-
.withUrl(ALERTS_HUB_URL())
|
|
18
|
-
.configureLogging(signalR.LogLevel.Warning)
|
|
19
|
-
.withAutomaticReconnect()
|
|
20
|
-
.build();
|
|
21
|
-
}
|
|
22
|
-
if (connection.value.state !== signalR.HubConnectionState.Connected) {
|
|
23
|
-
await connection.value.start();
|
|
24
|
-
}
|
|
25
|
-
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
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));
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
initialized = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ready = new Promise((resolve) => {
|
|
35
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
36
|
-
resolve(true);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
watch(connection, () => {
|
|
40
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
41
|
-
resolve(true);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
ready
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { onMounted, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import * as signalR from "@microsoft/signalr";
|
|
4
|
-
|
|
5
|
-
import { CONNECTIVITY_ALERTS_HUB_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
let initialized = false;
|
|
9
|
-
|
|
10
|
-
const connection = ref<signalR.HubConnection | null>(null);
|
|
11
|
-
|
|
12
|
-
export const useConnectivityAlertsHub = () => {
|
|
13
|
-
if (!initialized) {
|
|
14
|
-
onMounted(async () => {
|
|
15
|
-
if (!connection.value) {
|
|
16
|
-
connection.value = new signalR.HubConnectionBuilder()
|
|
17
|
-
.withUrl(CONNECTIVITY_ALERTS_HUB_URL())
|
|
18
|
-
.configureLogging(signalR.LogLevel.Warning)
|
|
19
|
-
.withAutomaticReconnect()
|
|
20
|
-
.build();
|
|
21
|
-
}
|
|
22
|
-
if (connection.value.state !== signalR.HubConnectionState.Connected) {
|
|
23
|
-
await connection.value.start();
|
|
24
|
-
}
|
|
25
|
-
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
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));
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
initialized = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ready = new Promise((resolve) => {
|
|
35
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
36
|
-
resolve(true);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
watch(connection, () => {
|
|
40
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
41
|
-
resolve(true);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
ready
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { onMounted, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import * as signalR from "@microsoft/signalr";
|
|
4
|
-
|
|
5
|
-
import { DEVICE_CONNECTIVITIES_HUB_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
let initialized = false;
|
|
9
|
-
|
|
10
|
-
const connection = ref<signalR.HubConnection | null>(null);
|
|
11
|
-
|
|
12
|
-
export const useDeviceConnectivitiesHub = () => {
|
|
13
|
-
if (!initialized) {
|
|
14
|
-
onMounted(async () => {
|
|
15
|
-
if (!connection.value) {
|
|
16
|
-
connection.value = new signalR.HubConnectionBuilder()
|
|
17
|
-
.withUrl(DEVICE_CONNECTIVITIES_HUB_URL())
|
|
18
|
-
.configureLogging(signalR.LogLevel.Warning)
|
|
19
|
-
.withAutomaticReconnect()
|
|
20
|
-
.build();
|
|
21
|
-
}
|
|
22
|
-
if (connection.value.state !== signalR.HubConnectionState.Connected) {
|
|
23
|
-
await connection.value.start();
|
|
24
|
-
}
|
|
25
|
-
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
26
|
-
// connection.value.on(HUBS.UPDATE_DEVICE_CONNECTIVITY, (deviceOrganisationId: string) => useNotifyDeviceConnectivity().fetch(deviceOrganisationId));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
initialized = true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const ready = new Promise((resolve) => {
|
|
33
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
34
|
-
resolve(true);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
watch(connection, () => {
|
|
38
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
39
|
-
resolve(true);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
ready
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { onMounted, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import * as signalR from "@microsoft/signalr";
|
|
4
|
-
|
|
5
|
-
import { DEVICE_STATUSES_HUB_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
let initialized = false;
|
|
9
|
-
|
|
10
|
-
const connection = ref<signalR.HubConnection | null>(null);
|
|
11
|
-
|
|
12
|
-
export const useDeviceStatusesHub = () => {
|
|
13
|
-
if (!initialized) {
|
|
14
|
-
onMounted(async () => {
|
|
15
|
-
if (!connection.value) {
|
|
16
|
-
connection.value = new signalR.HubConnectionBuilder()
|
|
17
|
-
.withUrl(DEVICE_STATUSES_HUB_URL())
|
|
18
|
-
.configureLogging(signalR.LogLevel.Warning)
|
|
19
|
-
.withAutomaticReconnect()
|
|
20
|
-
.build();
|
|
21
|
-
}
|
|
22
|
-
if (connection.value.state !== signalR.HubConnectionState.Connected) {
|
|
23
|
-
await connection.value.start();
|
|
24
|
-
}
|
|
25
|
-
connection.value.invoke(HUBS.SUBSCRIBE);
|
|
26
|
-
// connection.value.on(HUBS.UPDATE_DEVICE_STATUS, (deviceOrganisationId: string) => useNotifyDeviceStatus().fetch(deviceOrganisationId));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
initialized = true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const ready = new Promise((resolve) => {
|
|
33
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
34
|
-
resolve(true);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
watch(connection, () => {
|
|
38
|
-
if (connection.value && connection.value.state === signalR.HubConnectionState.Connected) {
|
|
39
|
-
resolve(true);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
ready
|
|
47
|
-
};
|
|
48
|
-
}
|