@navios/core 0.4.0 → 0.5.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 (92) hide show
  1. package/README.md +95 -2
  2. package/docs/README.md +310 -3
  3. package/docs/adapters.md +308 -0
  4. package/docs/application-setup.md +524 -0
  5. package/docs/attributes.md +689 -0
  6. package/docs/controllers.md +373 -0
  7. package/docs/endpoints.md +444 -0
  8. package/docs/exceptions.md +316 -0
  9. package/docs/guards.md +550 -0
  10. package/docs/modules.md +377 -0
  11. package/docs/quick-start.md +295 -0
  12. package/docs/services.md +427 -0
  13. package/docs/testing.md +704 -0
  14. package/lib/_tsup-dts-rollup.d.mts +310 -239
  15. package/lib/_tsup-dts-rollup.d.ts +310 -239
  16. package/lib/index.d.mts +51 -28
  17. package/lib/index.d.ts +51 -28
  18. package/lib/index.js +633 -1072
  19. package/lib/index.js.map +1 -1
  20. package/lib/index.mjs +631 -1064
  21. package/lib/index.mjs.map +1 -1
  22. package/package.json +5 -9
  23. package/project.json +9 -1
  24. package/src/__tests__/config.service.spec.mts +11 -9
  25. package/src/__tests__/controller.spec.mts +0 -1
  26. package/src/config/config.service.mts +2 -2
  27. package/src/decorators/controller.decorator.mts +1 -1
  28. package/src/decorators/endpoint.decorator.mts +2 -2
  29. package/src/decorators/header.decorator.mts +1 -1
  30. package/src/decorators/multipart.decorator.mts +1 -2
  31. package/src/decorators/stream.decorator.mts +2 -3
  32. package/src/factories/endpoint-adapter.factory.mts +21 -0
  33. package/src/factories/http-adapter.factory.mts +20 -0
  34. package/src/factories/index.mts +6 -0
  35. package/src/factories/multipart-adapter.factory.mts +21 -0
  36. package/src/factories/reply.factory.mts +21 -0
  37. package/src/factories/request.factory.mts +21 -0
  38. package/src/factories/stream-adapter.factory.mts +20 -0
  39. package/src/index.mts +1 -1
  40. package/src/interfaces/abstract-execution-context.inteface.mts +13 -0
  41. package/src/interfaces/abstract-http-adapter.interface.mts +20 -0
  42. package/src/interfaces/abstract-http-cors-options.interface.mts +59 -0
  43. package/src/interfaces/abstract-http-handler-adapter.interface.mts +13 -0
  44. package/src/interfaces/abstract-http-listen-options.interface.mts +4 -0
  45. package/src/interfaces/can-activate.mts +4 -2
  46. package/src/interfaces/http-header.mts +18 -0
  47. package/src/interfaces/index.mts +6 -0
  48. package/src/logger/console-logger.service.mts +28 -44
  49. package/src/logger/index.mts +1 -2
  50. package/src/logger/logger.service.mts +9 -128
  51. package/src/logger/logger.tokens.mts +21 -0
  52. package/src/metadata/handler.metadata.mts +7 -5
  53. package/src/navios.application.mts +65 -172
  54. package/src/navios.environment.mts +30 -0
  55. package/src/navios.factory.mts +53 -12
  56. package/src/services/guard-runner.service.mts +19 -9
  57. package/src/services/index.mts +0 -2
  58. package/src/services/module-loader.service.mts +4 -3
  59. package/src/tokens/endpoint-adapter.token.mts +8 -0
  60. package/src/tokens/execution-context.token.mts +2 -2
  61. package/src/tokens/http-adapter.token.mts +8 -0
  62. package/src/tokens/index.mts +4 -1
  63. package/src/tokens/multipart-adapter.token.mts +8 -0
  64. package/src/tokens/reply.token.mts +1 -5
  65. package/src/tokens/request.token.mts +1 -7
  66. package/src/tokens/stream-adapter.token.mts +8 -0
  67. package/docs/recipes/prisma.md +0 -60
  68. package/e2e/endpoints/get.spec.mts +0 -97
  69. package/e2e/endpoints/post.spec.mts +0 -113
  70. package/examples/simple-test/api/index.mts +0 -64
  71. package/examples/simple-test/config/config.service.mts +0 -14
  72. package/examples/simple-test/config/configuration.mts +0 -7
  73. package/examples/simple-test/index.mts +0 -16
  74. package/examples/simple-test/src/acl/acl-modern.guard.mts +0 -15
  75. package/examples/simple-test/src/acl/acl.guard.mts +0 -14
  76. package/examples/simple-test/src/acl/app.guard.mts +0 -27
  77. package/examples/simple-test/src/acl/one-more.guard.mts +0 -15
  78. package/examples/simple-test/src/acl/public.attribute.mts +0 -21
  79. package/examples/simple-test/src/app.module.mts +0 -9
  80. package/examples/simple-test/src/user/user.controller.mts +0 -72
  81. package/examples/simple-test/src/user/user.module.mts +0 -14
  82. package/examples/simple-test/src/user/user.service.mts +0 -14
  83. package/src/adapters/endpoint-adapter.service.mts +0 -72
  84. package/src/adapters/handler-adapter.interface.mts +0 -21
  85. package/src/adapters/index.mts +0 -4
  86. package/src/adapters/multipart-adapter.service.mts +0 -135
  87. package/src/adapters/stream-adapter.service.mts +0 -91
  88. package/src/logger/logger.factory.mts +0 -36
  89. package/src/logger/pino-wrapper.mts +0 -64
  90. package/src/services/controller-adapter.service.mts +0 -124
  91. package/src/services/execution-context.mts +0 -54
  92. package/src/tokens/application.token.mts +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navios/core",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "author": {
5
5
  "name": "Oleksandr Hanzha",
6
6
  "email": "alex@granted.name"
@@ -34,15 +34,11 @@
34
34
  "@navios/builder": "^0.3.0",
35
35
  "@types/supertest": "^6.0.3",
36
36
  "supertest": "^7.1.4",
37
- "tsx": "^4.20.5",
38
- "typescript": "^5.9.2",
39
- "zod": "^4.1.4"
37
+ "tsx": "^4.20.6",
38
+ "typescript": "^5.9.3",
39
+ "zod": "^4.1.12"
40
40
  },
41
41
  "dependencies": {
42
- "@fastify/cors": "^11.1.0",
43
- "@fastify/multipart": "^9.0.3",
44
- "@navios/di": "^0.2.1",
45
- "fastify": "^5.5.0",
46
- "fastify-type-provider-zod": "^5.0.3"
42
+ "@navios/di": "^0.5.0"
47
43
  }
48
44
  }
package/project.json CHANGED
@@ -20,6 +20,14 @@
20
20
  "cwd": "packages/core"
21
21
  }
22
22
  },
23
+ "lint": {
24
+ "executor": "nx:run-commands",
25
+ "inputs": ["^projectSources", "project"],
26
+ "options": {
27
+ "command": "oxlint --fix",
28
+ "cwd": "packages/core"
29
+ }
30
+ },
23
31
  "test:ci": {
24
32
  "executor": "nx:run-commands",
25
33
  "inputs": ["^projectSources", "project"],
@@ -32,7 +40,7 @@
32
40
  "executor": "nx:run-commands",
33
41
  "inputs": ["projectSources", "{projectRoot}/tsup.config.mts"],
34
42
  "outputs": ["{projectRoot}/lib"],
35
- "dependsOn": ["check", "test:ci"],
43
+ "dependsOn": ["check", "test:ci", "lint"],
36
44
  "options": {
37
45
  "command": "tsup",
38
46
  "cwd": "packages/core"
@@ -1,27 +1,29 @@
1
1
  import { env } from 'node:process'
2
2
 
3
- import { describe, expect, it } from 'vitest'
3
+ import { beforeEach, describe, expect, it } from 'vitest'
4
4
 
5
5
  import {
6
- ConfigService,
7
6
  ConfigServiceToken,
7
+ Container,
8
8
  EnvConfigProvider,
9
- getGlobalServiceLocator,
10
9
  inject,
11
10
  Injectable,
12
11
  Logger,
13
- syncInject,
14
12
  } from '../index.mjs'
15
13
 
16
14
  describe('ConfigService', () => {
15
+ let container: Container
16
+ beforeEach(() => {
17
+ container = new Container()
18
+ })
17
19
  it('should be able to get a config value', async () => {
18
- const service = await inject(ConfigServiceToken, { ...env })
20
+ const service = await container.get(ConfigServiceToken, { ...env })
19
21
  expect(service).toBeDefined()
20
22
  expect(service.get('NODE_ENV')).toBe(env.NODE_ENV)
21
23
  })
22
24
 
23
25
  it('should be possible to use bound config service', async () => {
24
- const service = await inject(EnvConfigProvider)
26
+ const service = await container.get(EnvConfigProvider)
25
27
  expect(service).toBeDefined()
26
28
  expect(service.get('NODE_ENV')).toBe(env.NODE_ENV)
27
29
  })
@@ -29,11 +31,11 @@ describe('ConfigService', () => {
29
31
  it('should be possible to use inside service as a syncInject', async () => {
30
32
  @Injectable()
31
33
  class TestService {
32
- public readonly configService = syncInject(EnvConfigProvider)
33
- public readonly logger = syncInject(Logger)
34
+ public readonly configService = inject(EnvConfigProvider)
35
+ public readonly logger = inject(Logger)
34
36
  }
35
37
 
36
- const service = await inject(TestService)
38
+ const service = await container.get(TestService)
37
39
 
38
40
  expect(service.configService).toBeDefined()
39
41
  expect(service.configService.get('NODE_ENV')).toBe(env.NODE_ENV)
@@ -51,7 +51,6 @@ describe('Controller decorator', () => {
51
51
  }
52
52
 
53
53
  const metadata = extractControllerMetadata(Test)
54
- console.log(metadata)
55
54
  expect(metadata).toBeDefined()
56
55
  expect(metadata.endpoints).toBeInstanceOf(Set)
57
56
  expect(metadata.endpoints.size).toBe(2)
@@ -1,5 +1,5 @@
1
1
  import { NaviosException } from '@navios/builder'
2
- import { Injectable, InjectionToken, syncInject } from '@navios/di'
2
+ import { inject, Injectable, InjectionToken } from '@navios/di'
3
3
 
4
4
  import { z } from 'zod/v4'
5
5
 
@@ -23,7 +23,7 @@ export class ConfigService<
23
23
  Config extends ConfigServiceOptions = Record<string, unknown>,
24
24
  > implements IConfigService<Config>
25
25
  {
26
- private readonly logger = syncInject(Logger, {
26
+ private readonly logger = inject(Logger, {
27
27
  context: ConfigService.name,
28
28
  })
29
29
 
@@ -25,7 +25,7 @@ export function Controller({ guards }: ControllerOptions = {}) {
25
25
  }
26
26
  return Injectable({
27
27
  token,
28
- scope: InjectableScope.Instance,
28
+ scope: InjectableScope.Request,
29
29
  })(target, context)
30
30
  }
31
31
  }
@@ -4,12 +4,12 @@ import type {
4
4
  HttpMethod,
5
5
  Util_FlatObject,
6
6
  } from '@navios/builder'
7
- import type { z, ZodObject, ZodType } from 'zod/v4'
7
+ import type { z, ZodType } from 'zod/v4'
8
8
 
9
9
  import { ZodDiscriminatedUnion } from 'zod/v4'
10
10
 
11
- import { EndpointAdapterToken } from '../adapters/index.mjs'
12
11
  import { getEndpointMetadata } from '../metadata/index.mjs'
12
+ import { EndpointAdapterToken } from '../tokens/index.mjs'
13
13
 
14
14
  export type EndpointParams<
15
15
  EndpointDeclaration extends {
@@ -1,4 +1,4 @@
1
- import type { HttpHeader } from 'fastify/types/utils.js'
1
+ import type { HttpHeader } from '../interfaces/index.mjs'
2
2
 
3
3
  import { getEndpointMetadata } from '../metadata/index.mjs'
4
4
 
@@ -8,8 +8,8 @@ import type { z, ZodObject, ZodType } from 'zod/v4'
8
8
 
9
9
  import { ZodDiscriminatedUnion } from 'zod/v4'
10
10
 
11
- import { MultipartAdapterToken } from '../adapters/index.mjs'
12
11
  import { getEndpointMetadata } from '../metadata/index.mjs'
12
+ import { MultipartAdapterToken } from '../tokens/index.mjs'
13
13
 
14
14
  export type MultipartParams<
15
15
  EndpointDeclaration extends {
@@ -45,7 +45,6 @@ export type MultipartResult<
45
45
  },
46
46
  > =
47
47
  EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<
48
- any,
49
48
  infer Options
50
49
  >
51
50
  ? Promise<z.input<Options[number]>>
@@ -4,11 +4,10 @@ import type {
4
4
  HttpMethod,
5
5
  Util_FlatObject,
6
6
  } from '@navios/builder'
7
- import type { FastifyReply } from 'fastify'
8
7
  import type { ZodObject, ZodType } from 'zod/v4'
9
8
 
10
- import { StreamAdapterToken } from '../adapters/index.mjs'
11
9
  import { getEndpointMetadata } from '../metadata/index.mjs'
10
+ import { StreamAdapterToken } from '../tokens/index.mjs'
12
11
 
13
12
  export type StreamParams<
14
13
  EndpointDeclaration extends {
@@ -55,7 +54,7 @@ export function Stream<
55
54
  : RequestSchema extends ZodType
56
55
  ? EndpointFunctionArgs<Url, undefined, RequestSchema>
57
56
  : EndpointFunctionArgs<Url, undefined, undefined>,
58
- reply: FastifyReply,
57
+ reply: any,
59
58
  ) => Promise<void>,
60
59
  context: ClassMethodDecoratorContext,
61
60
  ) => {
@@ -0,0 +1,21 @@
1
+ import type { FactoryContext, InjectionToken } from '@navios/di'
2
+
3
+ import { Factory, inject } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { EndpointAdapterToken } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: EndpointAdapterToken,
10
+ })
11
+ export class EndpointAdapterFactory {
12
+ private readonly environment = inject(NaviosEnvironment)
13
+
14
+ create(ctx: FactoryContext) {
15
+ const service = this.environment.getHttpToken(EndpointAdapterToken)
16
+ if (!service) {
17
+ throw new Error('EndpointAdapterToken service not found in environment')
18
+ }
19
+ return ctx.inject(service as InjectionToken<any, undefined>)
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ import type { FactoryContext } from '@navios/di'
2
+
3
+ import { Factory, inject, InjectionToken } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { HttpAdapterToken } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: HttpAdapterToken,
10
+ })
11
+ export class HttpAdapterFactory {
12
+ private readonly environment = inject(NaviosEnvironment)
13
+ create(ctx: FactoryContext) {
14
+ const service = this.environment.getHttpToken(HttpAdapterToken)
15
+ if (!service) {
16
+ throw new Error('HttpAdapterToken service not found in environment')
17
+ }
18
+ return ctx.inject(service as InjectionToken<any, undefined>)
19
+ }
20
+ }
@@ -0,0 +1,6 @@
1
+ export * from './endpoint-adapter.factory.mjs'
2
+ export * from './http-adapter.factory.mjs'
3
+ export * from './multipart-adapter.factory.mjs'
4
+ export * from './request.factory.mjs'
5
+ export * from './reply.factory.mjs'
6
+ export * from './stream-adapter.factory.mjs'
@@ -0,0 +1,21 @@
1
+ import type { FactoryContext, InjectionToken } from '@navios/di'
2
+
3
+ import { Factory, inject } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { MultipartAdapterToken } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: MultipartAdapterToken,
10
+ })
11
+ export class MultipartAdapterFactory {
12
+ private readonly environment = inject(NaviosEnvironment)
13
+
14
+ create(ctx: FactoryContext) {
15
+ const service = this.environment.getHttpToken(MultipartAdapterToken)
16
+ if (!service) {
17
+ throw new Error('MultipartAdapterToken service not found in environment')
18
+ }
19
+ return ctx.inject(service as InjectionToken<any, undefined>)
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import type { FactoryContext, InjectionToken } from '@navios/di'
2
+
3
+ import { Factory, inject, InjectableScope } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { Reply } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: Reply,
10
+ scope: InjectableScope.Request,
11
+ })
12
+ export class ReplyFactory {
13
+ private readonly environment = inject(NaviosEnvironment)
14
+ create(ctx: FactoryContext) {
15
+ const service = this.environment.getHttpToken(Reply)
16
+ if (!service) {
17
+ throw new Error('ReplyToken service not found in environment')
18
+ }
19
+ return ctx.inject(service as InjectionToken<any, undefined>)
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import type { FactoryContext, InjectionToken } from '@navios/di'
2
+
3
+ import { Factory, inject, InjectableScope } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { Request } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: Request,
10
+ scope: InjectableScope.Request,
11
+ })
12
+ export class RequestFactory {
13
+ private readonly environment = inject(NaviosEnvironment)
14
+ create(ctx: FactoryContext) {
15
+ const service = this.environment.getHttpToken(Request)
16
+ if (!service) {
17
+ throw new Error('RequestToken service not found in environment')
18
+ }
19
+ return ctx.inject(service as InjectionToken<any, undefined>)
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ import type { FactoryContext, InjectionToken } from '@navios/di'
2
+
3
+ import { Factory, inject } from '@navios/di'
4
+
5
+ import { NaviosEnvironment } from '../navios.environment.mjs'
6
+ import { StreamAdapterToken } from '../tokens/index.mjs'
7
+
8
+ @Factory({
9
+ token: StreamAdapterToken,
10
+ })
11
+ export class StreamAdapterFactory {
12
+ private readonly environment = inject(NaviosEnvironment)
13
+ create(ctx: FactoryContext) {
14
+ const service = this.environment.getHttpToken(StreamAdapterToken)
15
+ if (!service) {
16
+ throw new Error('StreamAdapterToken service not found in environment')
17
+ }
18
+ return ctx.inject(service as InjectionToken<any, undefined>)
19
+ }
20
+ }
package/src/index.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from '@navios/di'
2
- export * from './adapters/index.mjs'
3
2
  export * from './config/index.mjs'
4
3
  export * from './decorators/index.mjs'
5
4
  export * from './exceptions/index.mjs'
@@ -9,5 +8,6 @@ export * from './metadata/index.mjs'
9
8
  export * from './services/index.mjs'
10
9
  export * from './tokens/index.mjs'
11
10
  export * from './attribute.factory.mjs'
11
+ export * from './factories/index.mjs'
12
12
  export * from './navios.application.mjs'
13
13
  export * from './navios.factory.mjs'
@@ -0,0 +1,13 @@
1
+ import type {
2
+ ControllerMetadata,
3
+ HandlerMetadata,
4
+ ModuleMetadata,
5
+ } from '../metadata/index.mjs'
6
+
7
+ export interface AbstractExecutionContext {
8
+ getModule(): ModuleMetadata
9
+ getController(): ControllerMetadata
10
+ getHandler(): HandlerMetadata
11
+ getRequest(): any
12
+ getReply(): any
13
+ }
@@ -0,0 +1,20 @@
1
+ import type { ModuleMetadata } from '../metadata/index.mjs'
2
+ import type { AbstractHttpCorsOptions } from './abstract-http-cors-options.interface.mjs'
3
+ import type { AbstractHttpListenOptions } from './abstract-http-listen-options.interface.mjs'
4
+
5
+ export interface AbstractHttpAdapterInterface<
6
+ ServerInstance,
7
+ CorsOptions = AbstractHttpCorsOptions,
8
+ Options = {},
9
+ MultipartOptions = {},
10
+ > {
11
+ setupHttpServer(options: Options): Promise<void>
12
+ onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>
13
+ ready(): Promise<void>
14
+ getServer(): ServerInstance
15
+ setGlobalPrefix(prefix: string): void
16
+ enableCors(options: CorsOptions): void
17
+ enableMultipart(options: MultipartOptions): void
18
+ listen(options: AbstractHttpListenOptions): Promise<string>
19
+ dispose(): Promise<void>
20
+ }
@@ -0,0 +1,59 @@
1
+ import type { LogLevel } from '../logger/index.mjs'
2
+
3
+ interface ArrayOfValueOrArray<T> extends Array<ValueOrArray<T>> {}
4
+
5
+ type OriginType = string | boolean | RegExp
6
+ type ValueOrArray<T> = T | ArrayOfValueOrArray<T>
7
+
8
+ export interface AbstractHttpCorsOptions {
9
+ /**
10
+ * Configures the Access-Control-Allow-Origin CORS header.
11
+ */
12
+ origin?: ValueOrArray<OriginType>
13
+ /**
14
+ * Configures the Access-Control-Allow-Credentials CORS header.
15
+ * Set to true to pass the header, otherwise it is omitted.
16
+ */
17
+ credentials?: boolean
18
+ /**
19
+ * Configures the Access-Control-Expose-Headers CORS header.
20
+ * Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range')
21
+ * or an array (ex: ['Content-Range', 'X-Content-Range']).
22
+ * If not specified, no custom headers are exposed.
23
+ */
24
+ exposedHeaders?: string | string[]
25
+ /**
26
+ * Configures the Access-Control-Allow-Headers CORS header.
27
+ * Expects a comma-delimited string (ex: 'Content-Type,Authorization')
28
+ * or an array (ex: ['Content-Type', 'Authorization']). If not
29
+ * specified, defaults to reflecting the headers specified in the
30
+ * request's Access-Control-Request-Headers header.
31
+ */
32
+ allowedHeaders?: string | string[]
33
+ /**
34
+ * Configures the Access-Control-Allow-Methods CORS header.
35
+ * Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']).
36
+ */
37
+ methods?: string | string[]
38
+ /**
39
+ * Configures the Access-Control-Max-Age CORS header.
40
+ * Set to an integer to pass the header, otherwise it is omitted.
41
+ */
42
+ maxAge?: number
43
+ /**
44
+ * Configures the Cache-Control header for CORS preflight responses.
45
+ * Set to an integer to pass the header as `Cache-Control: max-age=${cacheControl}`,
46
+ * or set to a string to pass the header as `Cache-Control: ${cacheControl}` (fully define
47
+ * the header value), otherwise the header is omitted.
48
+ */
49
+ cacheControl?: number | string
50
+
51
+ /**
52
+ * Sets the Fastify log level specifically for the internal OPTIONS route
53
+ * used to handle CORS preflight requests. For example, setting this to `'silent'`
54
+ * will prevent these requests from being logged.
55
+ * Useful for reducing noise in application logs.
56
+ * Default: inherits Fastify's global log level.
57
+ */
58
+ logLevel?: LogLevel
59
+ }
@@ -0,0 +1,13 @@
1
+ import type { ClassType, RequestContextHolder } from '@navios/di'
2
+
3
+ import type { HandlerMetadata } from '../metadata/index.mjs'
4
+
5
+ export interface AbstractHttpHandlerAdapterInterface {
6
+ prepareArguments?: (
7
+ handlerMetadata: HandlerMetadata<any>,
8
+ ) => ((target: Record<string, any>, request: any) => Promise<void> | void)[]
9
+ provideHandler: (
10
+ controller: ClassType,
11
+ handlerMetadata: HandlerMetadata<any>,
12
+ ) => (context: RequestContextHolder, request: any, reply: any) => Promise<any>
13
+ }
@@ -0,0 +1,4 @@
1
+ export interface AbstractHttpListenOptions {
2
+ port: number
3
+ host?: string
4
+ }
@@ -1,5 +1,7 @@
1
- import type { ExecutionContext } from '../services/index.mjs'
1
+ import type { AbstractExecutionContext } from '../interfaces/index.mjs'
2
2
 
3
3
  export interface CanActivate {
4
- canActivate(executionContext: ExecutionContext): Promise<boolean> | boolean
4
+ canActivate(
5
+ executionContext: AbstractExecutionContext,
6
+ ): Promise<boolean> | boolean
5
7
  }
@@ -0,0 +1,18 @@
1
+ import type { OutgoingHttpHeaders } from 'http'
2
+
3
+ export type OmitIndexSignature<T> = {
4
+ [K in keyof T as string extends K
5
+ ? never
6
+ : number extends K
7
+ ? never
8
+ : K]: T[K]
9
+ }
10
+
11
+ /**
12
+ * HTTP header strings
13
+ * Use this type only for input values, not for output values.
14
+ */
15
+
16
+ export type HttpHeader =
17
+ | keyof OmitIndexSignature<OutgoingHttpHeaders>
18
+ | (string & Record<never, never>)
@@ -1,2 +1,8 @@
1
+ export * from './abstract-execution-context.inteface.mjs'
2
+ export * from './abstract-http-adapter.interface.mjs'
3
+ export * from './abstract-http-cors-options.interface.mjs'
4
+ export * from './abstract-http-handler-adapter.interface.mjs'
5
+ export * from './abstract-http-listen-options.interface.mjs'
1
6
  export * from './can-activate.mjs'
7
+ export * from './http-header.mjs'
2
8
  export * from './navios-module.mjs'