zyket 1.0.27 → 1.0.29

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/index.js CHANGED
@@ -2,7 +2,7 @@ const Kernel = require("./src/kernel");
2
2
  const Service = require("./src/services/Service");
3
3
  const EnvManager = require("./src/utils/EnvManager");
4
4
 
5
- const {Route, Middleware} = require("./src/services/express");
5
+ const {Route, Middleware, Express} = require("./src/services/express");
6
6
  const { Handler, Guard } = require("./src/services/socketio");
7
7
  const Schedule = require("./src/services/scheduler/Schedule");
8
8
  const Event = require("./src/services/events/Event");
@@ -10,6 +10,7 @@ const Worker = require("./src/services/bullmq/Worker");
10
10
 
11
11
 
12
12
  module.exports = {
13
+ Express,
13
14
  Kernel, Service,
14
15
  Route, Middleware,
15
16
  Handler, Guard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyket",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -15,14 +15,16 @@ module.exports = class Express extends Service {
15
15
  #app;
16
16
  #httpServer;
17
17
  static swaggerConfig = {
18
- info: {
19
- title: process.env.API_DOCS_TITLE || "API Documentation",
20
- version: version,
21
- description: process.env.API_DOCS_DESCRIPTION || "API Documentation generated by Swagger",
18
+ swaggerDefinition: {
19
+ info: {
20
+ title: process.env.API_DOCS_TITLE || "API Documentation",
21
+ version: require(path.join(process.cwd(), "package.json")).version || "1.0.0",
22
+ description: process.env.API_DOCS_DESCRIPTION || "API Documentation generated by Swagger",
23
+ },
24
+ servers: [
25
+ { url: `http://localhost:3000` }
26
+ ],
22
27
  },
23
- servers: [
24
- { url: `http://localhost:3000` }
25
- ],
26
28
  }
27
29
 
28
30
  constructor(container) {
@@ -41,16 +43,14 @@ module.exports = class Express extends Service {
41
43
  this.#app.use(express.json({ limit: `100mb` }))
42
44
  this.#app.use(cors({
43
45
  origin: '*'
44
- }))
45
-
46
- // get version from package json
47
- const version = require(path.join(process.cwd(), "package.json")).version;
46
+ }));
48
47
 
49
48
  // Swagger setup
50
49
  const swaggerOptions = {
51
50
  ...Express.swaggerConfig,
52
51
  apis: [path.join(process.cwd(), "src", "routes", "**", "*.js")],
53
52
  };
53
+ console.log("Swagger Options:", swaggerOptions);
54
54
  const swaggerDocs = swaggerJsDoc(swaggerOptions);
55
55
  this.#app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerDocs));
56
56