@nxtedition/lib 23.3.6 → 23.3.8
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/package.json +2 -2
- package/serializers.js +25 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"@elastic/transport": "^8.9.3",
|
|
67
67
|
"@nxtedition/nxt-undici": "^6.1.2",
|
|
68
68
|
"@swc/wasm-web": "^1.10.16",
|
|
69
|
-
"canvas": "^3.1.0",
|
|
70
69
|
"content-type": "^1.0.5",
|
|
71
70
|
"date-fns": "^4.1.0",
|
|
72
71
|
"fast-querystring": "^1.1.1",
|
|
@@ -117,6 +116,7 @@
|
|
|
117
116
|
"@elastic/elasticsearch": "^8.6.0",
|
|
118
117
|
"@elastic/transport": "^8.3.1",
|
|
119
118
|
"@nxtedition/deepstream.io-client-js": ">=14.1.0",
|
|
119
|
+
"canvas": "^3.1.0",
|
|
120
120
|
"pino": ">=7.0.0",
|
|
121
121
|
"rxjs": ">=6.0.0"
|
|
122
122
|
}
|
package/serializers.js
CHANGED
|
@@ -27,28 +27,40 @@ function getUrl(obj) {
|
|
|
27
27
|
return undefined
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const { origin, path, hostname, protocol, port, url } = obj
|
|
31
|
+
|
|
32
|
+
const href = url?.href
|
|
33
|
+
if (typeof href === 'string' && href) {
|
|
34
|
+
return href
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
if (typeof
|
|
35
|
-
return
|
|
37
|
+
if (typeof url === 'string' && url) {
|
|
38
|
+
return url
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (origin && (!path || typeof path === 'string')) {
|
|
42
|
+
if (typeof origin === 'object') {
|
|
43
|
+
return `${origin.protocol || 'http:'}//${origin.hostname}:${origin.port || { 'http:': 80, 'https:': 443 }[origin.protocol]}${path || ''}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof origin === 'string') {
|
|
47
|
+
if (path?.startsWith('/') && origin.endsWith('/')) {
|
|
48
|
+
return `${origin.slice(0, -1)}${path || ''}`
|
|
49
|
+
} else {
|
|
50
|
+
return `${origin}${path || ''}`
|
|
51
|
+
}
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
if (
|
|
48
|
-
return `${
|
|
55
|
+
if (typeof hostname === 'string') {
|
|
56
|
+
return `${protocol || 'http:'}//${hostname}:${port || { 'http:': 80, 'https:': 443 }[protocol || 'http:']}${path || ''}`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (typeof path === 'string' && path) {
|
|
60
|
+
return path
|
|
49
61
|
}
|
|
50
62
|
|
|
51
|
-
return
|
|
63
|
+
return null
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
function getTiming(obj) {
|