@eggjs/core-decorator 4.0.0-beta.6 → 4.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +193 -13
- package/dist/index.js +531 -15
- package/package.json +3 -3
- package/dist/decorator/ConfigSource.d.ts +0 -4
- package/dist/decorator/ConfigSource.js +0 -13
- package/dist/decorator/ContextProto.d.ts +0 -7
- package/dist/decorator/ContextProto.js +0 -14
- package/dist/decorator/EggQualifier.d.ts +0 -6
- package/dist/decorator/EggQualifier.js +0 -13
- package/dist/decorator/InitTypeQualifier.d.ts +0 -6
- package/dist/decorator/InitTypeQualifier.js +0 -13
- package/dist/decorator/Inject.d.ts +0 -7
- package/dist/decorator/Inject.js +0 -77
- package/dist/decorator/ModuleQualifier.d.ts +0 -4
- package/dist/decorator/ModuleQualifier.js +0 -13
- package/dist/decorator/MultiInstanceInfo.d.ts +0 -6
- package/dist/decorator/MultiInstanceInfo.js +0 -13
- package/dist/decorator/MultiInstanceProto.d.ts +0 -6
- package/dist/decorator/MultiInstanceProto.js +0 -35
- package/dist/decorator/Prototype.d.ts +0 -6
- package/dist/decorator/Prototype.js +0 -27
- package/dist/decorator/SingletonProto.d.ts +0 -7
- package/dist/decorator/SingletonProto.js +0 -14
- package/dist/decorator/index.js +0 -12
- package/dist/util/MetadataUtil.d.ts +0 -39
- package/dist/util/MetadataUtil.js +0 -75
- package/dist/util/PrototypeUtil.d.ts +0 -112
- package/dist/util/PrototypeUtil.js +0 -216
- package/dist/util/QualifierUtil.d.ts +0 -17
- package/dist/util/QualifierUtil.js +0 -67
- package/dist/util/index.js +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,195 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { EggQualifier } from "./decorator/EggQualifier.js";
|
|
4
|
-
import { InitTypeQualifier } from "./decorator/InitTypeQualifier.js";
|
|
5
|
-
import { Inject, InjectOptional } from "./decorator/Inject.js";
|
|
6
|
-
import { ModuleQualifier } from "./decorator/ModuleQualifier.js";
|
|
7
|
-
import { MultiInstanceInfo } from "./decorator/MultiInstanceInfo.js";
|
|
8
|
-
import { MultiInstanceProto } from "./decorator/MultiInstanceProto.js";
|
|
9
|
-
import { Prototype } from "./decorator/Prototype.js";
|
|
10
|
-
import { SingletonProto } from "./decorator/SingletonProto.js";
|
|
11
|
-
import { MetadataUtil } from "./util/MetadataUtil.js";
|
|
12
|
-
import { PrototypeUtil } from "./util/PrototypeUtil.js";
|
|
13
|
-
import { QualifierUtil } from "./util/QualifierUtil.js";
|
|
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";
|
|
14
3
|
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
|
|
15
195
|
export { ConfigSourceQualifier, ContextProto, EggQualifier, InitTypeQualifier, Inject, InjectOptional, MetadataUtil, ModuleQualifier, MultiInstanceInfo, MultiInstanceProto, Prototype, PrototypeUtil, QualifierUtil, SingletonProto };
|