@navios/core 0.3.0 → 0.5.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/README.md +96 -3
- package/docs/README.md +310 -3
- package/docs/adapters.md +308 -0
- package/docs/application-setup.md +524 -0
- package/docs/attributes.md +689 -0
- package/docs/controllers.md +373 -0
- package/docs/endpoints.md +444 -0
- package/docs/exceptions.md +316 -0
- package/docs/guards.md +550 -0
- package/docs/modules.md +251 -0
- package/docs/quick-start.md +295 -0
- package/docs/services.md +428 -0
- package/docs/testing.md +704 -0
- package/lib/_tsup-dts-rollup.d.mts +313 -280
- package/lib/_tsup-dts-rollup.d.ts +313 -280
- package/lib/index.d.mts +47 -26
- package/lib/index.d.ts +47 -26
- package/lib/index.js +633 -1068
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +632 -1061
- package/lib/index.mjs.map +1 -1
- package/package.json +11 -12
- package/project.json +17 -4
- package/src/__tests__/config.service.spec.mts +11 -9
- package/src/__tests__/controller.spec.mts +1 -2
- package/src/attribute.factory.mts +1 -1
- package/src/config/config.provider.mts +2 -2
- package/src/config/config.service.mts +4 -4
- package/src/decorators/controller.decorator.mts +1 -1
- package/src/decorators/endpoint.decorator.mts +9 -10
- package/src/decorators/header.decorator.mts +1 -1
- package/src/decorators/multipart.decorator.mts +5 -5
- package/src/decorators/stream.decorator.mts +5 -6
- package/src/factories/endpoint-adapter.factory.mts +21 -0
- package/src/factories/http-adapter.factory.mts +20 -0
- package/src/factories/index.mts +6 -0
- package/src/factories/multipart-adapter.factory.mts +21 -0
- package/src/factories/reply.factory.mts +21 -0
- package/src/factories/request.factory.mts +21 -0
- package/src/factories/stream-adapter.factory.mts +20 -0
- package/src/index.mts +1 -1
- package/src/interfaces/abstract-execution-context.inteface.mts +13 -0
- package/src/interfaces/abstract-http-adapter.interface.mts +20 -0
- package/src/interfaces/abstract-http-cors-options.interface.mts +59 -0
- package/src/interfaces/abstract-http-handler-adapter.interface.mts +13 -0
- package/src/interfaces/abstract-http-listen-options.interface.mts +4 -0
- package/src/interfaces/can-activate.mts +4 -2
- package/src/interfaces/http-header.mts +18 -0
- package/src/interfaces/index.mts +6 -0
- package/src/logger/console-logger.service.mts +28 -44
- package/src/logger/index.mts +1 -2
- package/src/logger/logger.service.mts +9 -128
- package/src/logger/logger.tokens.mts +21 -0
- package/src/metadata/handler.metadata.mts +7 -5
- package/src/navios.application.mts +65 -172
- package/src/navios.environment.mts +30 -0
- package/src/navios.factory.mts +53 -12
- package/src/services/guard-runner.service.mts +19 -9
- package/src/services/index.mts +0 -2
- package/src/services/module-loader.service.mts +4 -3
- package/src/tokens/endpoint-adapter.token.mts +8 -0
- package/src/tokens/execution-context.token.mts +2 -2
- package/src/tokens/http-adapter.token.mts +8 -0
- package/src/tokens/index.mts +4 -1
- package/src/tokens/multipart-adapter.token.mts +8 -0
- package/src/tokens/reply.token.mts +1 -5
- package/src/tokens/request.token.mts +1 -7
- package/src/tokens/stream-adapter.token.mts +8 -0
- package/tsconfig.json +6 -1
- package/tsconfig.lib.json +8 -0
- package/tsconfig.spec.json +12 -0
- package/tsup.config.mts +1 -0
- package/docs/recipes/prisma.md +0 -60
- package/examples/simple-test/api/index.mts +0 -64
- package/examples/simple-test/config/config.service.mts +0 -14
- package/examples/simple-test/config/configuration.mts +0 -7
- package/examples/simple-test/index.mts +0 -16
- package/examples/simple-test/src/acl/acl-modern.guard.mts +0 -15
- package/examples/simple-test/src/acl/acl.guard.mts +0 -14
- package/examples/simple-test/src/acl/app.guard.mts +0 -27
- package/examples/simple-test/src/acl/one-more.guard.mts +0 -15
- package/examples/simple-test/src/acl/public.attribute.mts +0 -21
- package/examples/simple-test/src/app.module.mts +0 -9
- package/examples/simple-test/src/user/user.controller.mts +0 -72
- package/examples/simple-test/src/user/user.module.mts +0 -14
- package/examples/simple-test/src/user/user.service.mts +0 -14
- package/src/adapters/endpoint-adapter.service.mts +0 -72
- package/src/adapters/handler-adapter.interface.mts +0 -21
- package/src/adapters/index.mts +0 -4
- package/src/adapters/multipart-adapter.service.mts +0 -131
- package/src/adapters/stream-adapter.service.mts +0 -91
- package/src/logger/logger.factory.mts +0 -36
- package/src/logger/pino-wrapper.mts +0 -64
- package/src/services/controller-adapter.service.mts +0 -124
- package/src/services/execution-context.mts +0 -54
- package/src/tokens/application.token.mts +0 -9
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { FastifyReply, FastifyRequest } from 'fastify'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
ControllerMetadata,
|
|
5
|
-
HandlerMetadata,
|
|
6
|
-
ModuleMetadata,
|
|
7
|
-
} from '../metadata/index.mjs'
|
|
8
|
-
|
|
9
|
-
export class ExecutionContext {
|
|
10
|
-
private request: FastifyRequest | undefined
|
|
11
|
-
private reply: FastifyReply | undefined
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly module: ModuleMetadata,
|
|
14
|
-
private readonly controller: ControllerMetadata,
|
|
15
|
-
private readonly handler: HandlerMetadata,
|
|
16
|
-
) {}
|
|
17
|
-
getModule(): ModuleMetadata {
|
|
18
|
-
return this.module
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getController(): ControllerMetadata {
|
|
22
|
-
return this.controller
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getHandler(): HandlerMetadata {
|
|
26
|
-
return this.handler
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getRequest(): FastifyRequest {
|
|
30
|
-
if (!this.request) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
'[Navios] Request is not set. Make sure to set it before using it.',
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
return this.request
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getReply(): FastifyReply {
|
|
39
|
-
if (!this.reply) {
|
|
40
|
-
throw new Error(
|
|
41
|
-
'[Navios] Reply is not set. Make sure to set it before using it.',
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
return this.reply
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
provideRequest(request: FastifyRequest): void {
|
|
48
|
-
this.request = request
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
provideReply(reply: FastifyReply): void {
|
|
52
|
-
this.reply = reply
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { FastifyInstance } from 'fastify'
|
|
2
|
-
|
|
3
|
-
import { InjectionToken } from '@navios/di'
|
|
4
|
-
|
|
5
|
-
const ApplicationInjectionToken = 'ApplicationInjectionToken'
|
|
6
|
-
|
|
7
|
-
export const Application = InjectionToken.create<FastifyInstance>(
|
|
8
|
-
ApplicationInjectionToken,
|
|
9
|
-
)
|