@navios/core 0.1.14 → 0.2.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.
Files changed (71) hide show
  1. package/dist/_tsup-dts-rollup.d.mts +185 -434
  2. package/dist/_tsup-dts-rollup.d.ts +185 -434
  3. package/dist/index.d.mts +62 -46
  4. package/dist/index.d.ts +62 -46
  5. package/dist/index.js +482 -1328
  6. package/dist/index.mjs +484 -1292
  7. package/package.json +3 -2
  8. package/src/adapters/endpoint-adapter.service.mts +72 -0
  9. package/src/adapters/handler-adapter.interface.mts +21 -0
  10. package/src/adapters/index.mts +4 -0
  11. package/src/adapters/multipart-adapter.service.mts +131 -0
  12. package/src/adapters/stream-adapter.service.mts +91 -0
  13. package/src/attribute.factory.mts +14 -14
  14. package/src/config/config.provider.mts +16 -12
  15. package/src/decorators/controller.decorator.mts +3 -8
  16. package/src/decorators/endpoint.decorator.mts +7 -3
  17. package/src/decorators/header.decorator.mts +1 -6
  18. package/src/decorators/http-code.decorator.mts +1 -6
  19. package/src/decorators/module.decorator.mts +16 -21
  20. package/src/decorators/multipart.decorator.mts +7 -3
  21. package/src/decorators/stream.decorator.mts +7 -3
  22. package/src/decorators/use-guards.decorator.mts +3 -2
  23. package/src/index.mts +2 -1
  24. package/src/logger/console-logger.service.mts +3 -2
  25. package/src/logger/logger.factory.mts +4 -5
  26. package/src/logger/logger.service.mts +2 -2
  27. package/src/metadata/controller.metadata.mts +6 -5
  28. package/src/metadata/{endpoint.metadata.mts → handler.metadata.mts} +18 -28
  29. package/src/metadata/index.mts +1 -2
  30. package/src/metadata/module.metadata.mts +3 -2
  31. package/src/navios.application.mts +12 -12
  32. package/src/navios.factory.mts +4 -2
  33. package/src/services/controller-adapter.service.mts +65 -245
  34. package/src/services/execution-context.mts +4 -3
  35. package/src/services/guard-runner.service.mts +4 -6
  36. package/src/services/module-loader.service.mts +4 -2
  37. package/src/tokens/application.token.mts +1 -1
  38. package/src/tokens/execution-context.token.mts +2 -1
  39. package/src/tokens/reply.token.mts +1 -1
  40. package/src/tokens/request.token.mts +1 -1
  41. package/src/metadata/injectable.metadata.mts +0 -11
  42. package/src/service-locator/__tests__/injectable.spec.mts +0 -171
  43. package/src/service-locator/__tests__/injection-token.spec.mts +0 -124
  44. package/src/service-locator/decorators/get-injectable-token.mts +0 -19
  45. package/src/service-locator/decorators/index.mts +0 -2
  46. package/src/service-locator/decorators/injectable.decorator.mts +0 -64
  47. package/src/service-locator/enums/index.mts +0 -1
  48. package/src/service-locator/enums/injectable-scope.enum.mts +0 -10
  49. package/src/service-locator/errors/errors.enum.mts +0 -8
  50. package/src/service-locator/errors/factory-not-found.mts +0 -8
  51. package/src/service-locator/errors/factory-token-not-resolved.mts +0 -10
  52. package/src/service-locator/errors/index.mts +0 -7
  53. package/src/service-locator/errors/instance-destroying.mts +0 -8
  54. package/src/service-locator/errors/instance-expired.mts +0 -8
  55. package/src/service-locator/errors/instance-not-found.mts +0 -8
  56. package/src/service-locator/errors/unknown-error.mts +0 -15
  57. package/src/service-locator/event-emitter.mts +0 -107
  58. package/src/service-locator/index.mts +0 -15
  59. package/src/service-locator/inject.mts +0 -28
  60. package/src/service-locator/injection-token.mts +0 -92
  61. package/src/service-locator/injector.mts +0 -18
  62. package/src/service-locator/interfaces/factory.interface.mts +0 -3
  63. package/src/service-locator/override.mts +0 -22
  64. package/src/service-locator/proxy-service-locator.mts +0 -99
  65. package/src/service-locator/resolve-service.mts +0 -46
  66. package/src/service-locator/service-locator-abstract-factory-context.mts +0 -23
  67. package/src/service-locator/service-locator-event-bus.mts +0 -96
  68. package/src/service-locator/service-locator-instance-holder.mts +0 -63
  69. package/src/service-locator/service-locator-manager.mts +0 -89
  70. package/src/service-locator/service-locator.mts +0 -535
  71. package/src/service-locator/sync-injector.mts +0 -52
@@ -1,7 +1,25 @@
1
1
  import type { AnyZodObject } from 'zod';
2
2
  import type { BaseEndpointConfig } from '@navios/common';
3
3
  import type { BaseStreamConfig } from '@navios/common';
4
+ import { BoundInjectionToken } from '@navios/di';
5
+ import { ChannelEmitter } from '@navios/di';
6
+ import { ClassType } from '@navios/di';
7
+ import { ClassTypeWithInstance } from '@navios/di';
8
+ import { CreateInjectorsOptions } from '@navios/di';
4
9
  import type { EndpointFunctionArgs } from '@navios/common';
10
+ import { ErrorsEnum } from '@navios/di';
11
+ import { EventEmitter } from '@navios/di';
12
+ import { EventEmitterInterface } from '@navios/di';
13
+ import { EventsArgs } from '@navios/di';
14
+ import { EventsConfig } from '@navios/di';
15
+ import { EventsNames } from '@navios/di';
16
+ import { Factory } from '@navios/di';
17
+ import { FactoryContext } from '@navios/di';
18
+ import { FactoryInjectionToken } from '@navios/di';
19
+ import { FactoryNotFound } from '@navios/di';
20
+ import { FactoryRecord } from '@navios/di';
21
+ import { FactoryTokenNotResolved } from '@navios/di';
22
+ import { FactoryWithArgs } from '@navios/di';
5
23
  import { FastifyBaseLogger } from 'fastify';
6
24
  import type { FastifyCorsOptions } from '@fastify/cors';
7
25
  import type { FastifyInstance } from 'fastify';
@@ -12,19 +30,53 @@ import type { FastifyRequest } from 'fastify';
12
30
  import { FastifySchema } from 'fastify';
13
31
  import type { FastifyServerOptions } from 'fastify';
14
32
  import { FastifyTypeProviderDefault } from 'fastify';
33
+ import { getGlobalServiceLocator } from '@navios/di';
34
+ import { getInjectableToken } from '@navios/di';
35
+ import { getInjectors } from '@navios/di';
36
+ import { globalRegistry } from '@navios/di';
15
37
  import type { HttpHeader } from 'fastify/types/utils.js';
16
38
  import type { HttpMethod } from '@navios/common';
17
39
  import { IncomingMessage } from 'http';
40
+ import { inject } from '@navios/di';
41
+ import { Injectable } from '@navios/di';
42
+ import { InjectableOptions } from '@navios/di';
43
+ import { InjectableScope } from '@navios/di';
44
+ import { InjectableTokenMeta } from '@navios/di';
45
+ import { InjectableType } from '@navios/di';
46
+ import { InjectionFactory } from '@navios/di';
47
+ import { InjectionToken } from '@navios/di';
48
+ import { Injectors } from '@navios/di';
49
+ import { InjectorsBase } from '@navios/di';
18
50
  import type { InspectOptions } from 'util';
51
+ import { InstanceDestroying } from '@navios/di';
52
+ import { InstanceExpired } from '@navios/di';
53
+ import { InstanceNotFound } from '@navios/di';
19
54
  import { LoggerInstance as LoggerInstance_2 } from '../logger/logger.service.mjs';
20
- import type { output } from 'zod';
55
+ import { makeProxyServiceLocator } from '@navios/di';
56
+ import { provideServiceLocator } from '@navios/di';
57
+ import { ProxyServiceLocator } from '@navios/di';
21
58
  import { RawServerDefault } from 'fastify';
59
+ import { Registry } from '@navios/di';
22
60
  import { ResolveFastifyRequestType } from 'fastify/types/type-provider.js';
61
+ import { resolveService } from '@navios/di';
23
62
  import { RouteGenericInterface } from 'fastify';
24
63
  import { ServerResponse } from 'http';
64
+ import { ServiceLocator } from '@navios/di';
65
+ import { ServiceLocatorEventBus } from '@navios/di';
66
+ import { ServiceLocatorInstanceDestroyListener } from '@navios/di';
67
+ import { ServiceLocatorInstanceEffect } from '@navios/di';
68
+ import { ServiceLocatorInstanceHolder } from '@navios/di';
69
+ import { ServiceLocatorInstanceHolderCreated } from '@navios/di';
70
+ import { ServiceLocatorInstanceHolderCreating } from '@navios/di';
71
+ import { ServiceLocatorInstanceHolderDestroying } from '@navios/di';
72
+ import { ServiceLocatorInstanceHolderKind } from '@navios/di';
73
+ import { ServiceLocatorInstanceHolderStatus } from '@navios/di';
74
+ import { ServiceLocatorManager } from '@navios/di';
75
+ import { syncInject } from '@navios/di';
76
+ import { UnknownError } from '@navios/di';
77
+ import { wrapSyncInit } from '@navios/di';
25
78
  import { z } from 'zod';
26
79
  import { ZodDiscriminatedUnion } from 'zod';
27
- import { ZodOptional } from 'zod';
28
80
  import type { ZodType } from 'zod';
29
81
 
30
82
  declare const addLeadingSlash: (path?: string) => string;
@@ -41,14 +93,14 @@ export { Application as Application_alias_2 }
41
93
  declare class AttributeFactory {
42
94
  static createAttribute(token: symbol): ClassAttribute;
43
95
  static createAttribute<T extends ZodType>(token: symbol, schema: T): ClassSchemaAttribute<T>;
44
- static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): true | null;
45
- static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): z.output<T> | null;
46
- static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): Array<true> | null;
47
- static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): Array<z.output<T>> | null;
48
- static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | EndpointMetadata)[]): true | null;
49
- static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | EndpointMetadata)[]): z.output<T> | null;
50
- static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): boolean;
51
- static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | EndpointMetadata): boolean;
96
+ static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): true | null;
97
+ static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): z.output<T> | null;
98
+ static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<true> | null;
99
+ static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<z.output<T>> | null;
100
+ static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): true | null;
101
+ static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): z.output<T> | null;
102
+ static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
103
+ static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
52
104
  }
53
105
  export { AttributeFactory }
54
106
  export { AttributeFactory as AttributeFactory_alias_1 }
@@ -60,14 +112,7 @@ export { BadRequestException }
60
112
  export { BadRequestException as BadRequestException_alias_1 }
61
113
  export { BadRequestException as BadRequestException_alias_2 }
62
114
 
63
- declare class BoundInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> extends InjectionToken<T, undefined> {
64
- readonly token: InjectionToken<T, S>;
65
- readonly value: z.input<S>;
66
- constructor(token: InjectionToken<T, S>, value: z.input<S>);
67
- }
68
115
  export { BoundInjectionToken }
69
- export { BoundInjectionToken as BoundInjectionToken_alias_1 }
70
- export { BoundInjectionToken as BoundInjectionToken_alias_2 }
71
116
 
72
117
  declare interface CanActivate {
73
118
  canActivate(executionContext: ExecutionContext): Promise<boolean> | boolean;
@@ -76,12 +121,7 @@ export { CanActivate }
76
121
  export { CanActivate as CanActivate_alias_1 }
77
122
  export { CanActivate as CanActivate_alias_2 }
78
123
 
79
- declare type ChannelEmitter<Events extends EventsConfig, Ns extends string, E extends EventsNames<Events>> = {
80
- emit<Args extends EventsArgs<Events, E>>(ns: Ns, event: E, ...args: Args): Promise<any>;
81
- };
82
124
  export { ChannelEmitter }
83
- export { ChannelEmitter as ChannelEmitter_alias_1 }
84
- export { ChannelEmitter as ChannelEmitter_alias_2 }
85
125
 
86
126
  declare type ClassAttribute = (() => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
87
127
  token: symbol;
@@ -96,15 +136,9 @@ declare type ClassSchemaAttribute<T extends ZodType> = ((value: z.input<T>) => <
96
136
  export { ClassSchemaAttribute }
97
137
  export { ClassSchemaAttribute as ClassSchemaAttribute_alias_1 }
98
138
 
99
- declare type ClassType = new (...args: any[]) => any;
100
139
  export { ClassType }
101
- export { ClassType as ClassType_alias_1 }
102
- export { ClassType as ClassType_alias_2 }
103
140
 
104
- declare type ClassTypeWithInstance<T> = new (...args: any[]) => T;
105
141
  export { ClassTypeWithInstance }
106
- export { ClassTypeWithInstance as ClassTypeWithInstance_alias_1 }
107
- export { ClassTypeWithInstance as ClassTypeWithInstance_alias_2 }
108
142
 
109
143
  declare const clc: {
110
144
  bold: (text: string) => string;
@@ -132,7 +166,7 @@ export { ConfigProvider as ConfigProvider_alias_2 }
132
166
 
133
167
  declare class ConfigProviderFactory {
134
168
  logger: LoggerInstance_2;
135
- create(ctx: any, args: z.infer<typeof ConfigProviderOptions>): Promise<ConfigServiceInstance<unknown>>;
169
+ create(ctx: any, args: z.infer<typeof ConfigProviderOptions>): Promise<ConfigService>;
136
170
  }
137
171
  export { ConfigProviderFactory }
138
172
  export { ConfigProviderFactory as ConfigProviderFactory_alias_1 }
@@ -377,7 +411,7 @@ export { ConsoleLoggerOptions }
377
411
  export { ConsoleLoggerOptions as ConsoleLoggerOptions_alias_1 }
378
412
  export { ConsoleLoggerOptions as ConsoleLoggerOptions_alias_2 }
379
413
 
380
- declare function Controller({ guards }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
414
+ declare function Controller({ guards }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => any;
381
415
  export { Controller }
382
416
  export { Controller as Controller_alias_1 }
383
417
  export { Controller as Controller_alias_2 }
@@ -385,20 +419,16 @@ export { Controller as Controller_alias_2 }
385
419
  declare class ControllerAdapterService {
386
420
  guardRunner: GuardRunnerService;
387
421
  private logger;
388
- setupController(controller: ClassType, instance: FastifyInstance, moduleMetadata: ModuleMetadata): void;
389
- providePreHandler(executionContext: ExecutionContext): ((request: FastifyRequest, reply: FastifyReply) => Promise<undefined>) | undefined;
390
- private provideSchemaForConfig;
391
- private provideHandler;
392
- private provideHandlerForConfig;
393
- private provideHandlerForStream;
394
- private provideHandlerForMultipart;
422
+ setupController(controller: ClassType, instance: FastifyInstance, moduleMetadata: ModuleMetadata): Promise<void>;
423
+ providePreHandler(executionContext: ExecutionContext): ((request: FastifyRequest, reply: FastifyReply) => Promise<void>) | undefined;
424
+ private wrapHandler;
395
425
  }
396
426
  export { ControllerAdapterService }
397
427
  export { ControllerAdapterService as ControllerAdapterService_alias_1 }
398
428
  export { ControllerAdapterService as ControllerAdapterService_alias_2 }
399
429
 
400
430
  declare interface ControllerMetadata {
401
- endpoints: Set<EndpointMetadata>;
431
+ endpoints: Set<HandlerMetadata>;
402
432
  guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
403
433
  customAttributes: Map<string | symbol, any>;
404
434
  }
@@ -418,6 +448,8 @@ export { ControllerOptions }
418
448
  export { ControllerOptions as ControllerOptions_alias_1 }
419
449
  export { ControllerOptions as ControllerOptions_alias_2 }
420
450
 
451
+ export { CreateInjectorsOptions }
452
+
421
453
  declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
422
454
  config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
423
455
  }): (target: (params: QuerySchema extends AnyZodObject ? 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 AnyZodObject ? 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>>;
@@ -425,20 +457,19 @@ export { Endpoint }
425
457
  export { Endpoint as Endpoint_alias_1 }
426
458
  export { Endpoint as Endpoint_alias_2 }
427
459
 
428
- declare interface EndpointMetadata {
429
- classMethod: string;
430
- url: string;
431
- successStatusCode: number;
432
- type: EndpointType;
433
- headers: Partial<Record<HttpHeader, number | string | string[] | undefined>>;
434
- httpMethod: HttpMethod;
435
- config: BaseEndpointConfig | BaseStreamConfig | null;
436
- guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
437
- customAttributes: Map<string | symbol, any>;
460
+ declare class EndpointAdapterService extends StreamAdapterService {
461
+ hasSchema(handlerMetadata: HandlerMetadata<BaseEndpointConfig>): boolean;
462
+ provideSchema(handlerMetadata: HandlerMetadata<BaseEndpointConfig>): Record<string, any>;
463
+ provideHandler(controller: ClassType, executionContext: ExecutionContext, handlerMetadata: HandlerMetadata<BaseEndpointConfig>): (request: FastifyRequest, reply: FastifyReply) => Promise<any>;
438
464
  }
439
- export { EndpointMetadata }
440
- export { EndpointMetadata as EndpointMetadata_alias_1 }
441
- export { EndpointMetadata as EndpointMetadata_alias_2 }
465
+ export { EndpointAdapterService }
466
+ export { EndpointAdapterService as EndpointAdapterService_alias_1 }
467
+ export { EndpointAdapterService as EndpointAdapterService_alias_2 }
468
+
469
+ declare const EndpointAdapterToken: InjectionToken<EndpointAdapterService, undefined>;
470
+ export { EndpointAdapterToken }
471
+ export { EndpointAdapterToken as EndpointAdapterToken_alias_1 }
472
+ export { EndpointAdapterToken as EndpointAdapterToken_alias_2 }
442
473
 
443
474
  declare const EndpointMetadataKey: unique symbol;
444
475
  export { EndpointMetadataKey }
@@ -459,17 +490,6 @@ export { EndpointResult }
459
490
  export { EndpointResult as EndpointResult_alias_1 }
460
491
  export { EndpointResult as EndpointResult_alias_2 }
461
492
 
462
- declare enum EndpointType {
463
- Unknown = "unknown",
464
- Endpoint = "endpoint",
465
- Stream = "stream",
466
- Multipart = "multipart",
467
- Handler = "handler"
468
- }
469
- export { EndpointType }
470
- export { EndpointType as EndpointType_alias_1 }
471
- export { EndpointType as EndpointType_alias_2 }
472
-
473
493
  declare function envInt(key: keyof NodeJS.ProcessEnv, defaultValue: number): number;
474
494
  export { envInt }
475
495
  export { envInt as envInt_alias_1 }
@@ -482,56 +502,17 @@ export { envString as envString_alias_1 }
482
502
  export { envString as envString_alias_2 }
483
503
  export { envString as envString_alias_3 }
484
504
 
485
- declare enum ErrorsEnum {
486
- InstanceExpired = "InstanceExpired",
487
- InstanceNotFound = "InstanceNotFound",
488
- InstanceDestroying = "InstanceDestroying",
489
- UnknownError = "UnknownError",
490
- FactoryNotFound = "FactoryNotFound",
491
- FactoryTokenNotResolved = "FactoryTokenNotResolved"
492
- }
493
505
  export { ErrorsEnum }
494
- export { ErrorsEnum as ErrorsEnum_alias_1 }
495
- export { ErrorsEnum as ErrorsEnum_alias_2 }
496
- export { ErrorsEnum as ErrorsEnum_alias_3 }
497
-
498
- declare class EventEmitter<Events extends EventsConfig = {}> implements EventEmitterInterface<Events> {
499
- private listeners;
500
- on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
501
- off<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): void;
502
- once<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
503
- emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): Promise<any>;
504
- addChannel<E extends EventsNames<Events>, Ns extends string, Emitter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emitter): () => void;
505
- }
506
+
506
507
  export { EventEmitter }
507
- export { EventEmitter as EventEmitter_alias_1 }
508
- export { EventEmitter as EventEmitter_alias_2 }
509
508
 
510
- declare interface EventEmitterInterface<Events extends EventsConfig> {
511
- on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
512
- emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): void;
513
- addChannel<E extends EventsNames<Events>, Ns extends string, Emmiter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emmiter): () => void;
514
- }
515
509
  export { EventEmitterInterface }
516
- export { EventEmitterInterface as EventEmitterInterface_alias_1 }
517
- export { EventEmitterInterface as EventEmitterInterface_alias_2 }
518
510
 
519
- declare type EventsArgs<Events extends EventsConfig, Name extends EventsNames<Events>> = Events[Name] extends any[] ? Events[Name] : [];
520
511
  export { EventsArgs }
521
- export { EventsArgs as EventsArgs_alias_1 }
522
- export { EventsArgs as EventsArgs_alias_2 }
523
512
 
524
- declare type EventsConfig = {
525
- [event: string]: any[];
526
- };
527
513
  export { EventsConfig }
528
- export { EventsConfig as EventsConfig_alias_1 }
529
- export { EventsConfig as EventsConfig_alias_2 }
530
514
 
531
- declare type EventsNames<Events extends EventsConfig> = Exclude<keyof Events, symbol | number>;
532
515
  export { EventsNames }
533
- export { EventsNames as EventsNames_alias_1 }
534
- export { EventsNames as EventsNames_alias_2 }
535
516
 
536
517
  declare type ExcludedKeys = 'computedTimeRates' | 'aiModelsRates' | 'aiModel';
537
518
 
@@ -543,10 +524,10 @@ declare class ExecutionContext {
543
524
  private readonly handler;
544
525
  private request;
545
526
  private reply;
546
- constructor(module: ModuleMetadata, controller: ControllerMetadata, handler: EndpointMetadata);
527
+ constructor(module: ModuleMetadata, controller: ControllerMetadata, handler: HandlerMetadata);
547
528
  getModule(): ModuleMetadata;
548
529
  getController(): ControllerMetadata;
549
- getHandler(): EndpointMetadata;
530
+ getHandler(): HandlerMetadata;
550
531
  getRequest(): FastifyRequest;
551
532
  getReply(): FastifyReply;
552
533
  provideRequest(request: FastifyRequest): void;
@@ -576,40 +557,19 @@ export { extractModuleMetadata }
576
557
  export { extractModuleMetadata as extractModuleMetadata_alias_1 }
577
558
  export { extractModuleMetadata as extractModuleMetadata_alias_2 }
578
559
 
579
- export declare interface Factory<T> {
580
- create(ctx: any): Promise<T>;
581
- }
560
+ export { Factory }
561
+
562
+ export { FactoryContext }
582
563
 
583
- declare class FactoryInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> extends InjectionToken<T, S> {
584
- readonly token: InjectionToken<T, S>;
585
- readonly factory: () => Promise<z.input<S>>;
586
- value?: z.input<S>;
587
- resolved: boolean;
588
- constructor(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>);
589
- resolve(): Promise<z.input<S>>;
590
- }
591
564
  export { FactoryInjectionToken }
592
- export { FactoryInjectionToken as FactoryInjectionToken_alias_1 }
593
- export { FactoryInjectionToken as FactoryInjectionToken_alias_2 }
594
565
 
595
- declare class FactoryNotFound extends Error {
596
- name: string;
597
- code: ErrorsEnum;
598
- constructor(name: string);
599
- }
600
566
  export { FactoryNotFound }
601
- export { FactoryNotFound as FactoryNotFound_alias_1 }
602
- export { FactoryNotFound as FactoryNotFound_alias_2 }
603
- export { FactoryNotFound as FactoryNotFound_alias_3 }
604
567
 
605
- declare class FactoryTokenNotResolved extends Error {
606
- code: ErrorsEnum;
607
- constructor(name: string | symbol | ClassType);
608
- }
568
+ export { FactoryRecord }
569
+
609
570
  export { FactoryTokenNotResolved }
610
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_1 }
611
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_2 }
612
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_3 }
571
+
572
+ export { FactoryWithArgs }
613
573
 
614
574
  /**
615
575
  * @publicApi
@@ -627,7 +587,7 @@ export { ForbiddenException }
627
587
  export { ForbiddenException as ForbiddenException_alias_1 }
628
588
  export { ForbiddenException as ForbiddenException_alias_2 }
629
589
 
630
- declare function getAllEndpointMetadata(context: ClassMethodDecoratorContext | ClassDecoratorContext): Set<EndpointMetadata>;
590
+ declare function getAllEndpointMetadata(context: ClassMethodDecoratorContext | ClassDecoratorContext): Set<HandlerMetadata<any>>;
631
591
  export { getAllEndpointMetadata }
632
592
  export { getAllEndpointMetadata as getAllEndpointMetadata_alias_1 }
633
593
  export { getAllEndpointMetadata as getAllEndpointMetadata_alias_2 }
@@ -637,28 +597,23 @@ export { getControllerMetadata }
637
597
  export { getControllerMetadata as getControllerMetadata_alias_1 }
638
598
  export { getControllerMetadata as getControllerMetadata_alias_2 }
639
599
 
640
- declare function getEndpointMetadata(target: Function, context: ClassMethodDecoratorContext): EndpointMetadata;
600
+ declare function getEndpointMetadata<Config = any>(target: Function, context: ClassMethodDecoratorContext): HandlerMetadata<Config>;
641
601
  export { getEndpointMetadata }
642
602
  export { getEndpointMetadata as getEndpointMetadata_alias_1 }
643
603
  export { getEndpointMetadata as getEndpointMetadata_alias_2 }
644
604
 
645
- declare function getInjectableToken<R>(target: ClassType): R extends {
646
- create(...args: any[]): infer V;
647
- } ? InjectionToken<V> : InjectionToken<R>;
605
+ export { getGlobalServiceLocator }
606
+
648
607
  export { getInjectableToken }
649
- export { getInjectableToken as getInjectableToken_alias_1 }
650
- export { getInjectableToken as getInjectableToken_alias_2 }
651
- export { getInjectableToken as getInjectableToken_alias_3 }
608
+
609
+ export { getInjectors }
652
610
 
653
611
  declare function getModuleMetadata(target: ClassType, context: ClassDecoratorContext): ModuleMetadata;
654
612
  export { getModuleMetadata }
655
613
  export { getModuleMetadata as getModuleMetadata_alias_1 }
656
614
  export { getModuleMetadata as getModuleMetadata_alias_2 }
657
615
 
658
- declare function getServiceLocator(): ServiceLocator;
659
- export { getServiceLocator }
660
- export { getServiceLocator as getServiceLocator_alias_1 }
661
- export { getServiceLocator as getServiceLocator_alias_2 }
616
+ export { globalRegistry }
662
617
 
663
618
  declare class GuardRunnerService {
664
619
  runGuards(allGuards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>, executionContext: ExecutionContext): Promise<boolean>;
@@ -668,6 +623,31 @@ export { GuardRunnerService }
668
623
  export { GuardRunnerService as GuardRunnerService_alias_1 }
669
624
  export { GuardRunnerService as GuardRunnerService_alias_2 }
670
625
 
626
+ declare interface HandlerAdapterInterface {
627
+ provideSchema?: (handlerMetadata: HandlerMetadata<any>) => Record<string, any>;
628
+ hasSchema?: (handlerMetadata: HandlerMetadata<any>) => boolean;
629
+ prepareArguments?: (handlerMetadata: HandlerMetadata<any>) => ((target: Record<string, any>, request: FastifyRequest) => Promise<void> | void)[];
630
+ provideHandler: (controller: ClassType, executionContext: ExecutionContext, handlerMetadata: HandlerMetadata<any>) => (request: FastifyRequest, reply: FastifyReply) => Promise<any>;
631
+ }
632
+ export { HandlerAdapterInterface }
633
+ export { HandlerAdapterInterface as HandlerAdapterInterface_alias_1 }
634
+ export { HandlerAdapterInterface as HandlerAdapterInterface_alias_2 }
635
+
636
+ declare interface HandlerMetadata<Config = null> {
637
+ classMethod: string;
638
+ url: string;
639
+ successStatusCode: number;
640
+ adapterToken: InjectionToken<HandlerAdapterInterface, undefined> | ClassTypeWithInstance<HandlerAdapterInterface> | null;
641
+ headers: Partial<Record<HttpHeader, number | string | string[] | undefined>>;
642
+ httpMethod: HttpMethod;
643
+ config: Config;
644
+ guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
645
+ customAttributes: Map<string | symbol, any>;
646
+ }
647
+ export { HandlerMetadata }
648
+ export { HandlerMetadata as HandlerMetadata_alias_1 }
649
+ export { HandlerMetadata as HandlerMetadata_alias_2 }
650
+
671
651
  declare function hasControllerMetadata(target: ClassType): boolean;
672
652
  export { hasControllerMetadata }
673
653
  export { hasControllerMetadata as hasControllerMetadata_alias_1 }
@@ -698,118 +678,31 @@ export { HttpException }
698
678
  export { HttpException as HttpException_alias_1 }
699
679
  export { HttpException as HttpException_alias_2 }
700
680
 
701
- declare function inject<T extends ClassType>(token: T): Promise<InstanceType<T>>;
702
-
703
- declare function inject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): Promise<T>;
704
-
705
- declare function inject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args?: z.input<S>): Promise<T>;
706
-
707
- declare function inject<T>(token: InjectionToken<T, undefined>): Promise<T>;
708
681
  export { inject }
709
- export { inject as inject_alias_1 }
710
- export { inject as inject_alias_2 }
711
682
 
712
- declare function Injectable({ scope, type, token, }?: InjectableOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
713
683
  export { Injectable }
714
- export { Injectable as Injectable_alias_1 }
715
- export { Injectable as Injectable_alias_2 }
716
- export { Injectable as Injectable_alias_3 }
717
-
718
- declare interface InjectableMetadata<Instance = any, Schema = any> {
719
- type: InjectableType;
720
- scope: InjectableScope;
721
- token: InjectionToken<Instance, Schema>;
722
- }
723
- export { InjectableMetadata }
724
- export { InjectableMetadata as InjectableMetadata_alias_1 }
725
- export { InjectableMetadata as InjectableMetadata_alias_2 }
726
-
727
- declare interface InjectableOptions {
728
- scope?: InjectableScope;
729
- type?: InjectableType;
730
- token?: InjectionToken<any, any>;
731
- }
684
+
732
685
  export { InjectableOptions }
733
- export { InjectableOptions as InjectableOptions_alias_1 }
734
- export { InjectableOptions as InjectableOptions_alias_2 }
735
- export { InjectableOptions as InjectableOptions_alias_3 }
736
686
 
737
- declare enum InjectableScope {
738
- /**
739
- * Singleton scope: The instance is created once and shared across the application.
740
- */
741
- Singleton = "Singleton",
742
- /**
743
- * Instance scope: A new instance is created for each injection.
744
- */
745
- Instance = "Instance"
746
- }
747
687
  export { InjectableScope }
748
- export { InjectableScope as InjectableScope_alias_1 }
749
- export { InjectableScope as InjectableScope_alias_2 }
750
- export { InjectableScope as InjectableScope_alias_3 }
751
688
 
752
- declare const InjectableTokenMeta: unique symbol;
753
689
  export { InjectableTokenMeta }
754
- export { InjectableTokenMeta as InjectableTokenMeta_alias_1 }
755
- export { InjectableTokenMeta as InjectableTokenMeta_alias_2 }
756
- export { InjectableTokenMeta as InjectableTokenMeta_alias_3 }
757
690
 
758
- declare enum InjectableType {
759
- Class = "Class",
760
- Factory = "Factory"
761
- }
762
691
  export { InjectableType }
763
- export { InjectableType as InjectableType_alias_1 }
764
- export { InjectableType as InjectableType_alias_2 }
765
- export { InjectableType as InjectableType_alias_3 }
766
-
767
- declare class InjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject> | unknown = unknown> {
768
- readonly name: string | symbol | ClassType;
769
- readonly schema: AnyZodObject | undefined;
770
- id: `${string}-${string}-${string}-${string}-${string}`;
771
- constructor(name: string | symbol | ClassType, schema: AnyZodObject | undefined);
772
- static create<T extends ClassType>(name: T): InjectionToken<InstanceType<T>, undefined>;
773
- static create<T extends ClassType, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: T, schema: Schema): InjectionToken<InstanceType<T>, Schema>;
774
- static create<T>(name: string | symbol): InjectionToken<T, undefined>;
775
- static create<T, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: string | any, schema: Schema): InjectionToken<T, Schema>;
776
- static bound<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, value: z.input<S>): BoundInjectionToken<T, S>;
777
- static factory<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>): FactoryInjectionToken<T, S>;
778
- static refineType<T>(token: BoundInjectionToken<any, any>): BoundInjectionToken<T, any>;
779
- }
692
+
693
+ export { InjectionFactory }
694
+
780
695
  export { InjectionToken }
781
- export { InjectionToken as InjectionToken_alias_1 }
782
- export { InjectionToken as InjectionToken_alias_2 }
783
696
 
784
- declare class InstanceDestroying extends Error {
785
- name: string;
786
- code: ErrorsEnum;
787
- constructor(name: string);
788
- }
697
+ export { Injectors }
698
+
699
+ export { InjectorsBase }
700
+
789
701
  export { InstanceDestroying }
790
- export { InstanceDestroying as InstanceDestroying_alias_1 }
791
- export { InstanceDestroying as InstanceDestroying_alias_2 }
792
- export { InstanceDestroying as InstanceDestroying_alias_3 }
793
-
794
- declare class InstanceExpired extends Error {
795
- name: string;
796
- code: ErrorsEnum;
797
- constructor(name: string);
798
- }
702
+
799
703
  export { InstanceExpired }
800
- export { InstanceExpired as InstanceExpired_alias_1 }
801
- export { InstanceExpired as InstanceExpired_alias_2 }
802
- export { InstanceExpired as InstanceExpired_alias_3 }
803
-
804
- declare class InstanceNotFound extends Error {
805
- name: string;
806
- code: ErrorsEnum;
807
- constructor(name: string);
808
- }
704
+
809
705
  export { InstanceNotFound }
810
- export { InstanceNotFound as InstanceNotFound_alias_1 }
811
- export { InstanceNotFound as InstanceNotFound_alias_2 }
812
- export { InstanceNotFound as InstanceNotFound_alias_3 }
813
706
 
814
707
  declare class InternalServerErrorException extends HttpException {
815
708
  constructor(message: string | object, error?: Error);
@@ -1101,9 +994,9 @@ export { LogLevel }
1101
994
  export { LogLevel as LogLevel_alias_1 }
1102
995
  export { LogLevel as LogLevel_alias_2 }
1103
996
 
1104
- export declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: ServiceLocatorAbstractFactoryContext): ServiceLocator;
997
+ export { makeProxyServiceLocator }
1105
998
 
1106
- declare function Module(metadata: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
999
+ declare function Module({ controllers, imports, guards }?: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => any;
1107
1000
  export { Module }
1108
1001
  export { Module as Module_alias_1 }
1109
1002
  export { Module as Module_alias_2 }
@@ -1154,6 +1047,21 @@ export { Multipart }
1154
1047
  export { Multipart as Multipart_alias_1 }
1155
1048
  export { Multipart as Multipart_alias_2 }
1156
1049
 
1050
+ declare class MultipartAdapterService extends EndpointAdapterService {
1051
+ prepareArguments(handlerMetadata: HandlerMetadata<BaseEndpointConfig>): ((target: Record<string, any>, request: FastifyRequest) => void)[];
1052
+ private populateRequest;
1053
+ private analyzeSchema;
1054
+ provideSchema(handlerMetadata: HandlerMetadata<BaseEndpointConfig>): Record<string, any>;
1055
+ }
1056
+ export { MultipartAdapterService }
1057
+ export { MultipartAdapterService as MultipartAdapterService_alias_1 }
1058
+ export { MultipartAdapterService as MultipartAdapterService_alias_2 }
1059
+
1060
+ declare const MultipartAdapterToken: InjectionToken<MultipartAdapterService, undefined>;
1061
+ export { MultipartAdapterToken }
1062
+ export { MultipartAdapterToken as MultipartAdapterToken_alias_1 }
1063
+ export { MultipartAdapterToken as MultipartAdapterToken_alias_2 }
1064
+
1157
1065
  declare type MultipartParams<EndpointDeclaration extends {
1158
1066
  config: BaseEndpointConfig<any, any, any, any, any>;
1159
1067
  }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends AnyZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, QuerySchema, undefined> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, undefined, undefined>;
@@ -1239,15 +1147,6 @@ export { NotFoundException }
1239
1147
  export { NotFoundException as NotFoundException_alias_1 }
1240
1148
  export { NotFoundException as NotFoundException_alias_2 }
1241
1149
 
1242
- /**
1243
- * Useful for tests or when you want to override a service
1244
- * with a different implementation.
1245
- */
1246
- declare function override<T>(token: InjectionToken<T>, target: ClassType): () => void;
1247
- export { override }
1248
- export { override as override_alias_1 }
1249
- export { override as override_alias_2 }
1250
-
1251
1150
  declare type Path<T> = keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
1252
1151
  export { Path }
1253
1152
  export { Path as Path_alias_1 }
@@ -1285,32 +1184,22 @@ export { PinoWrapper }
1285
1184
  export { PinoWrapper as PinoWrapper_alias_1 }
1286
1185
  export { PinoWrapper as PinoWrapper_alias_2 }
1287
1186
 
1288
- declare let promiseCollector: null | ((promise: Promise<any>) => void);
1289
-
1290
- declare function provideConfig<ConfigMap extends Record<string, unknown>>(options: z.input<typeof ConfigProviderOptions>): InjectionToken<ConfigServiceInstance<ConfigMap>, undefined>;
1187
+ declare function provideConfig<ConfigMap extends Record<string, unknown>>(options: z.input<typeof ConfigProviderOptions>): BoundInjectionToken<ConfigService<Record<string, unknown>>, z.ZodObject<{
1188
+ load: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
1189
+ }, "strip", z.ZodTypeAny, {
1190
+ load: (...args: unknown[]) => unknown;
1191
+ }, {
1192
+ load: (...args: unknown[]) => unknown;
1193
+ }>>;
1291
1194
  export { provideConfig }
1292
1195
  export { provideConfig as provideConfig_alias_1 }
1293
1196
  export { provideConfig as provideConfig_alias_2 }
1294
1197
 
1295
- declare function provideServiceLocator(locator: ServiceLocator): ServiceLocator;
1296
1198
  export { provideServiceLocator }
1297
- export { provideServiceLocator as provideServiceLocator_alias_1 }
1298
- export { provideServiceLocator as provideServiceLocator_alias_2 }
1299
-
1300
- export declare class ProxyServiceLocator implements ServiceLocator {
1301
- private readonly serviceLocator;
1302
- private readonly ctx;
1303
- constructor(serviceLocator: ServiceLocator, ctx: ServiceLocatorAbstractFactoryContext);
1304
- get abstractFactories(): Map<InjectionToken<any, any>, (ctx: ServiceLocatorAbstractFactoryContext, args: any) => Promise<any>>;
1305
- getEventBus(): ServiceLocatorEventBus;
1306
- registerAbstractFactory<Instance, Schema extends AnyZodObject | undefined>(token: InjectionToken<Instance, Schema>, factory: (ctx: ServiceLocatorAbstractFactoryContext, values: Schema extends AnyZodObject ? output<Schema> : undefined) => Promise<Instance>): void;
1307
- getInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
1308
- getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
1309
- getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
1310
- invalidate(service: string, round?: number): Promise<any>;
1311
- ready(): Promise<null>;
1312
- makeInstanceName(token: InjectionToken<any, any>, args: any): string;
1313
- }
1199
+
1200
+ export { ProxyServiceLocator }
1201
+
1202
+ export { Registry }
1314
1203
 
1315
1204
  declare const Reply: InjectionToken<FastifyReply<RouteGenericInterface, RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, unknown, FastifySchema, FastifyTypeProviderDefault, unknown>, undefined>;
1316
1205
  export { Reply }
@@ -1322,167 +1211,29 @@ export { Request_2 as Request }
1322
1211
  export { Request_2 as Request_alias_1 }
1323
1212
  export { Request_2 as Request_alias_2 }
1324
1213
 
1325
- declare function resolveService<T extends ClassType>(ctx: ServiceLocatorAbstractFactoryContext, target: T, args?: any[]): Promise<InstanceType<T>>;
1326
1214
  export { resolveService }
1327
- export { resolveService as resolveService_alias_1 }
1328
- export { resolveService as resolveService_alias_2 }
1329
-
1330
- declare class ServiceLocator {
1331
- private readonly logger;
1332
- private abstractFactories;
1333
- private instanceFactories;
1334
- private readonly eventBus;
1335
- private readonly manager;
1336
- constructor(logger?: Console | null);
1337
- getEventBus(): ServiceLocatorEventBus;
1338
- registerInstance<Instance>(token: InjectionToken<Instance, undefined>, instance: Instance): void;
1339
- removeInstance<Instance>(token: InjectionToken<Instance, undefined>): Promise<any>;
1340
- registerAbstractFactory<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, factory: (ctx: ServiceLocatorAbstractFactoryContext, values: Schema extends AnyZodObject ? z.output<Schema> : undefined) => Promise<Instance>, type?: InjectableScope): void;
1341
- private resolveTokenArgs;
1342
- getInstanceIdentifier<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): string;
1343
- getInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
1344
- getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
1345
- private notifyListeners;
1346
- private createInstance;
1347
- private createInstanceFromAbstractFactory;
1348
- private createContextForAbstractFactory;
1349
- getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
1350
- invalidate(service: string, round?: number): Promise<any>;
1351
- ready(): Promise<null>;
1352
- makeInstanceName(token: InjectionToken<any, any>, args: any): string;
1353
- }
1215
+
1354
1216
  export { ServiceLocator }
1355
- export { ServiceLocator as ServiceLocator_alias_1 }
1356
- export { ServiceLocator as ServiceLocator_alias_2 }
1357
-
1358
- declare interface ServiceLocatorAbstractFactoryContext {
1359
- inject: typeof inject;
1360
- addDependency: ((token: InjectionToken<any, undefined>) => void) | (<S extends AnyZodObject>(token: InjectionToken<any, S>, args: z.input<S>) => void);
1361
- on: ServiceLocatorEventBus['on'];
1362
- getDependencies: () => string[];
1363
- invalidate: () => void;
1364
- addEffect: (listener: () => void) => void;
1365
- getDestroyListeners: () => (() => void)[];
1366
- setTtl: (ttl: number) => void;
1367
- getTtl: () => number;
1368
- }
1369
- export { ServiceLocatorAbstractFactoryContext }
1370
- export { ServiceLocatorAbstractFactoryContext as ServiceLocatorAbstractFactoryContext_alias_1 }
1371
- export { ServiceLocatorAbstractFactoryContext as ServiceLocatorAbstractFactoryContext_alias_2 }
1372
-
1373
- declare class ServiceLocatorEventBus {
1374
- private readonly logger;
1375
- private listeners;
1376
- constructor(logger?: Console | null);
1377
- on<Event extends string | `pre:${string}` | `post:${string}`>(ns: string, event: Event, listener: (event: Event) => void): () => void;
1378
- emit(key: string, event: string): Promise<PromiseSettledResult<any>[] | undefined>;
1379
- }
1217
+
1380
1218
  export { ServiceLocatorEventBus }
1381
- export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_1 }
1382
- export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_2 }
1383
1219
 
1384
- declare type ServiceLocatorInstanceDestroyListener = () => void | Promise<void>;
1385
1220
  export { ServiceLocatorInstanceDestroyListener }
1386
- export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_1 }
1387
- export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_2 }
1388
1221
 
1389
- declare type ServiceLocatorInstanceEffect = () => void;
1390
1222
  export { ServiceLocatorInstanceEffect }
1391
- export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_1 }
1392
- export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_2 }
1393
1223
 
1394
- declare type ServiceLocatorInstanceHolder<Instance = unknown> = ServiceLocatorInstanceHolderCreating<Instance> | ServiceLocatorInstanceHolderCreated<Instance> | ServiceLocatorInstanceHolderDestroying<Instance>;
1395
1224
  export { ServiceLocatorInstanceHolder }
1396
- export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_1 }
1397
- export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_2 }
1398
-
1399
- declare interface ServiceLocatorInstanceHolderCreated<Instance> {
1400
- status: ServiceLocatorInstanceHolderStatus.Created;
1401
- name: string;
1402
- instance: Instance;
1403
- creationPromise: null;
1404
- destroyPromise: null;
1405
- kind: ServiceLocatorInstanceHolderKind;
1406
- effects: ServiceLocatorInstanceEffect[];
1407
- deps: string[];
1408
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1409
- createdAt: number;
1410
- ttl: number;
1411
- }
1225
+
1412
1226
  export { ServiceLocatorInstanceHolderCreated }
1413
- export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_1 }
1414
- export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_2 }
1415
-
1416
- declare interface ServiceLocatorInstanceHolderCreating<Instance> {
1417
- status: ServiceLocatorInstanceHolderStatus.Creating;
1418
- name: string;
1419
- instance: null;
1420
- creationPromise: Promise<[undefined, Instance]> | null;
1421
- destroyPromise: null;
1422
- kind: ServiceLocatorInstanceHolderKind;
1423
- effects: ServiceLocatorInstanceEffect[];
1424
- deps: string[];
1425
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1426
- createdAt: number;
1427
- ttl: number;
1428
- }
1227
+
1429
1228
  export { ServiceLocatorInstanceHolderCreating }
1430
- export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_1 }
1431
- export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_2 }
1432
-
1433
- declare interface ServiceLocatorInstanceHolderDestroying<Instance> {
1434
- status: ServiceLocatorInstanceHolderStatus.Destroying;
1435
- name: string;
1436
- instance: Instance | null;
1437
- creationPromise: null;
1438
- destroyPromise: Promise<void>;
1439
- kind: ServiceLocatorInstanceHolderKind;
1440
- effects: ServiceLocatorInstanceEffect[];
1441
- deps: string[];
1442
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1443
- createdAt: number;
1444
- ttl: number;
1445
- }
1229
+
1446
1230
  export { ServiceLocatorInstanceHolderDestroying }
1447
- export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_1 }
1448
- export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_2 }
1449
1231
 
1450
- declare enum ServiceLocatorInstanceHolderKind {
1451
- Instance = "instance",
1452
- Factory = "factory",
1453
- AbstractFactory = "abstractFactory"
1454
- }
1455
1232
  export { ServiceLocatorInstanceHolderKind }
1456
- export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_1 }
1457
- export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_2 }
1458
1233
 
1459
- declare enum ServiceLocatorInstanceHolderStatus {
1460
- Created = "created",
1461
- Creating = "creating",
1462
- Destroying = "destroying"
1463
- }
1464
1234
  export { ServiceLocatorInstanceHolderStatus }
1465
- export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_1 }
1466
- export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_2 }
1467
-
1468
- declare class ServiceLocatorManager {
1469
- private readonly logger;
1470
- private readonly instancesHolders;
1471
- constructor(logger?: Console | null);
1472
- get(name: string): [InstanceExpired | InstanceDestroying, ServiceLocatorInstanceHolder] | [InstanceNotFound] | [undefined, ServiceLocatorInstanceHolder];
1473
- set(name: string, holder: ServiceLocatorInstanceHolder): void;
1474
- has(name: string): [InstanceExpired | InstanceDestroying] | [undefined, boolean];
1475
- delete(name: string): boolean;
1476
- filter(predicate: (value: ServiceLocatorInstanceHolder<any>, key: string) => boolean): Map<string, ServiceLocatorInstanceHolder>;
1477
- }
1478
- export { ServiceLocatorManager }
1479
- export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
1480
- export { ServiceLocatorManager as ServiceLocatorManager_alias_2 }
1481
1235
 
1482
- declare function setPromiseCollector(collector: null | ((promise: Promise<any>) => void)): typeof promiseCollector;
1483
- export { setPromiseCollector }
1484
- export { setPromiseCollector as setPromiseCollector_alias_1 }
1485
- export { setPromiseCollector as setPromiseCollector_alias_2 }
1236
+ export { ServiceLocatorManager }
1486
1237
 
1487
1238
  declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
1488
1239
  config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
@@ -1491,6 +1242,21 @@ export { Stream }
1491
1242
  export { Stream as Stream_alias_1 }
1492
1243
  export { Stream as Stream_alias_2 }
1493
1244
 
1245
+ declare class StreamAdapterService implements HandlerAdapterInterface {
1246
+ hasSchema(handlerMetadata: HandlerMetadata<BaseStreamConfig>): boolean;
1247
+ prepareArguments(handlerMetadata: HandlerMetadata<BaseStreamConfig>): ((target: Record<string, any>, request: FastifyRequest) => void | Promise<void>)[];
1248
+ provideHandler(controller: ClassType, executionContext: ExecutionContext, handlerMetadata: HandlerMetadata<BaseStreamConfig>): (request: FastifyRequest, reply: FastifyReply) => Promise<any>;
1249
+ provideSchema(handlerMetadata: HandlerMetadata<BaseStreamConfig>): Record<string, any>;
1250
+ }
1251
+ export { StreamAdapterService }
1252
+ export { StreamAdapterService as StreamAdapterService_alias_1 }
1253
+ export { StreamAdapterService as StreamAdapterService_alias_2 }
1254
+
1255
+ declare const StreamAdapterToken: InjectionToken<StreamAdapterService, undefined>;
1256
+ export { StreamAdapterToken }
1257
+ export { StreamAdapterToken as StreamAdapterToken_alias_1 }
1258
+ export { StreamAdapterToken as StreamAdapterToken_alias_2 }
1259
+
1494
1260
  declare type StreamParams<EndpointDeclaration extends {
1495
1261
  config: BaseStreamConfig<any, any, any, any>;
1496
1262
  }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends AnyZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, QuerySchema, undefined> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, undefined, undefined>;
@@ -1504,16 +1270,7 @@ export { stripEndSlash as stripEndSlash_alias_1 }
1504
1270
  export { stripEndSlash as stripEndSlash_alias_2 }
1505
1271
  export { stripEndSlash as stripEndSlash_alias_3 }
1506
1272
 
1507
- declare function syncInject<T extends ClassType>(token: T): InstanceType<T>;
1508
-
1509
- declare function syncInject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): T;
1510
-
1511
- declare function syncInject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args: z.input<S>): T;
1512
-
1513
- declare function syncInject<T>(token: InjectionToken<T, undefined>): T;
1514
1273
  export { syncInject }
1515
- export { syncInject as syncInject_alias_1 }
1516
- export { syncInject as syncInject_alias_2 }
1517
1274
 
1518
1275
  declare class UnauthorizedException extends HttpException {
1519
1276
  constructor(message: string | object, error?: Error);
@@ -1522,21 +1279,15 @@ export { UnauthorizedException }
1522
1279
  export { UnauthorizedException as UnauthorizedException_alias_1 }
1523
1280
  export { UnauthorizedException as UnauthorizedException_alias_2 }
1524
1281
 
1525
- declare class UnknownError extends Error {
1526
- code: ErrorsEnum;
1527
- parent?: Error;
1528
- constructor(message: string | Error);
1529
- }
1530
1282
  export { UnknownError }
1531
- export { UnknownError as UnknownError_alias_1 }
1532
- export { UnknownError as UnknownError_alias_2 }
1533
- export { UnknownError as UnknownError_alias_3 }
1534
1283
 
1535
1284
  declare function UseGuards(...guards: (ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>)[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext | ClassDecoratorContext) => T;
1536
1285
  export { UseGuards }
1537
1286
  export { UseGuards as UseGuards_alias_1 }
1538
1287
  export { UseGuards as UseGuards_alias_2 }
1539
1288
 
1289
+ export { wrapSyncInit }
1290
+
1540
1291
  declare const yellow: (text: string) => string;
1541
1292
  export { yellow }
1542
1293
  export { yellow as yellow_alias_1 }