@eik/service 2.3.2 → 4.0.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/CHANGELOG.md +33 -0
- package/bin/eik-server.js +11 -11
- package/lib/config.js +143 -145
- package/lib/main.js +840 -897
- package/lib/utils.js +36 -36
- package/package.json +12 -12
- package/types/main.d.ts +4 -4
package/lib/utils.js
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
import path from
|
1
|
+
import path from "path";
|
2
2
|
|
3
3
|
function doJoin(a, b) {
|
4
|
-
|
4
|
+
return path.join(a, b).replace(/\\/g, "/");
|
5
5
|
}
|
6
6
|
|
7
7
|
const sanitizeExtras = (extras, version) => {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
if (version && extras) {
|
9
|
+
return doJoin(version, extras);
|
10
|
+
}
|
11
|
+
return extras || "";
|
12
12
|
};
|
13
13
|
|
14
14
|
const sanitizeName = (scope, name) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
if (scope && name) {
|
16
|
+
return doJoin(scope, name);
|
17
|
+
}
|
18
|
+
return scope || "";
|
19
19
|
};
|
20
20
|
|
21
|
-
const sanitizeAlias = (alias =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
const sanitizeAlias = (alias = "") => {
|
22
|
+
if (alias.startsWith("v")) {
|
23
|
+
return alias.slice(1);
|
24
|
+
}
|
25
|
+
return alias;
|
26
26
|
};
|
27
27
|
|
28
|
-
const sanitizeParameters = (url =
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
28
|
+
const sanitizeParameters = (url = "") => {
|
29
|
+
const { pathname } = new URL(url, "http://localhost/");
|
30
|
+
const paths = pathname.split("/");
|
31
|
+
|
32
|
+
if (paths[2] && paths[2].startsWith("@")) {
|
33
|
+
return {
|
34
|
+
version: paths[4] || "",
|
35
|
+
extras: sanitizeExtras(paths.slice(5).join("/")),
|
36
|
+
alias: sanitizeAlias(paths[4]),
|
37
|
+
name: sanitizeName(paths[2] || "", paths[3] || ""),
|
38
|
+
type: paths[1] || "",
|
39
|
+
};
|
40
|
+
}
|
41
|
+
|
42
|
+
return {
|
43
|
+
version: paths[3] || "",
|
44
|
+
extras: sanitizeExtras(paths.slice(4).join("/")),
|
45
|
+
alias: sanitizeAlias(paths[3]),
|
46
|
+
name: sanitizeName(paths[2] || ""),
|
47
|
+
type: paths[1] || "",
|
48
|
+
};
|
49
49
|
};
|
50
50
|
|
51
51
|
export { sanitizeParameters, sanitizeExtras, sanitizeAlias, sanitizeName };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eik/service",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0",
|
4
4
|
"description": "Eik REST API as a standalone HTTP service",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./lib/main.js",
|
@@ -45,31 +45,31 @@
|
|
45
45
|
"@eik/sink": "1.2.5",
|
46
46
|
"@eik/sink-file-system": "1.0.1",
|
47
47
|
"@eik/sink-memory": "1.1.2",
|
48
|
-
"@fastify/compress": "
|
49
|
-
"@fastify/cors": "
|
50
|
-
"@fastify/jwt": "
|
48
|
+
"@fastify/compress": "8.0.1",
|
49
|
+
"@fastify/cors": "10.0.1",
|
50
|
+
"@fastify/jwt": "9.0.1",
|
51
51
|
"convict": "6.2.4",
|
52
|
-
"fastify": "
|
52
|
+
"fastify": "5.1.0",
|
53
53
|
"http-errors": "2.0.0",
|
54
54
|
"js-yaml": "4.1.0",
|
55
|
-
"pino": "
|
55
|
+
"pino": "9.5.0"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
|
-
"@eik/eslint-config": "1.0.
|
58
|
+
"@eik/eslint-config": "1.0.4",
|
59
59
|
"@eik/prettier-config": "1.0.1",
|
60
60
|
"@eik/semantic-release-config": "1.0.0",
|
61
61
|
"@eik/typescript-config": "1.0.0",
|
62
62
|
"@types/mime": "3.0.4",
|
63
|
-
"@types/readable-stream": "4.0.
|
63
|
+
"@types/readable-stream": "4.0.18",
|
64
64
|
"cross-env": "7.0.3",
|
65
|
-
"eslint": "9.
|
66
|
-
"form-data": "4.0.
|
65
|
+
"eslint": "9.13.0",
|
66
|
+
"form-data": "4.0.1",
|
67
67
|
"node-fetch": "3.3.2",
|
68
|
-
"npm-run-
|
68
|
+
"npm-run-all2": "5.0.2",
|
69
69
|
"pino-pretty": "10.3.1",
|
70
70
|
"prettier": "3.3.3",
|
71
71
|
"rimraf": "6.0.1",
|
72
|
-
"semantic-release": "24.
|
72
|
+
"semantic-release": "24.1.2",
|
73
73
|
"tap": "21.0.1",
|
74
74
|
"typescript": "5.5.4",
|
75
75
|
"unique-slug": "4.0.0"
|
package/types/main.d.ts
CHANGED
@@ -596,11 +596,11 @@ declare const EikService: {
|
|
596
596
|
};
|
597
597
|
metrics: PassThrough;
|
598
598
|
config: any;
|
599
|
-
logger: pino.Logger<never>;
|
599
|
+
logger: pino.Logger<never, boolean>;
|
600
600
|
sink: import("@eik/sink").default;
|
601
601
|
health(): Promise<void>;
|
602
|
-
api(): (app:
|
602
|
+
api(): (app: import("fastify").FastifyInstance) => Promise<void>;
|
603
603
|
};
|
604
604
|
};
|
605
|
-
import { PassThrough } from
|
606
|
-
import pino from
|
605
|
+
import { PassThrough } from "stream";
|
606
|
+
import pino from "pino";
|