@typeix/metadata 9.1.0-rc.3 → 9.1.0-rc.4
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/metadata.d.ts +1 -1
- package/dist/metadata.js +23 -5
- package/package.json +3 -3
package/dist/metadata.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface IDecoratorMetadataKey {
|
|
|
52
52
|
export declare function getMetadataKeysForTarget(target: Function, targetKey?: string | symbol): Array<IDecoratorMetadataKey>;
|
|
53
53
|
export declare function getMetadataForTarget(target: Function, targetKey?: string | symbol): Array<IMetadata>;
|
|
54
54
|
export declare function getAllKeysForTarget(target: Function): Array<{
|
|
55
|
-
key: string;
|
|
55
|
+
key: string | symbol;
|
|
56
56
|
target: Function;
|
|
57
57
|
}>;
|
|
58
58
|
export declare function getAllMetadataKeysForTarget(target: Function): Array<IDecoratorMetadataKey>;
|
package/dist/metadata.js
CHANGED
|
@@ -208,12 +208,29 @@ function getMetadataForTarget(target, targetKey) {
|
|
|
208
208
|
}
|
|
209
209
|
return (0, utils_1.flatten)(keys.map(item => mapKeyToMetadata(item)));
|
|
210
210
|
}
|
|
211
|
+
const decoratedKeys = new WeakMap();
|
|
212
|
+
function rememberDecoratedKey(target, propertyKey, type) {
|
|
213
|
+
var _a;
|
|
214
|
+
if (type === "constructor" || !(0, utils_1.isDefined)(propertyKey)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const keys = (_a = decoratedKeys.get(target)) !== null && _a !== void 0 ? _a : new Set();
|
|
218
|
+
keys.add(propertyKey);
|
|
219
|
+
decoratedKeys.set(target, keys);
|
|
220
|
+
}
|
|
211
221
|
function getAllKeysForTarget(target) {
|
|
222
|
+
var _a;
|
|
212
223
|
let keys = (0, utils_1.isObject)(target.prototype) ? [{ target: target, key: undefined }] : [], _target = (0, utils_1.isObject)(target.prototype) ? target.prototype : target;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
const ownKeys = new Set();
|
|
225
|
+
for (const key of Reflect.ownKeys(_target)) {
|
|
226
|
+
if ((0, utils_1.isSymbol)(key) || (0, utils_1.isString)(key)) {
|
|
227
|
+
ownKeys.add(key);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
for (const key of (_a = decoratedKeys.get(_target)) !== null && _a !== void 0 ? _a : []) {
|
|
231
|
+
ownKeys.add(key);
|
|
232
|
+
}
|
|
233
|
+
return keys.concat(Array.from(ownKeys).map(key => {
|
|
217
234
|
return {
|
|
218
235
|
key,
|
|
219
236
|
target: _target
|
|
@@ -305,7 +322,8 @@ function decorate(decorator, type, args) {
|
|
|
305
322
|
else {
|
|
306
323
|
defineMetadata(metadata.metadataKey, metadata, target, propertyKey);
|
|
307
324
|
}
|
|
308
|
-
|
|
325
|
+
rememberDecoratedKey(target, propertyKey, metadata.type);
|
|
326
|
+
return type === "constructor" ? target : undefined;
|
|
309
327
|
};
|
|
310
328
|
}
|
|
311
329
|
function createClassDecorator(decorator, args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typeix/metadata",
|
|
3
|
-
"version": "9.1.0-rc.
|
|
3
|
+
"version": "9.1.0-rc.4",
|
|
4
4
|
"description": "@typeix metadata apis::::",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://typeix.com",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@typeix/utils": "^9.1.0-rc.
|
|
32
|
+
"@typeix/utils": "^9.1.0-rc.4",
|
|
33
33
|
"reflect-metadata": "~0.2.2"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": "^26.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1e5ae6b3031d23aea22cf08e631ea366347b7963"
|
|
42
42
|
}
|