@navios/core 1.1.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +85 -13
  2. package/README.md +69 -220
  3. package/lib/async-context-BAdt7bno.d.mts +239 -0
  4. package/lib/async-context-BAdt7bno.d.mts.map +1 -0
  5. package/lib/async-context-RsWmy2Hi.d.cts +239 -0
  6. package/lib/async-context-RsWmy2Hi.d.cts.map +1 -0
  7. package/lib/attribute-factory-BW1kgBqf.d.mts +70 -0
  8. package/lib/attribute-factory-BW1kgBqf.d.mts.map +1 -0
  9. package/lib/attribute-factory-DqN4x5XM.d.cts +70 -0
  10. package/lib/attribute-factory-DqN4x5XM.d.cts.map +1 -0
  11. package/lib/attribute-value-BNiJjxl1.mjs +225 -0
  12. package/lib/attribute-value-BNiJjxl1.mjs.map +1 -0
  13. package/lib/attribute-value-Cux5HhOL.cjs +314 -0
  14. package/lib/attribute-value-Cux5HhOL.cjs.map +1 -0
  15. package/lib/basic-execution-context-5uq2DvEA.cjs +318 -0
  16. package/lib/basic-execution-context-5uq2DvEA.cjs.map +1 -0
  17. package/lib/basic-execution-context-u1VktGoM.mjs +277 -0
  18. package/lib/basic-execution-context-u1VktGoM.mjs.map +1 -0
  19. package/lib/execution-context-BVSmLkYp.d.cts +71 -0
  20. package/lib/execution-context-BVSmLkYp.d.cts.map +1 -0
  21. package/lib/execution-context-C5F9rojO.d.mts +71 -0
  22. package/lib/execution-context-C5F9rojO.d.mts.map +1 -0
  23. package/lib/execution-context-token--cKS4cJv.cjs +270 -0
  24. package/lib/execution-context-token--cKS4cJv.cjs.map +1 -0
  25. package/lib/execution-context-token-Cb3M3Ao0.mjs +223 -0
  26. package/lib/execution-context-token-Cb3M3Ao0.mjs.map +1 -0
  27. package/lib/index.cjs +1672 -4426
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +842 -3
  30. package/lib/index.d.cts.map +1 -0
  31. package/lib/index.d.mts +842 -3
  32. package/lib/index.d.mts.map +1 -0
  33. package/lib/index.mjs +1559 -4221
  34. package/lib/index.mjs.map +1 -1
  35. package/lib/legacy-compat/index.cjs +72 -371
  36. package/lib/legacy-compat/index.cjs.map +1 -1
  37. package/lib/legacy-compat/index.d.cts +42 -382
  38. package/lib/legacy-compat/index.d.cts.map +1 -1
  39. package/lib/legacy-compat/index.d.mts +41 -382
  40. package/lib/legacy-compat/index.d.mts.map +1 -1
  41. package/lib/legacy-compat/index.mjs +51 -345
  42. package/lib/legacy-compat/index.mjs.map +1 -1
  43. package/lib/module-Bz83ZnJ5.cjs +173 -0
  44. package/lib/module-Bz83ZnJ5.cjs.map +1 -0
  45. package/lib/module-options-CSqQUSTm.d.mts +51 -0
  46. package/lib/module-options-CSqQUSTm.d.mts.map +1 -0
  47. package/lib/module-options-DSRBri4J.d.cts +51 -0
  48. package/lib/module-options-DSRBri4J.d.cts.map +1 -0
  49. package/lib/module-zPXwR2qp.mjs +138 -0
  50. package/lib/module-zPXwR2qp.mjs.map +1 -0
  51. package/lib/settled-within-B6gpu2XW.cjs +32 -0
  52. package/lib/settled-within-B6gpu2XW.cjs.map +1 -0
  53. package/lib/settled-within-Bc2pj8WB.mjs +21 -0
  54. package/lib/settled-within-Bc2pj8WB.mjs.map +1 -0
  55. package/lib/testing/index.cjs +74 -414
  56. package/lib/testing/index.cjs.map +1 -1
  57. package/lib/testing/index.d.cts +25 -385
  58. package/lib/testing/index.d.cts.map +1 -1
  59. package/lib/testing/index.d.mts +24 -385
  60. package/lib/testing/index.d.mts.map +1 -1
  61. package/lib/testing/index.mjs +72 -408
  62. package/lib/testing/index.mjs.map +1 -1
  63. package/lib/transport.cjs +36 -0
  64. package/lib/transport.d.cts +254 -0
  65. package/lib/transport.d.cts.map +1 -0
  66. package/lib/transport.d.mts +254 -0
  67. package/lib/transport.d.mts.map +1 -0
  68. package/lib/transport.mjs +6 -0
  69. package/package.json +37 -17
  70. package/docs/README.md +0 -316
  71. package/docs/adapters.md +0 -308
  72. package/docs/application-setup.md +0 -524
  73. package/docs/attributes.md +0 -689
  74. package/docs/controllers.md +0 -373
  75. package/docs/endpoints.md +0 -444
  76. package/docs/exceptions.md +0 -352
  77. package/docs/guards.md +0 -550
  78. package/docs/legacy-compat.md +0 -356
  79. package/docs/modules.md +0 -377
  80. package/docs/quick-start.md +0 -290
  81. package/docs/services.md +0 -427
  82. package/docs/testing.md +0 -827
  83. package/lib/index-3LcTrbxz.d.mts +0 -3804
  84. package/lib/index-3LcTrbxz.d.mts.map +0 -1
  85. package/lib/index-B14SekVb.d.cts +0 -3804
  86. package/lib/index-B14SekVb.d.cts.map +0 -1
  87. package/lib/navios.factory-CUrO_p6K.cjs +0 -4538
  88. package/lib/navios.factory-CUrO_p6K.cjs.map +0 -1
  89. package/lib/navios.factory-DjUOOVVL.mjs +0 -4151
  90. package/lib/navios.factory-DjUOOVVL.mjs.map +0 -1
  91. package/lib/tokens-BEuBMGGX.cjs +0 -193
  92. package/lib/tokens-BEuBMGGX.cjs.map +0 -1
  93. package/lib/tokens-COyNGV1I.mjs +0 -97
  94. package/lib/tokens-COyNGV1I.mjs.map +0 -1
  95. package/lib/use-guards.decorator-DLmRl2CV.mjs +0 -336
  96. package/lib/use-guards.decorator-DLmRl2CV.mjs.map +0 -1
  97. package/lib/use-guards.decorator-DhumFTk3.cjs +0 -444
  98. package/lib/use-guards.decorator-DhumFTk3.cjs.map +0 -1
  99. package/project.json +0 -66
  100. package/src/__tests__/attribute.factory.spec.mts +0 -300
  101. package/src/__tests__/config.service.spec.mts +0 -43
  102. package/src/__tests__/console-logger.service.spec.mts +0 -312
  103. package/src/__tests__/controller-resolver.spec.mts +0 -229
  104. package/src/__tests__/controller.spec.mts +0 -58
  105. package/src/__tests__/guard-runner.service.spec.mts +0 -399
  106. package/src/__tests__/logger.service.spec.mts +0 -147
  107. package/src/__tests__/responders.spec.mts +0 -340
  108. package/src/__tests__/testing-module.spec.mts +0 -459
  109. package/src/__tests__/unit-testing-module.spec.mts +0 -424
  110. package/src/attribute.factory.mts +0 -325
  111. package/src/config/config-service.interface.mts +0 -47
  112. package/src/config/config.provider.mts +0 -69
  113. package/src/config/config.service.mts +0 -176
  114. package/src/config/index.mts +0 -5
  115. package/src/config/types.mts +0 -58
  116. package/src/config/utils/helpers.mts +0 -23
  117. package/src/config/utils/index.mts +0 -1
  118. package/src/decorators/controller.decorator.mts +0 -81
  119. package/src/decorators/endpoint.decorator.mts +0 -181
  120. package/src/decorators/header.decorator.mts +0 -38
  121. package/src/decorators/http-code.decorator.mts +0 -38
  122. package/src/decorators/index.mts +0 -8
  123. package/src/decorators/module.decorator.mts +0 -106
  124. package/src/decorators/multipart.decorator.mts +0 -169
  125. package/src/decorators/stream.decorator.mts +0 -155
  126. package/src/decorators/use-guards.decorator.mts +0 -73
  127. package/src/exceptions/bad-request.exception.mts +0 -28
  128. package/src/exceptions/conflict.exception.mts +0 -31
  129. package/src/exceptions/forbidden.exception.mts +0 -30
  130. package/src/exceptions/http.exception.mts +0 -33
  131. package/src/exceptions/index.mts +0 -7
  132. package/src/exceptions/internal-server-error.exception.mts +0 -33
  133. package/src/exceptions/not-found.exception.mts +0 -33
  134. package/src/exceptions/unauthorized.exception.mts +0 -30
  135. package/src/factories/adapter.factory.mts +0 -20
  136. package/src/factories/endpoint-adapter.factory.mts +0 -21
  137. package/src/factories/http-adapter.factory.mts +0 -20
  138. package/src/factories/index.mts +0 -8
  139. package/src/factories/multipart-adapter.factory.mts +0 -21
  140. package/src/factories/reply.factory.mts +0 -21
  141. package/src/factories/request.factory.mts +0 -21
  142. package/src/factories/stream-adapter.factory.mts +0 -20
  143. package/src/factories/xml-stream-adapter.factory.mts +0 -20
  144. package/src/index.mts +0 -16
  145. package/src/interfaces/abstract-adapter.interface.mts +0 -32
  146. package/src/interfaces/abstract-execution-context.inteface.mts +0 -48
  147. package/src/interfaces/abstract-http-adapter.interface.mts +0 -79
  148. package/src/interfaces/abstract-http-cors-options.interface.mts +0 -59
  149. package/src/interfaces/abstract-http-handler-adapter.interface.mts +0 -127
  150. package/src/interfaces/abstract-http-listen-options.interface.mts +0 -4
  151. package/src/interfaces/adapter-environment.interface.mts +0 -74
  152. package/src/interfaces/can-activate.mts +0 -38
  153. package/src/interfaces/http-header.mts +0 -18
  154. package/src/interfaces/index.mts +0 -14
  155. package/src/interfaces/navios-module.mts +0 -28
  156. package/src/interfaces/plugin-context.mts +0 -104
  157. package/src/interfaces/plugin-stage.mts +0 -62
  158. package/src/interfaces/plugin.interface.mts +0 -119
  159. package/src/interfaces/staged-plugin.interface.mts +0 -209
  160. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +0 -521
  161. package/src/legacy-compat/__type-tests__/tsconfig.json +0 -15
  162. package/src/legacy-compat/attribute.factory.mts +0 -351
  163. package/src/legacy-compat/decorators/controller.decorator.mts +0 -31
  164. package/src/legacy-compat/decorators/endpoint.decorator.mts +0 -73
  165. package/src/legacy-compat/decorators/header.decorator.mts +0 -43
  166. package/src/legacy-compat/decorators/http-code.decorator.mts +0 -39
  167. package/src/legacy-compat/decorators/index.mts +0 -11
  168. package/src/legacy-compat/decorators/module.decorator.mts +0 -37
  169. package/src/legacy-compat/decorators/multipart.decorator.mts +0 -72
  170. package/src/legacy-compat/decorators/stream.decorator.mts +0 -89
  171. package/src/legacy-compat/decorators/use-guards.decorator.mts +0 -80
  172. package/src/legacy-compat/index.mts +0 -57
  173. package/src/logger/README.md +0 -3
  174. package/src/logger/console-logger.service.mts +0 -714
  175. package/src/logger/index.mts +0 -6
  176. package/src/logger/log-levels.mts +0 -21
  177. package/src/logger/logger-service.interface.mts +0 -42
  178. package/src/logger/logger.service.mts +0 -113
  179. package/src/logger/logger.tokens.mts +0 -44
  180. package/src/logger/utils/cli-colors.util.mts +0 -17
  181. package/src/logger/utils/filter-log-levelts.util.mts +0 -29
  182. package/src/logger/utils/index.mts +0 -5
  183. package/src/logger/utils/is-log-level-enabled.mts +0 -33
  184. package/src/logger/utils/is-log-level.util.mts +0 -10
  185. package/src/logger/utils/shared.utils.mts +0 -51
  186. package/src/metadata/controller.metadata.mts +0 -79
  187. package/src/metadata/handler.metadata.mts +0 -80
  188. package/src/metadata/index.mts +0 -4
  189. package/src/metadata/module.metadata.mts +0 -116
  190. package/src/metadata/navios-managed.metadata.mts +0 -42
  191. package/src/navios.application.mts +0 -678
  192. package/src/navios.environment.mts +0 -42
  193. package/src/navios.factory.mts +0 -158
  194. package/src/responders/enums/framework-error.enum.mts +0 -38
  195. package/src/responders/enums/index.mts +0 -1
  196. package/src/responders/index.mts +0 -4
  197. package/src/responders/interfaces/error-responder.interface.mts +0 -42
  198. package/src/responders/interfaces/error-response.interface.mts +0 -22
  199. package/src/responders/interfaces/index.mts +0 -3
  200. package/src/responders/interfaces/problem-details.interface.mts +0 -34
  201. package/src/responders/services/error-response-producer.service.mts +0 -143
  202. package/src/responders/services/forbidden-responder.service.mts +0 -77
  203. package/src/responders/services/index.mts +0 -5
  204. package/src/responders/services/internal-server-error-responder.service.mts +0 -57
  205. package/src/responders/services/not-found-responder.service.mts +0 -76
  206. package/src/responders/services/validation-error-responder.service.mts +0 -78
  207. package/src/responders/tokens/index.mts +0 -1
  208. package/src/responders/tokens/responder.tokens.mts +0 -84
  209. package/src/services/abstract-handler-adapter.service.mts +0 -366
  210. package/src/services/guard-runner.service.mts +0 -152
  211. package/src/services/index.mts +0 -4
  212. package/src/services/instance-resolver.service.mts +0 -177
  213. package/src/services/module-loader.service.mts +0 -255
  214. package/src/stores/index.mts +0 -1
  215. package/src/stores/request-id.store.mts +0 -85
  216. package/src/testing/index.mts +0 -3
  217. package/src/testing/testing-module.mts +0 -393
  218. package/src/testing/unit-testing-module.mts +0 -298
  219. package/src/tokens/adapter.token.mts +0 -6
  220. package/src/tokens/endpoint-adapter.token.mts +0 -8
  221. package/src/tokens/execution-context.token.mts +0 -9
  222. package/src/tokens/http-adapter.token.mts +0 -8
  223. package/src/tokens/index.mts +0 -10
  224. package/src/tokens/multipart-adapter.token.mts +0 -8
  225. package/src/tokens/navios-options.token.mts +0 -6
  226. package/src/tokens/reply.token.mts +0 -3
  227. package/src/tokens/request.token.mts +0 -3
  228. package/src/tokens/stream-adapter.token.mts +0 -8
  229. package/src/tokens/xml-stream-adapter.token.mts +0 -8
  230. package/src/utils/adapter-supports.util.mts +0 -47
  231. package/src/utils/define-plugin.mts +0 -251
  232. package/src/utils/index.mts +0 -2
  233. package/tsconfig.json +0 -21
  234. package/tsconfig.lib.json +0 -8
  235. package/tsconfig.spec.json +0 -15
  236. package/tsdown.config.mts +0 -35
  237. package/vitest.config.mts +0 -15
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- import type { AbstractHttpAdapterInterface } from '../interfaces/index.mjs'
4
-
5
- export const HttpAdapterToken =
6
- InjectionToken.create<AbstractHttpAdapterInterface>(
7
- 'HttpAdapterToken',
8
- )
@@ -1,10 +0,0 @@
1
- export * from './adapter.token.mjs'
2
- export * from './endpoint-adapter.token.mjs'
3
- export * from './execution-context.token.mjs'
4
- export * from './http-adapter.token.mjs'
5
- export * from './multipart-adapter.token.mjs'
6
- export * from './navios-options.token.mjs'
7
- export * from './reply.token.mjs'
8
- export * from './request.token.mjs'
9
- export * from './stream-adapter.token.mjs'
10
- export * from './xml-stream-adapter.token.mjs'
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- import type { AbstractHttpHandlerAdapterInterface } from '../interfaces/index.mjs'
4
-
5
- export const MultipartAdapterToken =
6
- InjectionToken.create<AbstractHttpHandlerAdapterInterface>(
7
- 'MultipartAdapterToken',
8
- )
@@ -1,6 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- import type { NaviosApplicationOptions } from '../navios.application.mjs'
4
-
5
- export const NaviosOptionsToken =
6
- InjectionToken.create<NaviosApplicationOptions>('NaviosOptionsToken')
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- export const Reply = InjectionToken.create<any>('ReplyToken')
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- export const Request = InjectionToken.create<any>('RequestToken')
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- import type { AbstractHttpHandlerAdapterInterface } from '../interfaces/index.mjs'
4
-
5
- export const StreamAdapterToken =
6
- InjectionToken.create<AbstractHttpHandlerAdapterInterface>(
7
- 'StreamAdapterToken',
8
- )
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from '@navios/di'
2
-
3
- import type { AbstractHttpHandlerAdapterInterface } from '../interfaces/index.mjs'
4
-
5
- export const XmlStreamAdapterToken =
6
- InjectionToken.create<AbstractHttpHandlerAdapterInterface>(
7
- 'XmlStreamAdapterToken',
8
- )
@@ -1,47 +0,0 @@
1
- import type { AbstractAdapterInterface } from '../interfaces/index.mjs'
2
-
3
- /**
4
- * Type guard to check if adapter implements a specific method.
5
- * Narrows the adapter type to include the method.
6
- *
7
- * @example
8
- * ```typescript
9
- * if (adapterSupports(adapter, 'getServer')) {
10
- * const server = adapter.getServer() // TypeScript knows this exists
11
- * }
12
- * ```
13
- */
14
- export function adapterSupports<
15
- TAdapter extends AbstractAdapterInterface,
16
- TMethod extends string,
17
- >(
18
- adapter: TAdapter | null,
19
- method: TMethod,
20
- ): adapter is TAdapter & Record<TMethod, (...args: unknown[]) => unknown> {
21
- return (
22
- adapter !== null &&
23
- typeof (adapter as Record<string, unknown>)[method] === 'function'
24
- )
25
- }
26
-
27
- /**
28
- * Asserts adapter supports a method, throws if not.
29
- * Narrows type after assertion.
30
- *
31
- * @example
32
- * ```typescript
33
- * assertAdapterSupports(adapter, 'enableCors')
34
- * adapter.enableCors(options) // TypeScript knows this exists
35
- * ```
36
- */
37
- export function assertAdapterSupports<
38
- TAdapter extends AbstractAdapterInterface,
39
- TMethod extends string,
40
- >(
41
- adapter: TAdapter | null,
42
- method: TMethod,
43
- ): asserts adapter is TAdapter & Record<TMethod, (...args: unknown[]) => unknown> {
44
- if (!adapterSupports(adapter, method)) {
45
- throw new Error(`Current adapter does not implement '${method}()'`)
46
- }
47
- }
@@ -1,251 +0,0 @@
1
- import type { AbstractAdapterInterface } from '../interfaces/abstract-adapter.interface.mjs'
2
- import type {
3
- ContainerOnlyContext,
4
- FullPluginContext,
5
- ModulesLoadedContext,
6
- } from '../interfaces/plugin-context.mjs'
7
- import type { PluginStage } from '../interfaces/plugin-stage.mjs'
8
- import type { StagedPluginDefinition } from '../interfaces/staged-plugin.interface.mjs'
9
-
10
- import { PluginStages } from '../interfaces/plugin-stage.mjs'
11
-
12
- // ============ Plugin Config Type ============
13
-
14
- interface PluginConfig<TContext, TOptions> {
15
- name: string
16
- register: (context: TContext, options: TOptions) => Promise<void> | void
17
- }
18
-
19
- // ============ Internal Factory Creator ============
20
-
21
- /**
22
- * Creates a curried plugin factory for a specific stage.
23
- * Returns a function that takes config and returns a function that takes options.
24
- */
25
- function createPluginFactory<TStage extends PluginStage, TContext>(
26
- stage: TStage,
27
- ) {
28
- return <
29
- TOptions,
30
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
31
- >(
32
- config: PluginConfig<TContext, TOptions>,
33
- ) =>
34
- (options: TOptions): StagedPluginDefinition<TStage, TOptions, TAdapter> => ({
35
- plugin: {
36
- name: config.name,
37
- stage,
38
- register: config.register as (
39
- context: never,
40
- options: TOptions,
41
- ) => Promise<void> | void,
42
- },
43
- options,
44
- })
45
- }
46
-
47
- // ============ Pre-Adapter Stages (No adapter in context) ============
48
-
49
- /**
50
- * Define a plugin that runs before modules are traversed.
51
- *
52
- * Context: container only
53
- *
54
- * Use this stage for early DI setup before any modules are loaded.
55
- *
56
- * @example
57
- * ```typescript
58
- * export const defineEarlySetupPlugin = definePreModulesTraversePlugin({
59
- * name: 'early-setup',
60
- * register: (context, options: { key: string }) => {
61
- * context.container.addInstance(SomeToken, options.key)
62
- * },
63
- * })
64
- *
65
- * // Usage
66
- * app.usePlugin(defineEarlySetupPlugin({ key: 'value' }))
67
- * ```
68
- */
69
- export const definePreModulesTraversePlugin = createPluginFactory<
70
- 'pre:modules-traverse',
71
- ContainerOnlyContext
72
- >(PluginStages.PRE_MODULES_TRAVERSE)
73
-
74
- /**
75
- * Define a plugin that runs after modules are traversed.
76
- *
77
- * Context: container + modules + moduleLoader
78
- *
79
- * Use this stage to inspect loaded modules or extend the module tree.
80
- *
81
- * @example
82
- * ```typescript
83
- * export const defineModuleInspectorPlugin = definePostModulesTraversePlugin({
84
- * name: 'module-inspector',
85
- * register: (context, options) => {
86
- * console.log('Loaded modules:', context.modules.size)
87
- * },
88
- * })
89
- * ```
90
- */
91
- export const definePostModulesTraversePlugin = createPluginFactory<
92
- 'post:modules-traverse',
93
- ModulesLoadedContext
94
- >(PluginStages.POST_MODULES_TRAVERSE)
95
-
96
- /**
97
- * Define a plugin that runs before adapter is resolved from container.
98
- *
99
- * Context: container + modules + moduleLoader (NO adapter yet!)
100
- *
101
- * Use this stage to modify registry/bindings before adapter instantiation.
102
- * This is ideal for instrumentation, service wrapping, or changing DI bindings.
103
- *
104
- * @example
105
- * ```typescript
106
- * export const defineOtelPlugin = definePreAdapterResolvePlugin({
107
- * name: 'otel',
108
- * register: (context, options: OtelOptions) => {
109
- * const registry = context.container.getRegistry()
110
- * // Modify registry before adapter is created
111
- * },
112
- * })
113
- *
114
- * // Usage
115
- * app.usePlugin(defineOtelPlugin({ serviceName: 'my-app' }))
116
- * ```
117
- */
118
- export const definePreAdapterResolvePlugin = createPluginFactory<
119
- 'pre:adapter-resolve',
120
- ModulesLoadedContext
121
- >(PluginStages.PRE_ADAPTER_RESOLVE)
122
-
123
- // ============ Post-Adapter Stages (Adapter available) ============
124
-
125
- /**
126
- * Define a plugin that runs after adapter is resolved.
127
- *
128
- * Context: full (container + modules + moduleLoader + adapter)
129
- *
130
- * @example
131
- * ```typescript
132
- * export const defineAdapterConfigPlugin = definePostAdapterResolvePlugin<
133
- * { prefix: string },
134
- * BunApplicationServiceInterface
135
- * >()({
136
- * name: 'adapter-config',
137
- * register: (context, options) => {
138
- * context.adapter.setGlobalPrefix(options.prefix)
139
- * },
140
- * })
141
- * ```
142
- */
143
- export function definePostAdapterResolvePlugin<
144
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
145
- >() {
146
- return createPluginFactory<'post:adapter-resolve', FullPluginContext<TAdapter>>(
147
- PluginStages.POST_ADAPTER_RESOLVE,
148
- )
149
- }
150
-
151
- /**
152
- * Define a plugin that runs before adapter setup.
153
- *
154
- * Context: full
155
- */
156
- export function definePreAdapterSetupPlugin<
157
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
158
- >() {
159
- return createPluginFactory<'pre:adapter-setup', FullPluginContext<TAdapter>>(
160
- PluginStages.PRE_ADAPTER_SETUP,
161
- )
162
- }
163
-
164
- /**
165
- * Define a plugin that runs after adapter setup.
166
- *
167
- * Context: full
168
- */
169
- export function definePostAdapterSetupPlugin<
170
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
171
- >() {
172
- return createPluginFactory<'post:adapter-setup', FullPluginContext<TAdapter>>(
173
- PluginStages.POST_ADAPTER_SETUP,
174
- )
175
- }
176
-
177
- /**
178
- * Define a plugin that runs before modules init (route registration).
179
- *
180
- * Context: full
181
- */
182
- export function definePreModulesInitPlugin<
183
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
184
- >() {
185
- return createPluginFactory<'pre:modules-init', FullPluginContext<TAdapter>>(
186
- PluginStages.PRE_MODULES_INIT,
187
- )
188
- }
189
-
190
- /**
191
- * Define a plugin that runs after modules init (route registration).
192
- *
193
- * Context: full
194
- *
195
- * This is the default stage for legacy NaviosPlugin implementations.
196
- *
197
- * @example
198
- * ```typescript
199
- * export const defineOpenApiPlugin = definePostModulesInitPlugin<
200
- * BunApplicationServiceInterface
201
- * >()({
202
- * name: 'openapi',
203
- * register: async (context, options: OpenApiOptions) => {
204
- * // Routes are registered, can generate OpenAPI docs
205
- * },
206
- * })
207
- * ```
208
- */
209
- export function definePostModulesInitPlugin<
210
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
211
- >() {
212
- return createPluginFactory<'post:modules-init', FullPluginContext<TAdapter>>(
213
- PluginStages.POST_MODULES_INIT,
214
- )
215
- }
216
-
217
- /**
218
- * Define a plugin that runs before adapter signals ready.
219
- *
220
- * Context: full
221
- */
222
- export function definePreReadyPlugin<
223
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
224
- >() {
225
- return createPluginFactory<'pre:ready', FullPluginContext<TAdapter>>(
226
- PluginStages.PRE_READY,
227
- )
228
- }
229
-
230
- /**
231
- * Define a plugin that runs after adapter signals ready.
232
- *
233
- * Context: full - this is the final stage, app is fully initialized
234
- *
235
- * @example
236
- * ```typescript
237
- * export const defineStartupLogPlugin = definePostReadyPlugin()({
238
- * name: 'startup-log',
239
- * register: (context) => {
240
- * console.log('Application fully initialized!')
241
- * },
242
- * })
243
- * ```
244
- */
245
- export function definePostReadyPlugin<
246
- TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
247
- >() {
248
- return createPluginFactory<'post:ready', FullPluginContext<TAdapter>>(
249
- PluginStages.POST_READY,
250
- )
251
- }
@@ -1,2 +0,0 @@
1
- export { adapterSupports, assertAdapterSupports } from './adapter-supports.util.mjs'
2
- export * from './define-plugin.mjs'
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "module": "Node18",
5
- "outDir": "dist"
6
- },
7
- "references": [
8
- {
9
- "path": "./tsconfig.lib.json"
10
- },
11
- {
12
- "path": "./tsconfig.spec.json"
13
- },
14
- {
15
- "path": "../builder"
16
- },
17
- {
18
- "path": "../di"
19
- }
20
- ]
21
- }
package/tsconfig.lib.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist"
5
- },
6
- "include": ["src/**/*"],
7
- "exclude": ["src/**/*.spec.mts", "src/**/*.spec-d.mts"]
8
- }
@@ -1,15 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist"
5
- },
6
- "include": ["src/**/*.spec.mts", "e2e/**/*.mts", "vitest.config.mts"],
7
- "references": [
8
- {
9
- "path": "./tsconfig.lib.json"
10
- },
11
- {
12
- "path": "./src/legacy-compat/__type-tests__/tsconfig.json"
13
- }
14
- ]
15
- }
package/tsdown.config.mts DELETED
@@ -1,35 +0,0 @@
1
- import { withFilter } from 'rolldown/filter'
2
- import { defineConfig } from 'tsdown'
3
- import swc from 'unplugin-swc'
4
-
5
- export default defineConfig({
6
- entry: ['src/index.mts', 'src/testing/index.mts', 'src/legacy-compat/index.mts'],
7
- outDir: 'lib',
8
- format: ['esm', 'cjs'],
9
- clean: true,
10
- tsconfig: 'tsconfig.lib.json',
11
- treeshake: true,
12
- sourcemap: true,
13
- platform: 'node',
14
- external: ['@navios/di'],
15
- dts: true,
16
- target: 'es2022',
17
- plugins: [
18
- withFilter(
19
- swc.rolldown({
20
- jsc: {
21
- target: 'es2022',
22
- parser: {
23
- syntax: 'typescript',
24
- decorators: true,
25
- },
26
- transform: {
27
- decoratorVersion: '2022-03',
28
- },
29
- },
30
- }),
31
- // Only run this transform if the file contains a decorator.
32
- { transform: { code: '@' } },
33
- ),
34
- ],
35
- })
package/vitest.config.mts DELETED
@@ -1,15 +0,0 @@
1
- import { defineProject } from 'vitest/config'
2
-
3
- export default defineProject({
4
- test: {
5
- typecheck: {
6
- enabled: true,
7
- tsconfig: './tsconfig.lib.json',
8
- },
9
- include: [
10
- 'src/**/*.spec.mts',
11
- 'src/**/*.spec-d.mts',
12
- 'src/legacy-compat/__type-tests__/**/*.spec-d.mts',
13
- ],
14
- },
15
- })