@opencloning/opencloningdb 1.7.1 → 1.8.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @opencloning/opencloningdb
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#713](https://github.com/OpenCloning/OpenCloning_frontend/pull/713) [`a30b4dd`](https://github.com/OpenCloning/OpenCloning_frontend/commit/a30b4dd3087ac422cc3de48014e6bdee5b98cfac) Thanks [@manulera](https://github.com/manulera)! - \* Add VITE_OPENCLONING_DB_BACKEND to environment variables, and use it to set the base URL for the OpenCloningDB backend.
8
+ - Use error2String for better sign up error messages.
9
+ - Updated dependencies [[`e4d9515`](https://github.com/OpenCloning/OpenCloning_frontend/commit/e4d9515a7f6fcad09e5c196f3cb090f70fe3a156)]:
10
+ - @opencloning/ui@1.9.1
11
+ - @opencloning/utils@1.9.1
12
+
13
+ ## 1.8.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#711](https://github.com/OpenCloning/OpenCloning_frontend/pull/711) [`6813620`](https://github.com/OpenCloning/OpenCloning_frontend/commit/6813620f4a47c44857045866d667474efbf9a64c) Thanks [@manulera](https://github.com/manulera)! - Use authentication for cloning endpoints in opencloning-db
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [[`6813620`](https://github.com/OpenCloning/OpenCloning_frontend/commit/6813620f4a47c44857045866d667474efbf9a64c)]:
22
+ - @opencloning/utils@1.9.0
23
+ - @opencloning/ui@1.9.0
24
+
25
+ ## 1.7.2
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [[`08144c0`](https://github.com/OpenCloning/OpenCloning_frontend/commit/08144c085cb5da37e902edc1a3b9c593c58ab680)]:
30
+ - @opencloning/ui@1.8.2
31
+ - @opencloning/utils@1.8.2
32
+
3
33
  ## 1.7.1
4
34
 
5
35
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@opencloning/opencloningdb",
4
- "version": "1.7.1",
4
+ "version": "1.8.1",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@mui/icons-material": "^5.18.0",
17
17
  "@mui/material": "^5.18.0",
18
- "@opencloning/ui": "1.8.1",
19
- "@opencloning/utils": "1.8.1",
18
+ "@opencloning/ui": "1.9.1",
19
+ "@opencloning/utils": "1.9.1",
20
20
  "axios": "^1.16.0"
21
21
  },
22
22
  "peerDependencies": {
package/src/common.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import axios from 'axios';
2
+ import { attachAuthInterceptors, setHttpClientUnauthorizedHandler } from '@opencloning/utils/httpClientAuth';
2
3
 
3
- export const baseUrl = 'http://localhost:8001';
4
4
 
5
- let unauthorizedHandler = null;
5
+ export const baseUrl = `${import.meta.env?.VITE_OPENCLONING_DB_BACKEND || 'http://localhost:8000'}/db`;
6
6
 
7
- export function setUnauthorizedHandler(fn) {
8
- unauthorizedHandler = fn;
9
- }
7
+ export const setUnauthorizedHandler = setHttpClientUnauthorizedHandler;
10
8
 
11
9
  export function setWorkspaceHeader(id) {
12
10
  openCloningDBHttpClient.defaults.headers.common['X-Workspace-Id'] = id;
@@ -41,20 +39,4 @@ export const openCloningDBHttpClient = axios.create({
41
39
  },
42
40
  });
43
41
 
44
- openCloningDBHttpClient.interceptors.request.use((config) => {
45
- const token = localStorage.getItem('token');
46
- if (token) {
47
- config.headers.Authorization = `Bearer ${token}`;
48
- }
49
- return config;
50
- });
51
-
52
- openCloningDBHttpClient.interceptors.response.use(
53
- (response) => response,
54
- (error) => {
55
- if (error.response?.status === 401 && unauthorizedHandler) {
56
- unauthorizedHandler();
57
- }
58
- return Promise.reject(error);
59
- },
60
- );
42
+ attachAuthInterceptors(openCloningDBHttpClient);
@@ -26,7 +26,7 @@ afterEach(() => {
26
26
 
27
27
  describe('common', () => {
28
28
  it('exports the expected base URL', () => {
29
- expect(baseUrl).toBe('http://localhost:8001');
29
+ expect(baseUrl).toBe('http://localhost:8000/db');
30
30
  });
31
31
 
32
32
  it('sets and clears the workspace header', () => {
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { default as OpenCloningDBInterface } from './OpenCloningDBInterface.js';
2
- export { openCloningDBHttpClient, setUnauthorizedHandler, setWorkspaceHeader, clearWorkspaceHeader } from './common.js';
2
+ export { openCloningDBHttpClient, setUnauthorizedHandler, setWorkspaceHeader, clearWorkspaceHeader, baseUrl } from './common.js';
3
3
  export { default as endpoints } from './endpoints.js';
4
4
  export { default as SequenceSelect } from './SequenceSelect.jsx';