@viridial/shared 1.0.3 → 1.0.5

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 +1 @@
1
- {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../api/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAGlJ;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;uBACsB,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ9D;;OAEG;iBACgB,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAK1D;;OAEG;cACa,OAAO,CAAC,IAAI,CAAC;IAQ7B;;OAEG;yBACwB,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;OAEG;wBACuB,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;OAEG;oBACmB,OAAO,CAAC,aAAa,CAAC;IAQ5C;;OAEG;uBACgB,OAAO;CAG3B,CAAA"}
1
+ {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../api/auth.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAGlJ;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;uBACsB,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ9D;;OAEG;iBACgB,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAK1D;;OAEG;cACa,OAAO,CAAC,IAAI,CAAC;IAQ7B;;OAEG;yBACwB,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;OAEG;wBACuB,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;OAEG;oBACmB,OAAO,CAAC,aAAa,CAAC;IAQ5C;;OAEG;uBACgB,OAAO;CAG3B,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { httpClient } from './http.client';
2
+ import { API_ENDPOINTS } from '../constants/api.constants';
2
3
  import { tokenUtils } from '../utils/token.utils';
3
4
  /**
4
5
  * Service d'authentification
@@ -8,7 +9,7 @@ export const authService = {
8
9
  * Connexion
9
10
  */
10
11
  async login(credentials) {
11
- const response = await httpClient.post('/identity/auth/login', credentials);
12
+ const response = await httpClient.post(API_ENDPOINTS.AUTH.LOGIN, credentials);
12
13
  if (response.data?.token) {
13
14
  tokenUtils.setToken(response.data.token);
14
15
  }
@@ -18,7 +19,7 @@ export const authService = {
18
19
  * Inscription
19
20
  */
20
21
  async signup(data) {
21
- const response = await httpClient.post('/identity/auth/register', data);
22
+ const response = await httpClient.post(API_ENDPOINTS.AUTH.REGISTER, data);
22
23
  return response.data;
23
24
  },
24
25
  /**
@@ -26,7 +27,7 @@ export const authService = {
26
27
  */
27
28
  async logout() {
28
29
  try {
29
- await httpClient.post('/identity/auth/logout');
30
+ await httpClient.post(API_ENDPOINTS.AUTH.LOGOUT);
30
31
  }
31
32
  finally {
32
33
  tokenUtils.removeToken();
@@ -36,19 +37,19 @@ export const authService = {
36
37
  * Demande de réinitialisation de mot de passe
37
38
  */
38
39
  async forgotPassword(data) {
39
- await httpClient.post('/identity/auth/forgot-password', data);
40
+ await httpClient.post(API_ENDPOINTS.AUTH.FORGOT_PASSWORD, data);
40
41
  },
41
42
  /**
42
43
  * Réinitialisation de mot de passe
43
44
  */
44
45
  async resetPassword(data) {
45
- await httpClient.post('/identity/auth/reset-password', data);
46
+ await httpClient.post(API_ENDPOINTS.AUTH.RESET_PASSWORD, data);
46
47
  },
47
48
  /**
48
49
  * Rafraîchir le token
49
50
  */
50
51
  async refreshToken() {
51
- const response = await httpClient.post('/identity/auth/refresh');
52
+ const response = await httpClient.post(API_ENDPOINTS.AUTH.REFRESH);
52
53
  if (response.data?.token) {
53
54
  tokenUtils.setToken(response.data.token);
54
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.client.d.ts","sourceRoot":"","sources":["../../api/http.client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAsB,KAAK,kBAAkB,EAAsB,MAAM,OAAO,CAAA;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,oBAAoB,CAAA;AAiB/D;;GAEG;AACH,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAe;gBAEjB,OAAO,CAAC,EAAE,MAAM;IAc5B,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,WAAW;IAcb,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASzE,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAStF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASrF,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASvF,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAQnF;AAED,eAAO,MAAM,UAAU,YAAmB,CAAA"}
1
+ {"version":3,"file":"http.client.d.ts","sourceRoot":"","sources":["../../api/http.client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAsB,KAAK,kBAAkB,EAAsB,MAAM,OAAO,CAAA;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,oBAAoB,CAAA;AAgB/D;;GAEG;AACH,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAe;gBAEjB,OAAO,CAAC,EAAE,MAAM;IAc5B,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,WAAW;IAcb,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASzE,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAStF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASrF,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IASvF,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAQnF;AAED,eAAO,MAAM,UAAU,YAAmB,CAAA"}
@@ -2,16 +2,15 @@ import axios from 'axios';
2
2
  import { tokenUtils } from '../utils/token.utils';
3
3
  /**
4
4
  * Get API base URL from environment or use default
5
- * Note: In the shared package, we use '/api' as default (proxy path)
6
- * The actual URL is configured in the frontend application via Vite proxy
5
+ * Note: In the shared package, we use empty string as default
6
+ * The endpoints already include '/api' prefix for Vite proxy
7
+ * The proxy in vite.config.ts redirects /api to VITE_API_BASE_URL
7
8
  */
8
9
  const getApiBaseUrl = () => {
9
- // Try to get from window (if set by Vite at runtime)
10
- if (typeof window !== 'undefined' && window.__API_BASE_URL__) {
11
- return window.__API_BASE_URL__;
12
- }
13
- // Default: use proxy path (Vite will proxy /api to the configured backend)
14
- return '/api';
10
+ // Always use empty string - endpoints already include /api prefix
11
+ // The Vite proxy will handle redirecting /api to the gateway
12
+ // Example: /api/identity/auth/login -> proxy -> http://localhost:8080/api/identity/auth/login
13
+ return '';
15
14
  };
16
15
  /**
17
16
  * Client HTTP configuré avec intercepteurs pour l'authentification
@@ -3,30 +3,40 @@
3
3
  */
4
4
  export declare const API_ENDPOINTS: {
5
5
  readonly AUTH: {
6
- readonly LOGIN: "/identity/auth/login";
7
- readonly REGISTER: "/identity/auth/register";
8
- readonly LOGOUT: "/identity/auth/logout";
9
- readonly REFRESH: "/identity/auth/refresh";
10
- readonly FORGOT_PASSWORD: "/identity/auth/forgot-password";
11
- readonly RESET_PASSWORD: "/identity/auth/reset-password";
6
+ readonly LOGIN: "/api/identity/auth/login";
7
+ readonly REGISTER: "/api/identity/auth/register";
8
+ readonly LOGOUT: "/api/identity/auth/logout";
9
+ readonly REFRESH: "/api/identity/auth/refresh";
10
+ readonly FORGOT_PASSWORD: "/api/identity/auth/forgot-password";
11
+ readonly RESET_PASSWORD: "/api/identity/auth/reset-password";
12
12
  };
13
13
  readonly PROPERTIES: {
14
- readonly BASE: "/property-service/api/properties";
15
- readonly SEARCH: "/property-service/api/properties/search";
14
+ readonly BASE: "/api/properties";
15
+ readonly SEARCH: "/api/properties/search";
16
16
  readonly BY_ID: (id: number) => string;
17
17
  };
18
18
  readonly USERS: {
19
- readonly BASE: "/identity-service/api/users";
19
+ readonly BASE: "/api/identity/users";
20
20
  readonly BY_ID: (id: number) => string;
21
- readonly PROFILE: "/identity-service/api/users/profile";
22
- readonly STATS: "/identity-service/api/users/stats";
23
- readonly SEARCH: "/identity-service/api/users/search";
21
+ readonly PROFILE: "/api/identity/users/profile";
22
+ readonly STATS: "/api/identity/users/stats";
23
+ readonly SEARCH: "/api/identity/users/search";
24
24
  readonly ACTIVITY: (id: number) => string;
25
25
  };
26
26
  readonly ORGANIZATIONS: {
27
- readonly BASE: "/organization-service/api/organizations";
27
+ readonly BASE: "/api/organizations";
28
28
  readonly BY_ID: (id: number) => string;
29
29
  };
30
30
  };
31
- export declare const API_BASE_URL: string;
31
+ /**
32
+ * Get API base URL from environment
33
+ * Note: This constant is not used by httpClient (which uses empty string)
34
+ * It's kept for backward compatibility and documentation purposes
35
+ * The actual routing works as follows:
36
+ * - Frontend requests: /api/identity/auth/login
37
+ * - Vite proxy: redirects /api to VITE_API_BASE_URL (http://localhost:8080)
38
+ * - Final URL: http://localhost:8080/api/identity/auth/login
39
+ * - Gateway routes: /api/identity/** to identity-service:8081
40
+ */
41
+ export declare const API_BASE_URL = "/api";
32
42
  //# sourceMappingURL=api.constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;;;;6BAKN,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;;CAEZ,CAAA;AAgBV,eAAO,MAAM,YAAY,QAAkB,CAAA"}
1
+ {"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;;;;6BAKN,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;;CAEZ,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA"}
@@ -4,45 +4,42 @@
4
4
  export const API_ENDPOINTS = {
5
5
  // Authentication
6
6
  AUTH: {
7
- LOGIN: '/identity/auth/login',
8
- REGISTER: '/identity/auth/register',
9
- LOGOUT: '/identity/auth/logout',
10
- REFRESH: '/identity/auth/refresh',
11
- FORGOT_PASSWORD: '/identity/auth/forgot-password',
12
- RESET_PASSWORD: '/identity/auth/reset-password'
7
+ LOGIN: '/api/identity/auth/login',
8
+ REGISTER: '/api/identity/auth/register',
9
+ LOGOUT: '/api/identity/auth/logout',
10
+ REFRESH: '/api/identity/auth/refresh',
11
+ FORGOT_PASSWORD: '/api/identity/auth/forgot-password',
12
+ RESET_PASSWORD: '/api/identity/auth/reset-password'
13
13
  },
14
14
  // Properties
15
15
  PROPERTIES: {
16
- BASE: '/property-service/api/properties',
17
- SEARCH: '/property-service/api/properties/search',
18
- BY_ID: (id) => `/property-service/api/properties/${id}`
16
+ BASE: '/api/properties',
17
+ SEARCH: '/api/properties/search',
18
+ BY_ID: (id) => `/api/properties/${id}`
19
19
  },
20
20
  // Users
21
21
  USERS: {
22
- BASE: '/identity-service/api/users',
23
- BY_ID: (id) => `/identity-service/api/users/${id}`,
24
- PROFILE: '/identity-service/api/users/profile',
25
- STATS: '/identity-service/api/users/stats',
26
- SEARCH: '/identity-service/api/users/search',
27
- ACTIVITY: (id) => `/identity-service/api/users/${id}/activity`
22
+ BASE: '/api/identity/users',
23
+ BY_ID: (id) => `/api/identity/users/${id}`,
24
+ PROFILE: '/api/identity/users/profile',
25
+ STATS: '/api/identity/users/stats',
26
+ SEARCH: '/api/identity/users/search',
27
+ ACTIVITY: (id) => `/api/identity/users/${id}/activity`
28
28
  },
29
29
  // Organizations
30
30
  ORGANIZATIONS: {
31
- BASE: '/organization-service/api/organizations',
32
- BY_ID: (id) => `/organization-service/api/organizations/${id}`
31
+ BASE: '/api/organizations',
32
+ BY_ID: (id) => `/api/organizations/${id}`
33
33
  }
34
34
  };
35
35
  /**
36
36
  * Get API base URL from environment
37
- * Note: In the shared package, we use '/api' as default (proxy path)
38
- * The actual URL is configured in the frontend application via Vite proxy
37
+ * Note: This constant is not used by httpClient (which uses empty string)
38
+ * It's kept for backward compatibility and documentation purposes
39
+ * The actual routing works as follows:
40
+ * - Frontend requests: /api/identity/auth/login
41
+ * - Vite proxy: redirects /api to VITE_API_BASE_URL (http://localhost:8080)
42
+ * - Final URL: http://localhost:8080/api/identity/auth/login
43
+ * - Gateway routes: /api/identity/** to identity-service:8081
39
44
  */
40
- const getApiBaseUrl = () => {
41
- // Try to get from window (if set by Vite at runtime)
42
- if (typeof window !== 'undefined' && window.__API_BASE_URL__) {
43
- return window.__API_BASE_URL__;
44
- }
45
- // Default: use proxy path (Vite will proxy /api to the configured backend)
46
- return '/api';
47
- };
48
- export const API_BASE_URL = getApiBaseUrl();
45
+ export const API_BASE_URL = '/api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viridial/shared",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "Shared modules for Real Estate frontend applications - Vue 3, TypeScript, Pinia, Axios",
6
6
  "main": "./dist/index.js",