@dative-gpi/foundation-core-services 0.0.49 → 0.0.51

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.
@@ -0,0 +1 @@
1
+ export * from "./useAppOrganisationId";
@@ -0,0 +1,18 @@
1
+ import { computed, ref } from "vue";
2
+
3
+ const organisationId = ref<string | null>(null);
4
+
5
+ export const useAppOrganisationId = () => {
6
+
7
+ const setOrganisationId = (payload: string) => {
8
+ organisationId.value = payload;
9
+ };
10
+
11
+ const ready = computed(() => organisationId.value !== null);
12
+
13
+ return {
14
+ ready,
15
+ organisationId,
16
+ setOrganisationId
17
+ };
18
+ }
@@ -1,4 +1,4 @@
1
+ export * from "./app";
1
2
  export * from "./hubs";
2
3
  export * from "./services";
3
- export * from "./useCore";
4
- export * from "./useOrganisationId";
4
+ export * from "./useFoundationCore";
@@ -12,14 +12,12 @@ export * from "./useDeviceConnectivities";
12
12
  export * from "./useDeviceOrganisations";
13
13
  export * from "./useDeviceStatuses";
14
14
  export * from "./useGroups";
15
- export * from "./useLanguages";
16
15
  export * from "./useLocations";
17
16
  export * from "./useManufacturers";
18
17
  export * from "./useModels";
19
18
  export * from "./useOrganisations";
20
19
  export * from "./useOrganisationTypes";
21
20
  export * from "./usePermissionCategories";
22
- export * from "./usePermissions";
23
21
  export * from "./useRoleOrganisations";
24
22
  export * from "./useRoleOrganisationTypes";
25
23
  export * from "./useTables";
@@ -0,0 +1,17 @@
1
+ import { computed } from "vue";
2
+
3
+ import { useFoundationShared } from "@dative-gpi/foundation-shared-services/composables";
4
+
5
+ import { useAppOrganisationId } from "./app/useAppOrganisationId";
6
+
7
+ export function useFoundationCore() {
8
+
9
+ const { ready: sharedReady } = useFoundationShared();
10
+ const { ready: organisationReady } = useAppOrganisationId();
11
+
12
+ const ready = computed(() => sharedReady.value && organisationReady.value);
13
+
14
+ return {
15
+ ready
16
+ };
17
+ }
@@ -12,8 +12,6 @@ export * from "./deviceConnectivities";
12
12
  export * from "./deviceOrganisations";
13
13
  export * from "./deviceStatuses";
14
14
  export * from "./groups";
15
- export * from "./images";
16
- export * from "./languages";
17
15
  export * from "./locations";
18
16
  export * from "./manufacturers";
19
17
  export * from "./models";
@@ -1,6 +1,6 @@
1
- import { useOrganisationId } from "../../composables/useOrganisationId";
1
+ import { useAppOrganisationId } from "../../composables";
2
2
 
3
- const { organisationId } = useOrganisationId();
3
+ const { organisationId } = useAppOrganisationId();
4
4
 
5
5
  export function urlFactory(url: (orgId: string) => string) {
6
6
  return () => {
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.49",
4
+ "version": "0.0.51",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -11,10 +11,10 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "@dative-gpi/bones-ui": "^0.0.61",
14
- "@dative-gpi/foundation-core-domain": "0.0.49",
14
+ "@dative-gpi/foundation-core-domain": "0.0.51",
15
15
  "@microsoft/signalr": "^8.0.0",
16
16
  "vue": "^3.2.0",
17
17
  "vue-router": "^4.2.5"
18
18
  },
19
- "gitHead": "cf285c38be7fcc0f02f813f2cb3693867d277003"
19
+ "gitHead": "13a8e0d4bd10a05a35c570412fa2024d33b0c115"
20
20
  }
@@ -1,11 +0,0 @@
1
- import { LanguageDetails, LanguageDetailsDTO, LanguageFilters, LanguageInfos, LanguageInfosDTO } from "@dative-gpi/foundation-shared-domain/models";
2
- import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
3
-
4
- import { LANGUAGES_URL } from "../../config/urls";
5
-
6
- const LanguageServiceFactory = new ServiceFactory<LanguageDetailsDTO, LanguageDetails>("language", LanguageDetails).create(factory => factory.build(
7
- factory.addGetMany<LanguageInfosDTO, LanguageInfos, LanguageFilters>(LANGUAGES_URL, LanguageInfos),
8
- factory.addNotify()
9
- ));
10
-
11
- export const useLanguages = ComposableFactory.getMany(LanguageServiceFactory);
@@ -1,41 +0,0 @@
1
- import { ref } from "vue";
2
-
3
- import { PermissionDetails, PermissionDetailsDTO, PermissionInfos } from "@dative-gpi/foundation-shared-domain/models";
4
- import { ServiceFactory } from "@dative-gpi/bones-ui";
5
-
6
- import { PERMISSIONS_CURRENT_URL } from "../../config/urls";
7
-
8
- const PermissionServiceFactory = new ServiceFactory<PermissionDetailsDTO, PermissionDetails>("permission", PermissionDetails).create(factory => factory.build(
9
- factory.addNotify(() => ({
10
- getCurrent: async (): Promise<PermissionInfos[]> => {
11
- const response = await ServiceFactory.http.get(PERMISSIONS_CURRENT_URL());
12
- const result = response.data.map((dto: PermissionInfos) => new PermissionInfos(dto));
13
-
14
- return result;
15
- }
16
- }))
17
- ));
18
-
19
- export const useCurrentPermissions = () => {
20
- const service = PermissionServiceFactory();
21
-
22
- const fetching = ref(false);
23
- const fetched = ref<PermissionInfos[] | null>(null);
24
-
25
- const fetch = async () => {
26
- fetching.value = true;
27
- try {
28
- fetched.value = await service.getCurrent();
29
- }
30
- finally {
31
- fetching.value = false;
32
- }
33
- return fetched;
34
- }
35
-
36
- return {
37
- fetching,
38
- fetch,
39
- fetched
40
- }
41
- }
@@ -1,26 +0,0 @@
1
- import { ref } from "vue";
2
-
3
- import { useOrganisationId } from "./useOrganisationId";
4
-
5
- let called = false;
6
-
7
- const ready = ref(false);
8
-
9
- export async function useCore() {
10
- if (called) {
11
- return {
12
- ready
13
- };
14
- }
15
-
16
- called = true;
17
-
18
- const { ready: organisationIdReady } = useOrganisationId();
19
-
20
- await organisationIdReady;
21
- ready.value = true;
22
-
23
- return {
24
- ready
25
- };
26
- }
@@ -1,28 +0,0 @@
1
- import { ref, watch } from "vue";
2
-
3
- const organisationId = ref<string | null>(null);
4
-
5
- export const useOrganisationId = () => {
6
- const setOrganisationId = (payload: string) => {
7
- organisationId.value = payload;
8
- };
9
-
10
- const ready = new Promise((resolve) => {
11
- if (organisationId.value) {
12
- resolve(organisationId.value);
13
- }
14
- else {
15
- watch(organisationId, () => {
16
- if (organisationId.value) {
17
- resolve(organisationId.value);
18
- }
19
- });
20
- }
21
- });
22
-
23
- return {
24
- ready,
25
- organisationId,
26
- setOrganisationId
27
- };
28
- }
@@ -1,5 +0,0 @@
1
- import { CORE_URL } from "./base";
2
-
3
- export const IMAGES_URL = () => `${CORE_URL()}/images`;
4
- export const IMAGE_RAW_URL = (imageId: string) => `${IMAGES_URL()}/raw/${encodeURIComponent(imageId)}`;
5
- export const IMAGE_THUMBNAIL_URL = (imageId: string) => `${IMAGES_URL()}/thumbnail/${encodeURIComponent(imageId)}`
@@ -1,3 +0,0 @@
1
- import { CORE_URL } from "./base";
2
-
3
- export const LANGUAGES_URL = () => `${CORE_URL()}/languages`;