@navios/openapi 0.7.0 → 0.9.1

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/legacy-compat/__type-tests__/legacy-decorators.spec-d.d.mts +2 -0
  3. package/dist/legacy-compat/__type-tests__/legacy-decorators.spec-d.d.mts.map +1 -0
  4. package/dist/legacy-compat/__type-tests__/tsconfig.tsbuildinfo +1 -0
  5. package/dist/src/legacy-compat/decorators/api-deprecated.decorator.d.mts +35 -0
  6. package/dist/src/legacy-compat/decorators/api-deprecated.decorator.d.mts.map +1 -0
  7. package/dist/src/legacy-compat/decorators/api-exclude.decorator.d.mts +28 -0
  8. package/dist/src/legacy-compat/decorators/api-exclude.decorator.d.mts.map +1 -0
  9. package/dist/src/legacy-compat/decorators/api-operation.decorator.d.mts +60 -0
  10. package/dist/src/legacy-compat/decorators/api-operation.decorator.d.mts.map +1 -0
  11. package/dist/src/legacy-compat/decorators/api-security.decorator.d.mts +38 -0
  12. package/dist/src/legacy-compat/decorators/api-security.decorator.d.mts.map +1 -0
  13. package/dist/src/legacy-compat/decorators/api-stream.decorator.d.mts +52 -0
  14. package/dist/src/legacy-compat/decorators/api-stream.decorator.d.mts.map +1 -0
  15. package/dist/src/legacy-compat/decorators/api-summary.decorator.d.mts +26 -0
  16. package/dist/src/legacy-compat/decorators/api-summary.decorator.d.mts.map +1 -0
  17. package/dist/src/legacy-compat/decorators/api-tag.decorator.d.mts +44 -0
  18. package/dist/src/legacy-compat/decorators/api-tag.decorator.d.mts.map +1 -0
  19. package/dist/src/legacy-compat/decorators/index.d.mts +8 -0
  20. package/dist/src/legacy-compat/decorators/index.d.mts.map +1 -0
  21. package/dist/src/legacy-compat/index.d.mts +24 -0
  22. package/dist/src/legacy-compat/index.d.mts.map +1 -0
  23. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  24. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/dist/vitest.config.d.mts.map +1 -1
  27. package/lib/index-BYd1gzJQ.d.cts +594 -0
  28. package/lib/index-BYd1gzJQ.d.cts.map +1 -0
  29. package/lib/index-KzCwlPFD.d.mts +594 -0
  30. package/lib/index-KzCwlPFD.d.mts.map +1 -0
  31. package/lib/index.cjs +20 -1840
  32. package/lib/index.cjs.map +1 -1
  33. package/lib/index.d.cts +2 -594
  34. package/lib/index.d.mts +2 -594
  35. package/lib/index.mjs +2 -1822
  36. package/lib/index.mjs.map +1 -1
  37. package/lib/legacy-compat/index.cjs +314 -0
  38. package/lib/legacy-compat/index.cjs.map +1 -0
  39. package/lib/legacy-compat/index.d.cts +285 -0
  40. package/lib/legacy-compat/index.d.cts.map +1 -0
  41. package/lib/legacy-compat/index.d.mts +285 -0
  42. package/lib/legacy-compat/index.d.mts.map +1 -0
  43. package/lib/legacy-compat/index.mjs +271 -0
  44. package/lib/legacy-compat/index.mjs.map +1 -0
  45. package/lib/services-MFCyRMd8.mjs +1825 -0
  46. package/lib/services-MFCyRMd8.mjs.map +1 -0
  47. package/lib/services-kEHEZqLZ.cjs +1896 -0
  48. package/lib/services-kEHEZqLZ.cjs.map +1 -0
  49. package/package.json +15 -5
  50. package/src/__tests__/metadata.spec.mts +5 -7
  51. package/src/__tests__/services.spec.mts +6 -7
  52. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +347 -0
  53. package/src/legacy-compat/__type-tests__/tsconfig.json +15 -0
  54. package/src/legacy-compat/decorators/api-deprecated.decorator.mts +46 -0
  55. package/src/legacy-compat/decorators/api-exclude.decorator.mts +31 -0
  56. package/src/legacy-compat/decorators/api-operation.decorator.mts +60 -0
  57. package/src/legacy-compat/decorators/api-security.decorator.mts +45 -0
  58. package/src/legacy-compat/decorators/api-stream.decorator.mts +56 -0
  59. package/src/legacy-compat/decorators/api-summary.decorator.mts +34 -0
  60. package/src/legacy-compat/decorators/api-tag.decorator.mts +52 -0
  61. package/src/legacy-compat/decorators/index.mts +7 -0
  62. package/src/legacy-compat/index.mts +58 -0
  63. package/tsconfig.spec.json +4 -1
  64. package/tsdown.config.mts +2 -2
  65. package/vitest.config.mts +5 -1
  66. package/lib/index.d.cts.map +0 -1
  67. package/lib/index.d.mts.map +0 -1
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod/v4';
2
+ declare const ApiSecuritySchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
3
+ /** Security requirement for an endpoint, inferred from the schema */
4
+ export type ApiSecurityRequirement = z.infer<typeof ApiSecuritySchema>;
5
+ /**
6
+ * Specifies security requirements for an endpoint.
7
+ *
8
+ * The security requirement object maps security scheme names to their scopes.
9
+ * For schemes that don't use scopes (like API keys), use an empty array.
10
+ *
11
+ * Legacy-compatible version for TypeScript experimental decorators.
12
+ *
13
+ * @param requirements - Security requirements object
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * @Controller()
18
+ * export class UserController {
19
+ * // Require bearer token authentication
20
+ * @Endpoint(getUser)
21
+ * @ApiSecurity({ bearerAuth: [] })
22
+ * async getUser() {}
23
+ *
24
+ * // Require multiple authentication methods
25
+ * @Endpoint(adminEndpoint)
26
+ * @ApiSecurity({ bearerAuth: [], apiKey: [] })
27
+ * async adminAction() {}
28
+ *
29
+ * // OAuth2 with specific scopes
30
+ * @Endpoint(writeUser)
31
+ * @ApiSecurity({ oauth2: ['users:write', 'users:read'] })
32
+ * async writeUser() {}
33
+ * }
34
+ * ```
35
+ */
36
+ export declare const ApiSecurity: import("@navios/core/legacy-compat").LegacyClassSchemaAttribute<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
37
+ export {};
38
+ //# sourceMappingURL=api-security.decorator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-security.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/api-security.decorator.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAI1B,QAAA,MAAM,iBAAiB,mDAA4C,CAAA;AAEnE,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,WAAW,oHAGvB,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod/v4';
2
+ declare const ApiStreamSchema: z.ZodObject<{
3
+ contentType: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ /** Options for the @ApiStream decorator, inferred from the schema */
7
+ export type ApiStreamOptions = z.infer<typeof ApiStreamSchema>;
8
+ /**
9
+ * Specifies content type and description for stream endpoints.
10
+ *
11
+ * Stream endpoints don't have a responseSchema, so this decorator provides
12
+ * the necessary metadata for OpenAPI documentation.
13
+ *
14
+ * Legacy-compatible version for TypeScript experimental decorators.
15
+ *
16
+ * @param options - Stream response options
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * @Controller()
21
+ * export class FileController {
22
+ * // Binary file download
23
+ * @Stream(downloadFile)
24
+ * @ApiStream({
25
+ * contentType: 'application/octet-stream',
26
+ * description: 'Download file as binary stream'
27
+ * })
28
+ * async download(params: StreamParams<typeof downloadFile>, reply: Reply) {
29
+ * // Stream implementation
30
+ * }
31
+ * }
32
+ *
33
+ * @Controller()
34
+ * export class EventController {
35
+ * // Server-Sent Events
36
+ * @Stream(streamEvents)
37
+ * @ApiStream({
38
+ * contentType: 'text/event-stream',
39
+ * description: 'Real-time event stream'
40
+ * })
41
+ * async stream(params: StreamParams<typeof streamEvents>, reply: Reply) {
42
+ * // SSE implementation
43
+ * }
44
+ * }
45
+ * ```
46
+ */
47
+ export declare const ApiStream: import("@navios/core/legacy-compat").LegacyClassSchemaAttribute<z.ZodObject<{
48
+ contentType: z.ZodString;
49
+ description: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>>;
51
+ export {};
52
+ //# sourceMappingURL=api-stream.decorator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-stream.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/api-stream.decorator.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAI1B,QAAA,MAAM,eAAe;;;iBAGnB,CAAA;AAEF,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,SAAS;;;kBAGrB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod/v4';
2
+ /**
3
+ * Shorthand decorator for adding just a summary to an endpoint.
4
+ *
5
+ * This is equivalent to `@ApiOperation({ summary: '...' })` but more concise.
6
+ *
7
+ * Legacy-compatible version for TypeScript experimental decorators.
8
+ *
9
+ * @param summary - Short summary text for the endpoint
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * @Controller()
14
+ * export class UserController {
15
+ * @Endpoint(getUser)
16
+ * @ApiSummary('Get user by ID')
17
+ * async getUser() {}
18
+ *
19
+ * @Endpoint(createUser)
20
+ * @ApiSummary('Create a new user')
21
+ * async createUser() {}
22
+ * }
23
+ * ```
24
+ */
25
+ export declare const ApiSummary: import("@navios/core/legacy-compat").LegacyClassSchemaAttribute<z.ZodString>;
26
+ //# sourceMappingURL=api-summary.decorator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-summary.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/api-summary.decorator.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAM1B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,UAAU,8EAGtB,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod/v4';
2
+ declare const ApiTagSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ /** Options for the @ApiTag decorator, inferred from the schema */
7
+ export type ApiTagOptions = z.infer<typeof ApiTagSchema>;
8
+ /**
9
+ * Groups endpoints under a specific tag/folder in the documentation.
10
+ *
11
+ * Can be applied to controllers (affects all endpoints) or individual methods.
12
+ * When applied to both, the method-level tag takes precedence.
13
+ *
14
+ * Legacy-compatible version for TypeScript experimental decorators.
15
+ *
16
+ * @param name - The tag name
17
+ * @param description - Optional tag description
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Apply to entire controller
22
+ * @Controller()
23
+ * @ApiTag('Users', 'User management operations')
24
+ * export class UserController {
25
+ * @Endpoint(getUser)
26
+ * async getUser() {}
27
+ * }
28
+ *
29
+ * // Apply to individual endpoint
30
+ * @Controller()
31
+ * export class MixedController {
32
+ * @Endpoint(getUser)
33
+ * @ApiTag('Users')
34
+ * async getUser() {}
35
+ *
36
+ * @Endpoint(getOrder)
37
+ * @ApiTag('Orders')
38
+ * async getOrder() {}
39
+ * }
40
+ * ```
41
+ */
42
+ export declare function ApiTag(name: string, description?: string): ClassDecorator & MethodDecorator;
43
+ export {};
44
+ //# sourceMappingURL=api-tag.decorator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-tag.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/api-tag.decorator.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAI1B,QAAA,MAAM,YAAY;;;iBAGhB,CAAA;AAEF,kEAAkE;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,oCAExD"}
@@ -0,0 +1,8 @@
1
+ export { ApiTag, type ApiTagOptions } from './api-tag.decorator.mjs';
2
+ export { ApiOperation, type ApiOperationOptions } from './api-operation.decorator.mjs';
3
+ export { ApiSummary } from './api-summary.decorator.mjs';
4
+ export { ApiDeprecated, type ApiDeprecatedOptions } from './api-deprecated.decorator.mjs';
5
+ export { ApiSecurity, type ApiSecurityRequirement } from './api-security.decorator.mjs';
6
+ export { ApiExclude } from './api-exclude.decorator.mjs';
7
+ export { ApiStream, type ApiStreamOptions } from './api-stream.decorator.mjs';
8
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Legacy-compatible decorators for projects that cannot use Stage 3 decorators.
3
+ *
4
+ * These decorators use the TypeScript experimental decorator API and convert
5
+ * the arguments to Stage 3 format internally.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { ApiTag, ApiOperation, ApiSummary } from '@navios/openapi/legacy-compat'
10
+ *
11
+ * @Controller()
12
+ * @ApiTag('Users', 'User management operations')
13
+ * export class UserController {
14
+ * @Endpoint(getUser)
15
+ * @ApiSummary('Get user by ID')
16
+ * async getUser() {}
17
+ * }
18
+ * ```
19
+ */
20
+ export { ApiTag, ApiOperation, ApiSummary, ApiDeprecated, ApiSecurity, ApiExclude, ApiStream, type ApiTagOptions, type ApiOperationOptions, type ApiDeprecatedOptions, type ApiSecurityRequirement, type ApiStreamOptions, } from './decorators/index.mjs';
21
+ export { ApiTagToken, ApiOperationToken, ApiSummaryToken, ApiDeprecatedToken, ApiSecurityToken, ApiExcludeToken, ApiStreamToken, } from '../tokens/index.mjs';
22
+ export { OpenApiGeneratorService, EndpointScannerService, MetadataExtractorService, SchemaConverterService, PathBuilderService, } from '../services/index.mjs';
23
+ export type { OpenApiEndpointMetadata } from '../metadata/index.mjs';
24
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/legacy-compat/index.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAG9B,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA"}