@navios/core 0.1.15 → 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 (64) hide show
  1. package/dist/_tsup-dts-rollup.d.mts +98 -422
  2. package/dist/_tsup-dts-rollup.d.ts +98 -422
  3. package/dist/index.d.mts +54 -44
  4. package/dist/index.d.ts +54 -44
  5. package/dist/index.js +111 -1023
  6. package/dist/index.mjs +113 -982
  7. package/package.json +3 -2
  8. package/src/adapters/endpoint-adapter.service.mts +3 -6
  9. package/src/adapters/handler-adapter.interface.mts +1 -1
  10. package/src/adapters/multipart-adapter.service.mts +2 -1
  11. package/src/adapters/stream-adapter.service.mts +3 -7
  12. package/src/attribute.factory.mts +1 -1
  13. package/src/config/config.provider.mts +8 -10
  14. package/src/decorators/controller.decorator.mts +3 -6
  15. package/src/decorators/module.decorator.mts +3 -6
  16. package/src/decorators/use-guards.decorator.mts +3 -2
  17. package/src/index.mts +1 -1
  18. package/src/logger/console-logger.service.mts +3 -2
  19. package/src/logger/logger.factory.mts +4 -5
  20. package/src/logger/logger.service.mts +2 -1
  21. package/src/metadata/controller.metadata.mts +3 -2
  22. package/src/metadata/handler.metadata.mts +1 -4
  23. package/src/metadata/index.mts +0 -1
  24. package/src/metadata/module.metadata.mts +3 -2
  25. package/src/navios.application.mts +9 -8
  26. package/src/navios.factory.mts +4 -2
  27. package/src/services/controller-adapter.service.mts +13 -12
  28. package/src/services/guard-runner.service.mts +4 -6
  29. package/src/services/module-loader.service.mts +4 -2
  30. package/src/tokens/application.token.mts +1 -1
  31. package/src/tokens/execution-context.token.mts +2 -1
  32. package/src/tokens/reply.token.mts +1 -1
  33. package/src/tokens/request.token.mts +1 -1
  34. package/src/metadata/injectable.metadata.mts +0 -11
  35. package/src/service-locator/__tests__/injectable.spec.mts +0 -171
  36. package/src/service-locator/__tests__/injection-token.spec.mts +0 -129
  37. package/src/service-locator/decorators/get-injectable-token.mts +0 -19
  38. package/src/service-locator/decorators/index.mts +0 -2
  39. package/src/service-locator/decorators/injectable.decorator.mts +0 -113
  40. package/src/service-locator/enums/index.mts +0 -1
  41. package/src/service-locator/enums/injectable-scope.enum.mts +0 -10
  42. package/src/service-locator/errors/errors.enum.mts +0 -8
  43. package/src/service-locator/errors/factory-not-found.mts +0 -8
  44. package/src/service-locator/errors/factory-token-not-resolved.mts +0 -10
  45. package/src/service-locator/errors/index.mts +0 -7
  46. package/src/service-locator/errors/instance-destroying.mts +0 -8
  47. package/src/service-locator/errors/instance-expired.mts +0 -8
  48. package/src/service-locator/errors/instance-not-found.mts +0 -8
  49. package/src/service-locator/errors/unknown-error.mts +0 -15
  50. package/src/service-locator/event-emitter.mts +0 -107
  51. package/src/service-locator/index.mts +0 -15
  52. package/src/service-locator/inject.mts +0 -42
  53. package/src/service-locator/injection-token.mts +0 -92
  54. package/src/service-locator/injector.mts +0 -18
  55. package/src/service-locator/interfaces/factory.interface.mts +0 -11
  56. package/src/service-locator/override.mts +0 -22
  57. package/src/service-locator/proxy-service-locator.mts +0 -99
  58. package/src/service-locator/resolve-service.mts +0 -46
  59. package/src/service-locator/service-locator-abstract-factory-context.mts +0 -23
  60. package/src/service-locator/service-locator-event-bus.mts +0 -96
  61. package/src/service-locator/service-locator-instance-holder.mts +0 -63
  62. package/src/service-locator/service-locator-manager.mts +0 -89
  63. package/src/service-locator/service-locator.mts +0 -535
  64. package/src/service-locator/sync-injector.mts +0 -66
@@ -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;
@@ -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;
@@ -414,6 +448,8 @@ export { ControllerOptions }
414
448
  export { ControllerOptions as ControllerOptions_alias_1 }
415
449
  export { ControllerOptions as ControllerOptions_alias_2 }
416
450
 
451
+ export { CreateInjectorsOptions }
452
+
417
453
  declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
418
454
  config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
419
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>>;
@@ -466,56 +502,17 @@ export { envString as envString_alias_1 }
466
502
  export { envString as envString_alias_2 }
467
503
  export { envString as envString_alias_3 }
468
504
 
469
- declare enum ErrorsEnum {
470
- InstanceExpired = "InstanceExpired",
471
- InstanceNotFound = "InstanceNotFound",
472
- InstanceDestroying = "InstanceDestroying",
473
- UnknownError = "UnknownError",
474
- FactoryNotFound = "FactoryNotFound",
475
- FactoryTokenNotResolved = "FactoryTokenNotResolved"
476
- }
477
505
  export { ErrorsEnum }
478
- export { ErrorsEnum as ErrorsEnum_alias_1 }
479
- export { ErrorsEnum as ErrorsEnum_alias_2 }
480
- export { ErrorsEnum as ErrorsEnum_alias_3 }
481
-
482
- declare class EventEmitter<Events extends EventsConfig = {}> implements EventEmitterInterface<Events> {
483
- private listeners;
484
- on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
485
- off<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): void;
486
- once<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
487
- emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): Promise<any>;
488
- addChannel<E extends EventsNames<Events>, Ns extends string, Emitter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emitter): () => void;
489
- }
506
+
490
507
  export { EventEmitter }
491
- export { EventEmitter as EventEmitter_alias_1 }
492
- export { EventEmitter as EventEmitter_alias_2 }
493
508
 
494
- declare interface EventEmitterInterface<Events extends EventsConfig> {
495
- on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
496
- emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): void;
497
- addChannel<E extends EventsNames<Events>, Ns extends string, Emmiter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emmiter): () => void;
498
- }
499
509
  export { EventEmitterInterface }
500
- export { EventEmitterInterface as EventEmitterInterface_alias_1 }
501
- export { EventEmitterInterface as EventEmitterInterface_alias_2 }
502
510
 
503
- declare type EventsArgs<Events extends EventsConfig, Name extends EventsNames<Events>> = Events[Name] extends any[] ? Events[Name] : [];
504
511
  export { EventsArgs }
505
- export { EventsArgs as EventsArgs_alias_1 }
506
- export { EventsArgs as EventsArgs_alias_2 }
507
512
 
508
- declare type EventsConfig = {
509
- [event: string]: any[];
510
- };
511
513
  export { EventsConfig }
512
- export { EventsConfig as EventsConfig_alias_1 }
513
- export { EventsConfig as EventsConfig_alias_2 }
514
514
 
515
- declare type EventsNames<Events extends EventsConfig> = Exclude<keyof Events, symbol | number>;
516
515
  export { EventsNames }
517
- export { EventsNames as EventsNames_alias_1 }
518
- export { EventsNames as EventsNames_alias_2 }
519
516
 
520
517
  declare type ExcludedKeys = 'computedTimeRates' | 'aiModelsRates' | 'aiModel';
521
518
 
@@ -560,44 +557,19 @@ export { extractModuleMetadata }
560
557
  export { extractModuleMetadata as extractModuleMetadata_alias_1 }
561
558
  export { extractModuleMetadata as extractModuleMetadata_alias_2 }
562
559
 
563
- export declare interface Factory<T> {
564
- create(ctx?: any): Promise<T> | T;
565
- }
560
+ export { Factory }
561
+
562
+ export { FactoryContext }
566
563
 
567
- declare class FactoryInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> extends InjectionToken<T, S> {
568
- readonly token: InjectionToken<T, S>;
569
- readonly factory: () => Promise<z.input<S>>;
570
- value?: z.input<S>;
571
- resolved: boolean;
572
- constructor(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>);
573
- resolve(): Promise<z.input<S>>;
574
- }
575
564
  export { FactoryInjectionToken }
576
- export { FactoryInjectionToken as FactoryInjectionToken_alias_1 }
577
- export { FactoryInjectionToken as FactoryInjectionToken_alias_2 }
578
565
 
579
- declare class FactoryNotFound extends Error {
580
- name: string;
581
- code: ErrorsEnum;
582
- constructor(name: string);
583
- }
584
566
  export { FactoryNotFound }
585
- export { FactoryNotFound as FactoryNotFound_alias_1 }
586
- export { FactoryNotFound as FactoryNotFound_alias_2 }
587
- export { FactoryNotFound as FactoryNotFound_alias_3 }
588
567
 
589
- declare class FactoryTokenNotResolved extends Error {
590
- code: ErrorsEnum;
591
- constructor(name: string | symbol | ClassType);
592
- }
568
+ export { FactoryRecord }
569
+
593
570
  export { FactoryTokenNotResolved }
594
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_1 }
595
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_2 }
596
- export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_3 }
597
571
 
598
- export declare interface FactoryWithArgs<T, A extends AnyZodObject> {
599
- create(ctx: any, args: z.output<A>): Promise<T> | T;
600
- }
572
+ export { FactoryWithArgs }
601
573
 
602
574
  /**
603
575
  * @publicApi
@@ -630,23 +602,18 @@ export { getEndpointMetadata }
630
602
  export { getEndpointMetadata as getEndpointMetadata_alias_1 }
631
603
  export { getEndpointMetadata as getEndpointMetadata_alias_2 }
632
604
 
633
- declare function getInjectableToken<R>(target: ClassType): R extends {
634
- create(...args: any[]): infer V;
635
- } ? InjectionToken<V> : InjectionToken<R>;
605
+ export { getGlobalServiceLocator }
606
+
636
607
  export { getInjectableToken }
637
- export { getInjectableToken as getInjectableToken_alias_1 }
638
- export { getInjectableToken as getInjectableToken_alias_2 }
639
- export { getInjectableToken as getInjectableToken_alias_3 }
608
+
609
+ export { getInjectors }
640
610
 
641
611
  declare function getModuleMetadata(target: ClassType, context: ClassDecoratorContext): ModuleMetadata;
642
612
  export { getModuleMetadata }
643
613
  export { getModuleMetadata as getModuleMetadata_alias_1 }
644
614
  export { getModuleMetadata as getModuleMetadata_alias_2 }
645
615
 
646
- declare function getServiceLocator(): ServiceLocator;
647
- export { getServiceLocator }
648
- export { getServiceLocator as getServiceLocator_alias_1 }
649
- export { getServiceLocator as getServiceLocator_alias_2 }
616
+ export { globalRegistry }
650
617
 
651
618
  declare class GuardRunnerService {
652
619
  runGuards(allGuards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>, executionContext: ExecutionContext): Promise<boolean>;
@@ -711,150 +678,31 @@ export { HttpException }
711
678
  export { HttpException as HttpException_alias_1 }
712
679
  export { HttpException as HttpException_alias_2 }
713
680
 
714
- declare function inject<T extends ClassType>(token: T): Promise<InstanceType<T>>;
715
-
716
- declare function inject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): Promise<T>;
717
-
718
- declare function inject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args?: z.input<S>): Promise<T>;
719
-
720
- declare function inject<T>(token: InjectionToken<T, undefined>): Promise<T>;
721
681
  export { inject }
722
- export { inject as inject_alias_1 }
723
- export { inject as inject_alias_2 }
724
682
 
725
- declare function Injectable(): <T extends ClassType>(target: T, context: ClassDecoratorContext) => T & {
726
- [InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
727
- };
728
-
729
- declare function Injectable<T extends ClassType>(options: {
730
- scope?: InjectableScope;
731
- token: InjectionToken<T, undefined>;
732
- }): (target: T, context: ClassDecoratorContext) => T & {
733
- [InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
734
- };
735
-
736
- declare function Injectable<R>(options: {
737
- scope?: InjectableScope;
738
- type: InjectableType.Factory;
739
- }): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
740
- [InjectableTokenMeta]: InjectionToken<R, undefined>;
741
- };
742
-
743
- declare function Injectable<R, S extends AnyZodObject>(options: {
744
- scope?: InjectableScope;
745
- type: InjectableType.Factory;
746
- token: InjectionToken<R, S>;
747
- }): <T extends ClassTypeWithInstance<FactoryWithArgs<R, S>>>(target: T, context: ClassDecoratorContext) => T & {
748
- [InjectableTokenMeta]: InjectionToken<R, S>;
749
- };
750
-
751
- declare function Injectable<R>(options: {
752
- scope?: InjectableScope;
753
- type: InjectableType.Factory;
754
- token: InjectionToken<R, undefined>;
755
- }): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
756
- [InjectableTokenMeta]: InjectionToken<R, undefined>;
757
- };
758
683
  export { Injectable }
759
- export { Injectable as Injectable_alias_1 }
760
- export { Injectable as Injectable_alias_2 }
761
- export { Injectable as Injectable_alias_3 }
762
-
763
- declare interface InjectableMetadata<Instance = any, Schema = any> {
764
- type: InjectableType;
765
- scope: InjectableScope;
766
- token: InjectionToken<Instance, Schema>;
767
- }
768
- export { InjectableMetadata }
769
- export { InjectableMetadata as InjectableMetadata_alias_1 }
770
- export { InjectableMetadata as InjectableMetadata_alias_2 }
771
-
772
- declare interface InjectableOptions {
773
- scope?: InjectableScope;
774
- type?: InjectableType;
775
- token?: InjectionToken<any, any>;
776
- }
684
+
777
685
  export { InjectableOptions }
778
- export { InjectableOptions as InjectableOptions_alias_1 }
779
- export { InjectableOptions as InjectableOptions_alias_2 }
780
- export { InjectableOptions as InjectableOptions_alias_3 }
781
686
 
782
- declare enum InjectableScope {
783
- /**
784
- * Singleton scope: The instance is created once and shared across the application.
785
- */
786
- Singleton = "Singleton",
787
- /**
788
- * Instance scope: A new instance is created for each injection.
789
- */
790
- Instance = "Instance"
791
- }
792
687
  export { InjectableScope }
793
- export { InjectableScope as InjectableScope_alias_1 }
794
- export { InjectableScope as InjectableScope_alias_2 }
795
- export { InjectableScope as InjectableScope_alias_3 }
796
688
 
797
- declare const InjectableTokenMeta: unique symbol;
798
689
  export { InjectableTokenMeta }
799
- export { InjectableTokenMeta as InjectableTokenMeta_alias_1 }
800
- export { InjectableTokenMeta as InjectableTokenMeta_alias_2 }
801
- export { InjectableTokenMeta as InjectableTokenMeta_alias_3 }
802
690
 
803
- declare enum InjectableType {
804
- Class = "Class",
805
- Factory = "Factory"
806
- }
807
691
  export { InjectableType }
808
- export { InjectableType as InjectableType_alias_1 }
809
- export { InjectableType as InjectableType_alias_2 }
810
- export { InjectableType as InjectableType_alias_3 }
811
-
812
- declare class InjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject> | unknown = unknown> {
813
- readonly name: string | symbol | ClassType;
814
- readonly schema: AnyZodObject | undefined;
815
- id: `${string}-${string}-${string}-${string}-${string}`;
816
- constructor(name: string | symbol | ClassType, schema: AnyZodObject | undefined);
817
- static create<T extends ClassType>(name: T): InjectionToken<InstanceType<T>, undefined>;
818
- static create<T extends ClassType, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: T, schema: Schema): InjectionToken<InstanceType<T>, Schema>;
819
- static create<T>(name: string | symbol): InjectionToken<T, undefined>;
820
- static create<T, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: string | any, schema: Schema): InjectionToken<T, Schema>;
821
- static bound<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, value: z.input<S>): BoundInjectionToken<T, S>;
822
- static factory<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>): FactoryInjectionToken<T, S>;
823
- static refineType<T>(token: BoundInjectionToken<any, any>): BoundInjectionToken<T, any>;
824
- }
692
+
693
+ export { InjectionFactory }
694
+
825
695
  export { InjectionToken }
826
- export { InjectionToken as InjectionToken_alias_1 }
827
- export { InjectionToken as InjectionToken_alias_2 }
828
696
 
829
- declare class InstanceDestroying extends Error {
830
- name: string;
831
- code: ErrorsEnum;
832
- constructor(name: string);
833
- }
697
+ export { Injectors }
698
+
699
+ export { InjectorsBase }
700
+
834
701
  export { InstanceDestroying }
835
- export { InstanceDestroying as InstanceDestroying_alias_1 }
836
- export { InstanceDestroying as InstanceDestroying_alias_2 }
837
- export { InstanceDestroying as InstanceDestroying_alias_3 }
838
-
839
- declare class InstanceExpired extends Error {
840
- name: string;
841
- code: ErrorsEnum;
842
- constructor(name: string);
843
- }
702
+
844
703
  export { InstanceExpired }
845
- export { InstanceExpired as InstanceExpired_alias_1 }
846
- export { InstanceExpired as InstanceExpired_alias_2 }
847
- export { InstanceExpired as InstanceExpired_alias_3 }
848
-
849
- declare class InstanceNotFound extends Error {
850
- name: string;
851
- code: ErrorsEnum;
852
- constructor(name: string);
853
- }
704
+
854
705
  export { InstanceNotFound }
855
- export { InstanceNotFound as InstanceNotFound_alias_1 }
856
- export { InstanceNotFound as InstanceNotFound_alias_2 }
857
- export { InstanceNotFound as InstanceNotFound_alias_3 }
858
706
 
859
707
  declare class InternalServerErrorException extends HttpException {
860
708
  constructor(message: string | object, error?: Error);
@@ -1146,7 +994,7 @@ export { LogLevel }
1146
994
  export { LogLevel as LogLevel_alias_1 }
1147
995
  export { LogLevel as LogLevel_alias_2 }
1148
996
 
1149
- export declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: ServiceLocatorAbstractFactoryContext): ServiceLocator;
997
+ export { makeProxyServiceLocator }
1150
998
 
1151
999
  declare function Module({ controllers, imports, guards }?: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => any;
1152
1000
  export { Module }
@@ -1299,15 +1147,6 @@ export { NotFoundException }
1299
1147
  export { NotFoundException as NotFoundException_alias_1 }
1300
1148
  export { NotFoundException as NotFoundException_alias_2 }
1301
1149
 
1302
- /**
1303
- * Useful for tests or when you want to override a service
1304
- * with a different implementation.
1305
- */
1306
- declare function override<T>(token: InjectionToken<T>, target: ClassType): () => void;
1307
- export { override }
1308
- export { override as override_alias_1 }
1309
- export { override as override_alias_2 }
1310
-
1311
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;
1312
1151
  export { Path }
1313
1152
  export { Path as Path_alias_1 }
@@ -1345,32 +1184,22 @@ export { PinoWrapper }
1345
1184
  export { PinoWrapper as PinoWrapper_alias_1 }
1346
1185
  export { PinoWrapper as PinoWrapper_alias_2 }
1347
1186
 
1348
- declare let promiseCollector: null | ((promise: Promise<any>) => void);
1349
-
1350
- 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
+ }>>;
1351
1194
  export { provideConfig }
1352
1195
  export { provideConfig as provideConfig_alias_1 }
1353
1196
  export { provideConfig as provideConfig_alias_2 }
1354
1197
 
1355
- declare function provideServiceLocator(locator: ServiceLocator): ServiceLocator;
1356
1198
  export { provideServiceLocator }
1357
- export { provideServiceLocator as provideServiceLocator_alias_1 }
1358
- export { provideServiceLocator as provideServiceLocator_alias_2 }
1359
-
1360
- export declare class ProxyServiceLocator implements ServiceLocator {
1361
- private readonly serviceLocator;
1362
- private readonly ctx;
1363
- constructor(serviceLocator: ServiceLocator, ctx: ServiceLocatorAbstractFactoryContext);
1364
- get abstractFactories(): Map<InjectionToken<any, any>, (ctx: ServiceLocatorAbstractFactoryContext, args: any) => Promise<any>>;
1365
- getEventBus(): ServiceLocatorEventBus;
1366
- registerAbstractFactory<Instance, Schema extends AnyZodObject | undefined>(token: InjectionToken<Instance, Schema>, factory: (ctx: ServiceLocatorAbstractFactoryContext, values: Schema extends AnyZodObject ? output<Schema> : undefined) => Promise<Instance>): void;
1367
- 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]>;
1368
- 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>;
1369
- 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;
1370
- invalidate(service: string, round?: number): Promise<any>;
1371
- ready(): Promise<null>;
1372
- makeInstanceName(token: InjectionToken<any, any>, args: any): string;
1373
- }
1199
+
1200
+ export { ProxyServiceLocator }
1201
+
1202
+ export { Registry }
1374
1203
 
1375
1204
  declare const Reply: InjectionToken<FastifyReply<RouteGenericInterface, RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, unknown, FastifySchema, FastifyTypeProviderDefault, unknown>, undefined>;
1376
1205
  export { Reply }
@@ -1382,167 +1211,29 @@ export { Request_2 as Request }
1382
1211
  export { Request_2 as Request_alias_1 }
1383
1212
  export { Request_2 as Request_alias_2 }
1384
1213
 
1385
- declare function resolveService<T extends ClassType>(ctx: ServiceLocatorAbstractFactoryContext, target: T, args?: any[]): Promise<InstanceType<T>>;
1386
1214
  export { resolveService }
1387
- export { resolveService as resolveService_alias_1 }
1388
- export { resolveService as resolveService_alias_2 }
1389
-
1390
- declare class ServiceLocator {
1391
- private readonly logger;
1392
- private abstractFactories;
1393
- private instanceFactories;
1394
- private readonly eventBus;
1395
- private readonly manager;
1396
- constructor(logger?: Console | null);
1397
- getEventBus(): ServiceLocatorEventBus;
1398
- registerInstance<Instance>(token: InjectionToken<Instance, undefined>, instance: Instance): void;
1399
- removeInstance<Instance>(token: InjectionToken<Instance, undefined>): Promise<any>;
1400
- 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;
1401
- private resolveTokenArgs;
1402
- 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;
1403
- 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]>;
1404
- 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>;
1405
- private notifyListeners;
1406
- private createInstance;
1407
- private createInstanceFromAbstractFactory;
1408
- private createContextForAbstractFactory;
1409
- 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;
1410
- invalidate(service: string, round?: number): Promise<any>;
1411
- ready(): Promise<null>;
1412
- makeInstanceName(token: InjectionToken<any, any>, args: any): string;
1413
- }
1215
+
1414
1216
  export { ServiceLocator }
1415
- export { ServiceLocator as ServiceLocator_alias_1 }
1416
- export { ServiceLocator as ServiceLocator_alias_2 }
1417
-
1418
- declare interface ServiceLocatorAbstractFactoryContext {
1419
- inject: typeof inject;
1420
- addDependency: ((token: InjectionToken<any, undefined>) => void) | (<S extends AnyZodObject>(token: InjectionToken<any, S>, args: z.input<S>) => void);
1421
- on: ServiceLocatorEventBus['on'];
1422
- getDependencies: () => string[];
1423
- invalidate: () => void;
1424
- addEffect: (listener: () => void) => void;
1425
- getDestroyListeners: () => (() => void)[];
1426
- setTtl: (ttl: number) => void;
1427
- getTtl: () => number;
1428
- }
1429
- export { ServiceLocatorAbstractFactoryContext }
1430
- export { ServiceLocatorAbstractFactoryContext as ServiceLocatorAbstractFactoryContext_alias_1 }
1431
- export { ServiceLocatorAbstractFactoryContext as ServiceLocatorAbstractFactoryContext_alias_2 }
1432
-
1433
- declare class ServiceLocatorEventBus {
1434
- private readonly logger;
1435
- private listeners;
1436
- constructor(logger?: Console | null);
1437
- on<Event extends string | `pre:${string}` | `post:${string}`>(ns: string, event: Event, listener: (event: Event) => void): () => void;
1438
- emit(key: string, event: string): Promise<PromiseSettledResult<any>[] | undefined>;
1439
- }
1217
+
1440
1218
  export { ServiceLocatorEventBus }
1441
- export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_1 }
1442
- export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_2 }
1443
1219
 
1444
- declare type ServiceLocatorInstanceDestroyListener = () => void | Promise<void>;
1445
1220
  export { ServiceLocatorInstanceDestroyListener }
1446
- export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_1 }
1447
- export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_2 }
1448
1221
 
1449
- declare type ServiceLocatorInstanceEffect = () => void;
1450
1222
  export { ServiceLocatorInstanceEffect }
1451
- export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_1 }
1452
- export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_2 }
1453
1223
 
1454
- declare type ServiceLocatorInstanceHolder<Instance = unknown> = ServiceLocatorInstanceHolderCreating<Instance> | ServiceLocatorInstanceHolderCreated<Instance> | ServiceLocatorInstanceHolderDestroying<Instance>;
1455
1224
  export { ServiceLocatorInstanceHolder }
1456
- export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_1 }
1457
- export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_2 }
1458
-
1459
- declare interface ServiceLocatorInstanceHolderCreated<Instance> {
1460
- status: ServiceLocatorInstanceHolderStatus.Created;
1461
- name: string;
1462
- instance: Instance;
1463
- creationPromise: null;
1464
- destroyPromise: null;
1465
- kind: ServiceLocatorInstanceHolderKind;
1466
- effects: ServiceLocatorInstanceEffect[];
1467
- deps: string[];
1468
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1469
- createdAt: number;
1470
- ttl: number;
1471
- }
1225
+
1472
1226
  export { ServiceLocatorInstanceHolderCreated }
1473
- export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_1 }
1474
- export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_2 }
1475
-
1476
- declare interface ServiceLocatorInstanceHolderCreating<Instance> {
1477
- status: ServiceLocatorInstanceHolderStatus.Creating;
1478
- name: string;
1479
- instance: null;
1480
- creationPromise: Promise<[undefined, Instance]> | null;
1481
- destroyPromise: null;
1482
- kind: ServiceLocatorInstanceHolderKind;
1483
- effects: ServiceLocatorInstanceEffect[];
1484
- deps: string[];
1485
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1486
- createdAt: number;
1487
- ttl: number;
1488
- }
1227
+
1489
1228
  export { ServiceLocatorInstanceHolderCreating }
1490
- export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_1 }
1491
- export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_2 }
1492
-
1493
- declare interface ServiceLocatorInstanceHolderDestroying<Instance> {
1494
- status: ServiceLocatorInstanceHolderStatus.Destroying;
1495
- name: string;
1496
- instance: Instance | null;
1497
- creationPromise: null;
1498
- destroyPromise: Promise<void>;
1499
- kind: ServiceLocatorInstanceHolderKind;
1500
- effects: ServiceLocatorInstanceEffect[];
1501
- deps: string[];
1502
- destroyListeners: ServiceLocatorInstanceDestroyListener[];
1503
- createdAt: number;
1504
- ttl: number;
1505
- }
1229
+
1506
1230
  export { ServiceLocatorInstanceHolderDestroying }
1507
- export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_1 }
1508
- export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_2 }
1509
1231
 
1510
- declare enum ServiceLocatorInstanceHolderKind {
1511
- Instance = "instance",
1512
- Factory = "factory",
1513
- AbstractFactory = "abstractFactory"
1514
- }
1515
1232
  export { ServiceLocatorInstanceHolderKind }
1516
- export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_1 }
1517
- export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_2 }
1518
1233
 
1519
- declare enum ServiceLocatorInstanceHolderStatus {
1520
- Created = "created",
1521
- Creating = "creating",
1522
- Destroying = "destroying"
1523
- }
1524
1234
  export { ServiceLocatorInstanceHolderStatus }
1525
- export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_1 }
1526
- export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_2 }
1527
-
1528
- declare class ServiceLocatorManager {
1529
- private readonly logger;
1530
- private readonly instancesHolders;
1531
- constructor(logger?: Console | null);
1532
- get(name: string): [InstanceExpired | InstanceDestroying, ServiceLocatorInstanceHolder] | [InstanceNotFound] | [undefined, ServiceLocatorInstanceHolder];
1533
- set(name: string, holder: ServiceLocatorInstanceHolder): void;
1534
- has(name: string): [InstanceExpired | InstanceDestroying] | [undefined, boolean];
1535
- delete(name: string): boolean;
1536
- filter(predicate: (value: ServiceLocatorInstanceHolder<any>, key: string) => boolean): Map<string, ServiceLocatorInstanceHolder>;
1537
- }
1538
- export { ServiceLocatorManager }
1539
- export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
1540
- export { ServiceLocatorManager as ServiceLocatorManager_alias_2 }
1541
1235
 
1542
- declare function setPromiseCollector(collector: null | ((promise: Promise<any>) => void)): typeof promiseCollector;
1543
- export { setPromiseCollector }
1544
- export { setPromiseCollector as setPromiseCollector_alias_1 }
1545
- export { setPromiseCollector as setPromiseCollector_alias_2 }
1236
+ export { ServiceLocatorManager }
1546
1237
 
1547
1238
  declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
1548
1239
  config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
@@ -1579,16 +1270,7 @@ export { stripEndSlash as stripEndSlash_alias_1 }
1579
1270
  export { stripEndSlash as stripEndSlash_alias_2 }
1580
1271
  export { stripEndSlash as stripEndSlash_alias_3 }
1581
1272
 
1582
- declare function syncInject<T extends ClassType>(token: T): InstanceType<T>;
1583
-
1584
- declare function syncInject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): T;
1585
-
1586
- declare function syncInject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args: z.input<S>): T;
1587
-
1588
- declare function syncInject<T>(token: InjectionToken<T, undefined>): T;
1589
1273
  export { syncInject }
1590
- export { syncInject as syncInject_alias_1 }
1591
- export { syncInject as syncInject_alias_2 }
1592
1274
 
1593
1275
  declare class UnauthorizedException extends HttpException {
1594
1276
  constructor(message: string | object, error?: Error);
@@ -1597,21 +1279,15 @@ export { UnauthorizedException }
1597
1279
  export { UnauthorizedException as UnauthorizedException_alias_1 }
1598
1280
  export { UnauthorizedException as UnauthorizedException_alias_2 }
1599
1281
 
1600
- declare class UnknownError extends Error {
1601
- code: ErrorsEnum;
1602
- parent?: Error;
1603
- constructor(message: string | Error);
1604
- }
1605
1282
  export { UnknownError }
1606
- export { UnknownError as UnknownError_alias_1 }
1607
- export { UnknownError as UnknownError_alias_2 }
1608
- export { UnknownError as UnknownError_alias_3 }
1609
1283
 
1610
1284
  declare function UseGuards(...guards: (ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>)[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext | ClassDecoratorContext) => T;
1611
1285
  export { UseGuards }
1612
1286
  export { UseGuards as UseGuards_alias_1 }
1613
1287
  export { UseGuards as UseGuards_alias_2 }
1614
1288
 
1289
+ export { wrapSyncInit }
1290
+
1615
1291
  declare const yellow: (text: string) => string;
1616
1292
  export { yellow }
1617
1293
  export { yellow as yellow_alias_1 }