@dative-gpi/foundation-shared-services 1.0.13 → 1.0.14

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.
@@ -1,11 +1,12 @@
1
1
  import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
2
- import type { BlurHashDTO } from "@dative-gpi/foundation-shared-domain/models";
3
- import { BlurHash } from "@dative-gpi/foundation-shared-domain/models";
2
+ import type { ImageDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
3
+ import { ImageDetails } from "@dative-gpi/foundation-shared-domain/models";
4
4
 
5
- import { IMAGE_BLURHASH_URL } from "../../config/urls";
5
+ import { IMAGE_URL } from "../../config/urls";
6
6
 
7
- const ImageServiceFactory = {
8
- ...ServiceFactory.addCustom("getBlurHash", (axios, imageId: string) => axios.get(IMAGE_BLURHASH_URL(imageId)), (dto: BlurHashDTO) => new BlurHash(dto))
9
- };
7
+ const ImageServiceFactory = new ServiceFactory<ImageDetailsDTO, ImageDetails>("image", ImageDetails).create(factory => factory.build(
8
+ factory.addGet(IMAGE_URL),
9
+ factory.addNotify()
10
+ ));
10
11
 
11
- export const useImageBlurHash = ComposableFactory.custom(ImageServiceFactory.getBlurHash);
12
+ export const useImage = ComposableFactory.get(ImageServiceFactory);
@@ -2,12 +2,7 @@ import { GATEWAY_URL } from "./base";
2
2
 
3
3
  export const IMAGES_URL = () => `${GATEWAY_URL()}/images`;
4
4
 
5
- export const IMAGES_RAW_URL = () => `${IMAGES_URL()}/raw`;
6
- export const IMAGE_RAW_URL = (imageId: string) => `${IMAGES_RAW_URL()}/${encodeURIComponent(imageId)}`;
7
- export const IMAGE_RAW_EXTENSION_URL = (imageId: string, jwt: string) => `${IMAGE_RAW_URL(imageId)}?access_token=${jwt}`;
5
+ export const IMAGE_URL = (imageId: string) => `${IMAGES_URL()}/${encodeURIComponent(imageId)}`;
6
+ export const IMAGE_RAW_URL = (imageId: string) => `${IMAGE_URL(imageId)}/raw`;
8
7
 
9
- export const IMAGES_THUMBNAIL_URL = () => `${IMAGES_URL()}/thumbnail`;
10
- export const IMAGE_THUMBNAIL_URL = (imageId: string) => `${IMAGES_THUMBNAIL_URL()}/${encodeURIComponent(imageId)}`;
11
-
12
- export const IMAGES_BLURHASH_URL = () => `${IMAGES_URL()}/blurHash`;
13
- export const IMAGE_BLURHASH_URL = (imageId: string) => `${IMAGES_BLURHASH_URL()}/${encodeURIComponent(imageId)}`;
8
+ export const IMAGE_THUMBNAIL_URL = (imageId: string) => `${IMAGE_URL(imageId)}/thumbnail`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-services",
3
3
  "sideEffects": false,
4
- "version": "1.0.13",
4
+ "version": "1.0.14",
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-shared-domain": "1.0.13"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.14"
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": "b77b0e0975cd193eae758a4af0effa38e5182a9f"
21
+ "gitHead": "e073c5a79111956c451fe05f19c7829246d4784e"
22
22
  }