@dative-gpi/foundation-core-services 0.0.230 → 0.1.68
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/app/index.ts +2 -1
- package/composables/app/useEntityId.ts +19 -0
- package/composables/index.ts +2 -1
- package/composables/services/index.ts +1 -1
- package/composables/services/useActions.ts +3 -4
- package/composables/services/useAlerts.ts +1 -1
- package/composables/services/useArticles.ts +4 -5
- package/composables/services/useChartCategories.ts +1 -2
- package/composables/services/useChartOrganisationTypes.ts +10 -12
- package/composables/services/useChartOrganisations.ts +10 -12
- package/composables/services/useCharts.ts +1 -3
- package/composables/services/useComments.ts +2 -3
- package/composables/services/useConnectivityAlerts.ts +33 -34
- package/composables/services/useConnectivityScenarios.ts +1 -2
- package/composables/services/useCustomProperties.ts +3 -4
- package/composables/services/useCustomPropertyValues.ts +3 -3
- package/composables/services/useDashboardOrganisationTypes.ts +25 -28
- package/composables/services/useDashboardOrganisations.ts +20 -22
- package/composables/services/useDashboardShallows.ts +15 -17
- package/composables/services/useDashboards.ts +2 -4
- package/composables/services/useDataCategories.ts +4 -5
- package/composables/services/useDataDefinitions.ts +4 -5
- package/composables/services/useDataTables.ts +10 -6
- package/composables/services/useDeviceConnectivities.ts +15 -16
- package/composables/services/useDeviceOrganisations.ts +23 -26
- package/composables/services/useDeviceStatuses.ts +14 -15
- package/composables/services/useFolders.ts +10 -13
- package/composables/services/useGroups.ts +1 -2
- package/composables/services/useLocations.ts +1 -1
- package/composables/services/useManufacturers.ts +4 -5
- package/composables/services/useModels.ts +3 -3
- package/composables/services/useOrganisationTypes.ts +4 -5
- package/composables/services/useOrganisations.ts +9 -10
- package/composables/services/usePermissionCategories.ts +3 -4
- package/composables/services/useRoleOrganisationTypes.ts +4 -5
- package/composables/services/useRoleOrganisations.ts +1 -2
- package/composables/services/useScenarioDeviceOrganisations.ts +9 -3
- package/composables/services/useScenarioOrganisationTypes.ts +21 -22
- package/composables/services/useScenarioOrganisations.ts +11 -13
- package/composables/services/useServiceAccountOrganisationAuthTokens.ts +8 -13
- package/composables/services/useServiceAccountOrganisations.ts +2 -3
- package/composables/services/useServiceAccountRoleOrganisations.ts +13 -0
- package/composables/services/useUserOrganisationTables.ts +4 -6
- package/composables/services/useUserOrganisations.ts +25 -25
- package/composables/services/useWidgetTemplates.ts +4 -5
- package/composables/useRouteOrganisation.ts +24 -0
- package/config/literals/index.ts +1 -3
- package/config/urls/index.ts +1 -1
- package/config/urls/serviceAccountOrganisationAuthTokens.ts +3 -4
- package/config/urls/serviceAccountRoleOrganisations.ts +4 -0
- package/package.json +3 -3
- package/composables/services/useNotifications.ts +0 -48
- package/config/literals/hubs.ts +0 -16
- package/config/urls/notifications.ts +0 -6
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { type ChangeCurrentUserOrganisationDashboardDTO, type CreateUserOrganisationDTO, type UpdateUserOrganisationDTO, UserOrganisationDetails, type UserOrganisationDetailsDTO, type UserOrganisationFilters, UserOrganisationInfos, type UserOrganisationInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
4
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
3
|
-
import type { ChangeCurrentUserOrganisationDashboardDTO, CreateUserOrganisationDTO, UpdateUserOrganisationDTO, UserOrganisationDetailsDTO, UserOrganisationFilters, UserOrganisationInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { UserOrganisationDetails, UserOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
5
5
|
|
|
6
6
|
import { USER_ORGANISATIONS_URL, USER_ORGANISATION_CURRENT_DASHBOARD_URL, USER_ORGANISATION_CURRENT_URL, USER_ORGANISATION_URL } from "../../config/urls";
|
|
7
7
|
|
|
8
8
|
const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetailsDTO, UserOrganisationDetails>("userOrganisation", UserOrganisationDetails).create(factory => factory.build(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
factory.addGet(USER_ORGANISATION_URL),
|
|
10
|
+
factory.addGetMany<UserOrganisationInfosDTO, UserOrganisationInfos, UserOrganisationFilters>(USER_ORGANISATIONS_URL, UserOrganisationInfos),
|
|
11
|
+
factory.addCreate<CreateUserOrganisationDTO>(USER_ORGANISATIONS_URL),
|
|
12
|
+
factory.addUpdate<UpdateUserOrganisationDTO>(USER_ORGANISATION_URL),
|
|
13
|
+
factory.addRemove(USER_ORGANISATION_URL),
|
|
14
|
+
ServiceFactory.addCustom("getCurrent", (axios) => axios.get(USER_ORGANISATION_CURRENT_URL()), (dto: UserOrganisationDetailsDTO) => new UserOrganisationDetails(dto)),
|
|
15
|
+
factory.addNotify(notifyService => ({
|
|
16
|
+
...ServiceFactory.addCustom("updateCurrent", (axios, payload: UpdateUserOrganisationDTO) => axios.post(USER_ORGANISATION_CURRENT_URL(), payload), (dto: UserOrganisationDetailsDTO) => {
|
|
17
|
+
const result = new UserOrganisationDetails(dto)
|
|
18
|
+
notifyService.notify("update", result);
|
|
19
|
+
return result;
|
|
20
|
+
}),
|
|
21
|
+
...ServiceFactory.addCustom("changeCurrentDashboard", (axios, payload: ChangeCurrentUserOrganisationDashboardDTO) => axios.put(USER_ORGANISATION_CURRENT_DASHBOARD_URL(), payload), (dto: UserOrganisationDetailsDTO) => {
|
|
22
|
+
const result = new UserOrganisationDetails(dto)
|
|
23
|
+
notifyService.notify("update", result);
|
|
24
|
+
return result;
|
|
25
|
+
})
|
|
26
|
+
}))
|
|
27
27
|
));
|
|
28
28
|
|
|
29
29
|
export const useTrackUserOrganisation = ComposableFactory.track(UserOrganisationServiceFactory);
|
|
30
30
|
export const useTrackUserOrganisationRef = ComposableFactory.trackRef(UserOrganisationServiceFactory);
|
|
31
31
|
|
|
32
32
|
const trackUserOrganisation = () => {
|
|
33
|
-
|
|
33
|
+
const { track } = useTrackUserOrganisationRef();
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return (userOrganisation: Ref<UserOrganisationDetails>) => {
|
|
36
|
+
track(userOrganisation);
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export const useUserOrganisation = ComposableFactory.get(UserOrganisationServiceFactory);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { WidgetTemplateInfos, WidgetTemplateDetails } from "@dative-gpi/foundation-core-domain/models";
|
|
1
|
+
import { WidgetTemplateInfos, type WidgetTemplateInfosDTO, type WidgetTemplateFilters, WidgetTemplateDetails, type WidgetTemplateDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
3
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
3
|
|
|
5
4
|
import { WIDGET_TEMPLATES_URL, WIDGET_TEMPLATE_URL } from "../../config/urls";
|
|
6
5
|
|
|
7
6
|
const WidgetTemplateServiceFactory = new ServiceFactory<WidgetTemplateDetailsDTO, WidgetTemplateDetails>("widgetTemplate", WidgetTemplateDetails).create(factory => factory.build(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
factory.addGet(WIDGET_TEMPLATE_URL),
|
|
8
|
+
factory.addGetMany<WidgetTemplateInfosDTO, WidgetTemplateInfos, WidgetTemplateFilters>(WIDGET_TEMPLATES_URL, WidgetTemplateInfos),
|
|
9
|
+
factory.addNotify()
|
|
11
10
|
));
|
|
12
11
|
|
|
13
12
|
export const useWidgetTemplate = ComposableFactory.get(WidgetTemplateServiceFactory);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RouteLocation } from "vue-router";
|
|
2
|
+
|
|
3
|
+
import { useAppOrganisationId } from "../composables"
|
|
4
|
+
|
|
5
|
+
export const useRouteOrganisation = () => {
|
|
6
|
+
const { organisationId } = useAppOrganisationId();
|
|
7
|
+
|
|
8
|
+
const $r = (route: Partial<RouteLocation>) => {
|
|
9
|
+
if (route.params) {
|
|
10
|
+
route.params.organisationId = organisationId.value!;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
route.params = {
|
|
14
|
+
organisationId: organisationId.value!
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return route;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
$r
|
|
23
|
+
}
|
|
24
|
+
}
|
package/config/literals/index.ts
CHANGED
package/config/urls/index.ts
CHANGED
|
@@ -23,7 +23,6 @@ export * from "./groups";
|
|
|
23
23
|
export * from "./locations";
|
|
24
24
|
export * from "./manufacturers";
|
|
25
25
|
export * from "./models";
|
|
26
|
-
export * from "./notifications";
|
|
27
26
|
export * from "./organisations";
|
|
28
27
|
export * from "./organisationTypes";
|
|
29
28
|
export * from "./permissionCategories";
|
|
@@ -35,6 +34,7 @@ export * from "./scenarioOrganisations";
|
|
|
35
34
|
export * from "./scenarioOrganisationTypes";
|
|
36
35
|
export * from "./serviceAccountOrganisationAuthTokens";
|
|
37
36
|
export * from "./serviceAccountOrganisations";
|
|
37
|
+
export * from "./serviceAccountRoleOrganisations";
|
|
38
38
|
export * from "./userOrganisations";
|
|
39
39
|
export * from "./userOrganisationTables";
|
|
40
40
|
export * from "./widgetTemplates";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
export const SERVICE_ACCOUNT_ORGANISATION_AUTH_TOKEN_URL = (serviceAccountOrganisationId: string, authTokenId: string) => `${SERVICE_ACCOUNT_ORGANISATION_AUTH_TOKENS_URL(serviceAccountOrganisationId)}/${encodeURIComponent(authTokenId)}`;
|
|
3
|
+
export const SERVICE_ACCOUNT_ORGANISATION_AUTH_TOKENS_URL = () => `${CORE_URL()}/pats`;
|
|
4
|
+
export const SERVICE_ACCOUNT_ORGANISATION_AUTH_TOKEN_URL = (authTokenId: string) => `${SERVICE_ACCOUNT_ORGANISATION_AUTH_TOKENS_URL()}/${encodeURIComponent(authTokenId)}`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
|
+
|
|
3
|
+
export const SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL = () => `${CORE_URL()}/service-account-role-organisations`;
|
|
4
|
+
export const SERVICE_ACCOUNT_ROLE_ORGANISATION_URL = (serviceAccountRoleOrganisationId: string) => `${SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL()}/${encodeURIComponent(serviceAccountRoleOrganisationId)}`;
|
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.
|
|
4
|
+
"version": "0.1.68",
|
|
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": "0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "0.1.68"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@dative-gpi/bones-ui": "^0.0.75",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"vue": "^3.4.29",
|
|
19
19
|
"vue-router": "^4.3.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "fa2ed7031088f422751fc1d939f2fbe168ae0596"
|
|
22
22
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NotificationDetails, type NotificationDetailsDTO, NotificationInfos, type NotificationInfosDTO, type NotificationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
-
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
|
-
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
-
|
|
5
|
-
import { NOTIFICATIONS_HUB_URL, NOTIFICATIONS_URL, NOTIFICATION_URL } from "../../config";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
const NotificationServiceFactory = new ServiceFactory<NotificationDetailsDTO, NotificationDetails>("notifications", NotificationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addGet(NOTIFICATION_URL),
|
|
10
|
-
factory.addGetMany<NotificationInfosDTO, NotificationInfos, NotificationFilters>(NOTIFICATIONS_URL, NotificationInfos),
|
|
11
|
-
factory.addNotify(notifyService => ({
|
|
12
|
-
notifyCreate: (notification: NotificationDetails) => notifyService.notify("add", notification),
|
|
13
|
-
...ServiceFactory.addCustom("acknowledge", (axios, notificationId: string) => axios.patch(NOTIFICATION_URL(notificationId)), (dto: NotificationDetailsDTO) => {
|
|
14
|
-
const result = new NotificationDetails(dto);
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
return result;
|
|
17
|
-
})
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
const useNotificationsHub = HubFactory.create(NOTIFICATIONS_HUB_URL,
|
|
22
|
-
(connection, { hasWatchers }) => {
|
|
23
|
-
connection.on(HUBS.CREATE_NOTIFICATION, (notificationId: string) => hasWatchers()
|
|
24
|
-
? NotificationServiceFactory.get(notificationId).then(NotificationServiceFactory.notifyCreate)
|
|
25
|
-
: null);
|
|
26
|
-
},
|
|
27
|
-
async (connection) => {
|
|
28
|
-
await connection.invoke(HUBS.SUBSCRIBE);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const useWatchNotifications = HubFactory.createWatcher(useNotificationsHub);
|
|
33
|
-
|
|
34
|
-
export const useNotification = ComposableFactory.get(NotificationServiceFactory, () => {
|
|
35
|
-
const { watchOne } = useWatchNotifications();
|
|
36
|
-
return (notification) => {
|
|
37
|
-
watchOne(notification.value.id);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export const useNotifications = ComposableFactory.getMany(NotificationServiceFactory, () => {
|
|
42
|
-
const { watchMany } = useWatchNotifications();
|
|
43
|
-
return () => {
|
|
44
|
-
watchMany();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const useAcknowledgeNotification = ComposableFactory.custom(NotificationServiceFactory.acknowledge);
|
package/config/literals/hubs.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const SUBSCRIBE = "Subscribe";
|
|
2
|
-
export const UNSUBSCRIBE = "Unsubscribe";
|
|
3
|
-
|
|
4
|
-
export const UPDATE_DEVICE_STATUS = "UpdateDeviceStatus";
|
|
5
|
-
|
|
6
|
-
export const UPDATE_DEVICE_CONNECTIVITY = "UpdateDeviceConnectivity";
|
|
7
|
-
|
|
8
|
-
export const CREATE_ALERT = "CreateAlert";
|
|
9
|
-
export const UPDATE_ALERT = "UpdateAlert";
|
|
10
|
-
export const REMOVE_ALERT = "RemoveAlert";
|
|
11
|
-
|
|
12
|
-
export const CREATE_CONNECTIVITY_ALERT = "CreateConnectivityAlert";
|
|
13
|
-
export const UPDATE_CONNECTIVITY_ALERT = "UpdateConnectivityAlert";
|
|
14
|
-
export const REMOVE_CONNECTIVITY_ALERT = "RemoveConnectivityAlert";
|
|
15
|
-
|
|
16
|
-
export const CREATE_NOTIFICATION = "CreateNotification";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CORE_URL, HUBS_URL } from "./base";
|
|
2
|
-
|
|
3
|
-
export const NOTIFICATIONS_URL = () => `${CORE_URL()}/notifications`;
|
|
4
|
-
export const NOTIFICATION_URL = (notificationId: string) => `${CORE_URL()}/notifications/${notificationId}`;
|
|
5
|
-
|
|
6
|
-
export const NOTIFICATIONS_HUB_URL = () => `${HUBS_URL()}/notifications`;
|