@deltares/fews-web-oc-utils 2.1.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/README.md
CHANGED
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
# fews-web-oc-utils
|
|
2
2
|
|
|
3
3
|
## Project setup
|
|
4
|
+
|
|
4
5
|
```
|
|
5
6
|
npm install
|
|
6
7
|
```
|
|
8
|
+
|
|
7
9
|
### Compiles and minifies for production
|
|
10
|
+
|
|
8
11
|
```
|
|
9
12
|
npm run build
|
|
10
13
|
```
|
|
14
|
+
|
|
11
15
|
Build only esm bundle
|
|
16
|
+
|
|
12
17
|
```
|
|
13
18
|
npm run build:esm
|
|
14
19
|
```
|
|
20
|
+
|
|
15
21
|
Build only cjs bundle
|
|
22
|
+
|
|
16
23
|
```
|
|
17
24
|
npm run build:cjs
|
|
18
25
|
```
|
|
26
|
+
|
|
19
27
|
### Lints and fixes files
|
|
28
|
+
|
|
20
29
|
```
|
|
21
30
|
npm run lint
|
|
22
31
|
```
|
|
23
32
|
|
|
24
33
|
### Run tests
|
|
34
|
+
|
|
25
35
|
Get the coverage report
|
|
36
|
+
|
|
26
37
|
```
|
|
27
38
|
npm run test
|
|
28
39
|
```
|
|
40
|
+
|
|
29
41
|
Run only unit tests
|
|
42
|
+
|
|
30
43
|
```
|
|
31
44
|
npm run test:unit
|
|
32
45
|
```
|
|
46
|
+
|
|
33
47
|
Run only e2e tests
|
|
48
|
+
|
|
34
49
|
```
|
|
35
50
|
npm run test:e2e
|
|
36
51
|
```
|
|
@@ -22,13 +22,12 @@ var e = class {
|
|
|
22
22
|
webserviceUrl;
|
|
23
23
|
transformRequest;
|
|
24
24
|
constructor(e, t) {
|
|
25
|
-
if (this.webserviceUrl = e, t
|
|
26
|
-
else {
|
|
25
|
+
if (this.webserviceUrl = e, t === void 0) {
|
|
27
26
|
async function e(e) {
|
|
28
27
|
return e;
|
|
29
28
|
}
|
|
30
29
|
this.transformRequest = e;
|
|
31
|
-
}
|
|
30
|
+
} else this.transformRequest = t;
|
|
32
31
|
}
|
|
33
32
|
async getDataWithParser(e, t, n) {
|
|
34
33
|
let r = t.relativeUrl ? this.webserviceUrl + e : e, i = {}, a = {};
|
|
@@ -48,9 +47,12 @@ var e = class {
|
|
|
48
47
|
let r = new e();
|
|
49
48
|
return r.relativeUrl = !n.startsWith("http"), this.getDataWithParser(n, r, new t());
|
|
50
49
|
}
|
|
51
|
-
async postData(n, r, i
|
|
50
|
+
async postData(n, r, i) {
|
|
52
51
|
let a = new e();
|
|
53
|
-
return a.relativeUrl = !n.startsWith("http"), this.postDataWithParser(n, a, new t(), r,
|
|
52
|
+
return a.relativeUrl = !n.startsWith("http"), this.postDataWithParser(n, a, new t(), r, {
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
...i
|
|
55
|
+
});
|
|
54
56
|
}
|
|
55
57
|
async processResponse(e, t, n, r) {
|
|
56
58
|
e.responseCode = t.status, e.contentType = t.headers.get("content-type");
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import DataRequestResult from
|
|
2
|
-
import { RequestOptions } from
|
|
3
|
-
import { ResponseParser } from
|
|
4
|
-
export
|
|
5
|
-
(request: Request): Promise<Request>;
|
|
6
|
-
}
|
|
1
|
+
import type { DataRequestResult } from './dataRequestResult.js';
|
|
2
|
+
import { RequestOptions } from './requestOptions.js';
|
|
3
|
+
import { ResponseParser } from '../parser/responseParser.js';
|
|
4
|
+
export type TransformRequestFunction = (request: Request) => Promise<Request>;
|
|
7
5
|
export declare class PiRestService {
|
|
8
6
|
private readonly webserviceUrl;
|
|
9
|
-
private transformRequest;
|
|
7
|
+
private readonly transformRequest;
|
|
10
8
|
constructor(webserviceUrl: string, transformRequestFn?: TransformRequestFunction);
|
|
11
9
|
getDataWithParser<T>(url: string, requestOption: RequestOptions, parser: ResponseParser<T>): Promise<DataRequestResult<T>>;
|
|
12
10
|
postDataWithParser<T>(url: string, requestOption: RequestOptions, parser: ResponseParser<T>, body: BodyInit, headers: HeadersInit): Promise<DataRequestResult<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deltares/fews-web-oc-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Util Library for common Web OC functionality",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Werner Kramer",
|
|
@@ -25,34 +25,28 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "vite build && tsc -p tsconfig.build.json",
|
|
27
27
|
"doc": "typedoc --out doc src",
|
|
28
|
-
"lint": "
|
|
29
|
-
"
|
|
28
|
+
"lint": "npm run prettier",
|
|
29
|
+
"prettier": "prettier . --check",
|
|
30
|
+
"format": "prettier . --write",
|
|
30
31
|
"test:unit": "vitest run test/unit",
|
|
31
32
|
"test:e2e": "vitest run test/e2e",
|
|
32
|
-
"test": "vitest"
|
|
33
|
-
"sonar": "sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_KEY -Dsonar.projectName='Delft-FEWS Web OC Utils'"
|
|
33
|
+
"test": "vitest"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eslint/js": "^10.0.1",
|
|
37
37
|
"@types/node": "^24.12.2",
|
|
38
|
-
"eslint": "^10.
|
|
38
|
+
"eslint": "^10.4.0",
|
|
39
39
|
"eslint-config-prettier": "^10.1.8",
|
|
40
40
|
"fetch-mock": "^12.6.0",
|
|
41
|
-
"globals": "^17.
|
|
41
|
+
"globals": "^17.6.0",
|
|
42
42
|
"json-schema-to-typescript": "^15.0.4",
|
|
43
|
-
"
|
|
43
|
+
"prettier": "^3.8.3",
|
|
44
44
|
"tslib": "^2.8.1",
|
|
45
|
-
"typedoc": "^0.28.
|
|
46
|
-
"typescript": "^6.0.
|
|
47
|
-
"typescript-eslint": "^8.
|
|
48
|
-
"vite": "^8.0.
|
|
49
|
-
"vitest": "^4.1.
|
|
50
|
-
},
|
|
51
|
-
"overrides": {
|
|
52
|
-
"sonarqube-scanner": {
|
|
53
|
-
"axios": "^1.15.0",
|
|
54
|
-
"node-forge": "^1.4.0"
|
|
55
|
-
}
|
|
45
|
+
"typedoc": "^0.28.19",
|
|
46
|
+
"typescript": "^6.0.3",
|
|
47
|
+
"typescript-eslint": "^8.59.3",
|
|
48
|
+
"vite": "^8.0.13",
|
|
49
|
+
"vitest": "^4.1.6"
|
|
56
50
|
},
|
|
57
51
|
"engines": {
|
|
58
52
|
"node": ">=22.0.0"
|