@opencloning/utils 2.0.0 → 2.1.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,21 @@
|
|
|
1
1
|
# @opencloning/utils
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#790](https://github.com/OpenCloning/OpenCloning_frontend/pull/790) [`0b2a21d`](https://github.com/OpenCloning/OpenCloning_frontend/commit/0b2a21dde79f5539579bee39f0de49b01cd6c10c) Thanks [@manulera](https://github.com/manulera)! - Support for fetchin sequences created by the OC mcp server
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @opencloning/store@2.1.1
|
|
11
|
+
|
|
12
|
+
## 2.1.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies []:
|
|
17
|
+
- @opencloning/store@2.1.0
|
|
18
|
+
|
|
3
19
|
## 2.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "MIT",
|
|
3
3
|
"name": "@opencloning/utils",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/utils/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"directory": "packages/utils"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@opencloning/store": "2.
|
|
36
|
+
"@opencloning/store": "2.1.1",
|
|
37
37
|
"@teselagen/bio-parsers": "^0.4.38",
|
|
38
38
|
"@teselagen/sequence-utils": "^0.3.42",
|
|
39
39
|
"@zip.js/zip.js": "^2.8.26",
|
|
@@ -20,4 +20,6 @@ export default [
|
|
|
20
20
|
'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/taxonomy/taxon_suggest',
|
|
21
21
|
'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/taxon',
|
|
22
22
|
'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/accession',
|
|
23
|
+
// OpenCloning MCP server, set at build time
|
|
24
|
+
...(import.meta.env.VITE_MCP_SERVER_URL ? [import.meta.env.VITE_MCP_SERVER_URL] : []),
|
|
23
25
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default function error2String(error) {
|
|
2
2
|
if (error.code === 'ERR_NETWORK') { return 'Cannot connect to backend server'; }
|
|
3
|
-
|
|
3
|
+
// No response from the server (e.g. timeout), or not a request error
|
|
4
|
+
if (!error.code || !error.response) {
|
|
4
5
|
return error.message;
|
|
5
6
|
}
|
|
6
7
|
const { detail } = error.response.data;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import error2String from './error2String';
|
|
2
|
+
|
|
3
|
+
describe('error2String', () => {
|
|
4
|
+
it('returns the message of errors that are not from a request', () => {
|
|
5
|
+
expect(error2String(new Error('Something failed'))).toBe('Something failed');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('returns the message of request errors without a response (e.g. timeout)', () => {
|
|
9
|
+
const error = Object.assign(new Error('timeout of 1000ms exceeded'), { code: 'ECONNABORTED' });
|
|
10
|
+
expect(error2String(error)).toBe('timeout of 1000ms exceeded');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('handles network errors', () => {
|
|
14
|
+
expect(error2String({ code: 'ERR_NETWORK', message: 'Network Error' })).toBe('Cannot connect to backend server');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('returns the detail of the response', () => {
|
|
18
|
+
const error = { code: 'ERR_BAD_REQUEST', response: { status: 400, data: { detail: 'Bad input' } } };
|
|
19
|
+
expect(error2String(error)).toBe('Bad input');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('handles server errors', () => {
|
|
23
|
+
const error = { code: 'ERR_BAD_RESPONSE', response: { status: 500, data: {} } };
|
|
24
|
+
expect(error2String(error)).toBe('Internal server error');
|
|
25
|
+
});
|
|
26
|
+
});
|