@navios/core 0.5.1 → 0.7.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/CHANGELOG.md +93 -0
- package/README.md +18 -1
- package/docs/README.md +1 -0
- package/docs/legacy-compat.md +320 -0
- package/docs/testing.md +140 -17
- package/lib/index-BFwNx9WQ.d.cts +1951 -0
- package/lib/index-BFwNx9WQ.d.cts.map +1 -0
- package/lib/index-D657ijFO.d.mts +1951 -0
- package/lib/index-D657ijFO.d.mts.map +1 -0
- package/lib/index.cjs +157 -0
- package/lib/index.d.cts +3 -0
- package/lib/index.d.mts +3 -188
- package/lib/index.mjs +4 -1439
- package/lib/legacy-compat/index.cjs +315 -0
- package/lib/legacy-compat/index.cjs.map +1 -0
- package/lib/legacy-compat/index.d.cts +219 -0
- package/lib/legacy-compat/index.d.cts.map +1 -0
- package/lib/legacy-compat/index.d.mts +219 -0
- package/lib/legacy-compat/index.d.mts.map +1 -0
- package/lib/legacy-compat/index.mjs +308 -0
- package/lib/legacy-compat/index.mjs.map +1 -0
- package/lib/src-Cb1aTjl0.cjs +5710 -0
- package/lib/src-Cb1aTjl0.cjs.map +1 -0
- package/lib/src-DzPY5s6d.mjs +5353 -0
- package/lib/src-DzPY5s6d.mjs.map +1 -0
- package/lib/testing/index.cjs +106 -0
- package/lib/testing/index.cjs.map +1 -0
- package/lib/testing/index.d.cts +156 -0
- package/lib/testing/index.d.cts.map +1 -0
- package/lib/testing/index.d.mts +156 -0
- package/lib/testing/index.d.mts.map +1 -0
- package/lib/testing/index.mjs +100 -0
- package/lib/testing/index.mjs.map +1 -0
- package/lib/use-guards.decorator-DdvUhB03.cjs +622 -0
- package/lib/use-guards.decorator-DdvUhB03.cjs.map +1 -0
- package/lib/use-guards.decorator-kZ3lNK8v.mjs +454 -0
- package/lib/use-guards.decorator-kZ3lNK8v.mjs.map +1 -0
- package/package.json +26 -6
- package/project.json +2 -2
- package/src/attribute.factory.d.mts +175 -0
- package/src/attribute.factory.d.mts.map +1 -0
- package/src/attribute.factory.mts +154 -0
- package/src/config/config-service.interface.d.mts +39 -0
- package/src/config/config-service.interface.d.mts.map +1 -0
- package/src/config/config-service.interface.mts +31 -0
- package/src/config/config.provider.d.mts +46 -0
- package/src/config/config.provider.d.mts.map +1 -0
- package/src/config/config.provider.mts +36 -0
- package/src/config/config.service.d.mts +108 -0
- package/src/config/config.service.d.mts.map +1 -0
- package/src/config/config.service.mts +94 -4
- package/src/config/index.d.mts +6 -0
- package/src/config/index.d.mts.map +1 -0
- package/src/config/types.d.mts +13 -0
- package/src/config/types.d.mts.map +1 -0
- package/src/config/utils/helpers.d.mts +3 -0
- package/src/config/utils/helpers.d.mts.map +1 -0
- package/src/config/utils/index.d.mts +2 -0
- package/src/config/utils/index.d.mts.map +1 -0
- package/src/decorators/controller.decorator.d.mts +33 -0
- package/src/decorators/controller.decorator.d.mts.map +1 -0
- package/src/decorators/controller.decorator.mts +28 -0
- package/src/decorators/endpoint.decorator.d.mts +89 -0
- package/src/decorators/endpoint.decorator.d.mts.map +1 -0
- package/src/decorators/endpoint.decorator.mts +76 -0
- package/src/decorators/header.decorator.d.mts +22 -0
- package/src/decorators/header.decorator.d.mts.map +1 -0
- package/src/decorators/header.decorator.mts +19 -0
- package/src/decorators/http-code.decorator.d.mts +22 -0
- package/src/decorators/http-code.decorator.d.mts.map +1 -0
- package/src/decorators/http-code.decorator.mts +20 -0
- package/src/decorators/index.d.mts +9 -0
- package/src/decorators/index.d.mts.map +1 -0
- package/src/decorators/module.decorator.d.mts +42 -0
- package/src/decorators/module.decorator.d.mts.map +1 -0
- package/src/decorators/module.decorator.mts +34 -0
- package/src/decorators/multipart.decorator.d.mts +54 -0
- package/src/decorators/multipart.decorator.d.mts.map +1 -0
- package/src/decorators/multipart.decorator.mts +41 -0
- package/src/decorators/stream.decorator.d.mts +42 -0
- package/src/decorators/stream.decorator.d.mts.map +1 -0
- package/src/decorators/stream.decorator.mts +33 -0
- package/src/decorators/use-guards.decorator.d.mts +33 -0
- package/src/decorators/use-guards.decorator.d.mts.map +1 -0
- package/src/decorators/use-guards.decorator.mts +29 -0
- package/src/exceptions/bad-request.exception.d.mts +26 -0
- package/src/exceptions/bad-request.exception.d.mts.map +1 -0
- package/src/exceptions/bad-request.exception.mts +21 -0
- package/src/exceptions/conflict.exception.d.mts +29 -0
- package/src/exceptions/conflict.exception.d.mts.map +1 -0
- package/src/exceptions/conflict.exception.mts +24 -0
- package/src/exceptions/forbidden.exception.d.mts +28 -0
- package/src/exceptions/forbidden.exception.d.mts.map +1 -0
- package/src/exceptions/forbidden.exception.mts +23 -0
- package/src/exceptions/http.exception.d.mts +33 -0
- package/src/exceptions/http.exception.d.mts.map +1 -0
- package/src/exceptions/http.exception.mts +26 -0
- package/src/exceptions/index.d.mts +8 -0
- package/src/exceptions/index.d.mts.map +1 -0
- package/src/exceptions/internal-server-error.exception.d.mts +31 -0
- package/src/exceptions/internal-server-error.exception.d.mts.map +1 -0
- package/src/exceptions/internal-server-error.exception.mts +26 -0
- package/src/exceptions/not-found.exception.d.mts +30 -0
- package/src/exceptions/not-found.exception.d.mts.map +1 -0
- package/src/exceptions/not-found.exception.mts +23 -0
- package/src/exceptions/unauthorized.exception.d.mts +28 -0
- package/src/exceptions/unauthorized.exception.d.mts.map +1 -0
- package/src/exceptions/unauthorized.exception.mts +23 -0
- package/src/factories/endpoint-adapter.factory.d.mts +6 -0
- package/src/factories/endpoint-adapter.factory.d.mts.map +1 -0
- package/src/factories/http-adapter.factory.d.mts +6 -0
- package/src/factories/http-adapter.factory.d.mts.map +1 -0
- package/src/factories/index.d.mts +8 -0
- package/src/factories/index.d.mts.map +1 -0
- package/src/factories/index.mts +1 -0
- package/src/factories/multipart-adapter.factory.d.mts +6 -0
- package/src/factories/multipart-adapter.factory.d.mts.map +1 -0
- package/src/factories/reply.factory.d.mts +6 -0
- package/src/factories/reply.factory.d.mts.map +1 -0
- package/src/factories/request.factory.d.mts +6 -0
- package/src/factories/request.factory.d.mts.map +1 -0
- package/src/factories/stream-adapter.factory.d.mts +6 -0
- package/src/factories/stream-adapter.factory.d.mts.map +1 -0
- package/src/factories/xml-stream-adapter.factory.d.mts +6 -0
- package/src/factories/xml-stream-adapter.factory.d.mts.map +1 -0
- package/src/factories/xml-stream-adapter.factory.mts +20 -0
- package/src/index.d.mts +15 -0
- package/src/index.d.mts.map +1 -0
- package/src/index.mts +1 -0
- package/src/interfaces/abstract-execution-context.inteface.d.mts +44 -0
- package/src/interfaces/abstract-execution-context.inteface.d.mts.map +1 -0
- package/src/interfaces/abstract-execution-context.inteface.mts +35 -0
- package/src/interfaces/abstract-http-adapter.interface.d.mts +15 -0
- package/src/interfaces/abstract-http-adapter.interface.d.mts.map +1 -0
- package/src/interfaces/abstract-http-cors-options.interface.d.mts +58 -0
- package/src/interfaces/abstract-http-cors-options.interface.d.mts.map +1 -0
- package/src/interfaces/abstract-http-handler-adapter.interface.d.mts +7 -0
- package/src/interfaces/abstract-http-handler-adapter.interface.d.mts.map +1 -0
- package/src/interfaces/abstract-http-handler-adapter.interface.mts +2 -2
- package/src/interfaces/abstract-http-listen-options.interface.d.mts +5 -0
- package/src/interfaces/abstract-http-listen-options.interface.d.mts.map +1 -0
- package/src/interfaces/can-activate.d.mts +36 -0
- package/src/interfaces/can-activate.d.mts.map +1 -0
- package/src/interfaces/can-activate.mts +31 -0
- package/src/interfaces/http-header.d.mts +10 -0
- package/src/interfaces/http-header.d.mts.map +1 -0
- package/src/interfaces/index.d.mts +9 -0
- package/src/interfaces/index.d.mts.map +1 -0
- package/src/interfaces/navios-module.d.mts +29 -0
- package/src/interfaces/navios-module.d.mts.map +1 -0
- package/src/interfaces/navios-module.mts +25 -0
- package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +420 -0
- package/src/legacy-compat/__type-tests__/tsconfig.json +15 -0
- package/src/legacy-compat/context-compat.d.mts +19 -0
- package/src/legacy-compat/context-compat.d.mts.map +1 -0
- package/src/legacy-compat/context-compat.mts +93 -0
- package/src/legacy-compat/decorators/controller.decorator.d.mts +21 -0
- package/src/legacy-compat/decorators/controller.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/controller.decorator.mts +31 -0
- package/src/legacy-compat/decorators/endpoint.decorator.d.mts +33 -0
- package/src/legacy-compat/decorators/endpoint.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/endpoint.decorator.mts +99 -0
- package/src/legacy-compat/decorators/header.decorator.d.mts +24 -0
- package/src/legacy-compat/decorators/header.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/header.decorator.mts +42 -0
- package/src/legacy-compat/decorators/http-code.decorator.d.mts +22 -0
- package/src/legacy-compat/decorators/http-code.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/http-code.decorator.mts +38 -0
- package/src/legacy-compat/decorators/index.d.mts +9 -0
- package/src/legacy-compat/decorators/index.d.mts.map +1 -0
- package/src/legacy-compat/decorators/index.mts +9 -0
- package/src/legacy-compat/decorators/module.decorator.d.mts +22 -0
- package/src/legacy-compat/decorators/module.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/module.decorator.mts +37 -0
- package/src/legacy-compat/decorators/multipart.decorator.d.mts +34 -0
- package/src/legacy-compat/decorators/multipart.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/multipart.decorator.mts +93 -0
- package/src/legacy-compat/decorators/stream.decorator.d.mts +34 -0
- package/src/legacy-compat/decorators/stream.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/stream.decorator.mts +76 -0
- package/src/legacy-compat/decorators/use-guards.decorator.d.mts +29 -0
- package/src/legacy-compat/decorators/use-guards.decorator.d.mts.map +1 -0
- package/src/legacy-compat/decorators/use-guards.decorator.mts +80 -0
- package/src/legacy-compat/index.d.mts +19 -0
- package/src/legacy-compat/index.d.mts.map +1 -0
- package/src/legacy-compat/index.mts +40 -0
- package/src/logger/console-logger.service.d.mts +196 -0
- package/src/logger/console-logger.service.d.mts.map +1 -0
- package/src/logger/console-logger.service.mts +15 -2
- package/src/logger/index.d.mts +7 -0
- package/src/logger/index.d.mts.map +1 -0
- package/src/logger/log-levels.d.mts +14 -0
- package/src/logger/log-levels.d.mts.map +1 -0
- package/src/logger/log-levels.mts +9 -0
- package/src/logger/logger-service.interface.d.mts +36 -0
- package/src/logger/logger-service.interface.d.mts.map +1 -0
- package/src/logger/logger.service.d.mts +57 -0
- package/src/logger/logger.service.d.mts.map +1 -0
- package/src/logger/logger.service.mts +19 -0
- package/src/logger/logger.tokens.d.mts +36 -0
- package/src/logger/logger.tokens.d.mts.map +1 -0
- package/src/logger/logger.tokens.mts +23 -0
- package/src/logger/utils/cli-colors.util.d.mts +10 -0
- package/src/logger/utils/cli-colors.util.d.mts.map +1 -0
- package/src/logger/utils/filter-log-levelts.util.d.mts +6 -0
- package/src/logger/utils/filter-log-levelts.util.d.mts.map +1 -0
- package/src/logger/utils/index.d.mts +6 -0
- package/src/logger/utils/index.d.mts.map +1 -0
- package/src/logger/utils/is-log-level-enabled.d.mts +8 -0
- package/src/logger/utils/is-log-level-enabled.d.mts.map +1 -0
- package/src/logger/utils/is-log-level.util.d.mts +6 -0
- package/src/logger/utils/is-log-level.util.d.mts.map +1 -0
- package/src/logger/utils/shared.utils.d.mts +14 -0
- package/src/logger/utils/shared.utils.d.mts.map +1 -0
- package/src/metadata/controller.metadata.d.mts +13 -0
- package/src/metadata/controller.metadata.d.mts.map +1 -0
- package/src/metadata/handler.metadata.d.mts +18 -0
- package/src/metadata/handler.metadata.d.mts.map +1 -0
- package/src/metadata/index.d.mts +4 -0
- package/src/metadata/index.d.mts.map +1 -0
- package/src/metadata/module.metadata.d.mts +13 -0
- package/src/metadata/module.metadata.d.mts.map +1 -0
- package/src/navios.application.d.mts +210 -0
- package/src/navios.application.d.mts.map +1 -0
- package/src/navios.application.mts +176 -2
- package/src/navios.environment.d.mts +11 -0
- package/src/navios.environment.d.mts.map +1 -0
- package/src/navios.factory.d.mts +68 -0
- package/src/navios.factory.d.mts.map +1 -0
- package/src/navios.factory.mts +59 -1
- package/src/services/guard-runner.service.d.mts +10 -0
- package/src/services/guard-runner.service.d.mts.map +1 -0
- package/src/services/guard-runner.service.mts +12 -11
- package/src/services/index.d.mts +3 -0
- package/src/services/index.d.mts.map +1 -0
- package/src/services/module-loader.service.d.mts +17 -0
- package/src/services/module-loader.service.d.mts.map +1 -0
- package/src/services/module-loader.service.mts +16 -11
- package/src/stores/index.d.mts +2 -0
- package/src/stores/index.d.mts.map +1 -0
- package/src/stores/index.mts +1 -0
- package/src/stores/request-id.store.d.mts +37 -0
- package/src/stores/request-id.store.d.mts.map +1 -0
- package/src/stores/request-id.store.mts +43 -0
- package/src/testing/index.mts +2 -0
- package/src/testing/testing-module.mts +231 -0
- package/src/tokens/endpoint-adapter.token.d.mts +4 -0
- package/src/tokens/endpoint-adapter.token.d.mts.map +1 -0
- package/src/tokens/execution-context.token.d.mts +5 -0
- package/src/tokens/execution-context.token.d.mts.map +1 -0
- package/src/tokens/http-adapter.token.d.mts +4 -0
- package/src/tokens/http-adapter.token.d.mts.map +1 -0
- package/src/tokens/index.d.mts +9 -0
- package/src/tokens/index.d.mts.map +1 -0
- package/src/tokens/index.mts +1 -0
- package/src/tokens/multipart-adapter.token.d.mts +4 -0
- package/src/tokens/multipart-adapter.token.d.mts.map +1 -0
- package/src/tokens/reply.token.d.mts +3 -0
- package/src/tokens/reply.token.d.mts.map +1 -0
- package/src/tokens/request.token.d.mts +3 -0
- package/src/tokens/request.token.d.mts.map +1 -0
- package/src/tokens/stream-adapter.token.d.mts +4 -0
- package/src/tokens/stream-adapter.token.d.mts.map +1 -0
- package/src/tokens/xml-stream-adapter.token.d.mts +4 -0
- package/src/tokens/xml-stream-adapter.token.d.mts.map +1 -0
- package/src/tokens/xml-stream-adapter.token.mts +8 -0
- package/tsconfig.lib.json +1 -1
- package/tsconfig.spec.json +3 -0
- package/tsdown.config.mts +35 -0
- package/vitest.config.mts +6 -0
- package/lib/_tsup-dts-rollup.d.mts +0 -1352
- package/lib/_tsup-dts-rollup.d.ts +0 -1352
- package/lib/index.d.ts +0 -188
- package/lib/index.js +0 -1519
- package/lib/index.js.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/tsup.config.mts +0 -13
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 400 Bad Request HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when the client's request is malformed or invalid.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(createUserEndpoint)
|
|
11
|
+
* async createUser(request: EndpointParams<typeof createUserEndpoint>) {
|
|
12
|
+
* if (!request.data.email) {
|
|
13
|
+
* throw new BadRequestException('Email is required')
|
|
14
|
+
* }
|
|
15
|
+
* // ...
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
3
19
|
export class BadRequestException extends HttpException {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new BadRequestException.
|
|
22
|
+
*
|
|
23
|
+
* @param message - Error message or response object
|
|
24
|
+
*/
|
|
4
25
|
constructor(message: string | object) {
|
|
5
26
|
super(400, message)
|
|
6
27
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HttpException } from './http.exception.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Exception that represents a 409 Conflict HTTP error.
|
|
4
|
+
*
|
|
5
|
+
* Use this exception when the request conflicts with the current state of the resource
|
|
6
|
+
* (e.g., trying to create a resource that already exists).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(createUserEndpoint)
|
|
11
|
+
* async createUser(request: EndpointParams<typeof createUserEndpoint>) {
|
|
12
|
+
* const existing = await this.userService.findByEmail(request.data.email)
|
|
13
|
+
* if (existing) {
|
|
14
|
+
* throw new ConflictException('User with this email already exists')
|
|
15
|
+
* }
|
|
16
|
+
* // ...
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class ConflictException extends HttpException {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new ConflictException.
|
|
23
|
+
*
|
|
24
|
+
* @param message - Error message or response object
|
|
25
|
+
* @param error - Optional underlying error for logging
|
|
26
|
+
*/
|
|
27
|
+
constructor(message: string | object, error?: Error);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=conflict.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.exception.d.mts","sourceRoot":"","sources":["conflict.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;IAClD;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAGpD"}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 409 Conflict HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when the request conflicts with the current state of the resource
|
|
7
|
+
* (e.g., trying to create a resource that already exists).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Endpoint(createUserEndpoint)
|
|
12
|
+
* async createUser(request: EndpointParams<typeof createUserEndpoint>) {
|
|
13
|
+
* const existing = await this.userService.findByEmail(request.data.email)
|
|
14
|
+
* if (existing) {
|
|
15
|
+
* throw new ConflictException('User with this email already exists')
|
|
16
|
+
* }
|
|
17
|
+
* // ...
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export class ConflictException extends HttpException {
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new ConflictException.
|
|
24
|
+
*
|
|
25
|
+
* @param message - Error message or response object
|
|
26
|
+
* @param error - Optional underlying error for logging
|
|
27
|
+
*/
|
|
4
28
|
constructor(message: string | object, error?: Error) {
|
|
5
29
|
super(409, message, error)
|
|
6
30
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HttpException } from './http.exception.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Exception that represents a 403 Forbidden HTTP error.
|
|
4
|
+
*
|
|
5
|
+
* Use this exception when the client is authenticated but does not have
|
|
6
|
+
* permission to access the requested resource.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(deleteUserEndpoint)
|
|
11
|
+
* @UseGuards(AuthGuard, RoleGuard)
|
|
12
|
+
* async deleteUser(request: EndpointParams<typeof deleteUserEndpoint>) {
|
|
13
|
+
* if (!this.userService.hasPermission(request.user, 'delete')) {
|
|
14
|
+
* throw new ForbiddenException('Insufficient permissions')
|
|
15
|
+
* }
|
|
16
|
+
* // ...
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class ForbiddenException extends HttpException {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new ForbiddenException.
|
|
23
|
+
*
|
|
24
|
+
* @param message - Error message
|
|
25
|
+
*/
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=forbidden.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden.exception.d.mts","sourceRoot":"","sources":["forbidden.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 403 Forbidden HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when the client is authenticated but does not have
|
|
7
|
+
* permission to access the requested resource.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Endpoint(deleteUserEndpoint)
|
|
12
|
+
* @UseGuards(AuthGuard, RoleGuard)
|
|
13
|
+
* async deleteUser(request: EndpointParams<typeof deleteUserEndpoint>) {
|
|
14
|
+
* if (!this.userService.hasPermission(request.user, 'delete')) {
|
|
15
|
+
* throw new ForbiddenException('Insufficient permissions')
|
|
16
|
+
* }
|
|
17
|
+
* // ...
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export class ForbiddenException extends HttpException {
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new ForbiddenException.
|
|
24
|
+
*
|
|
25
|
+
* @param message - Error message
|
|
26
|
+
*/
|
|
4
27
|
constructor(message: string) {
|
|
5
28
|
super(403, message)
|
|
6
29
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base exception class for all HTTP exceptions in Navios.
|
|
3
|
+
*
|
|
4
|
+
* All HTTP exception classes extend this base class. When thrown from an endpoint handler,
|
|
5
|
+
* Navios will automatically convert it to an appropriate HTTP response with the specified
|
|
6
|
+
* status code and response body.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(getUserEndpoint)
|
|
11
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
12
|
+
* const user = await this.userService.findById(request.urlParams.userId)
|
|
13
|
+
* if (!user) {
|
|
14
|
+
* throw new HttpException(404, 'User not found')
|
|
15
|
+
* }
|
|
16
|
+
* return user
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class HttpException {
|
|
21
|
+
readonly statusCode: number;
|
|
22
|
+
readonly response: string | object;
|
|
23
|
+
readonly error?: Error | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new HttpException instance.
|
|
26
|
+
*
|
|
27
|
+
* @param statusCode - HTTP status code (e.g., 400, 404, 500)
|
|
28
|
+
* @param response - Response body (string or object)
|
|
29
|
+
* @param error - Optional underlying error for logging/debugging
|
|
30
|
+
*/
|
|
31
|
+
constructor(statusCode: number, response: string | object, error?: Error | undefined);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=http.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.exception.d.mts","sourceRoot":"","sources":["http.exception.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,aAAa;aASN,UAAU,EAAE,MAAM;aAClB,QAAQ,EAAE,MAAM,GAAG,MAAM;aACzB,KAAK,CAAC,EAAE,KAAK;IAV/B;;;;;;OAMG;gBAEe,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,KAAK,CAAC,EAAE,KAAK,YAAA;CAEhC"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base exception class for all HTTP exceptions in Navios.
|
|
3
|
+
*
|
|
4
|
+
* All HTTP exception classes extend this base class. When thrown from an endpoint handler,
|
|
5
|
+
* Navios will automatically convert it to an appropriate HTTP response with the specified
|
|
6
|
+
* status code and response body.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(getUserEndpoint)
|
|
11
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
12
|
+
* const user = await this.userService.findById(request.urlParams.userId)
|
|
13
|
+
* if (!user) {
|
|
14
|
+
* throw new HttpException(404, 'User not found')
|
|
15
|
+
* }
|
|
16
|
+
* return user
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
1
20
|
export class HttpException {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new HttpException instance.
|
|
23
|
+
*
|
|
24
|
+
* @param statusCode - HTTP status code (e.g., 400, 404, 500)
|
|
25
|
+
* @param response - Response body (string or object)
|
|
26
|
+
* @param error - Optional underlying error for logging/debugging
|
|
27
|
+
*/
|
|
2
28
|
constructor(
|
|
3
29
|
public readonly statusCode: number,
|
|
4
30
|
public readonly response: string | object,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './http.exception.mjs';
|
|
2
|
+
export * from './bad-request.exception.mjs';
|
|
3
|
+
export * from './forbidden.exception.mjs';
|
|
4
|
+
export * from './internal-server-error.exception.mjs';
|
|
5
|
+
export * from './not-found.exception.mjs';
|
|
6
|
+
export * from './unauthorized.exception.mjs';
|
|
7
|
+
export * from './conflict.exception.mjs';
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,uCAAuC,CAAA;AACrD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HttpException } from './http.exception.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Exception that represents a 500 Internal Server Error HTTP error.
|
|
4
|
+
*
|
|
5
|
+
* Use this exception when an unexpected error occurs on the server.
|
|
6
|
+
* Generally, you should let unhandled errors bubble up rather than catching
|
|
7
|
+
* and rethrowing as InternalServerErrorException, as Navios will handle them appropriately.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Endpoint(processPaymentEndpoint)
|
|
12
|
+
* async processPayment(request: EndpointParams<typeof processPaymentEndpoint>) {
|
|
13
|
+
* try {
|
|
14
|
+
* return await this.paymentService.process(request.data)
|
|
15
|
+
* } catch (error) {
|
|
16
|
+
* this.logger.error('Payment processing failed', error)
|
|
17
|
+
* throw new InternalServerErrorException('Payment processing failed', error)
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class InternalServerErrorException extends HttpException {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new InternalServerErrorException.
|
|
25
|
+
*
|
|
26
|
+
* @param message - Error message or response object
|
|
27
|
+
* @param error - Optional underlying error for logging
|
|
28
|
+
*/
|
|
29
|
+
constructor(message: string | object, error?: Error);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=internal-server-error.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-server-error.exception.d.mts","sourceRoot":"","sources":["internal-server-error.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,4BAA6B,SAAQ,aAAa;IAC7D;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAGpD"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 500 Internal Server Error HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when an unexpected error occurs on the server.
|
|
7
|
+
* Generally, you should let unhandled errors bubble up rather than catching
|
|
8
|
+
* and rethrowing as InternalServerErrorException, as Navios will handle them appropriately.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* @Endpoint(processPaymentEndpoint)
|
|
13
|
+
* async processPayment(request: EndpointParams<typeof processPaymentEndpoint>) {
|
|
14
|
+
* try {
|
|
15
|
+
* return await this.paymentService.process(request.data)
|
|
16
|
+
* } catch (error) {
|
|
17
|
+
* this.logger.error('Payment processing failed', error)
|
|
18
|
+
* throw new InternalServerErrorException('Payment processing failed', error)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
3
23
|
export class InternalServerErrorException extends HttpException {
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new InternalServerErrorException.
|
|
26
|
+
*
|
|
27
|
+
* @param message - Error message or response object
|
|
28
|
+
* @param error - Optional underlying error for logging
|
|
29
|
+
*/
|
|
4
30
|
constructor(message: string | object, error?: Error) {
|
|
5
31
|
super(500, message, error)
|
|
6
32
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpException } from './http.exception.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Exception that represents a 404 Not Found HTTP error.
|
|
4
|
+
*
|
|
5
|
+
* Use this exception when the requested resource does not exist.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* @Endpoint(getUserEndpoint)
|
|
10
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
11
|
+
* const user = await this.userService.findById(request.urlParams.userId)
|
|
12
|
+
* if (!user) {
|
|
13
|
+
* throw new NotFoundException('User not found')
|
|
14
|
+
* }
|
|
15
|
+
* return user
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class NotFoundException extends HttpException {
|
|
20
|
+
readonly response: string | object;
|
|
21
|
+
readonly error?: Error | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new NotFoundException.
|
|
24
|
+
*
|
|
25
|
+
* @param response - Error message or response object
|
|
26
|
+
* @param error - Optional underlying error for logging
|
|
27
|
+
*/
|
|
28
|
+
constructor(response: string | object, error?: Error | undefined);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=not-found.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.exception.d.mts","sourceRoot":"","sources":["not-found.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;aAQhC,QAAQ,EAAE,MAAM,GAAG,MAAM;aACzB,KAAK,CAAC,EAAE,KAAK;IAR/B;;;;;OAKG;gBAEe,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,KAAK,CAAC,EAAE,KAAK,YAAA;CAIhC"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 404 Not Found HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when the requested resource does not exist.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(getUserEndpoint)
|
|
11
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
12
|
+
* const user = await this.userService.findById(request.urlParams.userId)
|
|
13
|
+
* if (!user) {
|
|
14
|
+
* throw new NotFoundException('User not found')
|
|
15
|
+
* }
|
|
16
|
+
* return user
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export class NotFoundException extends HttpException {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new NotFoundException.
|
|
23
|
+
*
|
|
24
|
+
* @param response - Error message or response object
|
|
25
|
+
* @param error - Optional underlying error for logging
|
|
26
|
+
*/
|
|
4
27
|
constructor(
|
|
5
28
|
public readonly response: string | object,
|
|
6
29
|
public readonly error?: Error,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HttpException } from './http.exception.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Exception that represents a 401 Unauthorized HTTP error.
|
|
4
|
+
*
|
|
5
|
+
* Use this exception when the client is not authenticated or authentication failed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* @Endpoint(getUserEndpoint)
|
|
10
|
+
* @UseGuards(AuthGuard)
|
|
11
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
12
|
+
* if (!request.headers.authorization) {
|
|
13
|
+
* throw new UnauthorizedException('Authentication required')
|
|
14
|
+
* }
|
|
15
|
+
* // ...
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class UnauthorizedException extends HttpException {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new UnauthorizedException.
|
|
22
|
+
*
|
|
23
|
+
* @param message - Error message or response object
|
|
24
|
+
* @param error - Optional underlying error for logging
|
|
25
|
+
*/
|
|
26
|
+
constructor(message: string | object, error?: Error);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=unauthorized.exception.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized.exception.d.mts","sourceRoot":"","sources":["unauthorized.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAGpD"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import { HttpException } from './http.exception.mjs'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Exception that represents a 401 Unauthorized HTTP error.
|
|
5
|
+
*
|
|
6
|
+
* Use this exception when the client is not authenticated or authentication failed.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Endpoint(getUserEndpoint)
|
|
11
|
+
* @UseGuards(AuthGuard)
|
|
12
|
+
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
13
|
+
* if (!request.headers.authorization) {
|
|
14
|
+
* throw new UnauthorizedException('Authentication required')
|
|
15
|
+
* }
|
|
16
|
+
* // ...
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export class UnauthorizedException extends HttpException {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new UnauthorizedException.
|
|
23
|
+
*
|
|
24
|
+
* @param message - Error message or response object
|
|
25
|
+
* @param error - Optional underlying error for logging
|
|
26
|
+
*/
|
|
4
27
|
constructor(message: string | object, error?: Error) {
|
|
5
28
|
super(401, message, error)
|
|
6
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-adapter.factory.d.mts","sourceRoot":"","sources":["endpoint-adapter.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAGa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IAExD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-adapter.factory.d.mts","sourceRoot":"","sources":["http-adapter.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhD,qBAGa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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';
|
|
7
|
+
export * from './xml-stream-adapter.factory.mjs';
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA"}
|
package/src/factories/index.mts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipart-adapter.factory.d.mts","sourceRoot":"","sources":["multipart-adapter.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAGa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IAExD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.factory.d.mts","sourceRoot":"","sources":["reply.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAIa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.factory.d.mts","sourceRoot":"","sources":["request.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAIa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-adapter.factory.d.mts","sourceRoot":"","sources":["stream-adapter.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAGa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-stream-adapter.factory.d.mts","sourceRoot":"","sources":["xml-stream-adapter.factory.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAA;AAOhE,qBAGa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,MAAM,CAAC,GAAG,EAAE,cAAc;CAO3B"}
|
|
@@ -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 { XmlStreamAdapterToken } from '../tokens/index.mjs'
|
|
7
|
+
|
|
8
|
+
@Factory({
|
|
9
|
+
token: XmlStreamAdapterToken,
|
|
10
|
+
})
|
|
11
|
+
export class XmlStreamAdapterFactory {
|
|
12
|
+
private readonly environment = inject(NaviosEnvironment)
|
|
13
|
+
create(ctx: FactoryContext) {
|
|
14
|
+
const service = this.environment.getHttpToken(XmlStreamAdapterToken)
|
|
15
|
+
if (!service) {
|
|
16
|
+
throw new Error('XmlStreamAdapterToken service not found in environment')
|
|
17
|
+
}
|
|
18
|
+
return ctx.inject(service as InjectionToken<any, undefined>)
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from '@navios/di';
|
|
2
|
+
export * from './config/index.mjs';
|
|
3
|
+
export * from './decorators/index.mjs';
|
|
4
|
+
export * from './exceptions/index.mjs';
|
|
5
|
+
export * from './interfaces/index.mjs';
|
|
6
|
+
export * from './logger/index.mjs';
|
|
7
|
+
export * from './metadata/index.mjs';
|
|
8
|
+
export * from './services/index.mjs';
|
|
9
|
+
export * from './stores/index.mjs';
|
|
10
|
+
export * from './tokens/index.mjs';
|
|
11
|
+
export * from './attribute.factory.mjs';
|
|
12
|
+
export * from './factories/index.mjs';
|
|
13
|
+
export * from './navios.application.mjs';
|
|
14
|
+
export * from './navios.factory.mjs';
|
|
15
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA"}
|
package/src/index.mts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './interfaces/index.mjs'
|
|
|
6
6
|
export * from './logger/index.mjs'
|
|
7
7
|
export * from './metadata/index.mjs'
|
|
8
8
|
export * from './services/index.mjs'
|
|
9
|
+
export * from './stores/index.mjs'
|
|
9
10
|
export * from './tokens/index.mjs'
|
|
10
11
|
export * from './attribute.factory.mjs'
|
|
11
12
|
export * from './factories/index.mjs'
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ControllerMetadata, HandlerMetadata, ModuleMetadata } from '../metadata/index.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Interface providing access to the execution context during request handling.
|
|
4
|
+
*
|
|
5
|
+
* The execution context provides access to metadata and request/reply objects
|
|
6
|
+
* for the current request. It is available in guards and can be injected into
|
|
7
|
+
* services if needed.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Injectable()
|
|
12
|
+
* export class AuthGuard implements CanActivate {
|
|
13
|
+
* async canActivate(context: AbstractExecutionContext): Promise<boolean> {
|
|
14
|
+
* const request = context.getRequest()
|
|
15
|
+
* const handler = context.getHandler()
|
|
16
|
+
* // Access request and handler metadata
|
|
17
|
+
* return true
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export interface AbstractExecutionContext {
|
|
23
|
+
/**
|
|
24
|
+
* Gets the metadata for the module containing the current endpoint.
|
|
25
|
+
*/
|
|
26
|
+
getModule(): ModuleMetadata;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the metadata for the controller containing the current endpoint.
|
|
29
|
+
*/
|
|
30
|
+
getController(): ControllerMetadata;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the metadata for the current endpoint handler.
|
|
33
|
+
*/
|
|
34
|
+
getHandler(): HandlerMetadata;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the HTTP request object (adapter-specific).
|
|
37
|
+
*/
|
|
38
|
+
getRequest(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the HTTP reply object (adapter-specific).
|
|
41
|
+
*/
|
|
42
|
+
getReply(): any;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=abstract-execution-context.inteface.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-execution-context.inteface.d.mts","sourceRoot":"","sources":["abstract-execution-context.inteface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,IAAI,cAAc,CAAA;IAC3B;;OAEG;IACH,aAAa,IAAI,kBAAkB,CAAA;IACnC;;OAEG;IACH,UAAU,IAAI,eAAe,CAAA;IAC7B;;OAEG;IACH,UAAU,IAAI,GAAG,CAAA;IACjB;;OAEG;IACH,QAAQ,IAAI,GAAG,CAAA;CAChB"}
|