@eggjs/core-decorator 4.0.0-beta.8 → 4.0.1-beta.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.
@@ -0,0 +1,4 @@
1
+ //#region src/decorator/ConfigSource.d.ts
2
+ declare function ConfigSourceQualifier(moduleName: string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
3
+ //#endregion
4
+ export { ConfigSourceQualifier };
@@ -0,0 +1,13 @@
1
+ import { QualifierUtil } from "../util/QualifierUtil.js";
2
+ import "../util/index.js";
3
+ import { ConfigSourceQualifierAttribute } from "@eggjs/tegg-types";
4
+
5
+ //#region src/decorator/ConfigSource.ts
6
+ function ConfigSourceQualifier(moduleName) {
7
+ return function(target, propertyKey, parameterIndex) {
8
+ QualifierUtil.addInjectQualifier(target, propertyKey, parameterIndex, ConfigSourceQualifierAttribute, moduleName);
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { ConfigSourceQualifier };
@@ -0,0 +1,7 @@
1
+ import { PrototypeDecorator } from "./Prototype.js";
2
+ import { ContextProtoParams } from "@eggjs/tegg-types";
3
+
4
+ //#region src/decorator/ContextProto.d.ts
5
+ declare function ContextProto(params?: ContextProtoParams): PrototypeDecorator;
6
+ //#endregion
7
+ export { ContextProto };
@@ -0,0 +1,14 @@
1
+ import { Prototype } from "./Prototype.js";
2
+ import { AccessLevel, ObjectInitType } from "@eggjs/tegg-types";
3
+
4
+ //#region src/decorator/ContextProto.ts
5
+ function ContextProto(params) {
6
+ return Prototype({
7
+ initType: ObjectInitType.CONTEXT,
8
+ accessLevel: params?.accessLevel || AccessLevel.PRIVATE,
9
+ ...params
10
+ });
11
+ }
12
+
13
+ //#endregion
14
+ export { ContextProto };
@@ -0,0 +1,6 @@
1
+ import { EggType } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/EggQualifier.d.ts
4
+ declare function EggQualifier(eggType: EggType): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
5
+ //#endregion
6
+ export { EggQualifier };
@@ -0,0 +1,13 @@
1
+ import { QualifierUtil } from "../util/QualifierUtil.js";
2
+ import "../util/index.js";
3
+ import { EggQualifierAttribute } from "@eggjs/tegg-types";
4
+
5
+ //#region src/decorator/EggQualifier.ts
6
+ function EggQualifier(eggType) {
7
+ return function(target, propertyKey, parameterIndex) {
8
+ QualifierUtil.addInjectQualifier(target, propertyKey, parameterIndex, EggQualifierAttribute, eggType);
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { EggQualifier };
@@ -0,0 +1,6 @@
1
+ import { ObjectInitTypeLike } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/InitTypeQualifier.d.ts
4
+ declare function InitTypeQualifier(initType: ObjectInitTypeLike): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
5
+ //#endregion
6
+ export { InitTypeQualifier };
@@ -0,0 +1,13 @@
1
+ import { QualifierUtil } from "../util/QualifierUtil.js";
2
+ import "../util/index.js";
3
+ import { InitTypeQualifierAttribute } from "@eggjs/tegg-types";
4
+
5
+ //#region src/decorator/InitTypeQualifier.ts
6
+ function InitTypeQualifier(initType) {
7
+ return function(target, propertyKey, parameterIndex) {
8
+ QualifierUtil.addInjectQualifier(target, propertyKey, parameterIndex, InitTypeQualifierAttribute, initType);
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { InitTypeQualifier };
@@ -0,0 +1,18 @@
1
+ import { InjectParams } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/Inject.d.ts
4
+ type InjectDecorator = (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
5
+ /**
6
+ * Inject decorator Factory
7
+ * @param param - Inject parameters
8
+ * @returns Inject decorator
9
+ */
10
+ declare function Inject(param?: InjectParams | string): InjectDecorator;
11
+ /**
12
+ * InjectOptional decorator Factory
13
+ * @param param - InjectOptional parameters
14
+ * @returns InjectOptional decorator
15
+ */
16
+ declare function InjectOptional(param?: Omit<InjectParams, "optional"> | string): InjectDecorator;
17
+ //#endregion
18
+ export { Inject, InjectDecorator, InjectOptional };
@@ -0,0 +1,87 @@
1
+ import { PrototypeUtil } from "../util/PrototypeUtil.js";
2
+ import { QualifierUtil } from "../util/QualifierUtil.js";
3
+ import "../util/index.js";
4
+ import { InitTypeQualifierAttribute, InjectType } from "@eggjs/tegg-types";
5
+ import { ObjectUtils } from "@eggjs/tegg-common-util";
6
+ import { debuglog } from "node:util";
7
+
8
+ //#region src/decorator/Inject.ts
9
+ const debug = debuglog("tegg/core/core-decorator/decorator/Inject");
10
+ function guessInjectInfo(clazz, name, proto) {
11
+ let objName;
12
+ let initType;
13
+ if (typeof proto === "function" && proto !== Object) {
14
+ const info = PrototypeUtil.getProperty(proto);
15
+ objName = info?.name;
16
+ if (info?.initType) {
17
+ if (!QualifierUtil.getProperQualifier(clazz, name, InitTypeQualifierAttribute)) initType = info.initType;
18
+ }
19
+ }
20
+ return {
21
+ objName,
22
+ initType
23
+ };
24
+ }
25
+ /**
26
+ * Inject decorator Factory
27
+ * @param param - Inject parameters
28
+ * @returns Inject decorator
29
+ */
30
+ function Inject(param) {
31
+ const injectParam = typeof param === "string" ? { name: param } : param;
32
+ function propertyInject(target, propertyKey) {
33
+ let objName;
34
+ let initType;
35
+ if (!injectParam) {
36
+ const proto = PrototypeUtil.getDesignType(target, propertyKey);
37
+ const result = guessInjectInfo(target.constructor, propertyKey, proto);
38
+ objName = result.objName;
39
+ initType = result.initType;
40
+ } else objName = injectParam?.name;
41
+ const injectObject = {
42
+ refName: propertyKey,
43
+ objName: objName || propertyKey
44
+ };
45
+ if (injectParam?.optional) injectObject.optional = true;
46
+ PrototypeUtil.setInjectType(target.constructor, InjectType.PROPERTY);
47
+ PrototypeUtil.addInjectObject(target.constructor, injectObject);
48
+ debug("propertyInject, clazz: %s, propertyKey: %s, injectObject: %o", target.constructor.name, propertyKey, injectObject);
49
+ if (initType) QualifierUtil.addProperQualifier(target.constructor, propertyKey, InitTypeQualifierAttribute, initType);
50
+ }
51
+ function constructorInject(target, parameterIndex) {
52
+ const argName = ObjectUtils.getConstructorArgNameList(target)[parameterIndex];
53
+ let objName;
54
+ let initType;
55
+ if (!injectParam) {
56
+ const protos = PrototypeUtil.getDesignParamtypes(target);
57
+ ({objName, initType} = guessInjectInfo(target, argName, protos?.[parameterIndex]));
58
+ } else objName = injectParam?.name;
59
+ const injectObject = {
60
+ refIndex: parameterIndex,
61
+ refName: argName,
62
+ objName: objName || argName
63
+ };
64
+ if (injectParam?.optional) injectObject.optional = true;
65
+ PrototypeUtil.setInjectType(target, InjectType.CONSTRUCTOR);
66
+ PrototypeUtil.addInjectConstructor(target, injectObject);
67
+ if (initType) QualifierUtil.addProperQualifier(target, argName, InitTypeQualifierAttribute, initType);
68
+ }
69
+ return function(target, propertyKey, parameterIndex) {
70
+ if (typeof parameterIndex === "undefined") propertyInject(target, propertyKey);
71
+ else constructorInject(target, parameterIndex);
72
+ };
73
+ }
74
+ /**
75
+ * InjectOptional decorator Factory
76
+ * @param param - InjectOptional parameters
77
+ * @returns InjectOptional decorator
78
+ */
79
+ function InjectOptional(param) {
80
+ return Inject({
81
+ ...typeof param === "string" ? { name: param } : param,
82
+ optional: true
83
+ });
84
+ }
85
+
86
+ //#endregion
87
+ export { Inject, InjectOptional };
@@ -0,0 +1,4 @@
1
+ //#region src/decorator/ModuleQualifier.d.ts
2
+ declare function ModuleQualifier(moduleName: string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
3
+ //#endregion
4
+ export { ModuleQualifier };
@@ -0,0 +1,13 @@
1
+ import { QualifierUtil } from "../util/QualifierUtil.js";
2
+ import "../util/index.js";
3
+ import { LoadUnitNameQualifierAttribute } from "@eggjs/tegg-types";
4
+
5
+ //#region src/decorator/ModuleQualifier.ts
6
+ function ModuleQualifier(moduleName) {
7
+ return function(target, propertyKey, parameterIndex) {
8
+ QualifierUtil.addInjectQualifier(target, propertyKey, parameterIndex, LoadUnitNameQualifierAttribute, moduleName);
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { ModuleQualifier };
@@ -0,0 +1,6 @@
1
+ import { QualifierAttribute } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/MultiInstanceInfo.d.ts
4
+ declare function MultiInstanceInfo(attributes: QualifierAttribute[]): (target: any, _propertyKey: PropertyKey | undefined, parameterIndex: number) => void;
5
+ //#endregion
6
+ export { MultiInstanceInfo };
@@ -0,0 +1,13 @@
1
+ import { PrototypeUtil } from "../util/PrototypeUtil.js";
2
+ import "../util/index.js";
3
+
4
+ //#region src/decorator/MultiInstanceInfo.ts
5
+ function MultiInstanceInfo(attributes) {
6
+ return function(target, _propertyKey, parameterIndex) {
7
+ PrototypeUtil.setMultiInstanceConstructorIndex(target, parameterIndex);
8
+ PrototypeUtil.setMultiInstanceConstructorAttributes(target, attributes);
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { MultiInstanceInfo };
@@ -0,0 +1,6 @@
1
+ import { EggProtoImplClass, MultiInstancePrototypeParams } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/MultiInstanceProto.d.ts
4
+ declare function MultiInstanceProto(param: MultiInstancePrototypeParams): (clazz: EggProtoImplClass) => void;
5
+ //#endregion
6
+ export { MultiInstanceProto };
@@ -0,0 +1,35 @@
1
+ import { PrototypeUtil } from "../util/PrototypeUtil.js";
2
+ import "../util/index.js";
3
+ import { AccessLevel, DEFAULT_PROTO_IMPL_TYPE, ObjectInitType } from "@eggjs/tegg-types";
4
+ import { StackUtil } from "@eggjs/tegg-common-util";
5
+
6
+ //#region src/decorator/MultiInstanceProto.ts
7
+ const DEFAULT_PARAMS = {
8
+ initType: ObjectInitType.SINGLETON,
9
+ accessLevel: AccessLevel.PRIVATE,
10
+ protoImplType: DEFAULT_PROTO_IMPL_TYPE
11
+ };
12
+ function MultiInstanceProto(param) {
13
+ return function(clazz) {
14
+ PrototypeUtil.setIsEggMultiInstancePrototype(clazz);
15
+ if (param.objects) {
16
+ const property = {
17
+ ...DEFAULT_PARAMS,
18
+ ...param,
19
+ className: clazz.name
20
+ };
21
+ PrototypeUtil.setMultiInstanceStaticProperty(clazz, property);
22
+ } else if (param.getObjects) {
23
+ const property = {
24
+ ...DEFAULT_PARAMS,
25
+ ...param,
26
+ className: clazz.name
27
+ };
28
+ PrototypeUtil.setMultiInstanceCallbackProperty(clazz, property);
29
+ }
30
+ PrototypeUtil.setFilePath(clazz, StackUtil.getCalleeFromStack(false, 4));
31
+ };
32
+ }
33
+
34
+ //#endregion
35
+ export { MultiInstanceProto };
@@ -0,0 +1,12 @@
1
+ import { EggProtoImplClass, PrototypeParams } from "@eggjs/tegg-types";
2
+
3
+ //#region src/decorator/Prototype.d.ts
4
+ type PrototypeDecorator = (clazz: EggProtoImplClass) => void;
5
+ /**
6
+ * Prototype decorator Factory
7
+ * @param param - Prototype parameters
8
+ * @returns Prototype decorator
9
+ */
10
+ declare function Prototype(param?: PrototypeParams): PrototypeDecorator;
11
+ //#endregion
12
+ export { Prototype, PrototypeDecorator };
@@ -0,0 +1,32 @@
1
+ import { PrototypeUtil } from "../util/PrototypeUtil.js";
2
+ import "../util/index.js";
3
+ import { AccessLevel, DEFAULT_PROTO_IMPL_TYPE, ObjectInitType } from "@eggjs/tegg-types";
4
+ import { NameUtil, StackUtil } from "@eggjs/tegg-common-util";
5
+
6
+ //#region src/decorator/Prototype.ts
7
+ const DEFAULT_PARAMS = {
8
+ initType: ObjectInitType.SINGLETON,
9
+ accessLevel: AccessLevel.PRIVATE,
10
+ protoImplType: DEFAULT_PROTO_IMPL_TYPE
11
+ };
12
+ /**
13
+ * Prototype decorator Factory
14
+ * @param param - Prototype parameters
15
+ * @returns Prototype decorator
16
+ */
17
+ function Prototype(param) {
18
+ return function(clazz) {
19
+ PrototypeUtil.setIsEggPrototype(clazz);
20
+ const property = {
21
+ ...DEFAULT_PARAMS,
22
+ ...param,
23
+ className: clazz.name
24
+ };
25
+ if (!property.name) property.name = NameUtil.getClassName(clazz);
26
+ PrototypeUtil.setProperty(clazz, property);
27
+ PrototypeUtil.setFilePath(clazz, StackUtil.getCalleeFromStack(false, 4));
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ export { Prototype };
@@ -0,0 +1,7 @@
1
+ import { PrototypeDecorator } from "./Prototype.js";
2
+ import { SingletonProtoParams } from "@eggjs/tegg-types";
3
+
4
+ //#region src/decorator/SingletonProto.d.ts
5
+ declare function SingletonProto(params?: SingletonProtoParams): PrototypeDecorator;
6
+ //#endregion
7
+ export { SingletonProto };
@@ -0,0 +1,14 @@
1
+ import { Prototype } from "./Prototype.js";
2
+ import { AccessLevel, ObjectInitType } from "@eggjs/tegg-types";
3
+
4
+ //#region src/decorator/SingletonProto.ts
5
+ function SingletonProto(params) {
6
+ return Prototype({
7
+ initType: ObjectInitType.SINGLETON,
8
+ accessLevel: params?.accessLevel || AccessLevel.PRIVATE,
9
+ ...params
10
+ });
11
+ }
12
+
13
+ //#endregion
14
+ export { SingletonProto };
@@ -0,0 +1,10 @@
1
+ import { ConfigSourceQualifier } from "./ConfigSource.js";
2
+ import { Prototype, PrototypeDecorator } from "./Prototype.js";
3
+ import { ContextProto } from "./ContextProto.js";
4
+ import { EggQualifier } from "./EggQualifier.js";
5
+ import { InitTypeQualifier } from "./InitTypeQualifier.js";
6
+ import { Inject, InjectDecorator, InjectOptional } from "./Inject.js";
7
+ import { ModuleQualifier } from "./ModuleQualifier.js";
8
+ import { MultiInstanceInfo } from "./MultiInstanceInfo.js";
9
+ import { MultiInstanceProto } from "./MultiInstanceProto.js";
10
+ import { SingletonProto } from "./SingletonProto.js";
@@ -0,0 +1,12 @@
1
+ import { ConfigSourceQualifier } from "./ConfigSource.js";
2
+ import { Prototype } from "./Prototype.js";
3
+ import { ContextProto } from "./ContextProto.js";
4
+ import { EggQualifier } from "./EggQualifier.js";
5
+ import { InitTypeQualifier } from "./InitTypeQualifier.js";
6
+ import { Inject, InjectOptional } from "./Inject.js";
7
+ import { ModuleQualifier } from "./ModuleQualifier.js";
8
+ import { MultiInstanceInfo } from "./MultiInstanceInfo.js";
9
+ import { MultiInstanceProto } from "./MultiInstanceProto.js";
10
+ import { SingletonProto } from "./SingletonProto.js";
11
+
12
+ export { };
package/dist/index.d.ts CHANGED
@@ -1,195 +1,17 @@
1
- import * as _eggjs_tegg_types0 from "@eggjs/tegg-types";
2
- import { ContextProtoParams, EggMultiInstanceCallbackPrototypeInfo, EggMultiInstancePrototypeInfo, EggProtoImplClass, EggPrototypeInfo, EggPrototypeName, EggType, InjectConstructorInfo, InjectObjectInfo, InjectParams, InjectType, MetaDataKey, MultiInstancePrototypeGetObjectsContext, MultiInstancePrototypeParams, MultiInstanceType, ObjectInitTypeLike, PrototypeParams, QualifierAttribute, QualifierInfo, QualifierValue, SingletonProtoParams } from "@eggjs/tegg-types";
1
+ import { ConfigSourceQualifier } from "./decorator/ConfigSource.js";
2
+ import { Prototype, PrototypeDecorator } from "./decorator/Prototype.js";
3
+ import { ContextProto } from "./decorator/ContextProto.js";
4
+ import { EggQualifier } from "./decorator/EggQualifier.js";
5
+ import { InitTypeQualifier } from "./decorator/InitTypeQualifier.js";
6
+ import { Inject, InjectDecorator, InjectOptional } from "./decorator/Inject.js";
7
+ import { ModuleQualifier } from "./decorator/ModuleQualifier.js";
8
+ import { MultiInstanceInfo } from "./decorator/MultiInstanceInfo.js";
9
+ import { MultiInstanceProto } from "./decorator/MultiInstanceProto.js";
10
+ import { SingletonProto } from "./decorator/SingletonProto.js";
11
+ import "./decorator/index.js";
12
+ import { MetadataUtil } from "./util/MetadataUtil.js";
13
+ import { PrototypeUtil } from "./util/PrototypeUtil.js";
14
+ import { QualifierUtil } from "./util/QualifierUtil.js";
15
+ import "./util/index.js";
3
16
  export * from "@eggjs/tegg-types/core-decorator";
4
-
5
- //#region src/decorator/ConfigSource.d.ts
6
- declare function ConfigSourceQualifier(moduleName: string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
7
- //#endregion
8
- //#region src/decorator/ContextProto.d.ts
9
- declare function ContextProto(params?: ContextProtoParams): (clazz: _eggjs_tegg_types0.EggProtoImplClass) => void;
10
- //#endregion
11
- //#region src/decorator/EggQualifier.d.ts
12
- declare function EggQualifier(eggType: EggType): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
13
- //#endregion
14
- //#region src/decorator/InitTypeQualifier.d.ts
15
- declare function InitTypeQualifier(initType: ObjectInitTypeLike): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
16
- //#endregion
17
- //#region src/decorator/Inject.d.ts
18
- declare function Inject(param?: InjectParams | string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
19
- declare function InjectOptional(param?: Omit<InjectParams, 'optional'> | string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
20
- //#endregion
21
- //#region src/decorator/ModuleQualifier.d.ts
22
- declare function ModuleQualifier(moduleName: string): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
23
- //#endregion
24
- //#region src/decorator/MultiInstanceInfo.d.ts
25
- declare function MultiInstanceInfo(attributes: QualifierAttribute[]): (target: any, _propertyKey: PropertyKey | undefined, parameterIndex: number) => void;
26
- //#endregion
27
- //#region src/decorator/MultiInstanceProto.d.ts
28
- declare function MultiInstanceProto(param: MultiInstancePrototypeParams): (clazz: EggProtoImplClass) => void;
29
- //#endregion
30
- //#region src/decorator/Prototype.d.ts
31
- declare function Prototype(param?: PrototypeParams): (clazz: EggProtoImplClass) => void;
32
- //#endregion
33
- //#region src/decorator/SingletonProto.d.ts
34
- declare function SingletonProto(params?: SingletonProtoParams): (clazz: _eggjs_tegg_types0.EggProtoImplClass) => void;
35
- //#endregion
36
- //#region src/util/MetadataUtil.d.ts
37
- declare class MetadataUtil {
38
- static deleteMetaData(metadataKey: MetaDataKey, clazz: EggProtoImplClass): void;
39
- static defineMetaData<T>(metadataKey: MetaDataKey, metadataValue: T, clazz: EggProtoImplClass): void;
40
- static getOwnMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass): T | undefined;
41
- static hasMetaData(metadataKey: MetaDataKey, clazz: EggProtoImplClass, propKey?: PropertyKey): boolean;
42
- static getMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass, propKey?: PropertyKey): T | undefined;
43
- static getBooleanMetaData(metadataKey: MetaDataKey, clazz: EggProtoImplClass): boolean;
44
- static getOwnBooleanMetaData(metadataKey: MetaDataKey, clazz: EggProtoImplClass): boolean;
45
- static getArrayMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass): Array<T>;
46
- /**
47
- * init array metadata
48
- * not inherit parent metadata
49
- * return value true means use default value
50
- * return value false means use map value
51
- */
52
- static initArrayMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass, defaultValue: Array<T>): Array<T>;
53
- /**
54
- * init own array metadata
55
- * if parent metadata exists, inherit
56
- * if parent metadata not exits, use default value
57
- * return value true means use default value
58
- * return value false means use map value
59
- */
60
- static initOwnArrayMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass, defaultValue: Array<T>): Array<T>;
61
- /**
62
- * init own map metadata
63
- * if parent metadata exists, inherit
64
- * if parent metadata not exits, use default value
65
- * return value true means use default value
66
- * return value false means use map value
67
- */
68
- static initOwnMapMetaData<K, V>(metadataKey: MetaDataKey, clazz: EggProtoImplClass, defaultValue: Map<K, V>): Map<K, V>;
69
- static getOrStoreMetaData<T>(metadataKey: MetaDataKey, clazz: EggProtoImplClass, metadataValue: T): T;
70
- }
71
- //#endregion
72
- //#region src/util/PrototypeUtil.d.ts
73
- declare class PrototypeUtil {
74
- static readonly IS_EGG_OBJECT_PROTOTYPE: unique symbol;
75
- static readonly IS_EGG_OBJECT_MULTI_INSTANCE_PROTOTYPE: unique symbol;
76
- static readonly FILE_PATH: unique symbol;
77
- static readonly PROTOTYPE_PROPERTY: unique symbol;
78
- static readonly MULTI_INSTANCE_PROTOTYPE_STATIC_PROPERTY: unique symbol;
79
- static readonly MULTI_INSTANCE_PROTOTYPE_CALLBACK_PROPERTY: unique symbol;
80
- static readonly INJECT_OBJECT_NAME_SET: unique symbol;
81
- static readonly INJECT_TYPE: unique symbol;
82
- static readonly INJECT_CONSTRUCTOR_NAME_SET: unique symbol;
83
- static readonly CLAZZ_PROTO: unique symbol;
84
- static readonly MULTI_INSTANCE_CONSTRUCTOR_INDEX: unique symbol;
85
- static readonly MULTI_INSTANCE_CONSTRUCTOR_ATTRIBUTES: unique symbol;
86
- /**
87
- * Mark class is egg object prototype
88
- * @param {Function} clazz -
89
- */
90
- static setIsEggPrototype(clazz: EggProtoImplClass): void;
91
- /**
92
- * If class is egg object prototype, return true
93
- * @param {Function} clazz -
94
- */
95
- static isEggPrototype(clazz: EggProtoImplClass): boolean;
96
- /**
97
- * Mark class is egg object multi instance prototype
98
- * @param {Function} clazz -
99
- */
100
- static setIsEggMultiInstancePrototype(clazz: EggProtoImplClass): void;
101
- /**
102
- * If class is egg object multi instance prototype, return true
103
- * @param {Function} clazz -
104
- */
105
- static isEggMultiInstancePrototype(clazz: EggProtoImplClass): boolean;
106
- /**
107
- * Get the type of the egg multi-instance prototype.
108
- * @param {Function} clazz -
109
- */
110
- static getEggMultiInstancePrototypeType(clazz: EggProtoImplClass): MultiInstanceType | undefined;
111
- /**
112
- * set class file path
113
- * @param {Function} clazz -
114
- * @param {string} filePath -
115
- */
116
- static setFilePath(clazz: EggProtoImplClass, filePath: string): void;
117
- /**
118
- * get class file path
119
- * @param {Function} clazz -
120
- */
121
- static getFilePath(clazz: EggProtoImplClass): string | undefined;
122
- /**
123
- * set class property
124
- * @param {EggProtoImplClass} clazz -
125
- * @param {EggPrototypeInfo} property -
126
- */
127
- static setProperty(clazz: EggProtoImplClass, property: EggPrototypeInfo): void;
128
- /**
129
- * get class property
130
- * @param {EggProtoImplClass} clazz -
131
- * @return {EggPrototypeInfo} -
132
- */
133
- static getProperty(clazz: EggProtoImplClass): EggPrototypeInfo | undefined;
134
- static getInitType(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): Promise<string | undefined>;
135
- static getAccessLevel(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): Promise<string | undefined>;
136
- static getObjNames(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): Promise<EggPrototypeName[]>;
137
- /**
138
- * set class property
139
- * @param {EggProtoImplClass} clazz -
140
- * @param {EggPrototypeInfo} property -
141
- */
142
- static setMultiInstanceStaticProperty(clazz: EggProtoImplClass, property: EggMultiInstancePrototypeInfo): void;
143
- /**
144
- * set class property
145
- * @param {EggProtoImplClass} clazz -
146
- * @param {EggPrototypeInfo} property -
147
- */
148
- static setMultiInstanceCallbackProperty(clazz: EggProtoImplClass, property: EggMultiInstanceCallbackPrototypeInfo): void;
149
- /**
150
- * Get instance property of Static multi-instance prototype.
151
- * @param {EggProtoImplClass} clazz -
152
- */
153
- static getStaticMultiInstanceProperty(clazz: EggProtoImplClass): EggMultiInstancePrototypeInfo | undefined;
154
- /**
155
- * Get instance property of Dynamic multi-instance prototype.
156
- * @param {EggProtoImplClass} clazz -
157
- * @param {MultiInstancePrototypeGetObjectsContext} ctx -
158
- */
159
- static getDynamicMultiInstanceProperty(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): Promise<EggMultiInstancePrototypeInfo | undefined>;
160
- /**
161
- * get class property
162
- * @param {EggProtoImplClass} clazz -
163
- * @param {MultiInstancePrototypeGetObjectsContext} ctx -
164
- */
165
- static getMultiInstanceProperty(clazz: EggProtoImplClass, ctx: MultiInstancePrototypeGetObjectsContext): Promise<EggMultiInstancePrototypeInfo | undefined>;
166
- static setMultiInstanceConstructorAttributes(clazz: EggProtoImplClass, attributes: QualifierAttribute[]): void;
167
- static getMultiInstanceConstructorAttributes(clazz: EggProtoImplClass): QualifierAttribute[];
168
- static setMultiInstanceConstructorIndex(clazz: EggProtoImplClass, index: number): void;
169
- static getMultiInstanceConstructorIndex(clazz: EggProtoImplClass): number | undefined;
170
- static setInjectType(clazz: EggProtoImplClass, type: InjectType): void;
171
- static addInjectObject(clazz: EggProtoImplClass, injectObject: InjectObjectInfo): void;
172
- static addInjectConstructor(clazz: EggProtoImplClass, injectConstructorInfo: InjectConstructorInfo): void;
173
- static getInjectType(clazz: EggProtoImplClass): InjectType | undefined;
174
- static getInjectObjects(clazz: EggProtoImplClass): Array<InjectObjectInfo | InjectConstructorInfo>;
175
- static getClazzProto(clazz: EggProtoImplClass): object | undefined;
176
- static setClazzProto(clazz: EggProtoImplClass, proto: object): void;
177
- static getDesignType(clazz: EggProtoImplClass, propKey?: PropertyKey): unknown;
178
- static getDesignParamtypes(clazz: EggProtoImplClass, propKey?: PropertyKey): unknown[];
179
- }
180
- //#endregion
181
- //#region src/util/QualifierUtil.d.ts
182
- declare class QualifierUtil {
183
- static addProtoQualifier(clazz: EggProtoImplClass, attribute: QualifierAttribute, value: QualifierValue): void;
184
- static getProtoQualifiers(clazz: EggProtoImplClass): QualifierInfo[];
185
- static addInjectQualifier(clazz: EggProtoImplClass, property: PropertyKey | undefined, parameterIndex: number | undefined, attribute: QualifierAttribute, value: QualifierValue): void;
186
- static addProperQualifier(clazz: EggProtoImplClass, property: PropertyKey, attribute: QualifierAttribute, value: QualifierValue): void;
187
- static getProperQualifiers(clazz: EggProtoImplClass, property: PropertyKey): QualifierInfo[];
188
- static getQualifierValue(clazz: EggProtoImplClass, attribute: QualifierAttribute): QualifierValue | undefined;
189
- static getProperQualifier(clazz: EggProtoImplClass, property: PropertyKey, attribute: QualifierAttribute): QualifierValue | undefined;
190
- static matchQualifiers(clazzQualifiers: QualifierInfo[], requestQualifiers: QualifierInfo[]): boolean;
191
- static equalQualifiers(clazzQualifiers: QualifierInfo[], requestQualifiers: QualifierInfo[]): boolean;
192
- static mergeQualifiers(...qualifiers: QualifierInfo[][]): QualifierInfo[];
193
- }
194
- //#endregion
195
- export { ConfigSourceQualifier, ContextProto, EggQualifier, InitTypeQualifier, Inject, InjectOptional, MetadataUtil, ModuleQualifier, MultiInstanceInfo, MultiInstanceProto, Prototype, PrototypeUtil, QualifierUtil, SingletonProto };
17
+ export { ConfigSourceQualifier, ContextProto, EggQualifier, InitTypeQualifier, Inject, InjectDecorator, InjectOptional, MetadataUtil, ModuleQualifier, MultiInstanceInfo, MultiInstanceProto, Prototype, PrototypeDecorator, PrototypeUtil, QualifierUtil, SingletonProto };