@avleon/core 0.0.14 → 0.0.16
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/icore.js +30 -13
- package/dist/openapi.d.ts +2 -0
- package/package.json +5 -1
package/dist/icore.js
CHANGED
|
@@ -122,24 +122,41 @@ class AvleonApplication {
|
|
|
122
122
|
return env.get("NODE_ENV") == "development";
|
|
123
123
|
}
|
|
124
124
|
async initSwagger(options) {
|
|
125
|
-
const { routePrefix, logo, theme } = options, restOptions = __rest(options, ["routePrefix", "logo", "theme"]);
|
|
125
|
+
const { routePrefix, logo, ui, theme, configuration } = options, restOptions = __rest(options, ["routePrefix", "logo", "ui", "theme", "configuration"]);
|
|
126
126
|
this.app.register(swagger_1.default, {
|
|
127
127
|
openapi: Object.assign({ openapi: "3.0.0" }, restOptions),
|
|
128
128
|
});
|
|
129
129
|
const rPrefix = routePrefix ? routePrefix : "/docs";
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
if (options.ui && options.ui == "scalar") {
|
|
131
|
+
await this.app.register(require("@scalar/fastify-api-reference"), {
|
|
132
|
+
routePrefix: rPrefix,
|
|
133
|
+
configuration: configuration
|
|
134
|
+
? configuration
|
|
135
|
+
: {
|
|
136
|
+
metaData: {
|
|
137
|
+
title: "Avleon Api",
|
|
138
|
+
ogTitle: "Avleon",
|
|
139
|
+
},
|
|
140
|
+
theme: options.theme ? options.theme : "kepler",
|
|
141
|
+
favicon: "/static/favicon.png",
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
await this.app.register(require("@fastify/swagger-ui"), {
|
|
147
|
+
logo: logo ? logo : null,
|
|
148
|
+
theme: theme ? theme : {},
|
|
149
|
+
routePrefix: rPrefix,
|
|
150
|
+
configuration: {
|
|
151
|
+
metaData: {
|
|
152
|
+
title: "Avleon Api",
|
|
153
|
+
ogTitle: "Avleon",
|
|
154
|
+
},
|
|
155
|
+
theme: "kepler",
|
|
156
|
+
favicon: "/static/favicon.png",
|
|
138
157
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
143
160
|
}
|
|
144
161
|
useCors(corsOptions = {}) {
|
|
145
162
|
this.app.register(cors_1.default, corsOptions);
|
package/dist/openapi.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avleon/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf dist && tsc",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/jest": "^29.5.14",
|
|
16
|
+
"@types/node": "^20.17.25",
|
|
16
17
|
"class-transformer": "^0.5.1",
|
|
17
18
|
"class-validator": "^0.14.1",
|
|
18
19
|
"jest": "^29.7.0",
|
|
@@ -43,6 +44,9 @@
|
|
|
43
44
|
"class-validator": "^0.14.1",
|
|
44
45
|
"typeorm": "^0.3.20"
|
|
45
46
|
},
|
|
47
|
+
"optionalDependencies": {
|
|
48
|
+
"@scalar/fastify-api-reference": "^1.25.119"
|
|
49
|
+
},
|
|
46
50
|
"directories": {
|
|
47
51
|
"test": "tests"
|
|
48
52
|
},
|