@deltares/fews-web-oc-utils 2.0.1 → 2.1.0
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/dist/fews-web-oc-utils.js +69 -78
- package/package.json +21 -11
|
@@ -1,79 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
class
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
class q {
|
|
70
|
-
async parse(e) {
|
|
71
|
-
return await e.text();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
l as DefaultParser,
|
|
76
|
-
w as PiRestService,
|
|
77
|
-
q as PlainTextParser,
|
|
78
|
-
u as RequestOptions
|
|
1
|
+
//#region src/restservice/requestOptions.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
_mode = "cors";
|
|
4
|
+
_relativeUrl = !0;
|
|
5
|
+
get relativeUrl() {
|
|
6
|
+
return this._relativeUrl;
|
|
7
|
+
}
|
|
8
|
+
set relativeUrl(e) {
|
|
9
|
+
this._relativeUrl = e;
|
|
10
|
+
}
|
|
11
|
+
get mode() {
|
|
12
|
+
return this._mode;
|
|
13
|
+
}
|
|
14
|
+
set mode(e) {
|
|
15
|
+
this._mode = e;
|
|
16
|
+
}
|
|
17
|
+
}, t = class {
|
|
18
|
+
async parse(e) {
|
|
19
|
+
return await e.json();
|
|
20
|
+
}
|
|
21
|
+
}, n = class {
|
|
22
|
+
webserviceUrl;
|
|
23
|
+
transformRequest;
|
|
24
|
+
constructor(e, t) {
|
|
25
|
+
if (this.webserviceUrl = e, t !== void 0) this.transformRequest = t;
|
|
26
|
+
else {
|
|
27
|
+
async function e(e) {
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
this.transformRequest = e;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async getDataWithParser(e, t, n) {
|
|
34
|
+
let r = t.relativeUrl ? this.webserviceUrl + e : e, i = {}, a = {};
|
|
35
|
+
a.method = "GET";
|
|
36
|
+
let o = new Request(r, a), s = await fetch(await this.transformRequest(o));
|
|
37
|
+
if (!s.ok) throw Error("Fetch Error", { cause: s });
|
|
38
|
+
return await this.processResponse(i, s, r, n);
|
|
39
|
+
}
|
|
40
|
+
async postDataWithParser(e, t, n, r, i) {
|
|
41
|
+
let a = t.relativeUrl ? this.webserviceUrl + e : e, o = {}, s = {};
|
|
42
|
+
s.method = "POST", s.body = r, s.headers = i;
|
|
43
|
+
let c = new Request(a, s), l = await fetch(await this.transformRequest(c));
|
|
44
|
+
if (!l.ok) throw Error("Fetch Error", { cause: l });
|
|
45
|
+
return await this.processResponse(o, l, a, n);
|
|
46
|
+
}
|
|
47
|
+
async getData(n) {
|
|
48
|
+
let r = new e();
|
|
49
|
+
return r.relativeUrl = !n.startsWith("http"), this.getDataWithParser(n, r, new t());
|
|
50
|
+
}
|
|
51
|
+
async postData(n, r, i = { "Content-Type": "application/json" }) {
|
|
52
|
+
let a = new e();
|
|
53
|
+
return a.relativeUrl = !n.startsWith("http"), this.postDataWithParser(n, a, new t(), r, i);
|
|
54
|
+
}
|
|
55
|
+
async processResponse(e, t, n, r) {
|
|
56
|
+
e.responseCode = t.status, e.contentType = t.headers.get("content-type");
|
|
57
|
+
try {
|
|
58
|
+
e.data = await r.parse(t);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
throw Error(`Parse Error for response ${n}.`, { cause: e });
|
|
61
|
+
}
|
|
62
|
+
return e;
|
|
63
|
+
}
|
|
64
|
+
}, r = class {
|
|
65
|
+
async parse(e) {
|
|
66
|
+
return await e.text();
|
|
67
|
+
}
|
|
79
68
|
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { t as DefaultParser, n as PiRestService, r as PlainTextParser, e as RequestOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deltares/fews-web-oc-utils",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Util Library for common Web OC functionality",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Werner Kramer",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "
|
|
26
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
27
27
|
"doc": "typedoc --out doc src",
|
|
28
28
|
"lint": "eslint",
|
|
29
29
|
"lint:fix": "eslint --fix",
|
|
@@ -33,19 +33,26 @@
|
|
|
33
33
|
"sonar": "sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_KEY -Dsonar.projectName='Delft-FEWS Web OC Utils'"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"eslint": "^
|
|
36
|
+
"@eslint/js": "^10.0.1",
|
|
37
|
+
"@types/node": "^24.12.2",
|
|
38
|
+
"eslint": "^10.2.0",
|
|
39
39
|
"eslint-config-prettier": "^10.1.8",
|
|
40
40
|
"fetch-mock": "^12.6.0",
|
|
41
|
+
"globals": "^17.4.0",
|
|
41
42
|
"json-schema-to-typescript": "^15.0.4",
|
|
42
|
-
"sonarqube-scanner": "^4.3.
|
|
43
|
+
"sonarqube-scanner": "^4.3.5",
|
|
43
44
|
"tslib": "^2.8.1",
|
|
44
|
-
"typedoc": "^0.28.
|
|
45
|
-
"typescript": "^
|
|
46
|
-
"typescript-eslint": "^8.
|
|
47
|
-
"vite": "^
|
|
48
|
-
"vitest": "^4.
|
|
45
|
+
"typedoc": "^0.28.18",
|
|
46
|
+
"typescript": "^6.0.2",
|
|
47
|
+
"typescript-eslint": "^8.58.1",
|
|
48
|
+
"vite": "^8.0.8",
|
|
49
|
+
"vitest": "^4.1.4"
|
|
50
|
+
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"sonarqube-scanner": {
|
|
53
|
+
"axios": "^1.15.0",
|
|
54
|
+
"node-forge": "^1.4.0"
|
|
55
|
+
}
|
|
49
56
|
},
|
|
50
57
|
"engines": {
|
|
51
58
|
"node": ">=22.0.0"
|
|
@@ -63,5 +70,8 @@
|
|
|
63
70
|
"publishConfig": {
|
|
64
71
|
"access": "public",
|
|
65
72
|
"registry": "https://registry.npmjs.org"
|
|
73
|
+
},
|
|
74
|
+
"volta": {
|
|
75
|
+
"node": "24.14.1"
|
|
66
76
|
}
|
|
67
77
|
}
|