@navios/openapi-bun 0.7.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navios/openapi-bun",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "author": {
5
5
  "name": "Oleksandr Hanzha",
6
6
  "email": "alex@granted.name"
@@ -12,10 +12,10 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "peerDependencies": {
15
- "@navios/adapter-bun": "^0.7.1",
16
- "@navios/builder": "^0.5.1",
17
- "@navios/core": "^0.7.1",
18
- "@navios/openapi": "^0.7.0",
15
+ "@navios/adapter-bun": "^0.9.0",
16
+ "@navios/builder": "^0.5.2",
17
+ "@navios/core": "^0.9.0",
18
+ "@navios/openapi": "^0.9.0",
19
19
  "zod": "^3.25.0 || ^4.0.0"
20
20
  },
21
21
  "typings": "./lib/index.d.mts",
@@ -34,10 +34,10 @@
34
34
  }
35
35
  },
36
36
  "devDependencies": {
37
- "@navios/adapter-bun": "^0.7.1",
38
- "@navios/builder": "^0.5.1",
39
- "@navios/core": "^0.7.1",
40
- "@navios/openapi": "^0.7.0",
37
+ "@navios/adapter-bun": "^0.9.0",
38
+ "@navios/builder": "^0.5.2",
39
+ "@navios/core": "^0.9.0",
40
+ "@navios/openapi": "^0.9.0",
41
41
  "typescript": "^5.9.3",
42
42
  "zod": "^4.2.1"
43
43
  },
@@ -1,5 +1,4 @@
1
- import type { EndpointParams, EndpointResult } from '@navios/core'
2
- import type { ClassType } from '@navios/di'
1
+ import type { ClassType, EndpointResult } from '@navios/core'
3
2
 
4
3
  import { builder } from '@navios/builder'
5
4
  import { Controller, Endpoint, inject } from '@navios/core'
@@ -37,9 +36,7 @@ export function createOpenApiJsonController(jsonPath: string): ClassType {
37
36
  private documentService = inject(OpenApiDocumentServiceToken)
38
37
 
39
38
  @Endpoint(endpoint)
40
- async getJson(
41
- _params: EndpointParams<typeof endpoint>,
42
- ): EndpointResult<typeof endpoint> {
39
+ async getJson(): EndpointResult<typeof endpoint> {
43
40
  return this.documentService.getDocument() as unknown as Record<
44
41
  string,
45
42
  unknown
@@ -1,5 +1,4 @@
1
- import type { StreamParams } from '@navios/core'
2
- import type { ClassType } from '@navios/di'
1
+ import type { ClassType } from '@navios/core'
3
2
 
4
3
  import { builder } from '@navios/builder'
5
4
  import { Controller, inject, Stream } from '@navios/core'
@@ -35,10 +34,9 @@ export function createOpenApiUiController(
35
34
  private options = inject(OpenApiOptionsToken)
36
35
  private html: string | null = null
37
36
 
38
- // @ts-expect-error - Stream decorator is not typed correctly
39
37
  @Stream(endpoint)
40
38
  @ApiStream({ contentType: 'text/html' })
41
- async getUi(_params: StreamParams<typeof endpoint>) {
39
+ async getUi() {
42
40
  // Generate HTML on first request (lazy initialization)
43
41
  if (!this.html) {
44
42
  this.html = this.generateHtml()
@@ -1,5 +1,4 @@
1
- import type { StreamParams } from '@navios/core'
2
- import type { ClassType } from '@navios/di'
1
+ import type { ClassType } from '@navios/core'
3
2
 
4
3
  import { builder } from '@navios/builder'
5
4
  import { Controller, inject, Stream } from '@navios/core'
@@ -27,10 +26,9 @@ export function createOpenApiYamlController(yamlPath: string): ClassType {
27
26
  class OpenApiYamlController {
28
27
  private documentService = inject(OpenApiDocumentServiceToken)
29
28
 
30
- // @ts-expect-error - Stream decorator is not typed correctly
31
29
  @Stream(endpoint)
32
30
  @ApiStream({ contentType: 'text/yaml' })
33
- async getYaml(_params: StreamParams<typeof endpoint>) {
31
+ async getYaml() {
34
32
  const yaml = this.documentService.getYamlDocument()
35
33
 
36
34
  // Return a Response with proper content-type
@@ -1,11 +1,9 @@
1
1
  import type {
2
+ ClassType,
2
3
  NaviosPlugin,
3
4
  PluginContext,
4
5
  PluginDefinition,
5
6
  } from '@navios/core'
6
- import type { ClassType } from '@navios/di'
7
-
8
- import { InjectableScope, InjectableType } from '@navios/di'
9
7
 
10
8
  import type { ScalarOptions, ScalarTheme } from './schemas/index.mjs'
11
9
  import type { BunOpenApiPluginOptions } from './tokens/openapi-options.token.mjs'
@@ -67,17 +65,7 @@ export class OpenApiBunPlugin implements NaviosPlugin<BunOpenApiPluginOptions> {
67
65
  context: PluginContext,
68
66
  options: BunOpenApiPluginOptions,
69
67
  ): void {
70
- const locator = context.container.getServiceLocator()
71
- const instanceName = locator.getInstanceIdentifier(OpenApiOptionsToken)
72
-
73
- locator
74
- .getManager()
75
- .storeCreatedHolder(
76
- instanceName,
77
- options,
78
- InjectableType.Class,
79
- InjectableScope.Singleton,
80
- )
68
+ context.container.addInstance(OpenApiOptionsToken, options)
81
69
  }
82
70
 
83
71
  /**