@asyncapi/cli 3.5.0 → 3.5.2

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.
@@ -12,6 +12,7 @@ const helmet_1 = tslib_1.__importDefault(require("helmet"));
12
12
  const logger_1 = require("../../utils/logger");
13
13
  const constants_1 = require("./constants");
14
14
  const problem_middleware_1 = require("./middlewares/problem.middleware");
15
+ const logger_middleware_1 = require("./middlewares/logger.middleware");
15
16
  class App {
16
17
  constructor(controllers, port = process.env.PORT || 80, env = process.env.NODE_ENV || 'development') {
17
18
  this.controllers = controllers;
@@ -71,6 +72,7 @@ class App {
71
72
  // for `/docs` path
72
73
  crossOriginEmbedderPolicy: false,
73
74
  }));
75
+ this.app.use(logger_middleware_1.loggerMiddleware);
74
76
  });
75
77
  }
76
78
  initializeControllers() {
@@ -0,0 +1,8 @@
1
+ import { Router } from 'express';
2
+ import { Controller } from '../../../interfaces';
3
+ export declare class VersionController implements Controller {
4
+ basepath: string;
5
+ private startTime;
6
+ private getPackageInfo;
7
+ boot(): Promise<Router>;
8
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const os = tslib_1.__importStar(require("os"));
6
+ const fs = tslib_1.__importStar(require("fs"));
7
+ const path = tslib_1.__importStar(require("path"));
8
+ const express_1 = require("express");
9
+ class VersionController {
10
+ constructor() {
11
+ this.basepath = '/version';
12
+ this.startTime = new Date();
13
+ }
14
+ getPackageInfo() {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ try {
17
+ const packagePath = path.join(process.cwd(), 'package.json');
18
+ return JSON.parse(fs.readFileSync(packagePath, 'utf8'));
19
+ }
20
+ catch (_a) {
21
+ return {};
22
+ }
23
+ });
24
+ }
25
+ boot() {
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ const router = (0, express_1.Router)();
28
+ router.get(`${this.basepath}`, (req, res, next) => tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ var _a;
30
+ try {
31
+ const packageJson = yield this.getPackageInfo();
32
+ const versionInfo = {
33
+ // Core version information
34
+ version: packageJson.version || process.env.npm_package_version || 'unknown',
35
+ name: packageJson.name || 'AsyncAPI CLI API',
36
+ description: packageJson.description || 'All in one CLI for all AsyncAPI tools',
37
+ // Runtime information
38
+ runtime: {
39
+ node: process.version,
40
+ environment: process.env.NODE_ENV || 'development',
41
+ platform: os.platform(),
42
+ arch: os.arch(),
43
+ uptime: `${Math.floor((Date.now() - this.startTime.getTime()) / 1000)} seconds`,
44
+ startTime: this.startTime.toISOString()
45
+ },
46
+ // Repository information
47
+ repository: {
48
+ url: packageJson.homepage || ((_a = packageJson.repository) === null || _a === void 0 ? void 0 : _a.url) || 'https://github.com/asyncapi/cli',
49
+ bugs: packageJson.bugs || 'https://github.com/asyncapi/cli/issues',
50
+ license: packageJson.license || 'Apache-2.0'
51
+ },
52
+ // API metadata
53
+ api: {
54
+ basePath: this.basepath,
55
+ timestamp: new Date().toISOString(),
56
+ health: 'ok'
57
+ }
58
+ };
59
+ res.json(versionInfo);
60
+ }
61
+ catch (err) {
62
+ return next(err);
63
+ }
64
+ }));
65
+ return router;
66
+ });
67
+ }
68
+ }
69
+ exports.VersionController = VersionController;
@@ -6,4 +6,5 @@ import { BundleController } from './controllers/bundle.controller';
6
6
  import { DiffController } from './controllers/diff.controller';
7
7
  import { DocsController } from './controllers/docs.controller';
8
8
  import { HelpController } from './controllers/help.controller';
9
- export declare const CONTROLLERS: (ValidateController | ParseController | GenerateController | ConvertController | BundleController | DiffController | DocsController | HelpController)[];
9
+ import { VersionController } from './controllers/version.controller';
10
+ export declare const CONTROLLERS: (ValidateController | ParseController | GenerateController | ConvertController | BundleController | DiffController | DocsController | HelpController | VersionController)[];
@@ -9,6 +9,7 @@ const bundle_controller_1 = require("./controllers/bundle.controller");
9
9
  const diff_controller_1 = require("./controllers/diff.controller");
10
10
  const docs_controller_1 = require("./controllers/docs.controller");
11
11
  const help_controller_1 = require("./controllers/help.controller");
12
+ const version_controller_1 = require("./controllers/version.controller");
12
13
  exports.CONTROLLERS = [
13
14
  new validate_controller_1.ValidateController(),
14
15
  new parse_controller_1.ParseController(),
@@ -18,4 +19,5 @@ exports.CONTROLLERS = [
18
19
  new diff_controller_1.DiffController(),
19
20
  new docs_controller_1.DocsController(),
20
21
  new help_controller_1.HelpController(),
22
+ new version_controller_1.VersionController(),
21
23
  ];
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export declare function loggerMiddleware(req: Request, res: Response, next: NextFunction): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loggerMiddleware = loggerMiddleware;
4
+ const logger_1 = require("../../../utils/logger");
5
+ function loggerMiddleware(req, res, next) {
6
+ const start = Date.now();
7
+ res.on('finish', () => {
8
+ const duration = Date.now() - start;
9
+ logger_1.logger.info(`[${req.method}] ${req.originalUrl} ${res.statusCode} - ${duration}ms`);
10
+ });
11
+ next();
12
+ }
@@ -2142,5 +2142,5 @@
2142
2142
  ]
2143
2143
  }
2144
2144
  },
2145
- "version": "3.5.0"
2145
+ "version": "3.5.2"
2146
2146
  }
package/openapi.yaml CHANGED
@@ -1,6 +1,6 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
- version: 0.1.0
3
+ version: 0.2.0
4
4
  title: AsyncAPI Server API
5
5
  description: Server API providing official AsyncAPI tools
6
6
  contact:
@@ -15,6 +15,31 @@ servers:
15
15
  - url: https://api.asyncapi.com/v1
16
16
 
17
17
  paths:
18
+ /version:
19
+ get:
20
+ summary: Get the current version of the AsyncAPI CLI.
21
+ operationId: getVersion
22
+ tags:
23
+ - version
24
+ responses:
25
+ "200":
26
+ description: Successfully retrieved the version.
27
+ content:
28
+ application/json:
29
+ schema:
30
+ ref: "#/components/schemas/VersionResponse"
31
+ "500":
32
+ description: Internal server error.
33
+ content:
34
+ application/json:
35
+ schema:
36
+ $ref: "#/components/schemas/Problem"
37
+ default:
38
+ description: Unexpected problem.
39
+ content:
40
+ application/json:
41
+ schema:
42
+ $ref: "#/components/schemas/Problem"
18
43
  /validate:
19
44
  post:
20
45
  summary: Validate the given AsyncAPI document.
@@ -581,3 +606,108 @@ components:
581
606
  - title
582
607
  - status
583
608
  additionalProperties: true
609
+ VersionResponse:
610
+ type: object
611
+ description: Version information for the AsyncAPI CLI API
612
+ properties:
613
+ version:
614
+ type: string
615
+ description: The current version of the AsyncAPI CLI
616
+ example: "3.5.1"
617
+ name:
618
+ type: string
619
+ description: The name of the application
620
+ example: "@asyncapi/cli"
621
+ description:
622
+ type: string
623
+ description: Description of the application
624
+ example: "All in one CLI for all AsyncAPI tools"
625
+ runtime:
626
+ type: object
627
+ description: Runtime information
628
+ properties:
629
+ node:
630
+ type: string
631
+ description: Node.js version
632
+ example: "v24.7.0"
633
+ environment:
634
+ type: string
635
+ description: Build environment
636
+ example: "development"
637
+ enum: ["development", "staging", "production"]
638
+ platform:
639
+ type: string
640
+ description: Operating system platform
641
+ example: "darwin"
642
+ arch:
643
+ type: string
644
+ description: System architecture
645
+ example: "arm64"
646
+ uptime:
647
+ type: string
648
+ description: Application uptime
649
+ example: "12 seconds"
650
+ startTime:
651
+ type: string
652
+ format: date-time
653
+ description: Application start time
654
+ example: "2025-09-12T05:08:25.171Z"
655
+ required:
656
+ - node
657
+ - environment
658
+ - platform
659
+ - arch
660
+ - uptime
661
+ - startTime
662
+ repository:
663
+ type: object
664
+ description: Repository information
665
+ properties:
666
+ url:
667
+ type: string
668
+ format: uri
669
+ description: Repository URL
670
+ example: "https://github.com/asyncapi/cli"
671
+ bugs:
672
+ type: string
673
+ format: uri
674
+ description: Bug tracker URL
675
+ example: "https://github.com/asyncapi/cli/issues"
676
+ license:
677
+ type: string
678
+ description: License type
679
+ example: "Apache-2.0"
680
+ required:
681
+ - url
682
+ - bugs
683
+ - license
684
+ api:
685
+ type: object
686
+ description: API metadata
687
+ properties:
688
+ basePath:
689
+ type: string
690
+ description: API base path
691
+ example: "/version"
692
+ timestamp:
693
+ type: string
694
+ format: date-time
695
+ description: Current timestamp
696
+ example: "2025-09-12T05:08:37.979Z"
697
+ health:
698
+ type: string
699
+ description: API health status
700
+ example: "ok"
701
+ enum: ["ok", "degraded", "error"]
702
+ required:
703
+ - basePath
704
+ - timestamp
705
+ - health
706
+ required:
707
+ - version
708
+ - name
709
+ - description
710
+ - build
711
+ - runtime
712
+ - repository
713
+ - api
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@asyncapi/cli",
3
3
  "description": "All in one CLI for all AsyncAPI tools",
4
- "version": "3.5.0",
4
+ "version": "3.5.2",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run_bin"
@@ -199,7 +199,7 @@
199
199
  "api:prod": "npm run api:build && cross-env NODE_ENV=production PORT=80 node lib/apps/api/server.js",
200
200
  "api:docker": "docker run -it -p 80:80 asyncapi/server-api",
201
201
  "api:build:docker": "docker build -t asyncapi/server-api -f ./src/apps/api/Dockerfile .",
202
- "api:build": "rimraf lib && tsc && tsc-alias --project tsconfig.json",
202
+ "api:build": "rimraf lib && npm run generate:languages && tsc && tsc-alias --project tsconfig.json",
203
203
  "api:test": ""
204
204
  },
205
205
  "types": "lib/index.d.ts"