@navios/core 0.5.0 → 0.6.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/docs/modules.md +126 -0
- package/docs/services.md +2 -3
- package/lib/_tsup-dts-rollup.d.mts +28 -9
- package/lib/_tsup-dts-rollup.d.ts +28 -9
- package/lib/index.d.mts +8 -4
- package/lib/index.d.ts +8 -4
- package/lib/index.js +30 -9
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +30 -10
- package/lib/index.mjs.map +1 -1
- package/package.json +7 -8
- package/src/decorators/multipart.decorator.mts +0 -1
- package/src/factories/index.mts +1 -0
- package/src/factories/xml-stream-adapter.factory.mts +20 -0
- package/src/tokens/index.mts +1 -0
- package/src/tokens/xml-stream-adapter.token.mts +8 -0
package/docs/modules.md
CHANGED
|
@@ -113,6 +113,132 @@ Modules in Navios follow a specific lifecycle:
|
|
|
113
113
|
4. **Guard Application**: Module-level guards are applied to all controllers
|
|
114
114
|
5. **Initialization**: Module initialization hooks are called
|
|
115
115
|
|
|
116
|
+
## Module Lifecycle Methods
|
|
117
|
+
|
|
118
|
+
### `onModuleInit`
|
|
119
|
+
|
|
120
|
+
The `onModuleInit` lifecycle method is called after the module has been initialized and all its dependencies have been resolved. This is useful for performing setup tasks, initializing connections, or running startup logic.
|
|
121
|
+
|
|
122
|
+
#### Interface
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
interface NaviosModule {
|
|
126
|
+
onModuleInit(): void | Promise<void>
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Usage
|
|
131
|
+
|
|
132
|
+
To use the `onModuleInit` lifecycle method, implement the `NaviosModule` interface in your module class:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { Module, NaviosModule } from '@navios/core'
|
|
136
|
+
|
|
137
|
+
@Module({
|
|
138
|
+
controllers: [UserController],
|
|
139
|
+
})
|
|
140
|
+
export class UserModule implements NaviosModule {
|
|
141
|
+
onModuleInit() {
|
|
142
|
+
console.log('UserModule has been initialized')
|
|
143
|
+
// Perform initialization logic here
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Async Initialization
|
|
149
|
+
|
|
150
|
+
The `onModuleInit` method can be asynchronous, allowing you to perform async setup tasks:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { Module, NaviosModule } from '@navios/core'
|
|
154
|
+
|
|
155
|
+
@Module({
|
|
156
|
+
controllers: [DatabaseController],
|
|
157
|
+
})
|
|
158
|
+
export class DatabaseModule implements NaviosModule {
|
|
159
|
+
async onModuleInit() {
|
|
160
|
+
console.log('Initializing database connection...')
|
|
161
|
+
await this.connectToDatabase()
|
|
162
|
+
console.log('Database connection established')
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private async connectToDatabase() {
|
|
166
|
+
// Database connection logic
|
|
167
|
+
return new Promise((resolve) => setTimeout(resolve, 1000))
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Common Use Cases
|
|
173
|
+
|
|
174
|
+
- **Database Connections**: Initialize database connections or verify connectivity
|
|
175
|
+
- **Cache Warming**: Pre-populate caches with frequently accessed data
|
|
176
|
+
- **External Service Setup**: Initialize connections to external APIs or services
|
|
177
|
+
- **Configuration Validation**: Validate required configuration settings
|
|
178
|
+
- **Background Tasks**: Start background processes or scheduled tasks
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import { Module, NaviosModule } from '@navios/core'
|
|
182
|
+
|
|
183
|
+
@Module({
|
|
184
|
+
controllers: [CacheController],
|
|
185
|
+
})
|
|
186
|
+
export class CacheModule implements NaviosModule {
|
|
187
|
+
private cache = new Map<string, any>()
|
|
188
|
+
|
|
189
|
+
async onModuleInit() {
|
|
190
|
+
// Warm up the cache with initial data
|
|
191
|
+
await this.warmUpCache()
|
|
192
|
+
|
|
193
|
+
// Validate configuration
|
|
194
|
+
this.validateConfiguration()
|
|
195
|
+
|
|
196
|
+
console.log('CacheModule initialized successfully')
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private async warmUpCache() {
|
|
200
|
+
// Pre-populate cache with frequently accessed data
|
|
201
|
+
this.cache.set('app:config', await this.loadAppConfig())
|
|
202
|
+
this.cache.set('user:defaults', await this.loadUserDefaults())
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private validateConfiguration() {
|
|
206
|
+
if (!process.env.CACHE_TTL) {
|
|
207
|
+
throw new Error('CACHE_TTL environment variable is required')
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private async loadAppConfig() {
|
|
212
|
+
// Load application configuration
|
|
213
|
+
return { theme: 'dark', language: 'en' }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private async loadUserDefaults() {
|
|
217
|
+
// Load default user settings
|
|
218
|
+
return { notifications: true, theme: 'auto' }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### Execution Order
|
|
224
|
+
|
|
225
|
+
The `onModuleInit` methods are called in dependency order:
|
|
226
|
+
|
|
227
|
+
1. **Imported modules first**: All imported modules' `onModuleInit` methods are called before the current module
|
|
228
|
+
2. **Current module last**: The current module's `onModuleInit` method is called after all its dependencies
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
@Module({
|
|
232
|
+
imports: [DatabaseModule, CacheModule], // These initialize first
|
|
233
|
+
})
|
|
234
|
+
export class AppModule implements NaviosModule {
|
|
235
|
+
onModuleInit() {
|
|
236
|
+
// This runs after DatabaseModule and CacheModule have been initialized
|
|
237
|
+
console.log('AppModule initialized - all dependencies are ready')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
116
242
|
## Module Metadata
|
|
117
243
|
|
|
118
244
|
Each module decorated with `@Module()` has associated metadata that Navios uses internally:
|
package/docs/services.md
CHANGED
|
@@ -260,11 +260,10 @@ export class EmailProviderFactory {
|
|
|
260
260
|
|
|
261
261
|
@Injectable()
|
|
262
262
|
export class EmailService {
|
|
263
|
-
private
|
|
263
|
+
private emailProvider = inject(EmailProviderFactory)
|
|
264
264
|
|
|
265
265
|
async sendWelcomeEmail(user: User) {
|
|
266
|
-
|
|
267
|
-
await provider.send(
|
|
266
|
+
await this.emailProvider.send(
|
|
268
267
|
user.email,
|
|
269
268
|
'Welcome!',
|
|
270
269
|
`Hello ${user.name}, welcome to our platform!`,
|
|
@@ -12,12 +12,13 @@ import { ClassTypeWithInstance } from '@navios/di';
|
|
|
12
12
|
import { ClassTypeWithInstanceAndArgument } from '@navios/di';
|
|
13
13
|
import { ClassTypeWithInstanceAndOptionalArgument } from '@navios/di';
|
|
14
14
|
import { ClassTypeWithOptionalArgument } from '@navios/di';
|
|
15
|
+
import { ClassTypeWithoutArguments } from '@navios/di';
|
|
15
16
|
import { Container } from '@navios/di';
|
|
16
|
-
import { createDeferred } from '@navios/di';
|
|
17
17
|
import { createRequestContextHolder } from '@navios/di';
|
|
18
18
|
import { defaultInjectors } from '@navios/di';
|
|
19
19
|
import { DefaultRequestContextHolder } from '@navios/di';
|
|
20
|
-
import {
|
|
20
|
+
import { DIError } from '@navios/di';
|
|
21
|
+
import { DIErrorCode } from '@navios/di';
|
|
21
22
|
import type { EndpointFunctionArgs } from '@navios/builder';
|
|
22
23
|
import { ErrorsEnum } from '@navios/di';
|
|
23
24
|
import { EventEmitter } from '@navios/di';
|
|
@@ -48,15 +49,16 @@ import { InjectionToken } from '@navios/di';
|
|
|
48
49
|
import { InjectionTokenSchemaType } from '@navios/di';
|
|
49
50
|
import { InjectionTokenType } from '@navios/di';
|
|
50
51
|
import { Injectors } from '@navios/di';
|
|
52
|
+
import { InjectRequest } from '@navios/di';
|
|
51
53
|
import { InjectState } from '@navios/di';
|
|
52
54
|
import type { InspectOptions } from 'util';
|
|
53
55
|
import { InstanceDestroying } from '@navios/di';
|
|
54
|
-
import { InstanceExpired } from '@navios/di';
|
|
55
56
|
import { InstanceNotFound } from '@navios/di';
|
|
56
57
|
import { IsUnion } from '@navios/di';
|
|
57
58
|
import { Join } from '@navios/di';
|
|
58
59
|
import { OnServiceDestroy } from '@navios/di';
|
|
59
60
|
import { OnServiceInit } from '@navios/di';
|
|
61
|
+
import { optional } from '@navios/di';
|
|
60
62
|
import { OptionalInjectionTokenSchemaType } from '@navios/di';
|
|
61
63
|
import type { OutgoingHttpHeaders } from 'http';
|
|
62
64
|
import { PopUnion } from '@navios/di';
|
|
@@ -258,6 +260,8 @@ export { ClassTypeWithInstanceAndOptionalArgument }
|
|
|
258
260
|
|
|
259
261
|
export { ClassTypeWithOptionalArgument }
|
|
260
262
|
|
|
263
|
+
export { ClassTypeWithoutArguments }
|
|
264
|
+
|
|
261
265
|
declare const clc: {
|
|
262
266
|
bold: (text: string) => string;
|
|
263
267
|
green: (text: string) => string;
|
|
@@ -546,15 +550,15 @@ export { ControllerOptions }
|
|
|
546
550
|
export { ControllerOptions as ControllerOptions_alias_1 }
|
|
547
551
|
export { ControllerOptions as ControllerOptions_alias_2 }
|
|
548
552
|
|
|
549
|
-
export { createDeferred }
|
|
550
|
-
|
|
551
553
|
export { createRequestContextHolder }
|
|
552
554
|
|
|
553
555
|
export { defaultInjectors }
|
|
554
556
|
|
|
555
557
|
export { DefaultRequestContextHolder }
|
|
556
558
|
|
|
557
|
-
export {
|
|
559
|
+
export { DIError }
|
|
560
|
+
|
|
561
|
+
export { DIErrorCode }
|
|
558
562
|
|
|
559
563
|
declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
560
564
|
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
@@ -804,12 +808,12 @@ export { InjectionTokenType }
|
|
|
804
808
|
|
|
805
809
|
export { Injectors }
|
|
806
810
|
|
|
811
|
+
export { InjectRequest }
|
|
812
|
+
|
|
807
813
|
export { InjectState }
|
|
808
814
|
|
|
809
815
|
export { InstanceDestroying }
|
|
810
816
|
|
|
811
|
-
export { InstanceExpired }
|
|
812
|
-
|
|
813
817
|
export { InstanceNotFound }
|
|
814
818
|
|
|
815
819
|
declare class InternalServerErrorException extends HttpException {
|
|
@@ -1097,7 +1101,7 @@ export { MultipartParams as MultipartParams_alias_2 }
|
|
|
1097
1101
|
|
|
1098
1102
|
declare type MultipartResult<EndpointDeclaration extends {
|
|
1099
1103
|
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1100
|
-
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<
|
|
1104
|
+
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
1101
1105
|
export { MultipartResult }
|
|
1102
1106
|
export { MultipartResult as MultipartResult_alias_1 }
|
|
1103
1107
|
export { MultipartResult as MultipartResult_alias_2 }
|
|
@@ -1193,6 +1197,8 @@ export { OnServiceDestroy }
|
|
|
1193
1197
|
|
|
1194
1198
|
export { OnServiceInit }
|
|
1195
1199
|
|
|
1200
|
+
export { optional }
|
|
1201
|
+
|
|
1196
1202
|
export { OptionalInjectionTokenSchemaType }
|
|
1197
1203
|
|
|
1198
1204
|
declare type OriginType = string | boolean | RegExp;
|
|
@@ -1337,6 +1343,19 @@ declare type ValueOrArray<T> = T | ArrayOfValueOrArray<T>;
|
|
|
1337
1343
|
|
|
1338
1344
|
export { wrapSyncInit }
|
|
1339
1345
|
|
|
1346
|
+
declare class XmlStreamAdapterFactory {
|
|
1347
|
+
private readonly environment;
|
|
1348
|
+
create(ctx: FactoryContext): Promise<any>;
|
|
1349
|
+
}
|
|
1350
|
+
export { XmlStreamAdapterFactory }
|
|
1351
|
+
export { XmlStreamAdapterFactory as XmlStreamAdapterFactory_alias_1 }
|
|
1352
|
+
export { XmlStreamAdapterFactory as XmlStreamAdapterFactory_alias_2 }
|
|
1353
|
+
|
|
1354
|
+
declare const XmlStreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
|
|
1355
|
+
export { XmlStreamAdapterToken }
|
|
1356
|
+
export { XmlStreamAdapterToken as XmlStreamAdapterToken_alias_1 }
|
|
1357
|
+
export { XmlStreamAdapterToken as XmlStreamAdapterToken_alias_2 }
|
|
1358
|
+
|
|
1340
1359
|
declare const yellow: (text: string) => string;
|
|
1341
1360
|
export { yellow }
|
|
1342
1361
|
export { yellow as yellow_alias_1 }
|
|
@@ -12,12 +12,13 @@ import { ClassTypeWithInstance } from '@navios/di';
|
|
|
12
12
|
import { ClassTypeWithInstanceAndArgument } from '@navios/di';
|
|
13
13
|
import { ClassTypeWithInstanceAndOptionalArgument } from '@navios/di';
|
|
14
14
|
import { ClassTypeWithOptionalArgument } from '@navios/di';
|
|
15
|
+
import { ClassTypeWithoutArguments } from '@navios/di';
|
|
15
16
|
import { Container } from '@navios/di';
|
|
16
|
-
import { createDeferred } from '@navios/di';
|
|
17
17
|
import { createRequestContextHolder } from '@navios/di';
|
|
18
18
|
import { defaultInjectors } from '@navios/di';
|
|
19
19
|
import { DefaultRequestContextHolder } from '@navios/di';
|
|
20
|
-
import {
|
|
20
|
+
import { DIError } from '@navios/di';
|
|
21
|
+
import { DIErrorCode } from '@navios/di';
|
|
21
22
|
import type { EndpointFunctionArgs } from '@navios/builder';
|
|
22
23
|
import { ErrorsEnum } from '@navios/di';
|
|
23
24
|
import { EventEmitter } from '@navios/di';
|
|
@@ -48,15 +49,16 @@ import { InjectionToken } from '@navios/di';
|
|
|
48
49
|
import { InjectionTokenSchemaType } from '@navios/di';
|
|
49
50
|
import { InjectionTokenType } from '@navios/di';
|
|
50
51
|
import { Injectors } from '@navios/di';
|
|
52
|
+
import { InjectRequest } from '@navios/di';
|
|
51
53
|
import { InjectState } from '@navios/di';
|
|
52
54
|
import type { InspectOptions } from 'util';
|
|
53
55
|
import { InstanceDestroying } from '@navios/di';
|
|
54
|
-
import { InstanceExpired } from '@navios/di';
|
|
55
56
|
import { InstanceNotFound } from '@navios/di';
|
|
56
57
|
import { IsUnion } from '@navios/di';
|
|
57
58
|
import { Join } from '@navios/di';
|
|
58
59
|
import { OnServiceDestroy } from '@navios/di';
|
|
59
60
|
import { OnServiceInit } from '@navios/di';
|
|
61
|
+
import { optional } from '@navios/di';
|
|
60
62
|
import { OptionalInjectionTokenSchemaType } from '@navios/di';
|
|
61
63
|
import type { OutgoingHttpHeaders } from 'http';
|
|
62
64
|
import { PopUnion } from '@navios/di';
|
|
@@ -258,6 +260,8 @@ export { ClassTypeWithInstanceAndOptionalArgument }
|
|
|
258
260
|
|
|
259
261
|
export { ClassTypeWithOptionalArgument }
|
|
260
262
|
|
|
263
|
+
export { ClassTypeWithoutArguments }
|
|
264
|
+
|
|
261
265
|
declare const clc: {
|
|
262
266
|
bold: (text: string) => string;
|
|
263
267
|
green: (text: string) => string;
|
|
@@ -546,15 +550,15 @@ export { ControllerOptions }
|
|
|
546
550
|
export { ControllerOptions as ControllerOptions_alias_1 }
|
|
547
551
|
export { ControllerOptions as ControllerOptions_alias_2 }
|
|
548
552
|
|
|
549
|
-
export { createDeferred }
|
|
550
|
-
|
|
551
553
|
export { createRequestContextHolder }
|
|
552
554
|
|
|
553
555
|
export { defaultInjectors }
|
|
554
556
|
|
|
555
557
|
export { DefaultRequestContextHolder }
|
|
556
558
|
|
|
557
|
-
export {
|
|
559
|
+
export { DIError }
|
|
560
|
+
|
|
561
|
+
export { DIErrorCode }
|
|
558
562
|
|
|
559
563
|
declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
560
564
|
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
@@ -804,12 +808,12 @@ export { InjectionTokenType }
|
|
|
804
808
|
|
|
805
809
|
export { Injectors }
|
|
806
810
|
|
|
811
|
+
export { InjectRequest }
|
|
812
|
+
|
|
807
813
|
export { InjectState }
|
|
808
814
|
|
|
809
815
|
export { InstanceDestroying }
|
|
810
816
|
|
|
811
|
-
export { InstanceExpired }
|
|
812
|
-
|
|
813
817
|
export { InstanceNotFound }
|
|
814
818
|
|
|
815
819
|
declare class InternalServerErrorException extends HttpException {
|
|
@@ -1097,7 +1101,7 @@ export { MultipartParams as MultipartParams_alias_2 }
|
|
|
1097
1101
|
|
|
1098
1102
|
declare type MultipartResult<EndpointDeclaration extends {
|
|
1099
1103
|
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1100
|
-
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<
|
|
1104
|
+
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
1101
1105
|
export { MultipartResult }
|
|
1102
1106
|
export { MultipartResult as MultipartResult_alias_1 }
|
|
1103
1107
|
export { MultipartResult as MultipartResult_alias_2 }
|
|
@@ -1193,6 +1197,8 @@ export { OnServiceDestroy }
|
|
|
1193
1197
|
|
|
1194
1198
|
export { OnServiceInit }
|
|
1195
1199
|
|
|
1200
|
+
export { optional }
|
|
1201
|
+
|
|
1196
1202
|
export { OptionalInjectionTokenSchemaType }
|
|
1197
1203
|
|
|
1198
1204
|
declare type OriginType = string | boolean | RegExp;
|
|
@@ -1337,6 +1343,19 @@ declare type ValueOrArray<T> = T | ArrayOfValueOrArray<T>;
|
|
|
1337
1343
|
|
|
1338
1344
|
export { wrapSyncInit }
|
|
1339
1345
|
|
|
1346
|
+
declare class XmlStreamAdapterFactory {
|
|
1347
|
+
private readonly environment;
|
|
1348
|
+
create(ctx: FactoryContext): Promise<any>;
|
|
1349
|
+
}
|
|
1350
|
+
export { XmlStreamAdapterFactory }
|
|
1351
|
+
export { XmlStreamAdapterFactory as XmlStreamAdapterFactory_alias_1 }
|
|
1352
|
+
export { XmlStreamAdapterFactory as XmlStreamAdapterFactory_alias_2 }
|
|
1353
|
+
|
|
1354
|
+
declare const XmlStreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
|
|
1355
|
+
export { XmlStreamAdapterToken }
|
|
1356
|
+
export { XmlStreamAdapterToken as XmlStreamAdapterToken_alias_1 }
|
|
1357
|
+
export { XmlStreamAdapterToken as XmlStreamAdapterToken_alias_2 }
|
|
1358
|
+
|
|
1340
1359
|
declare const yellow: (text: string) => string;
|
|
1341
1360
|
export { yellow }
|
|
1342
1361
|
export { yellow as yellow_alias_1 }
|
package/lib/index.d.mts
CHANGED
|
@@ -4,13 +4,14 @@ export { Injectable } from './_tsup-dts-rollup.mjs';
|
|
|
4
4
|
export { InjectableOptions } from './_tsup-dts-rollup.mjs';
|
|
5
5
|
export { InjectableScope } from './_tsup-dts-rollup.mjs';
|
|
6
6
|
export { InjectableType } from './_tsup-dts-rollup.mjs';
|
|
7
|
-
export { ErrorsEnum } from './_tsup-dts-rollup.mjs';
|
|
8
7
|
export { FactoryNotFound } from './_tsup-dts-rollup.mjs';
|
|
9
8
|
export { FactoryTokenNotResolved } from './_tsup-dts-rollup.mjs';
|
|
10
9
|
export { InstanceDestroying } from './_tsup-dts-rollup.mjs';
|
|
11
|
-
export { InstanceExpired } from './_tsup-dts-rollup.mjs';
|
|
12
10
|
export { InstanceNotFound } from './_tsup-dts-rollup.mjs';
|
|
13
11
|
export { UnknownError } from './_tsup-dts-rollup.mjs';
|
|
12
|
+
export { ErrorsEnum } from './_tsup-dts-rollup.mjs';
|
|
13
|
+
export { DIErrorCode } from './_tsup-dts-rollup.mjs';
|
|
14
|
+
export { DIError } from './_tsup-dts-rollup.mjs';
|
|
14
15
|
export { Factorable } from './_tsup-dts-rollup.mjs';
|
|
15
16
|
export { FactorableWithArgs } from './_tsup-dts-rollup.mjs';
|
|
16
17
|
export { OnServiceInit } from './_tsup-dts-rollup.mjs';
|
|
@@ -18,14 +19,13 @@ export { OnServiceDestroy } from './_tsup-dts-rollup.mjs';
|
|
|
18
19
|
export { getInjectors } from './_tsup-dts-rollup.mjs';
|
|
19
20
|
export { Injectors } from './_tsup-dts-rollup.mjs';
|
|
20
21
|
export { getInjectableToken } from './_tsup-dts-rollup.mjs';
|
|
21
|
-
export { createDeferred } from './_tsup-dts-rollup.mjs';
|
|
22
|
-
export { Deferred } from './_tsup-dts-rollup.mjs';
|
|
23
22
|
export { Join } from './_tsup-dts-rollup.mjs';
|
|
24
23
|
export { UnionToIntersection } from './_tsup-dts-rollup.mjs';
|
|
25
24
|
export { UnionToOvlds } from './_tsup-dts-rollup.mjs';
|
|
26
25
|
export { PopUnion } from './_tsup-dts-rollup.mjs';
|
|
27
26
|
export { IsUnion } from './_tsup-dts-rollup.mjs';
|
|
28
27
|
export { UnionToArray } from './_tsup-dts-rollup.mjs';
|
|
28
|
+
export { InjectRequest } from './_tsup-dts-rollup.mjs';
|
|
29
29
|
export { InjectState } from './_tsup-dts-rollup.mjs';
|
|
30
30
|
export { BaseInstanceHolderManager } from './_tsup-dts-rollup.mjs';
|
|
31
31
|
export { EventsConfig } from './_tsup-dts-rollup.mjs';
|
|
@@ -36,6 +36,7 @@ export { EventEmitterInterface } from './_tsup-dts-rollup.mjs';
|
|
|
36
36
|
export { EventEmitter } from './_tsup-dts-rollup.mjs';
|
|
37
37
|
export { FactoryContext } from './_tsup-dts-rollup.mjs';
|
|
38
38
|
export { ClassType } from './_tsup-dts-rollup.mjs';
|
|
39
|
+
export { ClassTypeWithoutArguments } from './_tsup-dts-rollup.mjs';
|
|
39
40
|
export { ClassTypeWithArgument } from './_tsup-dts-rollup.mjs';
|
|
40
41
|
export { ClassTypeWithOptionalArgument } from './_tsup-dts-rollup.mjs';
|
|
41
42
|
export { ClassTypeWithInstance } from './_tsup-dts-rollup.mjs';
|
|
@@ -52,6 +53,7 @@ export { InjectionTokenType } from './_tsup-dts-rollup.mjs';
|
|
|
52
53
|
export { defaultInjectors } from './_tsup-dts-rollup.mjs';
|
|
53
54
|
export { asyncInject } from './_tsup-dts-rollup.mjs';
|
|
54
55
|
export { inject } from './_tsup-dts-rollup.mjs';
|
|
56
|
+
export { optional } from './_tsup-dts-rollup.mjs';
|
|
55
57
|
export { wrapSyncInit } from './_tsup-dts-rollup.mjs';
|
|
56
58
|
export { provideFactoryContext } from './_tsup-dts-rollup.mjs';
|
|
57
59
|
export { FactoryRecord } from './_tsup-dts-rollup.mjs';
|
|
@@ -171,6 +173,7 @@ export { MultipartAdapterToken } from './_tsup-dts-rollup.mjs';
|
|
|
171
173
|
export { Reply } from './_tsup-dts-rollup.mjs';
|
|
172
174
|
export { Request } from './_tsup-dts-rollup.mjs';
|
|
173
175
|
export { StreamAdapterToken } from './_tsup-dts-rollup.mjs';
|
|
176
|
+
export { XmlStreamAdapterToken } from './_tsup-dts-rollup.mjs';
|
|
174
177
|
export { ClassAttribute_alias_1 as ClassAttribute } from './_tsup-dts-rollup.mjs';
|
|
175
178
|
export { ClassSchemaAttribute_alias_1 as ClassSchemaAttribute } from './_tsup-dts-rollup.mjs';
|
|
176
179
|
export { AttributeFactory_alias_1 as AttributeFactory } from './_tsup-dts-rollup.mjs';
|
|
@@ -180,6 +183,7 @@ export { MultipartAdapterFactory } from './_tsup-dts-rollup.mjs';
|
|
|
180
183
|
export { RequestFactory } from './_tsup-dts-rollup.mjs';
|
|
181
184
|
export { ReplyFactory } from './_tsup-dts-rollup.mjs';
|
|
182
185
|
export { StreamAdapterFactory } from './_tsup-dts-rollup.mjs';
|
|
186
|
+
export { XmlStreamAdapterFactory } from './_tsup-dts-rollup.mjs';
|
|
183
187
|
export { NaviosApplicationContextOptions } from './_tsup-dts-rollup.mjs';
|
|
184
188
|
export { NaviosApplicationOptions } from './_tsup-dts-rollup.mjs';
|
|
185
189
|
export { NaviosApplication } from './_tsup-dts-rollup.mjs';
|
package/lib/index.d.ts
CHANGED
|
@@ -4,13 +4,14 @@ export { Injectable } from './_tsup-dts-rollup.js';
|
|
|
4
4
|
export { InjectableOptions } from './_tsup-dts-rollup.js';
|
|
5
5
|
export { InjectableScope } from './_tsup-dts-rollup.js';
|
|
6
6
|
export { InjectableType } from './_tsup-dts-rollup.js';
|
|
7
|
-
export { ErrorsEnum } from './_tsup-dts-rollup.js';
|
|
8
7
|
export { FactoryNotFound } from './_tsup-dts-rollup.js';
|
|
9
8
|
export { FactoryTokenNotResolved } from './_tsup-dts-rollup.js';
|
|
10
9
|
export { InstanceDestroying } from './_tsup-dts-rollup.js';
|
|
11
|
-
export { InstanceExpired } from './_tsup-dts-rollup.js';
|
|
12
10
|
export { InstanceNotFound } from './_tsup-dts-rollup.js';
|
|
13
11
|
export { UnknownError } from './_tsup-dts-rollup.js';
|
|
12
|
+
export { ErrorsEnum } from './_tsup-dts-rollup.js';
|
|
13
|
+
export { DIErrorCode } from './_tsup-dts-rollup.js';
|
|
14
|
+
export { DIError } from './_tsup-dts-rollup.js';
|
|
14
15
|
export { Factorable } from './_tsup-dts-rollup.js';
|
|
15
16
|
export { FactorableWithArgs } from './_tsup-dts-rollup.js';
|
|
16
17
|
export { OnServiceInit } from './_tsup-dts-rollup.js';
|
|
@@ -18,14 +19,13 @@ export { OnServiceDestroy } from './_tsup-dts-rollup.js';
|
|
|
18
19
|
export { getInjectors } from './_tsup-dts-rollup.js';
|
|
19
20
|
export { Injectors } from './_tsup-dts-rollup.js';
|
|
20
21
|
export { getInjectableToken } from './_tsup-dts-rollup.js';
|
|
21
|
-
export { createDeferred } from './_tsup-dts-rollup.js';
|
|
22
|
-
export { Deferred } from './_tsup-dts-rollup.js';
|
|
23
22
|
export { Join } from './_tsup-dts-rollup.js';
|
|
24
23
|
export { UnionToIntersection } from './_tsup-dts-rollup.js';
|
|
25
24
|
export { UnionToOvlds } from './_tsup-dts-rollup.js';
|
|
26
25
|
export { PopUnion } from './_tsup-dts-rollup.js';
|
|
27
26
|
export { IsUnion } from './_tsup-dts-rollup.js';
|
|
28
27
|
export { UnionToArray } from './_tsup-dts-rollup.js';
|
|
28
|
+
export { InjectRequest } from './_tsup-dts-rollup.js';
|
|
29
29
|
export { InjectState } from './_tsup-dts-rollup.js';
|
|
30
30
|
export { BaseInstanceHolderManager } from './_tsup-dts-rollup.js';
|
|
31
31
|
export { EventsConfig } from './_tsup-dts-rollup.js';
|
|
@@ -36,6 +36,7 @@ export { EventEmitterInterface } from './_tsup-dts-rollup.js';
|
|
|
36
36
|
export { EventEmitter } from './_tsup-dts-rollup.js';
|
|
37
37
|
export { FactoryContext } from './_tsup-dts-rollup.js';
|
|
38
38
|
export { ClassType } from './_tsup-dts-rollup.js';
|
|
39
|
+
export { ClassTypeWithoutArguments } from './_tsup-dts-rollup.js';
|
|
39
40
|
export { ClassTypeWithArgument } from './_tsup-dts-rollup.js';
|
|
40
41
|
export { ClassTypeWithOptionalArgument } from './_tsup-dts-rollup.js';
|
|
41
42
|
export { ClassTypeWithInstance } from './_tsup-dts-rollup.js';
|
|
@@ -52,6 +53,7 @@ export { InjectionTokenType } from './_tsup-dts-rollup.js';
|
|
|
52
53
|
export { defaultInjectors } from './_tsup-dts-rollup.js';
|
|
53
54
|
export { asyncInject } from './_tsup-dts-rollup.js';
|
|
54
55
|
export { inject } from './_tsup-dts-rollup.js';
|
|
56
|
+
export { optional } from './_tsup-dts-rollup.js';
|
|
55
57
|
export { wrapSyncInit } from './_tsup-dts-rollup.js';
|
|
56
58
|
export { provideFactoryContext } from './_tsup-dts-rollup.js';
|
|
57
59
|
export { FactoryRecord } from './_tsup-dts-rollup.js';
|
|
@@ -171,6 +173,7 @@ export { MultipartAdapterToken } from './_tsup-dts-rollup.js';
|
|
|
171
173
|
export { Reply } from './_tsup-dts-rollup.js';
|
|
172
174
|
export { Request } from './_tsup-dts-rollup.js';
|
|
173
175
|
export { StreamAdapterToken } from './_tsup-dts-rollup.js';
|
|
176
|
+
export { XmlStreamAdapterToken } from './_tsup-dts-rollup.js';
|
|
174
177
|
export { ClassAttribute_alias_1 as ClassAttribute } from './_tsup-dts-rollup.js';
|
|
175
178
|
export { ClassSchemaAttribute_alias_1 as ClassSchemaAttribute } from './_tsup-dts-rollup.js';
|
|
176
179
|
export { AttributeFactory_alias_1 as AttributeFactory } from './_tsup-dts-rollup.js';
|
|
@@ -180,6 +183,7 @@ export { MultipartAdapterFactory } from './_tsup-dts-rollup.js';
|
|
|
180
183
|
export { RequestFactory } from './_tsup-dts-rollup.js';
|
|
181
184
|
export { ReplyFactory } from './_tsup-dts-rollup.js';
|
|
182
185
|
export { StreamAdapterFactory } from './_tsup-dts-rollup.js';
|
|
186
|
+
export { XmlStreamAdapterFactory } from './_tsup-dts-rollup.js';
|
|
183
187
|
export { NaviosApplicationContextOptions } from './_tsup-dts-rollup.js';
|
|
184
188
|
export { NaviosApplicationOptions } from './_tsup-dts-rollup.js';
|
|
185
189
|
export { NaviosApplication } from './_tsup-dts-rollup.js';
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var z__default = /*#__PURE__*/_interopDefault(z);
|
|
|
13
13
|
var __create = Object.create;
|
|
14
14
|
var __defProp = Object.defineProperty;
|
|
15
15
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
16
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
17
17
|
var __typeError = (msg) => {
|
|
18
18
|
throw TypeError(msg);
|
|
19
19
|
};
|
|
@@ -550,7 +550,7 @@ __runInitializers(_init2, 1, exports.LoggerInstance);
|
|
|
550
550
|
|
|
551
551
|
// src/config/config.service.mts
|
|
552
552
|
var ConfigServiceOptionsSchema = z.z.record(z.z.string(), z.z.unknown());
|
|
553
|
-
var ConfigServiceToken = di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
|
|
553
|
+
var ConfigServiceToken = di.InjectionToken.create(/* @__PURE__ */ Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
|
|
554
554
|
var _ConfigService_decorators, _init3;
|
|
555
555
|
_ConfigService_decorators = [di.Injectable({
|
|
556
556
|
token: ConfigServiceToken
|
|
@@ -615,7 +615,7 @@ var EnvConfigProvider = di.InjectionToken.bound(ConfigServiceToken, {
|
|
|
615
615
|
});
|
|
616
616
|
|
|
617
617
|
// src/metadata/handler.metadata.mts
|
|
618
|
-
var EndpointMetadataKey = Symbol("EndpointMetadataKey");
|
|
618
|
+
var EndpointMetadataKey = /* @__PURE__ */ Symbol("EndpointMetadataKey");
|
|
619
619
|
function getAllEndpointMetadata(context) {
|
|
620
620
|
if (context.metadata) {
|
|
621
621
|
const metadata = context.metadata[EndpointMetadataKey];
|
|
@@ -659,7 +659,7 @@ function getEndpointMetadata(target, context) {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
// src/metadata/controller.metadata.mts
|
|
662
|
-
var ControllerMetadataKey = Symbol("ControllerMetadataKey");
|
|
662
|
+
var ControllerMetadataKey = /* @__PURE__ */ Symbol("ControllerMetadataKey");
|
|
663
663
|
function getControllerMetadata(target, context) {
|
|
664
664
|
if (context.metadata) {
|
|
665
665
|
const metadata = context.metadata[ControllerMetadataKey];
|
|
@@ -694,7 +694,7 @@ function hasControllerMetadata(target) {
|
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
// src/metadata/module.metadata.mts
|
|
697
|
-
var ModuleMetadataKey = Symbol("ControllerMetadataKey");
|
|
697
|
+
var ModuleMetadataKey = /* @__PURE__ */ Symbol("ControllerMetadataKey");
|
|
698
698
|
function getModuleMetadata(target, context) {
|
|
699
699
|
if (context.metadata) {
|
|
700
700
|
const metadata = context.metadata[ModuleMetadataKey];
|
|
@@ -768,6 +768,9 @@ var Request = di.InjectionToken.create("RequestToken");
|
|
|
768
768
|
var StreamAdapterToken = di.InjectionToken.create(
|
|
769
769
|
"StreamAdapterToken"
|
|
770
770
|
);
|
|
771
|
+
var XmlStreamAdapterToken = di.InjectionToken.create(
|
|
772
|
+
"XmlStreamAdapterToken"
|
|
773
|
+
);
|
|
771
774
|
|
|
772
775
|
// src/decorators/endpoint.decorator.mts
|
|
773
776
|
function Endpoint(endpoint) {
|
|
@@ -1307,7 +1310,24 @@ exports.StreamAdapterFactory = class StreamAdapterFactory {
|
|
|
1307
1310
|
_init12 = __decoratorStart();
|
|
1308
1311
|
exports.StreamAdapterFactory = __decorateElement(_init12, 0, "StreamAdapterFactory", _StreamAdapterFactory_decorators, exports.StreamAdapterFactory);
|
|
1309
1312
|
__runInitializers(_init12, 1, exports.StreamAdapterFactory);
|
|
1310
|
-
var
|
|
1313
|
+
var _XmlStreamAdapterFactory_decorators, _init13;
|
|
1314
|
+
_XmlStreamAdapterFactory_decorators = [di.Factory({
|
|
1315
|
+
token: XmlStreamAdapterToken
|
|
1316
|
+
})];
|
|
1317
|
+
exports.XmlStreamAdapterFactory = class XmlStreamAdapterFactory {
|
|
1318
|
+
environment = di.inject(NaviosEnvironment);
|
|
1319
|
+
create(ctx) {
|
|
1320
|
+
const service = this.environment.getHttpToken(XmlStreamAdapterToken);
|
|
1321
|
+
if (!service) {
|
|
1322
|
+
throw new Error("XmlStreamAdapterToken service not found in environment");
|
|
1323
|
+
}
|
|
1324
|
+
return ctx.inject(service);
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
_init13 = __decoratorStart();
|
|
1328
|
+
exports.XmlStreamAdapterFactory = __decorateElement(_init13, 0, "XmlStreamAdapterFactory", _XmlStreamAdapterFactory_decorators, exports.XmlStreamAdapterFactory);
|
|
1329
|
+
__runInitializers(_init13, 1, exports.XmlStreamAdapterFactory);
|
|
1330
|
+
var _NaviosApplication_decorators, _init14;
|
|
1311
1331
|
_NaviosApplication_decorators = [di.Injectable()];
|
|
1312
1332
|
var _NaviosApplication = class _NaviosApplication {
|
|
1313
1333
|
environment = di.inject(NaviosEnvironment);
|
|
@@ -1395,9 +1415,9 @@ var _NaviosApplication = class _NaviosApplication {
|
|
|
1395
1415
|
await this.dispose();
|
|
1396
1416
|
}
|
|
1397
1417
|
};
|
|
1398
|
-
|
|
1399
|
-
_NaviosApplication = __decorateElement(
|
|
1400
|
-
__runInitializers(
|
|
1418
|
+
_init14 = __decoratorStart();
|
|
1419
|
+
_NaviosApplication = __decorateElement(_init14, 0, "NaviosApplication", _NaviosApplication_decorators, _NaviosApplication);
|
|
1420
|
+
__runInitializers(_init14, 1, _NaviosApplication);
|
|
1401
1421
|
var NaviosApplication = _NaviosApplication;
|
|
1402
1422
|
var NaviosFactory = class {
|
|
1403
1423
|
static async create(appModule, options = {
|
|
@@ -1479,6 +1499,7 @@ exports.Stream = Stream;
|
|
|
1479
1499
|
exports.StreamAdapterToken = StreamAdapterToken;
|
|
1480
1500
|
exports.UnauthorizedException = UnauthorizedException;
|
|
1481
1501
|
exports.UseGuards = UseGuards;
|
|
1502
|
+
exports.XmlStreamAdapterToken = XmlStreamAdapterToken;
|
|
1482
1503
|
exports.addLeadingSlash = addLeadingSlash;
|
|
1483
1504
|
exports.clc = clc;
|
|
1484
1505
|
exports.envInt = envInt;
|