@dative-gpi/foundation-core-services 0.0.49 → 0.0.50
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 +1 -0
- package/composables/app/useAppOrganisationId.ts +18 -0
- package/composables/index.ts +2 -2
- package/composables/services/index.ts +0 -2
- package/composables/useFoundationCore.ts +17 -0
- package/config/urls/index.ts +0 -2
- package/config/urls/urlFactory.ts +2 -2
- package/package.json +3 -3
- package/composables/services/useLanguages.ts +0 -11
- package/composables/services/usePermissions.ts +0 -41
- package/composables/useCore.ts +0 -26
- package/composables/useOrganisationId.ts +0 -28
- package/config/urls/images.ts +0 -5
- package/config/urls/languages.ts +0 -3
|
@@ -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
|
+
}
|
package/composables/index.ts
CHANGED
|
@@ -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
|
+
}
|
package/config/urls/index.ts
CHANGED
|
@@ -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 {
|
|
1
|
+
import { useAppOrganisationId } from "../../composables";
|
|
2
2
|
|
|
3
|
-
const { organisationId } =
|
|
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.
|
|
4
|
+
"version": "0.0.50",
|
|
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.
|
|
14
|
+
"@dative-gpi/foundation-core-domain": "0.0.50",
|
|
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": "be18a14ae47c91c1f3ccd22a196593050f06aae8"
|
|
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
|
-
}
|
package/composables/useCore.ts
DELETED
|
@@ -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
|
-
}
|
package/config/urls/images.ts
DELETED
|
@@ -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)}`
|
package/config/urls/languages.ts
DELETED