@midwayjs/core 3.19.0 → 4.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/baseFramework.d.ts +7 -35
  2. package/dist/baseFramework.js +10 -52
  3. package/dist/common/applicationManager.d.ts +6 -6
  4. package/dist/common/applicationManager.js +18 -35
  5. package/dist/common/asyncContextManager.d.ts +15 -0
  6. package/dist/common/asyncContextManager.js +51 -2
  7. package/dist/common/dataListener.js +1 -1
  8. package/dist/common/dataSourceManager.js +3 -4
  9. package/dist/common/fileDetector.d.ts +9 -9
  10. package/dist/common/fileDetector.js +30 -28
  11. package/dist/common/filterManager.js +5 -4
  12. package/dist/common/guardManager.js +3 -2
  13. package/dist/common/middlewareManager.js +4 -3
  14. package/dist/common/performanceManager.js +1 -1
  15. package/dist/common/priorityManager.js +2 -2
  16. package/dist/common/serviceFactory.js +1 -1
  17. package/dist/common/webGenerator.js +4 -6
  18. package/dist/config/config.default.js +1 -1
  19. package/dist/constants.d.ts +2 -32
  20. package/dist/constants.js +3 -33
  21. package/dist/context/componentLoader.d.ts +20 -0
  22. package/dist/context/componentLoader.js +193 -0
  23. package/dist/context/container.d.ts +14 -29
  24. package/dist/context/container.js +68 -306
  25. package/dist/context/definitionRegistry.d.ts +3 -0
  26. package/dist/context/definitionRegistry.js +8 -15
  27. package/dist/context/managedResolverFactory.d.ts +15 -40
  28. package/dist/context/managedResolverFactory.js +263 -348
  29. package/dist/context/requestContainer.d.ts +22 -12
  30. package/dist/context/requestContainer.js +43 -51
  31. package/dist/decorator/common/aspect.js +4 -4
  32. package/dist/decorator/common/autoload.js +1 -1
  33. package/dist/decorator/common/configuration.d.ts +1 -24
  34. package/dist/decorator/common/configuration.js +6 -1
  35. package/dist/decorator/common/filter.js +6 -6
  36. package/dist/decorator/common/framework.d.ts +46 -3
  37. package/dist/decorator/common/framework.js +43 -9
  38. package/dist/decorator/common/guard.js +4 -9
  39. package/dist/decorator/common/inject.d.ts +4 -2
  40. package/dist/decorator/common/inject.js +87 -4
  41. package/dist/decorator/common/mock.js +1 -1
  42. package/dist/decorator/common/objectDef.d.ts +0 -5
  43. package/dist/decorator/common/objectDef.js +8 -20
  44. package/dist/decorator/common/provide.d.ts +1 -1
  45. package/dist/decorator/common/provide.js +1 -1
  46. package/dist/decorator/common/scope.d.ts +6 -0
  47. package/dist/decorator/common/scope.js +21 -0
  48. package/dist/decorator/constant.d.ts +14 -17
  49. package/dist/decorator/constant.js +23 -35
  50. package/dist/decorator/decoratorManager.d.ts +21 -294
  51. package/dist/decorator/decoratorManager.js +127 -694
  52. package/dist/decorator/faas/serverlessTrigger.js +5 -5
  53. package/dist/decorator/index.d.ts +2 -3
  54. package/dist/decorator/index.js +6 -4
  55. package/dist/decorator/metadataManager.d.ts +127 -0
  56. package/dist/decorator/metadataManager.js +465 -0
  57. package/dist/decorator/microservice/consumer.js +3 -2
  58. package/dist/decorator/microservice/kafkaListener.js +2 -1
  59. package/dist/decorator/microservice/provider.js +6 -5
  60. package/dist/decorator/microservice/rabbitmqListener.js +2 -1
  61. package/dist/decorator/task/queue.js +3 -2
  62. package/dist/decorator/task/schedule.js +3 -2
  63. package/dist/decorator/task/task.js +4 -3
  64. package/dist/decorator/task/taskLocal.js +4 -3
  65. package/dist/decorator/web/controller.js +3 -2
  66. package/dist/decorator/web/paramMapping.js +2 -2
  67. package/dist/decorator/web/requestMapping.js +5 -5
  68. package/dist/decorator/web/response.js +6 -5
  69. package/dist/decorator/ws/webSocketController.js +3 -2
  70. package/dist/decorator/ws/webSocketEvent.js +7 -6
  71. package/dist/definitions/functionDefinition.d.ts +3 -3
  72. package/dist/definitions/functionDefinition.js +12 -11
  73. package/dist/definitions/objectCreator.d.ts +5 -11
  74. package/dist/definitions/objectCreator.js +3 -27
  75. package/dist/definitions/objectDefinition.d.ts +2 -3
  76. package/dist/definitions/objectDefinition.js +1 -3
  77. package/dist/error/base.js +2 -2
  78. package/dist/error/framework.d.ts +1 -8
  79. package/dist/error/framework.js +9 -25
  80. package/dist/error/http.js +1 -1
  81. package/dist/functional/configuration.d.ts +14 -15
  82. package/dist/functional/configuration.js +37 -47
  83. package/dist/functional/hooks.d.ts +10 -0
  84. package/dist/functional/hooks.js +68 -0
  85. package/dist/functional/index.d.ts +3 -0
  86. package/dist/functional/index.js +22 -0
  87. package/dist/index.d.ts +3 -3
  88. package/dist/index.js +3 -6
  89. package/dist/interface.d.ts +80 -114
  90. package/dist/interface.js +9 -33
  91. package/dist/legacy/constants.d.ts +29 -0
  92. package/dist/legacy/constants.js +33 -0
  93. package/dist/legacy/decorator.d.ts +255 -0
  94. package/dist/legacy/decorator.js +468 -0
  95. package/dist/legacy/index.d.ts +3 -0
  96. package/dist/legacy/index.js +19 -0
  97. package/dist/legacy/types.d.ts +2 -0
  98. package/dist/legacy/types.js +3 -0
  99. package/dist/response/base.d.ts +1 -0
  100. package/dist/response/http.d.ts +1 -0
  101. package/dist/service/aspectService.js +11 -12
  102. package/dist/service/configService.js +2 -2
  103. package/dist/service/decoratorService.d.ts +3 -3
  104. package/dist/service/decoratorService.js +14 -10
  105. package/dist/service/environmentService.js +2 -2
  106. package/dist/service/frameworkService.d.ts +5 -4
  107. package/dist/service/frameworkService.js +30 -28
  108. package/dist/service/healthService.js +4 -4
  109. package/dist/service/informationService.js +3 -4
  110. package/dist/service/lifeCycleService.js +6 -17
  111. package/dist/service/loggerService.js +3 -4
  112. package/dist/service/middlewareService.js +7 -8
  113. package/dist/service/mockService.js +9 -15
  114. package/dist/service/slsFunctionService.d.ts +1 -14
  115. package/dist/service/slsFunctionService.js +33 -81
  116. package/dist/service/webRouterService.js +11 -11
  117. package/dist/setup.d.ts +5 -5
  118. package/dist/setup.js +75 -93
  119. package/dist/util/contextUtil.d.ts +2 -2
  120. package/dist/util/httpclient.d.ts +3 -2
  121. package/dist/util/index.d.ts +14 -0
  122. package/dist/util/index.js +159 -25
  123. package/dist/util/pathFileUtil.d.ts +14 -1
  124. package/dist/util/pathFileUtil.js +27 -6
  125. package/dist/util/webRouterParam.js +2 -2
  126. package/package.json +24 -6
  127. package/dist/decorator/common/pipeline.d.ts +0 -3
  128. package/dist/decorator/common/pipeline.js +0 -12
  129. package/dist/decorator/rpc/hsf.d.ts +0 -13
  130. package/dist/decorator/rpc/hsf.js +0 -20
  131. package/dist/definitions/properties.d.ts +0 -7
  132. package/dist/definitions/properties.js +0 -19
  133. package/dist/service/pipelineService.d.ts +0 -168
  134. package/dist/service/pipelineService.js +0 -254
@@ -1,7 +1,10 @@
1
1
  /// <reference types="node" />
2
- import * as EventEmitter from 'events';
3
2
  import type { AsyncContextManager } from './common/asyncContextManager';
4
3
  import type { LoggerFactory } from './common/loggerFactory';
4
+ import type { ManagedResolverFactory } from './context/managedResolverFactory';
5
+ import type { EventEmitter } from 'events';
6
+ import type { FunctionalConfiguration } from './functional';
7
+ export type ClassType<T = any> = new (...args: any[]) => T;
5
8
  export type PowerPartial<T> = {
6
9
  [U in keyof T]?: T[U] extends {} ? PowerPartial<T[U]> : T[U];
7
10
  };
@@ -41,7 +44,6 @@ export type WithoutFn<T> = {
41
44
  };
42
45
  export type MiddlewareParamArray = Array<string | any>;
43
46
  export type ObjectIdentifier = string | Symbol;
44
- export type GroupModeType = 'one' | 'multi';
45
47
  export declare enum ScopeEnum {
46
48
  Singleton = "Singleton",
47
49
  Request = "Request",
@@ -50,15 +52,24 @@ export declare enum ScopeEnum {
50
52
  export declare enum InjectModeEnum {
51
53
  Identifier = "Identifier",
52
54
  Class = "Class",
53
- PropertyName = "PropertyName"
55
+ SelfName = "SelfName"
54
56
  }
55
57
  /**
56
- * 内部管理的属性、json、ref等解析实例存储
58
+ * Metadata when using @Inject property injection
57
59
  */
58
- export interface IManagedInstance {
59
- type: string;
60
- value?: any;
61
- args?: any;
60
+ export interface PropertyInjectMetadata {
61
+ args: any[];
62
+ id: ObjectIdentifier | (() => ObjectIdentifier | ClassType);
63
+ name: string;
64
+ injectMode: InjectModeEnum;
65
+ targetKey: string;
66
+ isLazyInject: boolean;
67
+ }
68
+ /**
69
+ * Metadata when using @Inject constructor injection
70
+ */
71
+ export interface ConstructorInjectMetadata extends PropertyInjectMetadata {
72
+ parameterIndex: number;
62
73
  }
63
74
  export interface ObjectDefinitionOptions {
64
75
  isAsync?: boolean;
@@ -239,27 +250,6 @@ export declare namespace FaaSMetadata {
239
250
  }
240
251
  export {};
241
252
  }
242
- export declare abstract class FrameworkType {
243
- abstract name: string;
244
- }
245
- export declare class MidwayFrameworkType extends FrameworkType {
246
- name: string;
247
- static WEB: MidwayFrameworkType;
248
- static WEB_KOA: MidwayFrameworkType;
249
- static WEB_EXPRESS: MidwayFrameworkType;
250
- static FAAS: MidwayFrameworkType;
251
- static MS_GRPC: MidwayFrameworkType;
252
- static MS_RABBITMQ: MidwayFrameworkType;
253
- static MS_KAFKA: MidwayFrameworkType;
254
- static WS_IO: MidwayFrameworkType;
255
- static WS: MidwayFrameworkType;
256
- static SERVERLESS_APP: MidwayFrameworkType;
257
- static CUSTOM: MidwayFrameworkType;
258
- static EMPTY: MidwayFrameworkType;
259
- static LIGHT: MidwayFrameworkType;
260
- static TASK: MidwayFrameworkType;
261
- constructor(name: string);
262
- }
263
253
  export declare enum ServerlessTriggerType {
264
254
  EVENT = "event",
265
255
  HTTP = "http",
@@ -293,11 +283,6 @@ export interface IMethodAspect {
293
283
  before?(joinPoint: JoinPoint): void;
294
284
  around?(joinPoint: JoinPoint): any;
295
285
  }
296
- export interface IModuleStore {
297
- listModule(key: string): any;
298
- saveModule(key: string, module: any): any;
299
- transformModule?(moduleMap: Map<string, Set<any>>): any;
300
- }
301
286
  export interface TSDesignType<OriginType = unknown> {
302
287
  name: string;
303
288
  originDesign: OriginType;
@@ -320,6 +305,10 @@ export interface PipeTransform<T = unknown, R = unknown> {
320
305
  }
321
306
  export type PipeTransformFunction<T = any, R = any> = (value: T) => R;
322
307
  export type PipeUnionTransform<T = any, R = any> = PipeTransform<T, R> | (new (...args: any[]) => PipeTransform<T, R>) | PipeTransformFunction<T, R>;
308
+ export interface PropertyDecoratorOptions {
309
+ impl?: boolean;
310
+ allowMulti?: boolean;
311
+ }
323
312
  export interface MethodDecoratorMetaData<Metadata = any> {
324
313
  propertyName: string;
325
314
  /** decorator key */
@@ -362,10 +351,6 @@ export interface ILogger {
362
351
  error(msg: any, ...args: any[]): void;
363
352
  warn(msg: any, ...args: any[]): void;
364
353
  }
365
- /**
366
- * @deprecated
367
- */
368
- export type IMidwayLogger = ILogger;
369
354
  /**
370
355
  * Logger Options for midway, you can merge this interface in package
371
356
  * @example
@@ -445,19 +430,14 @@ export interface ILifeCycle extends Partial<IObjectLifeCycle> {
445
430
  onHealthCheck?(container: IMidwayContainer): Promise<HealthResult>;
446
431
  onStop?(container: IMidwayContainer, mainApp?: IMidwayApplication): Promise<void>;
447
432
  }
448
- export type ObjectContext = {
449
- originName?: string;
450
- };
451
433
  /**
452
434
  * Abstract Object Factory
453
435
  * 对象容器抽象
454
436
  */
455
437
  export interface IObjectFactory {
456
438
  registry: IObjectDefinitionRegistry;
457
- get<T>(identifier: new (...args: any[]) => T, args?: any[], objectContext?: ObjectContext): T;
458
- get<T>(identifier: ObjectIdentifier, args?: any[], objectContext?: ObjectContext): T;
459
- getAsync<T>(identifier: new (...args: any[]) => T, args?: any[], objectContext?: ObjectContext): Promise<T>;
460
- getAsync<T>(identifier: ObjectIdentifier, args?: any[], objectContext?: ObjectContext): Promise<T>;
439
+ get<T>(identifier: ClassType<T> | string, args?: any[]): T;
440
+ getAsync<T>(identifier: ClassType<T> | string, args?: any[]): Promise<T>;
461
441
  }
462
442
  export declare enum ObjectLifeCycleEvent {
463
443
  BEFORE_BIND = "beforeBind",
@@ -510,8 +490,8 @@ export interface IObjectDefinition {
510
490
  path: any;
511
491
  export: string;
512
492
  dependsOn: ObjectIdentifier[];
513
- constructorArgs: IManagedInstance[];
514
- properties: IProperties;
493
+ constructorArgs: ConstructorInjectMetadata[];
494
+ properties: Map<string, PropertyInjectMetadata>;
515
495
  scope: ScopeEnum;
516
496
  isAsync(): boolean;
517
497
  isSingletonScope(): boolean;
@@ -540,11 +520,11 @@ export interface IObjectDefinition {
540
520
  bindHook?: (module: any, options?: IObjectDefinition) => void;
541
521
  }
542
522
  export interface IObjectCreator {
523
+ type: string;
543
524
  load(): any;
544
- doConstruct(Clzz: any, args?: any, context?: IMidwayContainer): any;
545
- doConstructAsync(Clzz: any, args?: any, context?: IMidwayContainer): Promise<any>;
546
- doInit(obj: any): void;
547
- doInitAsync(obj: any): Promise<void>;
525
+ doConstruct(Clzz: any, args?: any[]): any;
526
+ doInit(obj: any, context: IMidwayContainer): any;
527
+ doInitAsync(obj: any, context: IMidwayContainer): Promise<any>;
548
528
  doDestroy(obj: any): void;
549
529
  doDestroyAsync(obj: any): Promise<void>;
550
530
  }
@@ -568,28 +548,6 @@ export interface IObjectDefinitionRegistry {
568
548
  getIdentifierRelation(): IIdentifierRelationShip;
569
549
  setIdentifierRelation(identifierRelation: IIdentifierRelationShip): any;
570
550
  }
571
- /**
572
- * 属性配置抽象
573
- */
574
- export interface IProperties extends Map<ObjectIdentifier, any> {
575
- getProperty(key: ObjectIdentifier, defaultValue?: any): any;
576
- setProperty(key: ObjectIdentifier, value: any): any;
577
- propertyKeys(): ObjectIdentifier[];
578
- }
579
- /**
580
- * 解析内部管理的属性、json、ref等实例的解析器
581
- * 同时创建这些对象的实际使用的对象
582
- */
583
- export interface IManagedResolver {
584
- type: string;
585
- resolve(managed: IManagedInstance): any;
586
- resolveAsync(managed: IManagedInstance): Promise<any>;
587
- }
588
- export interface IManagedResolverFactoryCreateOptions {
589
- definition: IObjectDefinition;
590
- args?: any;
591
- namespace?: string;
592
- }
593
551
  export type HandlerFunction = (
594
552
  /**
595
553
  * decorator uuid key
@@ -613,52 +571,57 @@ export type ParameterHandlerFunction = (options: {
613
571
  parameterIndex: number;
614
572
  }) => any;
615
573
  export interface IIdentifierRelationShip {
616
- saveClassRelation(module: any, namespace?: string): any;
617
- saveFunctionRelation(ObjectIdentifier: any, uuid: any): any;
574
+ saveClassRelation(module: any, namespace?: string): void;
575
+ saveFunctionRelation(id: ObjectIdentifier, uuid: string): void;
618
576
  hasRelation(id: ObjectIdentifier): boolean;
619
577
  getRelation(id: ObjectIdentifier): string;
620
578
  }
621
- export interface IMidwayContainer extends IObjectFactory, WithFn<IObjectLifeCycle> {
622
- parent: IMidwayContainer;
579
+ export interface IMidwayGlobalContainer extends IMidwayContainer, WithFn<IObjectLifeCycle> {
623
580
  identifierMapping: IIdentifierRelationShip;
624
581
  objectCreateEventTarget: EventEmitter;
625
- ready(): void | Promise<void>;
626
- stop(): Promise<void>;
627
- registerObject(identifier: ObjectIdentifier, target: any): any;
628
- load(module: any | any[]): any;
629
- hasNamespace(namespace: string): boolean;
630
582
  getNamespaceList(): string[];
631
- hasDefinition(identifier: ObjectIdentifier): any;
632
- hasObject(identifier: ObjectIdentifier): any;
583
+ addNamespace(namespace: string): void;
633
584
  bind<T>(target: T, options?: Partial<IObjectDefinition>): void;
634
585
  bind<T>(identifier: ObjectIdentifier, target: T, options?: Partial<IObjectDefinition>): void;
635
- bindClass(exports: any, options?: Partial<IObjectDefinition>): any;
636
- setFileDetector(fileDetector: IFileDetector): any;
637
- createChild(): IMidwayContainer;
586
+ bindClass(exports: any, options?: Partial<IObjectDefinition>): void;
587
+ stop(): Promise<void>;
588
+ getManagedResolverFactory(): ManagedResolverFactory;
589
+ }
590
+ export interface IMidwayRequestContainer extends IMidwayContainer {
591
+ parent: IMidwayContainer;
592
+ getContext(): IMidwayContext;
593
+ }
594
+ export interface IMidwayContainer extends IObjectFactory {
595
+ registerObject(identifier: ObjectIdentifier, target: any): void;
596
+ hasDefinition(identifier: ObjectIdentifier): boolean;
597
+ getDefinition(identifier: ObjectIdentifier): IObjectDefinition;
598
+ hasObject(identifier: ObjectIdentifier): boolean;
599
+ getObject<T>(identifier: ObjectIdentifier): T;
638
600
  /**
639
601
  * Set value to app attribute map
640
602
  * @param key
641
603
  * @param value
642
604
  */
643
- setAttr(key: string, value: any): any;
605
+ setAttr(key: string, value: any): void;
644
606
  /**
645
607
  * Get value from app attribute map
646
608
  * @param key
647
609
  */
648
610
  getAttr<T>(key: string): T;
611
+ /**
612
+ * Get IoC identifier
613
+ */
614
+ getIdentifier(identifier: (ClassType | string)): string;
649
615
  /**
650
616
  * Get instance IoC container scope
651
617
  * @param instance
652
618
  */
653
619
  getInstanceScope(instance: any): ScopeEnum | undefined;
620
+ hasNamespace(namespace: string): boolean;
654
621
  }
655
- /**
656
- * @deprecated
657
- */
658
- export type IApplicationContext = IMidwayContainer;
659
622
  export interface IFileDetector {
660
- run(container: IMidwayContainer, fileDetectorOptions?: Record<string, any>): void | Promise<void>;
661
- setExtraDetectorOptions(detectorOptions: Record<string, any>): any;
623
+ run(container: IMidwayGlobalContainer, namespace: string): Promise<void>;
624
+ runSync(container: IMidwayGlobalContainer, namespace: string): void;
662
625
  }
663
626
  export interface IConfigService {
664
627
  add(configFilePaths: any[]): any;
@@ -784,11 +747,6 @@ export interface IMidwayBaseApplication<CTX extends IMidwayContext> {
784
747
  * get current related framework
785
748
  */
786
749
  getFramework(): IMidwayFramework<this, CTX, unknown>;
787
- /**
788
- * @deprecated
789
- * Get current framework type in MidwayFrameworkType enum
790
- */
791
- getFrameworkType(): FrameworkType;
792
750
  /**
793
751
  * Get current running process type, app or agent, just for egg
794
752
  */
@@ -796,7 +754,7 @@ export interface IMidwayBaseApplication<CTX extends IMidwayContext> {
796
754
  /**
797
755
  * Get global Midway IoC Container
798
756
  */
799
- getApplicationContext(): IMidwayContainer;
757
+ getApplicationContext(): IMidwayGlobalContainer;
800
758
  /**
801
759
  * Get all configuration values or get the specified configuration through parameters
802
760
  * @param key config key
@@ -877,20 +835,11 @@ export interface IMidwayBootstrapOptions {
877
835
  [customPropertyKey: string]: any;
878
836
  baseDir?: string;
879
837
  appDir?: string;
880
- applicationContext?: IMidwayContainer;
838
+ applicationContext?: IMidwayGlobalContainer;
881
839
  preloadModules?: any[];
882
- /**
883
- * @deprecated please use 'imports'
884
- */
885
- configurationModule?: any | any[];
886
840
  imports?: any | any[];
887
841
  moduleLoadType?: ModuleLoadType;
888
- moduleDetector?: IFileDetector | false;
889
842
  logger?: boolean | ILogger;
890
- /**
891
- * @deprecated please set it from '@Configuration' decorator
892
- */
893
- ignore?: string[];
894
843
  globalConfig?: Array<{
895
844
  [environmentName: string]: Record<string, any>;
896
845
  }> | Record<string, any>;
@@ -906,13 +855,13 @@ export interface IConfigurationOptions {
906
855
  export interface IMidwayFramework<APP extends IMidwayApplication<CTX>, CTX extends IMidwayContext, CONFIG extends IConfigurationOptions, ResOrNext = unknown, Next = unknown> {
907
856
  app: APP;
908
857
  configurationOptions: CONFIG;
909
- configure(options?: CONFIG): any;
858
+ configure(options?: CONFIG): CONFIG;
910
859
  isEnable(): boolean;
911
860
  initialize(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
912
861
  run(): Promise<void>;
913
862
  stop(): Promise<void>;
914
863
  getApplication(): APP;
915
- getApplicationContext(): IMidwayContainer;
864
+ getApplicationContext(): IMidwayGlobalContainer;
916
865
  getConfiguration(key?: string): any;
917
866
  getCurrentEnvironment(): string;
918
867
  getFrameworkName(): string;
@@ -929,7 +878,6 @@ export interface IMidwayFramework<APP extends IMidwayApplication<CTX>, CTX exten
929
878
  useGuard(guard: CommonGuardUnion<CTX>): void;
930
879
  runGuard(ctx: CTX, supplierClz: new (...args: any[]) => any, methodName: string): Promise<boolean>;
931
880
  getNamespace(): string;
932
- setNamespace(namespace: string): void;
933
881
  }
934
882
  export interface MidwayAppInfo {
935
883
  pkg: Record<string, any>;
@@ -1011,6 +959,24 @@ export interface ServerSendEventStreamOptions<CTX extends IMidwayContext> {
1011
959
  closeEvent?: string;
1012
960
  tpl?: (data: ServerSendEventMessage, ctx: CTX) => ServerSendEventMessage;
1013
961
  }
1014
- export type ClassType<T = any> = new (...args: any[]) => T;
962
+ export interface IComponentInfo {
963
+ component: {
964
+ Configuration: ClassType<ILifeCycle>;
965
+ } | FunctionalConfiguration;
966
+ enabledEnvironment?: string[];
967
+ }
968
+ export interface InjectionConfigurationOptions {
969
+ imports?: Array<IComponentInfo | {
970
+ Configuration: ClassType<ILifeCycle>;
971
+ } | FunctionalConfiguration>;
972
+ importObjects?: Record<string, unknown>;
973
+ importConfigs?: Array<{
974
+ [environmentName: string]: Record<string, any>;
975
+ }> | Record<string, any>;
976
+ importConfigFilter?: (config: Record<string, any>) => Record<string, any>;
977
+ namespace?: string;
978
+ detector?: IFileDetector | false;
979
+ }
980
+ export type FunctionalConfigurationOptions = InjectionConfigurationOptions & ILifeCycle;
1015
981
  export {};
1016
982
  //# sourceMappingURL=interface.d.ts.map
package/dist/interface.js CHANGED
@@ -1,54 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MidwayProcessTypeEnum = exports.ObjectLifeCycleEvent = exports.ServerlessTriggerType = exports.MidwayFrameworkType = exports.FrameworkType = exports.MSListenerType = exports.MSProviderType = exports.InjectModeEnum = exports.ScopeEnum = void 0;
3
+ exports.MidwayProcessTypeEnum = exports.ObjectLifeCycleEvent = exports.ServerlessTriggerType = exports.MSListenerType = exports.MSProviderType = exports.InjectModeEnum = exports.ScopeEnum = void 0;
4
4
  var ScopeEnum;
5
5
  (function (ScopeEnum) {
6
6
  ScopeEnum["Singleton"] = "Singleton";
7
7
  ScopeEnum["Request"] = "Request";
8
8
  ScopeEnum["Prototype"] = "Prototype";
9
- })(ScopeEnum = exports.ScopeEnum || (exports.ScopeEnum = {}));
9
+ })(ScopeEnum || (exports.ScopeEnum = ScopeEnum = {}));
10
10
  var InjectModeEnum;
11
11
  (function (InjectModeEnum) {
12
12
  InjectModeEnum["Identifier"] = "Identifier";
13
13
  InjectModeEnum["Class"] = "Class";
14
- InjectModeEnum["PropertyName"] = "PropertyName";
15
- })(InjectModeEnum = exports.InjectModeEnum || (exports.InjectModeEnum = {}));
14
+ InjectModeEnum["SelfName"] = "SelfName";
15
+ })(InjectModeEnum || (exports.InjectModeEnum = InjectModeEnum = {}));
16
16
  var MSProviderType;
17
17
  (function (MSProviderType) {
18
18
  MSProviderType["DUBBO"] = "dubbo";
19
19
  MSProviderType["GRPC"] = "gRPC";
20
- })(MSProviderType = exports.MSProviderType || (exports.MSProviderType = {}));
20
+ })(MSProviderType || (exports.MSProviderType = MSProviderType = {}));
21
21
  var MSListenerType;
22
22
  (function (MSListenerType) {
23
23
  MSListenerType["RABBITMQ"] = "rabbitmq";
24
24
  MSListenerType["MQTT"] = "mqtt";
25
25
  MSListenerType["KAFKA"] = "kafka";
26
26
  MSListenerType["REDIS"] = "redis";
27
- })(MSListenerType = exports.MSListenerType || (exports.MSListenerType = {}));
28
- class FrameworkType {
29
- }
30
- exports.FrameworkType = FrameworkType;
31
- class MidwayFrameworkType extends FrameworkType {
32
- constructor(name) {
33
- super();
34
- this.name = name;
35
- }
36
- }
37
- exports.MidwayFrameworkType = MidwayFrameworkType;
38
- MidwayFrameworkType.WEB = new MidwayFrameworkType('@midwayjs/web');
39
- MidwayFrameworkType.WEB_KOA = new MidwayFrameworkType('@midwayjs/web-koa');
40
- MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
41
- MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
42
- MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
43
- MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
44
- MidwayFrameworkType.MS_KAFKA = new MidwayFrameworkType('@midwayjs/kafka');
45
- MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
46
- MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
47
- MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
48
- MidwayFrameworkType.CUSTOM = new MidwayFrameworkType('');
49
- MidwayFrameworkType.EMPTY = new MidwayFrameworkType('empty');
50
- MidwayFrameworkType.LIGHT = new MidwayFrameworkType('light');
51
- MidwayFrameworkType.TASK = new MidwayFrameworkType('@midwayjs/task');
27
+ })(MSListenerType || (exports.MSListenerType = MSListenerType = {}));
52
28
  var ServerlessTriggerType;
53
29
  (function (ServerlessTriggerType) {
54
30
  ServerlessTriggerType["EVENT"] = "event";
@@ -63,7 +39,7 @@ var ServerlessTriggerType;
63
39
  ServerlessTriggerType["HSF"] = "hsf";
64
40
  ServerlessTriggerType["MTOP"] = "mtop";
65
41
  ServerlessTriggerType["SSR"] = "ssr";
66
- })(ServerlessTriggerType = exports.ServerlessTriggerType || (exports.ServerlessTriggerType = {}));
42
+ })(ServerlessTriggerType || (exports.ServerlessTriggerType = ServerlessTriggerType = {}));
67
43
  var ObjectLifeCycleEvent;
68
44
  (function (ObjectLifeCycleEvent) {
69
45
  ObjectLifeCycleEvent["BEFORE_BIND"] = "beforeBind";
@@ -71,10 +47,10 @@ var ObjectLifeCycleEvent;
71
47
  ObjectLifeCycleEvent["AFTER_CREATED"] = "afterObjectCreated";
72
48
  ObjectLifeCycleEvent["AFTER_INIT"] = "afterObjectInit";
73
49
  ObjectLifeCycleEvent["BEFORE_DESTROY"] = "beforeObjectDestroy";
74
- })(ObjectLifeCycleEvent = exports.ObjectLifeCycleEvent || (exports.ObjectLifeCycleEvent = {}));
50
+ })(ObjectLifeCycleEvent || (exports.ObjectLifeCycleEvent = ObjectLifeCycleEvent = {}));
75
51
  var MidwayProcessTypeEnum;
76
52
  (function (MidwayProcessTypeEnum) {
77
53
  MidwayProcessTypeEnum["APPLICATION"] = "APPLICATION";
78
54
  MidwayProcessTypeEnum["AGENT"] = "AGENT";
79
- })(MidwayProcessTypeEnum = exports.MidwayProcessTypeEnum || (exports.MidwayProcessTypeEnum = {}));
55
+ })(MidwayProcessTypeEnum || (exports.MidwayProcessTypeEnum = MidwayProcessTypeEnum = {}));
80
56
  //# sourceMappingURL=interface.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @deprecated Use OBJECT_DEFINITION_KEY instead
3
+ */
4
+ export declare const OBJ_DEF_CLS = "common:object_definition";
5
+ /**
6
+ * @deprecated Use PROPERTY_INJECT_KEY instead
7
+ */
8
+ export declare const INJECT_TAG = "common:property_inject";
9
+ /**
10
+ * @deprecated Use ALL_VALUE_KEY instead
11
+ */
12
+ export declare const ALL = "common:all_value_key";
13
+ /**
14
+ * @deprecated Use CUSTOM_PROPERTY_INJECT_KEY instead
15
+ */
16
+ export declare const INJECT_CUSTOM_PROPERTY = "common:custom_property_inject";
17
+ /**
18
+ * @deprecated Use CUSTOM_METHOD_INJECT_KEY instead
19
+ */
20
+ export declare const INJECT_CUSTOM_METHOD = "common:custom_method_inject";
21
+ /**
22
+ * @deprecated Use CUSTOM_PARAM_INJECT_KEY instead
23
+ */
24
+ export declare const INJECT_CUSTOM_PARAM = "common:custom_param_inject";
25
+ /**
26
+ * @deprecated Use PROVIDE_KEY instead
27
+ */
28
+ export declare const TAGGED_CLS = "common:provide";
29
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TAGGED_CLS = exports.INJECT_CUSTOM_PARAM = exports.INJECT_CUSTOM_METHOD = exports.INJECT_CUSTOM_PROPERTY = exports.ALL = exports.INJECT_TAG = exports.OBJ_DEF_CLS = void 0;
4
+ const decorator_1 = require("../decorator");
5
+ /**
6
+ * @deprecated Use OBJECT_DEFINITION_KEY instead
7
+ */
8
+ exports.OBJ_DEF_CLS = decorator_1.OBJECT_DEFINITION_KEY;
9
+ /**
10
+ * @deprecated Use PROPERTY_INJECT_KEY instead
11
+ */
12
+ exports.INJECT_TAG = decorator_1.PROPERTY_INJECT_KEY;
13
+ /**
14
+ * @deprecated Use ALL_VALUE_KEY instead
15
+ */
16
+ exports.ALL = decorator_1.ALL_VALUE_KEY;
17
+ /**
18
+ * @deprecated Use CUSTOM_PROPERTY_INJECT_KEY instead
19
+ */
20
+ exports.INJECT_CUSTOM_PROPERTY = decorator_1.CUSTOM_PROPERTY_INJECT_KEY;
21
+ /**
22
+ * @deprecated Use CUSTOM_METHOD_INJECT_KEY instead
23
+ */
24
+ exports.INJECT_CUSTOM_METHOD = decorator_1.CUSTOM_METHOD_INJECT_KEY;
25
+ /**
26
+ * @deprecated Use CUSTOM_PARAM_INJECT_KEY instead
27
+ */
28
+ exports.INJECT_CUSTOM_PARAM = decorator_1.CUSTOM_PARAM_INJECT_KEY;
29
+ /**
30
+ * @deprecated Use PROVIDE_KEY instead
31
+ */
32
+ exports.TAGGED_CLS = decorator_1.PROVIDE_KEY;
33
+ //# sourceMappingURL=constants.js.map