@navios/core 0.7.0 → 0.8.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 +53 -0
- package/lib/{index-BFwNx9WQ.d.cts → index-BDNl7j1G.d.cts} +666 -292
- package/lib/index-BDNl7j1G.d.cts.map +1 -0
- package/lib/{index-D657ijFO.d.mts → index-BoP0cWT6.d.mts} +666 -292
- package/lib/index-BoP0cWT6.d.mts.map +1 -0
- package/lib/index.cjs +15 -6
- package/lib/index.d.cts +2 -2
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +3 -3
- package/lib/legacy-compat/index.cjs +1 -1
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +1 -1
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +1 -1
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +1 -1
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/lib/{src-Cb1aTjl0.cjs → src-B6eISODM.cjs} +622 -114
- package/lib/src-B6eISODM.cjs.map +1 -0
- package/lib/{src-DzPY5s6d.mjs → src-gBAChVRL.mjs} +563 -73
- package/lib/src-gBAChVRL.mjs.map +1 -0
- package/lib/testing/index.cjs +6 -6
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +1 -1
- package/lib/testing/index.d.mts +1 -1
- package/lib/testing/index.mjs +2 -2
- package/lib/{use-guards.decorator-DdvUhB03.cjs → use-guards.decorator-COR-9mZY.cjs} +34 -108
- package/lib/use-guards.decorator-COR-9mZY.cjs.map +1 -0
- package/lib/{use-guards.decorator-kZ3lNK8v.mjs → use-guards.decorator-CUww54Nt.mjs} +14 -94
- package/lib/use-guards.decorator-CUww54Nt.mjs.map +1 -0
- package/package.json +12 -12
- package/src/__tests__/controller-resolver.spec.mts +223 -0
- package/src/__tests__/controller.spec.mts +1 -1
- package/src/decorators/controller.decorator.mts +11 -6
- package/src/decorators/endpoint.decorator.mts +60 -12
- package/src/decorators/multipart.decorator.mts +67 -24
- package/src/decorators/stream.decorator.mts +65 -24
- package/src/interfaces/abstract-http-adapter.interface.mts +52 -0
- package/src/interfaces/abstract-http-handler-adapter.interface.mts +31 -1
- package/src/interfaces/index.mts +1 -0
- package/src/interfaces/plugin.interface.mts +105 -0
- package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
- package/src/legacy-compat/decorators/multipart.decorator.mts +1 -1
- package/src/legacy-compat/decorators/stream.decorator.mts +1 -1
- package/src/logger/logger.service.mts +3 -3
- package/src/navios.application.mts +91 -27
- package/src/navios.factory.mts +29 -9
- package/src/services/guard-runner.service.mts +46 -9
- package/src/services/index.mts +1 -0
- package/src/services/instance-resolver.service.mts +186 -0
- package/src/services/module-loader.service.mts +102 -1
- package/src/stores/request-id.store.mts +45 -3
- package/src/tokens/index.mts +1 -0
- package/src/tokens/navios-options.token.mts +6 -0
- package/lib/index-BFwNx9WQ.d.cts.map +0 -1
- package/lib/index-D657ijFO.d.mts.map +0 -1
- package/lib/src-Cb1aTjl0.cjs.map +0 -1
- package/lib/src-DzPY5s6d.mjs.map +0 -1
- package/lib/use-guards.decorator-DdvUhB03.cjs.map +0 -1
- package/lib/use-guards.decorator-kZ3lNK8v.mjs.map +0 -1
- package/src/attribute.factory.d.mts +0 -175
- package/src/attribute.factory.d.mts.map +0 -1
- package/src/config/config-service.interface.d.mts +0 -39
- package/src/config/config-service.interface.d.mts.map +0 -1
- package/src/config/config.provider.d.mts +0 -46
- package/src/config/config.provider.d.mts.map +0 -1
- package/src/config/config.service.d.mts +0 -108
- package/src/config/config.service.d.mts.map +0 -1
- package/src/config/index.d.mts +0 -6
- package/src/config/index.d.mts.map +0 -1
- package/src/config/types.d.mts +0 -13
- package/src/config/types.d.mts.map +0 -1
- package/src/config/utils/helpers.d.mts +0 -3
- package/src/config/utils/helpers.d.mts.map +0 -1
- package/src/config/utils/index.d.mts +0 -2
- package/src/config/utils/index.d.mts.map +0 -1
- package/src/decorators/controller.decorator.d.mts +0 -33
- package/src/decorators/controller.decorator.d.mts.map +0 -1
- package/src/decorators/endpoint.decorator.d.mts +0 -89
- package/src/decorators/endpoint.decorator.d.mts.map +0 -1
- package/src/decorators/header.decorator.d.mts +0 -22
- package/src/decorators/header.decorator.d.mts.map +0 -1
- package/src/decorators/http-code.decorator.d.mts +0 -22
- package/src/decorators/http-code.decorator.d.mts.map +0 -1
- package/src/decorators/index.d.mts +0 -9
- package/src/decorators/index.d.mts.map +0 -1
- package/src/decorators/module.decorator.d.mts +0 -42
- package/src/decorators/module.decorator.d.mts.map +0 -1
- package/src/decorators/multipart.decorator.d.mts +0 -54
- package/src/decorators/multipart.decorator.d.mts.map +0 -1
- package/src/decorators/stream.decorator.d.mts +0 -42
- package/src/decorators/stream.decorator.d.mts.map +0 -1
- package/src/decorators/use-guards.decorator.d.mts +0 -33
- package/src/decorators/use-guards.decorator.d.mts.map +0 -1
- package/src/exceptions/bad-request.exception.d.mts +0 -26
- package/src/exceptions/bad-request.exception.d.mts.map +0 -1
- package/src/exceptions/conflict.exception.d.mts +0 -29
- package/src/exceptions/conflict.exception.d.mts.map +0 -1
- package/src/exceptions/forbidden.exception.d.mts +0 -28
- package/src/exceptions/forbidden.exception.d.mts.map +0 -1
- package/src/exceptions/http.exception.d.mts +0 -33
- package/src/exceptions/http.exception.d.mts.map +0 -1
- package/src/exceptions/index.d.mts +0 -8
- package/src/exceptions/index.d.mts.map +0 -1
- package/src/exceptions/internal-server-error.exception.d.mts +0 -31
- package/src/exceptions/internal-server-error.exception.d.mts.map +0 -1
- package/src/exceptions/not-found.exception.d.mts +0 -30
- package/src/exceptions/not-found.exception.d.mts.map +0 -1
- package/src/exceptions/unauthorized.exception.d.mts +0 -28
- package/src/exceptions/unauthorized.exception.d.mts.map +0 -1
- package/src/factories/endpoint-adapter.factory.d.mts +0 -6
- package/src/factories/endpoint-adapter.factory.d.mts.map +0 -1
- package/src/factories/http-adapter.factory.d.mts +0 -6
- package/src/factories/http-adapter.factory.d.mts.map +0 -1
- package/src/factories/index.d.mts +0 -8
- package/src/factories/index.d.mts.map +0 -1
- package/src/factories/multipart-adapter.factory.d.mts +0 -6
- package/src/factories/multipart-adapter.factory.d.mts.map +0 -1
- package/src/factories/reply.factory.d.mts +0 -6
- package/src/factories/reply.factory.d.mts.map +0 -1
- package/src/factories/request.factory.d.mts +0 -6
- package/src/factories/request.factory.d.mts.map +0 -1
- package/src/factories/stream-adapter.factory.d.mts +0 -6
- package/src/factories/stream-adapter.factory.d.mts.map +0 -1
- package/src/factories/xml-stream-adapter.factory.d.mts +0 -6
- package/src/factories/xml-stream-adapter.factory.d.mts.map +0 -1
- package/src/index.d.mts +0 -15
- package/src/index.d.mts.map +0 -1
- package/src/interfaces/abstract-execution-context.inteface.d.mts +0 -44
- package/src/interfaces/abstract-execution-context.inteface.d.mts.map +0 -1
- package/src/interfaces/abstract-http-adapter.interface.d.mts +0 -15
- package/src/interfaces/abstract-http-adapter.interface.d.mts.map +0 -1
- package/src/interfaces/abstract-http-cors-options.interface.d.mts +0 -58
- package/src/interfaces/abstract-http-cors-options.interface.d.mts.map +0 -1
- package/src/interfaces/abstract-http-handler-adapter.interface.d.mts +0 -7
- package/src/interfaces/abstract-http-handler-adapter.interface.d.mts.map +0 -1
- package/src/interfaces/abstract-http-listen-options.interface.d.mts +0 -5
- package/src/interfaces/abstract-http-listen-options.interface.d.mts.map +0 -1
- package/src/interfaces/can-activate.d.mts +0 -36
- package/src/interfaces/can-activate.d.mts.map +0 -1
- package/src/interfaces/http-header.d.mts +0 -10
- package/src/interfaces/http-header.d.mts.map +0 -1
- package/src/interfaces/index.d.mts +0 -9
- package/src/interfaces/index.d.mts.map +0 -1
- package/src/interfaces/navios-module.d.mts +0 -29
- package/src/interfaces/navios-module.d.mts.map +0 -1
- package/src/legacy-compat/context-compat.d.mts +0 -19
- package/src/legacy-compat/context-compat.d.mts.map +0 -1
- package/src/legacy-compat/decorators/controller.decorator.d.mts +0 -21
- package/src/legacy-compat/decorators/controller.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/endpoint.decorator.d.mts +0 -33
- package/src/legacy-compat/decorators/endpoint.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/header.decorator.d.mts +0 -24
- package/src/legacy-compat/decorators/header.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/http-code.decorator.d.mts +0 -22
- package/src/legacy-compat/decorators/http-code.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/index.d.mts +0 -9
- package/src/legacy-compat/decorators/index.d.mts.map +0 -1
- package/src/legacy-compat/decorators/module.decorator.d.mts +0 -22
- package/src/legacy-compat/decorators/module.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/multipart.decorator.d.mts +0 -34
- package/src/legacy-compat/decorators/multipart.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/stream.decorator.d.mts +0 -34
- package/src/legacy-compat/decorators/stream.decorator.d.mts.map +0 -1
- package/src/legacy-compat/decorators/use-guards.decorator.d.mts +0 -29
- package/src/legacy-compat/decorators/use-guards.decorator.d.mts.map +0 -1
- package/src/legacy-compat/index.d.mts +0 -19
- package/src/legacy-compat/index.d.mts.map +0 -1
- package/src/logger/console-logger.service.d.mts +0 -196
- package/src/logger/console-logger.service.d.mts.map +0 -1
- package/src/logger/index.d.mts +0 -7
- package/src/logger/index.d.mts.map +0 -1
- package/src/logger/log-levels.d.mts +0 -14
- package/src/logger/log-levels.d.mts.map +0 -1
- package/src/logger/logger-service.interface.d.mts +0 -36
- package/src/logger/logger-service.interface.d.mts.map +0 -1
- package/src/logger/logger.service.d.mts +0 -57
- package/src/logger/logger.service.d.mts.map +0 -1
- package/src/logger/logger.tokens.d.mts +0 -36
- package/src/logger/logger.tokens.d.mts.map +0 -1
- package/src/logger/utils/cli-colors.util.d.mts +0 -10
- package/src/logger/utils/cli-colors.util.d.mts.map +0 -1
- package/src/logger/utils/filter-log-levelts.util.d.mts +0 -6
- package/src/logger/utils/filter-log-levelts.util.d.mts.map +0 -1
- package/src/logger/utils/index.d.mts +0 -6
- package/src/logger/utils/index.d.mts.map +0 -1
- package/src/logger/utils/is-log-level-enabled.d.mts +0 -8
- package/src/logger/utils/is-log-level-enabled.d.mts.map +0 -1
- package/src/logger/utils/is-log-level.util.d.mts +0 -6
- package/src/logger/utils/is-log-level.util.d.mts.map +0 -1
- package/src/logger/utils/shared.utils.d.mts +0 -14
- package/src/logger/utils/shared.utils.d.mts.map +0 -1
- package/src/metadata/controller.metadata.d.mts +0 -13
- package/src/metadata/controller.metadata.d.mts.map +0 -1
- package/src/metadata/handler.metadata.d.mts +0 -18
- package/src/metadata/handler.metadata.d.mts.map +0 -1
- package/src/metadata/index.d.mts +0 -4
- package/src/metadata/index.d.mts.map +0 -1
- package/src/metadata/module.metadata.d.mts +0 -13
- package/src/metadata/module.metadata.d.mts.map +0 -1
- package/src/navios.application.d.mts +0 -210
- package/src/navios.application.d.mts.map +0 -1
- package/src/navios.environment.d.mts +0 -11
- package/src/navios.environment.d.mts.map +0 -1
- package/src/navios.factory.d.mts +0 -68
- package/src/navios.factory.d.mts.map +0 -1
- package/src/services/guard-runner.service.d.mts +0 -10
- package/src/services/guard-runner.service.d.mts.map +0 -1
- package/src/services/index.d.mts +0 -3
- package/src/services/index.d.mts.map +0 -1
- package/src/services/module-loader.service.d.mts +0 -17
- package/src/services/module-loader.service.d.mts.map +0 -1
- package/src/stores/index.d.mts +0 -2
- package/src/stores/index.d.mts.map +0 -1
- package/src/stores/request-id.store.d.mts +0 -37
- package/src/stores/request-id.store.d.mts.map +0 -1
- package/src/tokens/endpoint-adapter.token.d.mts +0 -4
- package/src/tokens/endpoint-adapter.token.d.mts.map +0 -1
- package/src/tokens/execution-context.token.d.mts +0 -5
- package/src/tokens/execution-context.token.d.mts.map +0 -1
- package/src/tokens/http-adapter.token.d.mts +0 -4
- package/src/tokens/http-adapter.token.d.mts.map +0 -1
- package/src/tokens/index.d.mts +0 -9
- package/src/tokens/index.d.mts.map +0 -1
- package/src/tokens/multipart-adapter.token.d.mts +0 -4
- package/src/tokens/multipart-adapter.token.d.mts.map +0 -1
- package/src/tokens/reply.token.d.mts +0 -3
- package/src/tokens/reply.token.d.mts.map +0 -1
- package/src/tokens/request.token.d.mts +0 -3
- package/src/tokens/request.token.d.mts.map +0 -1
- package/src/tokens/stream-adapter.token.d.mts +0 -4
- package/src/tokens/stream-adapter.token.d.mts.map +0 -1
- package/src/tokens/xml-stream-adapter.token.d.mts +0 -4
- package/src/tokens/xml-stream-adapter.token.d.mts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["types.mts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,KAAK,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC,GAC7B,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACvB,KAAK,GACL,IAAI,GACN,KAAK,CAAA;AAET,KAAK,aAAa,GACd,UAAU,GACV,QAAQ,GACR,KAAK,GACL,mBAAmB,GACnB,eAAe,CAAA;AACnB,KAAK,YAAY,GAAG,mBAAmB,GAAG,eAAe,GAAG,SAAS,CAAA;AAErE,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,GAAG,SAAS,MAAM,CAAC,IAAI,GAAG,SAAS,MAAM,GAC7D,GAAG,SAAS,YAAY,GACtB,KAAK,GACL,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,IAAI,GACxB,KAAK,GACL,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GACnB,KAAK,GACL,CAAC,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,GAClB,KAAK,GACL,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,GAAG,SAAS,aAAa,GACvB,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,GAEnD,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,EAAE,GACzE,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,GAC7D,KAAK,GACf,KAAK,CAAA;AAET,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;AAEzD,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,MAAM,GACxC,SAAS,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAC1B,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,GACxB,CAAC,GACD,MAAM,CAAC,GACT,MAAM,CAAC,GACT,KAAK,CAAA;AAET,MAAM,MAAM,SAAS,CACnB,CAAC,EACD,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,IACf,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,EAAE,GACtC,GAAG,SAAS,MAAM,CAAC,GACjB,IAAI,SAAS,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GACvB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GACvB,KAAK,GACP,KAAK,GACP,CAAC,SAAS,MAAM,CAAC,GACf,CAAC,CAAC,CAAC,CAAC,GACJ,KAAK,CAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function envInt(key: keyof NodeJS.ProcessEnv, defaultValue: number): number;
|
|
2
|
-
export declare function envString<DefaultValue extends string | undefined, Ensured = DefaultValue extends string ? true : false>(key: keyof NodeJS.ProcessEnv, defaultValue?: DefaultValue): Ensured extends true ? string : string | undefined;
|
|
3
|
-
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","sourceRoot":"","sources":["helpers.mts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CACpB,GAAG,EAAE,MAAM,MAAM,CAAC,UAAU,EAC5B,YAAY,EAAE,MAAM,GACnB,MAAM,CAIR;AAED,wBAAgB,SAAS,CACvB,YAAY,SAAS,MAAM,GAAG,SAAS,EACvC,OAAO,GAAG,YAAY,SAAS,MAAM,GAAG,IAAI,GAAG,KAAK,EAEpD,GAAG,EAAE,MAAM,MAAM,CAAC,UAAU,EAC5B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,SAAS,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAKpD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/di';
|
|
2
|
-
/**
|
|
3
|
-
* Options for configuring a Navios controller.
|
|
4
|
-
*/
|
|
5
|
-
export interface ControllerOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Guards to apply to all endpoints in this controller.
|
|
8
|
-
* Guards are executed in reverse order (last guard first).
|
|
9
|
-
*/
|
|
10
|
-
guards?: ClassType[] | Set<ClassType>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Decorator that marks a class as a Navios controller.
|
|
14
|
-
*
|
|
15
|
-
* Controllers handle HTTP requests and define endpoints.
|
|
16
|
-
* They are request-scoped by default, meaning a new instance is created for each request.
|
|
17
|
-
*
|
|
18
|
-
* @param options - Controller configuration options
|
|
19
|
-
* @returns A class decorator
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* @Controller({ guards: [AuthGuard] })
|
|
24
|
-
* export class UserController {
|
|
25
|
-
* @Endpoint(getUserEndpoint)
|
|
26
|
-
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
27
|
-
* // Handle request
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function Controller({ guards }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
|
|
33
|
-
//# sourceMappingURL=controller.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.d.mts","sourceRoot":"","sources":["controller.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAM3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;CACtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAE,iBAAsB,IAC1C,QAAQ,SAAS,EAAE,SAAS,qBAAqB,eAoBnE"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { BaseEndpointConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder';
|
|
2
|
-
import type { z, ZodType } from 'zod/v4';
|
|
3
|
-
import { ZodDiscriminatedUnion } from 'zod/v4';
|
|
4
|
-
/**
|
|
5
|
-
* Extracts the typed parameters for an endpoint handler function.
|
|
6
|
-
*
|
|
7
|
-
* This utility type extracts URL parameters, query parameters, and request body
|
|
8
|
-
* from an endpoint declaration and flattens them into a single object.
|
|
9
|
-
*
|
|
10
|
-
* @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const getUserEndpoint = api.declareEndpoint({
|
|
15
|
-
* method: 'get',
|
|
16
|
-
* url: '/users/$userId',
|
|
17
|
-
* querySchema: z.object({ include: z.string().optional() }),
|
|
18
|
-
* responseSchema: z.object({ id: z.string(), name: z.string() }),
|
|
19
|
-
* })
|
|
20
|
-
*
|
|
21
|
-
* @Endpoint(getUserEndpoint)
|
|
22
|
-
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
23
|
-
* // request.urlParams.userId is typed as string
|
|
24
|
-
* // request.query.include is typed as string | undefined
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export type EndpointParams<EndpointDeclaration extends {
|
|
29
|
-
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
30
|
-
}, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodType ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
|
|
31
|
-
/**
|
|
32
|
-
* Extracts the typed return value for an endpoint handler function.
|
|
33
|
-
*
|
|
34
|
-
* This utility type extracts the response schema from an endpoint declaration
|
|
35
|
-
* and returns the appropriate Promise type.
|
|
36
|
-
*
|
|
37
|
-
* @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* const getUserEndpoint = api.declareEndpoint({
|
|
42
|
-
* method: 'get',
|
|
43
|
-
* url: '/users/$userId',
|
|
44
|
-
* responseSchema: z.object({ id: z.string(), name: z.string() }),
|
|
45
|
-
* })
|
|
46
|
-
*
|
|
47
|
-
* @Endpoint(getUserEndpoint)
|
|
48
|
-
* async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {
|
|
49
|
-
* return { id: '1', name: 'John' } // Type-checked against responseSchema
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export type EndpointResult<EndpointDeclaration extends {
|
|
54
|
-
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
55
|
-
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
56
|
-
/**
|
|
57
|
-
* Decorator that marks a method as an HTTP endpoint.
|
|
58
|
-
*
|
|
59
|
-
* The endpoint must be defined using @navios/builder's `declareEndpoint` method.
|
|
60
|
-
* This ensures type safety and consistency between client and server.
|
|
61
|
-
*
|
|
62
|
-
* @param endpoint - The endpoint declaration from @navios/builder
|
|
63
|
-
* @returns A method decorator
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* import { builder } from '@navios/builder'
|
|
68
|
-
*
|
|
69
|
-
* const api = builder()
|
|
70
|
-
* const getUserEndpoint = api.declareEndpoint({
|
|
71
|
-
* method: 'get',
|
|
72
|
-
* url: '/users/$userId',
|
|
73
|
-
* responseSchema: z.object({ id: z.string(), name: z.string() }),
|
|
74
|
-
* })
|
|
75
|
-
*
|
|
76
|
-
* @Controller()
|
|
77
|
-
* export class UserController {
|
|
78
|
-
* @Endpoint(getUserEndpoint)
|
|
79
|
-
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
80
|
-
* const { userId } = request.urlParams
|
|
81
|
-
* return { id: userId, name: 'John' }
|
|
82
|
-
* }
|
|
83
|
-
* }
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
87
|
-
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
88
|
-
}): (target: (params: QuerySchema extends ZodType ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodType ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z.input<ResponseSchema>>;
|
|
89
|
-
//# sourceMappingURL=endpoint.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.decorator.d.mts","sourceRoot":"","sources":["endpoint.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAK9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,cAAc,CACxB,mBAAmB,SAAS;IAC1B,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CACpD,EACD,GAAG,SAAS,MAAM,GAAG,mBAAmB,CAAC,QAAQ,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response header for an endpoint.
|
|
4
|
-
*
|
|
5
|
-
* @param name - The header name (e.g., 'Content-Type', 'Cache-Control')
|
|
6
|
-
* @param value - The header value (string, number, or array of strings)
|
|
7
|
-
* @returns A method decorator
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Controller()
|
|
12
|
-
* export class UserController {
|
|
13
|
-
* @Endpoint(getUserEndpoint)
|
|
14
|
-
* @Header('Cache-Control', 'max-age=3600')
|
|
15
|
-
* async getUser() {
|
|
16
|
-
* return { id: '1', name: 'John' }
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function Header(name: HttpHeader, value: string | number | string[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
|
|
22
|
-
//# sourceMappingURL=header.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header.decorator.d.mts","sourceRoot":"","sources":["header.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAChE,CAAC,SAAS,QAAQ,EACxB,QAAQ,CAAC,EACT,SAAS,2BAA2B,OAWvC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decorator that sets a custom HTTP status code for successful responses.
|
|
3
|
-
*
|
|
4
|
-
* By default, endpoints return 200 OK. Use this decorator to return a different status code.
|
|
5
|
-
*
|
|
6
|
-
* @param code - The HTTP status code to return (e.g., 201, 204, 202)
|
|
7
|
-
* @returns A method decorator
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Controller()
|
|
12
|
-
* export class UserController {
|
|
13
|
-
* @Endpoint(createUserEndpoint)
|
|
14
|
-
* @HttpCode(201)
|
|
15
|
-
* async createUser() {
|
|
16
|
-
* return { id: '1', name: 'John' }
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function HttpCode(code: number): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
|
|
22
|
-
//# sourceMappingURL=http-code.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-code.decorator.d.mts","sourceRoot":"","sources":["http-code.decorator.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,IAC3B,CAAC,SAAS,QAAQ,EACxB,QAAQ,CAAC,EACT,SAAS,2BAA2B,OAYvC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './controller.decorator.mjs';
|
|
2
|
-
export * from './endpoint.decorator.mjs';
|
|
3
|
-
export * from './header.decorator.mjs';
|
|
4
|
-
export * from './http-code.decorator.mjs';
|
|
5
|
-
export * from './module.decorator.mjs';
|
|
6
|
-
export * from './multipart.decorator.mjs';
|
|
7
|
-
export * from './stream.decorator.mjs';
|
|
8
|
-
export * from './use-guards.decorator.mjs';
|
|
9
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/di';
|
|
2
|
-
/**
|
|
3
|
-
* Options for configuring a Navios module.
|
|
4
|
-
*/
|
|
5
|
-
export interface ModuleOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Controllers to register in this module.
|
|
8
|
-
* Controllers handle HTTP requests and define endpoints.
|
|
9
|
-
*/
|
|
10
|
-
controllers?: ClassType[] | Set<ClassType>;
|
|
11
|
-
/**
|
|
12
|
-
* Other modules to import into this module.
|
|
13
|
-
* Imported modules' controllers and services become available.
|
|
14
|
-
*/
|
|
15
|
-
imports?: ClassType[] | Set<ClassType>;
|
|
16
|
-
/**
|
|
17
|
-
* Guards to apply to all controllers in this module.
|
|
18
|
-
* Guards are executed in reverse order (last guard first).
|
|
19
|
-
*/
|
|
20
|
-
guards?: ClassType[] | Set<ClassType>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Decorator that marks a class as a Navios module.
|
|
24
|
-
*
|
|
25
|
-
* Modules are the basic building blocks of a Navios application.
|
|
26
|
-
* They organize controllers, services, and other modules into logical units.
|
|
27
|
-
*
|
|
28
|
-
* @param options - Module configuration options
|
|
29
|
-
* @returns A class decorator
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* @Module({
|
|
34
|
-
* controllers: [UserController, AuthController],
|
|
35
|
-
* imports: [DatabaseModule],
|
|
36
|
-
* guards: [AuthGuard],
|
|
37
|
-
* })
|
|
38
|
-
* export class AppModule {}
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function Module({ controllers, imports, guards }?: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
|
|
42
|
-
//# sourceMappingURL=module.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.decorator.d.mts","sourceRoot":"","sources":["module.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAM3C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;CACtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CACpB,EAAE,WAAgB,EAAE,OAAY,EAAE,MAAW,EAAE,GAAE,aAIhD,IAEO,QAAQ,SAAS,EAAE,SAAS,qBAAqB,eAsB1D"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { BaseEndpointConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder';
|
|
2
|
-
import type { z, ZodObject, ZodType } from 'zod/v4';
|
|
3
|
-
import { ZodDiscriminatedUnion } from 'zod/v4';
|
|
4
|
-
/**
|
|
5
|
-
* Extracts the typed parameters for a multipart endpoint handler function.
|
|
6
|
-
*
|
|
7
|
-
* Similar to `EndpointParams`, but specifically for multipart/form-data endpoints.
|
|
8
|
-
*
|
|
9
|
-
* @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
|
|
10
|
-
*/
|
|
11
|
-
export type MultipartParams<EndpointDeclaration extends {
|
|
12
|
-
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
13
|
-
}, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
|
|
14
|
-
/**
|
|
15
|
-
* Extracts the typed return value for a multipart endpoint handler function.
|
|
16
|
-
*
|
|
17
|
-
* @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
|
|
18
|
-
*/
|
|
19
|
-
export type MultipartResult<EndpointDeclaration extends {
|
|
20
|
-
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
21
|
-
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
22
|
-
/**
|
|
23
|
-
* Decorator that marks a method as a multipart/form-data endpoint.
|
|
24
|
-
*
|
|
25
|
-
* Use this decorator for endpoints that handle file uploads or form data.
|
|
26
|
-
* The endpoint must be defined using @navios/builder's `declareMultipart` method.
|
|
27
|
-
*
|
|
28
|
-
* @param endpoint - The multipart endpoint declaration from @navios/builder
|
|
29
|
-
* @returns A method decorator
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const uploadFileEndpoint = api.declareMultipart({
|
|
34
|
-
* method: 'post',
|
|
35
|
-
* url: '/upload',
|
|
36
|
-
* requestSchema: z.object({ file: z.instanceof(File) }),
|
|
37
|
-
* responseSchema: z.object({ url: z.string() }),
|
|
38
|
-
* })
|
|
39
|
-
*
|
|
40
|
-
* @Controller()
|
|
41
|
-
* export class FileController {
|
|
42
|
-
* @Multipart(uploadFileEndpoint)
|
|
43
|
-
* async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>) {
|
|
44
|
-
* const { file } = request.data
|
|
45
|
-
* // Handle file upload
|
|
46
|
-
* return { url: 'https://example.com/file.jpg' }
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
52
|
-
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
53
|
-
}): (target: (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>;
|
|
54
|
-
//# sourceMappingURL=multipart.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.decorator.d.mts","sourceRoot":"","sources":["multipart.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAK9C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CACzB,mBAAmB,SAAS;IAC1B,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CACpD,EACD,GAAG,SAAS,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EACzD,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAA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,OAAO,EACxC,aAAa,GAAG,OAAO,EACvB,QAAQ,EAAE;IACV,MAAM,EAAE,kBAAkB,CACxB,MAAM,EACN,GAAG,EACH,WAAW,EACX,cAAc,EACd,aAAa,CACd,CAAA;CACF,IAEG,QAAQ,CACN,MAAM,EAAE,WAAW,SAAS,SAAS,GACjC,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,CAAC,GACrD,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,GACnD,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,GACnD,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,KAClD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EACrC,SAAS,2BAA2B,cAR1B,WAAW,SAAS,SAAS,GACjC,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,CAAC,GACrD,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,GACnD,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,GACnD,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,KAClD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAiCxC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BaseStreamConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder';
|
|
2
|
-
import type { ZodObject, ZodType } from 'zod/v4';
|
|
3
|
-
/**
|
|
4
|
-
* Extracts the typed parameters for a stream endpoint handler function.
|
|
5
|
-
*
|
|
6
|
-
* Similar to `EndpointParams`, but specifically for streaming endpoints.
|
|
7
|
-
*
|
|
8
|
-
* @typeParam EndpointDeclaration - The stream endpoint declaration from @navios/builder
|
|
9
|
-
*/
|
|
10
|
-
export type StreamParams<EndpointDeclaration extends {
|
|
11
|
-
config: BaseStreamConfig<any, any, any, any>;
|
|
12
|
-
}, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
|
|
13
|
-
/**
|
|
14
|
-
* Decorator that marks a method as a streaming endpoint.
|
|
15
|
-
*
|
|
16
|
-
* Use this decorator for endpoints that stream data (e.g., file downloads, SSE).
|
|
17
|
-
* The endpoint must be defined using @navios/builder's `declareStream` method.
|
|
18
|
-
*
|
|
19
|
-
* @param endpoint - The stream endpoint declaration from @navios/builder
|
|
20
|
-
* @returns A method decorator
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const downloadFileEndpoint = api.declareStream({
|
|
25
|
-
* method: 'get',
|
|
26
|
-
* url: '/files/$fileId',
|
|
27
|
-
* })
|
|
28
|
-
*
|
|
29
|
-
* @Controller()
|
|
30
|
-
* export class FileController {
|
|
31
|
-
* @Stream(downloadFileEndpoint)
|
|
32
|
-
* async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {
|
|
33
|
-
* const { fileId } = request.urlParams
|
|
34
|
-
* // Stream file data to reply
|
|
35
|
-
* }
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
|
|
40
|
-
config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
|
|
41
|
-
}): (target: (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>;
|
|
42
|
-
//# sourceMappingURL=stream.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream.decorator.d.mts","sourceRoot":"","sources":["stream.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAKhD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CACtB,mBAAmB,SAAS;IAC1B,MAAM,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CAC7C,EACD,GAAG,SAAS,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EACzD,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,IACxD,WAAW,SAAS,SAAS,GAC7B,mBAAmB,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,SAAS,OAAO,GAC5D,eAAe,CACb,oBAAoB,CAClB,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AAW,EAAE,aAAa,CAAC,GACrD,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,GACnD,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,GACnD,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,SAC9C,GAAG,KACP,OAAO,CAAC,IAAI,CAAC,CAiCrB"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ClassTypeWithInstance, InjectionToken } from '@navios/di';
|
|
2
|
-
import type { CanActivate } from '../interfaces/index.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Decorator that applies guards to a controller or endpoint.
|
|
5
|
-
*
|
|
6
|
-
* Guards are used for authentication, authorization, and request validation.
|
|
7
|
-
* They implement the `CanActivate` interface and are executed before the endpoint handler.
|
|
8
|
-
* Guards can be applied at the module, controller, or endpoint level.
|
|
9
|
-
*
|
|
10
|
-
* @param guards - Guard classes or injection tokens to apply
|
|
11
|
-
* @returns A class or method decorator
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Apply to a controller
|
|
16
|
-
* @Controller()
|
|
17
|
-
* @UseGuards(AuthGuard, RoleGuard)
|
|
18
|
-
* export class UserController {
|
|
19
|
-
* @Endpoint(getUserEndpoint)
|
|
20
|
-
* async getUser() { }
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* // Apply to a specific endpoint
|
|
24
|
-
* @Controller()
|
|
25
|
-
* export class UserController {
|
|
26
|
-
* @Endpoint(getUserEndpoint)
|
|
27
|
-
* @UseGuards(AuthGuard)
|
|
28
|
-
* async getUser() { }
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function UseGuards(...guards: (ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>)[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext | ClassDecoratorContext) => T;
|
|
33
|
-
//# sourceMappingURL=use-guards.decorator.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-guards.decorator.d.mts","sourceRoot":"","sources":["use-guards.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,qBAAqB,EACrB,cAAc,EACf,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAO1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,SAAS,CACvB,GAAG,MAAM,EAAE,CACP,qBAAqB,CAAC,WAAW,CAAC,GAClC,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CACzC,EAAE,IAEc,CAAC,SAAS,QAAQ,EACjC,QAAQ,CAAC,EACT,SAAS,2BAA2B,GAAG,qBAAqB,KAC3D,CAAC,CAqBL"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HttpException } from './http.exception.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Exception that represents a 400 Bad Request HTTP error.
|
|
4
|
-
*
|
|
5
|
-
* Use this exception when the client's request is malformed or invalid.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @Endpoint(createUserEndpoint)
|
|
10
|
-
* async createUser(request: EndpointParams<typeof createUserEndpoint>) {
|
|
11
|
-
* if (!request.data.email) {
|
|
12
|
-
* throw new BadRequestException('Email is required')
|
|
13
|
-
* }
|
|
14
|
-
* // ...
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class BadRequestException extends HttpException {
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new BadRequestException.
|
|
21
|
-
*
|
|
22
|
-
* @param message - Error message or response object
|
|
23
|
-
*/
|
|
24
|
-
constructor(message: string | object);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=bad-request.exception.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bad-request.exception.d.mts","sourceRoot":"","sources":["bad-request.exception.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD;;;;OAIG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM;CAGrC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,33 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|