@eggjs/core-decorator 4.0.2-beta.0 → 4.0.2-beta.2
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PrototypeUtil } from "../util/PrototypeUtil.js";
|
|
2
2
|
import "../util/index.js";
|
|
3
3
|
import { AccessLevel, DEFAULT_PROTO_IMPL_TYPE, ObjectInitType } from "@eggjs/tegg-types";
|
|
4
|
-
import { StackUtil } from "@eggjs/tegg-common-util";
|
|
4
|
+
import { NameUtil, StackUtil } from "@eggjs/tegg-common-util";
|
|
5
5
|
|
|
6
6
|
//#region src/decorator/MultiInstanceProto.ts
|
|
7
7
|
const DEFAULT_PARAMS = {
|
|
@@ -16,14 +16,14 @@ function MultiInstanceProto(param) {
|
|
|
16
16
|
const property = {
|
|
17
17
|
...DEFAULT_PARAMS,
|
|
18
18
|
...param,
|
|
19
|
-
className: clazz.name
|
|
19
|
+
className: NameUtil.cleanName(clazz.name)
|
|
20
20
|
};
|
|
21
21
|
PrototypeUtil.setMultiInstanceStaticProperty(clazz, property);
|
|
22
22
|
} else if (param.getObjects) {
|
|
23
23
|
const property = {
|
|
24
24
|
...DEFAULT_PARAMS,
|
|
25
25
|
...param,
|
|
26
|
-
className: clazz.name
|
|
26
|
+
className: NameUtil.cleanName(clazz.name)
|
|
27
27
|
};
|
|
28
28
|
PrototypeUtil.setMultiInstanceCallbackProperty(clazz, property);
|
|
29
29
|
}
|
|
@@ -20,7 +20,7 @@ function Prototype(param) {
|
|
|
20
20
|
const property = {
|
|
21
21
|
...DEFAULT_PARAMS,
|
|
22
22
|
...param,
|
|
23
|
-
className: clazz.name
|
|
23
|
+
className: NameUtil.cleanName(clazz.name)
|
|
24
24
|
};
|
|
25
25
|
if (!property.name) property.name = NameUtil.getClassName(clazz);
|
|
26
26
|
PrototypeUtil.setProperty(clazz, property);
|
|
@@ -2,7 +2,7 @@ import { EggProtoImplClass, QualifierAttribute, QualifierInfo, QualifierValue }
|
|
|
2
2
|
|
|
3
3
|
//#region src/util/QualifierUtil.d.ts
|
|
4
4
|
declare class QualifierUtil {
|
|
5
|
-
static addProtoQualifier(clazz: EggProtoImplClass, attribute: QualifierAttribute, value: QualifierValue
|
|
5
|
+
static addProtoQualifier(clazz: EggProtoImplClass, attribute: QualifierAttribute, value: QualifierValue): void;
|
|
6
6
|
static getProtoQualifiers(clazz: EggProtoImplClass): QualifierInfo[];
|
|
7
7
|
static addInjectQualifier(clazz: EggProtoImplClass, property: PropertyKey | undefined, parameterIndex: number | undefined, attribute: QualifierAttribute, value: QualifierValue): void;
|
|
8
8
|
static addProperQualifier(clazz: EggProtoImplClass, property: PropertyKey, attribute: QualifierAttribute, value: QualifierValue): void;
|
|
@@ -4,8 +4,7 @@ import { MapUtil, ObjectUtils } from "@eggjs/tegg-common-util";
|
|
|
4
4
|
|
|
5
5
|
//#region src/util/QualifierUtil.ts
|
|
6
6
|
var QualifierUtil = class QualifierUtil {
|
|
7
|
-
static addProtoQualifier(clazz, attribute, value
|
|
8
|
-
if (QualifierUtil.getQualifierValue(clazz, attribute) && !isForceReplacement) throw new Error(`Qualifier Error: clazz ${clazz.name} attribute ${attribute.toString()} has been implemented`);
|
|
7
|
+
static addProtoQualifier(clazz, attribute, value) {
|
|
9
8
|
MetadataUtil.initOwnMapMetaData(QUALIFIER_META_DATA, clazz, /* @__PURE__ */ new Map()).set(attribute, value);
|
|
10
9
|
}
|
|
11
10
|
static getProtoQualifiers(clazz) {
|
|
@@ -39,7 +38,7 @@ var QualifierUtil = class QualifierUtil {
|
|
|
39
38
|
return res;
|
|
40
39
|
}
|
|
41
40
|
static getQualifierValue(clazz, attribute) {
|
|
42
|
-
return MetadataUtil.
|
|
41
|
+
return MetadataUtil.getOwnMetaData(QUALIFIER_META_DATA, clazz)?.get(attribute);
|
|
43
42
|
}
|
|
44
43
|
static getProperQualifier(clazz, property, attribute) {
|
|
45
44
|
return (MetadataUtil.getMetaData(PROPERTY_QUALIFIER_META_DATA, clazz)?.get(property))?.get(attribute);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/core-decorator",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.2",
|
|
4
4
|
"description": "tegg core decorator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"decorator",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eggjs/tegg-common-util": "4.0.2-beta.
|
|
38
|
-
"@eggjs/tegg-types": "4.0.2-beta.
|
|
37
|
+
"@eggjs/tegg-common-util": "4.0.2-beta.2",
|
|
38
|
+
"@eggjs/tegg-types": "4.0.2-beta.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^24.10.2",
|