@prostojs/mate 0.0.3 → 0.1.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.
- package/README.md +45 -1
- package/dist/mate.cjs.prod.js +93 -14
- package/dist/mate.d.ts +6 -5
- package/dist/mate.esm-browser.prod.js +1 -1
- package/dist/mate.esm-bundler.js +93 -14
- package/dist/mate.global.prod.js +1 -1
- package/dist/src/mate.d.ts +5 -5
- package/dist/src/mate.d.ts.map +1 -1
- package/dist/src/reflect.d.ts +7 -0
- package/dist/src/reflect.d.ts.map +1 -0
- package/dist/src/tests/mate.artifacts.d.ts +18 -2
- package/dist/src/tests/mate.artifacts.d.ts.map +1 -1
- package/dist/src/tests/reflect.artifacts.d.ts +5 -0
- package/dist/src/tests/reflect.artifacts.d.ts.map +1 -0
- package/dist/src/tests/reflect.spec.d.ts +2 -0
- package/dist/src/tests/reflect.spec.d.ts.map +1 -0
- package/dist/src/utils/helpers.d.ts +2 -2
- package/dist/src/utils/helpers.d.ts.map +1 -1
- package/dist/src/utils/log.d.ts +1 -0
- package/dist/src/utils/log.d.ts.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -119,6 +119,7 @@ interface MyMeta extends TProstoMetadata {
|
|
|
119
119
|
const mate = new Mate<MyMeta>('my-metadata-key', {
|
|
120
120
|
readReturnType: true, // to copy `design:returntype` -> `returnType` of metadata object
|
|
121
121
|
readType: true, // to copy `design:type` -> `type` of metadata object
|
|
122
|
+
inherit: false, // allow or disable metadata inheritance
|
|
122
123
|
})
|
|
123
124
|
|
|
124
125
|
// Example of simple decorator
|
|
@@ -203,4 +204,47 @@ interface TMyMeta extends TProstoMetadata<TMyParamsMeta> {
|
|
|
203
204
|
|
|
204
205
|
// pass TMyMeta to Mate constructor to define types for mate instance
|
|
205
206
|
const mate = new Mate<TMyMeta>('my-metadata-key')
|
|
206
|
-
```
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Metadata Inheritance
|
|
210
|
+
|
|
211
|
+
It's possible to enable metadata inheritance and set some rules on whether it should be inherited from parent classes or not
|
|
212
|
+
|
|
213
|
+
### Metadata Inheritance ON
|
|
214
|
+
|
|
215
|
+
Simply use `true` on `inherit` key to enable metadata inheritance
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
const mate = new Mate<MyMeta>('my-metadata-key', {
|
|
219
|
+
inherit: true, // this will enable metadata inheritance for all the classes
|
|
220
|
+
})
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Conditional Metadata Inheritance
|
|
224
|
+
|
|
225
|
+
This example illustrates how to set a callback with logic to decide whether to inherit or not
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
const mate = new Mate<MyMeta>('my-metadata-key', {
|
|
229
|
+
inherit(classMeta, prop, methodMeta) {
|
|
230
|
+
if (prop) {
|
|
231
|
+
// if it is a method metadata
|
|
232
|
+
// we require a key `inherit` to be true for inheritance
|
|
233
|
+
return !!methodMeta?.inherit || !!(classMeta?.inherit && !methodMeta)
|
|
234
|
+
}
|
|
235
|
+
// otherwise (in case of class metadata) we require a key `inherit`
|
|
236
|
+
// to be true for inheritance on class metadata
|
|
237
|
+
return !!classMeta?.inherit
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Use or **reflect-metadata**
|
|
243
|
+
|
|
244
|
+
It is recomended to include `reflect-metadata` dependency to rely on the original implementation. Although it's still possible to use `@prostojs/mate` with no dependency on `reflect-metadata` because it already includes its own limited implementation of reflect-metadata which ships only the features used by `@prostojs/mate` such as:
|
|
245
|
+
|
|
246
|
+
- `getOwnMetadata(key, target, prop?)`
|
|
247
|
+
|
|
248
|
+
- `defineMetadata(key, data, target, prop?)`
|
|
249
|
+
|
|
250
|
+
- `metadata(key, data)`
|
package/dist/mate.cjs.prod.js
CHANGED
|
@@ -2,25 +2,79 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function getConstructor(instance) {
|
|
6
|
+
return isConstructor(instance) ?
|
|
7
|
+
instance : instance.constructor ?
|
|
8
|
+
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
9
|
+
}
|
|
10
|
+
function isConstructor(v) {
|
|
11
|
+
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
const banner = () => `[prostojs/mate][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
6
15
|
|
|
16
|
+
function warn(text) {
|
|
17
|
+
console.log('[33m' + banner() + text + '[0m');
|
|
18
|
+
}
|
|
7
19
|
function logError(error) {
|
|
8
20
|
console.error('[91m' + '[1m' + banner() + error + '[0m');
|
|
9
21
|
}
|
|
10
22
|
|
|
23
|
+
const classMetadata = {};
|
|
24
|
+
const paramMetadata = {};
|
|
25
|
+
const root = typeof global === 'object' ? global : typeof self === 'object' ? self : {};
|
|
26
|
+
function getMetaObject(target, prop) {
|
|
27
|
+
const isParam = typeof prop !== 'undefined';
|
|
28
|
+
const metadata = isParam ? paramMetadata : classMetadata;
|
|
29
|
+
const targetKey = Symbol.for(getConstructor(target));
|
|
30
|
+
let meta = metadata[targetKey] = metadata[targetKey] || {};
|
|
31
|
+
if (isParam)
|
|
32
|
+
meta = (meta[prop] = meta[prop] || {});
|
|
33
|
+
return meta;
|
|
34
|
+
}
|
|
35
|
+
const _reflect = {
|
|
36
|
+
getOwnMetadata(key, target, prop) {
|
|
37
|
+
return getMetaObject(target, prop)[key];
|
|
38
|
+
},
|
|
39
|
+
defineMetadata(key, data, target, prop) {
|
|
40
|
+
const meta = getMetaObject(target, prop);
|
|
41
|
+
meta[key] = data;
|
|
42
|
+
},
|
|
43
|
+
metadata(key, data) {
|
|
44
|
+
return ((target, propKey) => {
|
|
45
|
+
Reflect$1.defineMetadata(key, data, target, propKey);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
if (!root.Reflect) {
|
|
50
|
+
root.Reflect = _reflect;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const funcs = [
|
|
54
|
+
'getOwnMetadata',
|
|
55
|
+
'defineMetadata',
|
|
56
|
+
'metadata',
|
|
57
|
+
];
|
|
58
|
+
const target = root.Reflect;
|
|
59
|
+
let isOriginalReflectMetadata = true;
|
|
60
|
+
for (const func of funcs) {
|
|
61
|
+
if (typeof target[func] !== 'function') {
|
|
62
|
+
Object.defineProperty(target, func, { configurable: true, writable: true, value: _reflect[func] });
|
|
63
|
+
isOriginalReflectMetadata = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!isOriginalReflectMetadata) {
|
|
67
|
+
warn('A limited \'reflect-metadata\' implementation is used. In case of any issues include original \'reflect-metadata\' package and require it before any @prostojs/mate import.');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const Reflect$1 = _reflect;
|
|
71
|
+
|
|
11
72
|
function panic(error) {
|
|
12
73
|
logError(error);
|
|
13
74
|
return new Error(error);
|
|
14
75
|
}
|
|
15
76
|
|
|
16
|
-
|
|
17
|
-
return Object.getPrototypeOf(instance).constructor;
|
|
18
|
-
}
|
|
19
|
-
function isConstructor(v) {
|
|
20
|
-
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
require('reflect-metadata');
|
|
77
|
+
const Reflect = (global === null || global === void 0 ? void 0 : global.Reflect) || (self === null || self === void 0 ? void 0 : self.Reflect) || Reflect$1;
|
|
24
78
|
class Mate {
|
|
25
79
|
constructor(workspace, options = {}) {
|
|
26
80
|
this.workspace = workspace;
|
|
@@ -28,18 +82,18 @@ class Mate {
|
|
|
28
82
|
}
|
|
29
83
|
set(args, key, value, isArray) {
|
|
30
84
|
var _a;
|
|
31
|
-
let meta = Reflect.
|
|
85
|
+
let meta = Reflect.getOwnMetadata(this.workspace, args.target, args.propKey) || {};
|
|
32
86
|
if (args.propKey && this.options.readReturnType && !meta.returnType) {
|
|
33
|
-
meta.returnType = Reflect.
|
|
87
|
+
meta.returnType = Reflect.getOwnMetadata('design:returntype', args.target, args.propKey);
|
|
34
88
|
}
|
|
35
89
|
if (args.propKey && this.options.readType && !meta.type) {
|
|
36
|
-
meta.type = Reflect.
|
|
90
|
+
meta.type = Reflect.getOwnMetadata('design:type', args.target, args.propKey);
|
|
37
91
|
}
|
|
38
92
|
const { index } = args;
|
|
39
93
|
const cb = typeof key === 'function' ? key : undefined;
|
|
40
94
|
let data = meta;
|
|
41
95
|
if (!data.params) {
|
|
42
|
-
data.params = (_a = Reflect.
|
|
96
|
+
data.params = (_a = Reflect.getOwnMetadata('design:paramtypes', args.target, args.propKey)) === null || _a === void 0 ? void 0 : _a.map((f) => ({ type: f }));
|
|
43
97
|
}
|
|
44
98
|
if (typeof index === 'number') {
|
|
45
99
|
data.params = data.params || [];
|
|
@@ -72,7 +126,31 @@ class Mate {
|
|
|
72
126
|
Reflect.defineMetadata(this.workspace, meta, args.target, args.propKey);
|
|
73
127
|
}
|
|
74
128
|
read(target, propKey) {
|
|
75
|
-
|
|
129
|
+
const isConstr = isConstructor(target);
|
|
130
|
+
const constructor = isConstr ? target : getConstructor(target);
|
|
131
|
+
const proto = constructor.prototype;
|
|
132
|
+
let ownMeta = Reflect.getOwnMetadata(this.workspace, typeof propKey === 'string' ? proto : constructor, propKey);
|
|
133
|
+
if (this.options.inherit) {
|
|
134
|
+
const inheritFn = typeof this.options.inherit === 'function' ? this.options.inherit : undefined;
|
|
135
|
+
let shouldInherit = this.options.inherit;
|
|
136
|
+
if (inheritFn) {
|
|
137
|
+
if (typeof propKey === 'string') {
|
|
138
|
+
const classMeta = Reflect.getOwnMetadata(this.workspace, constructor);
|
|
139
|
+
shouldInherit = inheritFn(classMeta, propKey, ownMeta);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
shouldInherit = inheritFn(ownMeta);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (shouldInherit) {
|
|
146
|
+
const parent = Object.getPrototypeOf(constructor);
|
|
147
|
+
if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
|
|
148
|
+
const inheritedMeta = this.read(parent, propKey);
|
|
149
|
+
ownMeta = { ...inheritedMeta, ...ownMeta, params: ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return ownMeta;
|
|
76
154
|
}
|
|
77
155
|
apply(...decorators) {
|
|
78
156
|
return ((target, propKey, descriptor) => {
|
|
@@ -92,7 +170,8 @@ class Mate {
|
|
|
92
170
|
this.set(args, key, value, isArray);
|
|
93
171
|
});
|
|
94
172
|
}
|
|
95
|
-
}
|
|
173
|
+
}
|
|
174
|
+
const fnProto = Object.getPrototypeOf(Function);
|
|
96
175
|
|
|
97
176
|
exports.Mate = Mate;
|
|
98
177
|
exports.getConstructor = getConstructor;
|
package/dist/mate.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare function getConstructor<T =
|
|
1
|
+
export declare function getConstructor<T = TAny>(instance: T): TFunction;
|
|
2
2
|
|
|
3
3
|
export declare function isConstructor<T = TAny>(v: T): v is (T & TClassConstructor);
|
|
4
4
|
|
|
5
5
|
export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
|
|
6
6
|
protected workspace: string;
|
|
7
|
-
protected options: TMateOptions
|
|
8
|
-
constructor(workspace: string, options?: TMateOptions);
|
|
7
|
+
protected options: TMateOptions<T>;
|
|
8
|
+
constructor(workspace: string, options?: TMateOptions<T>);
|
|
9
9
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, cb: ((meta: R & RP) => R & RP)): void;
|
|
10
10
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, key: keyof R | keyof RP, value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined): void;
|
|
11
11
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, key: keyof R | keyof RP, value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined, isArray: boolean | undefined): void;
|
|
12
|
-
read<R = T>(target: TFunction | TObject, propKey?: string | symbol): R | undefined;
|
|
12
|
+
read<R extends T = T>(target: TFunction | TObject, propKey?: string | symbol): R | undefined;
|
|
13
13
|
apply(...decorators: (MethodDecorator & ClassDecorator & ParameterDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator;
|
|
14
14
|
decorate<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator;
|
|
15
15
|
decorate<R extends T = T, RP = R['params'][0]>(key: keyof R | keyof RP | ((meta: R & RP) => R & RP), value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined): MethodDecorator & ClassDecorator & ParameterDecorator;
|
|
@@ -22,9 +22,10 @@ declare type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
|
|
|
22
22
|
|
|
23
23
|
declare type TFunction = Function;
|
|
24
24
|
|
|
25
|
-
export declare interface TMateOptions {
|
|
25
|
+
export declare interface TMateOptions<T extends TProstoMetadata = TProstoMetadata> {
|
|
26
26
|
readReturnType?: boolean;
|
|
27
27
|
readType?: boolean;
|
|
28
|
+
inherit?: boolean | ((classMeta: T, propKey?: string, methodMeta?: T) => boolean);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export declare interface TMergedDecoratorArgs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){
|
|
1
|
+
function t(t){return e(t)?t:t.constructor?t.constructor:Object.getPrototypeOf(t).constructor}function e(t){return"function"==typeof t&&Object.getOwnPropertyNames(t).includes("prototype")&&!Object.getOwnPropertyNames(t).includes("caller")&&!!t.name}const o=()=>`[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `;const a={},r={},n="object"==typeof global?global:"object"==typeof self?self:{};function i(e,o){const n=void 0!==o,i=n?r:a,s=Symbol.for(t(e));let p=i[s]=i[s]||{};return n&&(p=p[o]=p[o]||{}),p}const s={getOwnMetadata:(t,e,o)=>i(e,o)[t],defineMetadata(t,e,o,a){i(o,a)[t]=e},metadata:(t,e)=>(o,a)=>{c.defineMetadata(t,e,o,a)}};if(n.Reflect){const t=["getOwnMetadata","defineMetadata","metadata"],e=n.Reflect;let a=!0;for(const o of t)"function"!=typeof e[o]&&(Object.defineProperty(e,o,{configurable:!0,writable:!0,value:s[o]}),a=!1);a||(p="A limited 'reflect-metadata' implementation is used. In case of any issues include original 'reflect-metadata' package and require it before any @prostojs/mate import.",console.log("[33m"+o()+p+"[0m"))}else n.Reflect=s;var p;const c=s;function f(t){return function(t){console.error("[91m[1m"+o()+t+"[0m")}(t),new Error(t)}const l=(null===global||void 0===global?void 0:global.Reflect)||(null===self||void 0===self?void 0:self.Reflect)||c;class d{constructor(t,e={}){this.workspace=t,this.options=e}set(t,e,o,a){var r;let n=l.getOwnMetadata(this.workspace,t.target,t.propKey)||{};t.propKey&&this.options.readReturnType&&!n.returnType&&(n.returnType=l.getOwnMetadata("design:returntype",t.target,t.propKey)),t.propKey&&this.options.readType&&!n.type&&(n.type=l.getOwnMetadata("design:type",t.target,t.propKey));const{index:i}=t,s="function"==typeof e?e:void 0;let p=n;if(p.params||(p.params=null===(r=l.getOwnMetadata("design:paramtypes",t.target,t.propKey))||void 0===r?void 0:r.map((t=>({type:t})))),"number"==typeof i&&(p.params=p.params||[],p.params[i]=p.params[i]||{type:void 0},s?p.params[i]=s(p.params[i]):p=p.params[i]),"function"!=typeof e)if(a){const t=p[e]||[];Array.isArray(t)||f("Mate.add (isArray=true) called for non-array metadata"),t.unshift(o),p[e]=t}else p[e]=o;else s&&"number"!=typeof i&&(n=s(p));l.defineMetadata(this.workspace,n,t.target,t.propKey)}read(o,a){const r=e(o)?o:t(o);let n=l.getOwnMetadata(this.workspace,"string"==typeof a?r.prototype:r,a);if(this.options.inherit){const t="function"==typeof this.options.inherit?this.options.inherit:void 0;let e=this.options.inherit;if(t)if("string"==typeof a){e=t(l.getOwnMetadata(this.workspace,r),a,n)}else e=t(n);if(e){const t=Object.getPrototypeOf(r);if("function"==typeof t&&t!==y&&t!==r){n={...this.read(t,a),...n,params:null==n?void 0:n.params}}}}return n}apply(...t){return(e,o,a)=>{for(const r of t)r(e,o,a)}}decorate(t,e,o){return(a,r,n)=>{this.set({target:a,propKey:r,descriptor:"number"==typeof n?void 0:n,index:"number"==typeof n?n:void 0},t,e,o)}}}const y=Object.getPrototypeOf(Function);export{d as Mate,t as getConstructor,e as isConstructor};
|
package/dist/mate.esm-bundler.js
CHANGED
|
@@ -1,22 +1,76 @@
|
|
|
1
|
+
function getConstructor(instance) {
|
|
2
|
+
return isConstructor(instance) ?
|
|
3
|
+
instance : instance.constructor ?
|
|
4
|
+
instance.constructor : Object.getPrototypeOf(instance).constructor;
|
|
5
|
+
}
|
|
6
|
+
function isConstructor(v) {
|
|
7
|
+
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
const banner = () => `[prostojs/mate][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
2
11
|
|
|
12
|
+
function warn(text) {
|
|
13
|
+
console.log('[33m' + banner() + text + '[0m');
|
|
14
|
+
}
|
|
3
15
|
function logError(error) {
|
|
4
16
|
console.error('[91m' + '[1m' + banner() + error + '[0m');
|
|
5
17
|
}
|
|
6
18
|
|
|
19
|
+
const classMetadata = {};
|
|
20
|
+
const paramMetadata = {};
|
|
21
|
+
const root = typeof global === 'object' ? global : typeof self === 'object' ? self : {};
|
|
22
|
+
function getMetaObject(target, prop) {
|
|
23
|
+
const isParam = typeof prop !== 'undefined';
|
|
24
|
+
const metadata = isParam ? paramMetadata : classMetadata;
|
|
25
|
+
const targetKey = Symbol.for(getConstructor(target));
|
|
26
|
+
let meta = metadata[targetKey] = metadata[targetKey] || {};
|
|
27
|
+
if (isParam)
|
|
28
|
+
meta = (meta[prop] = meta[prop] || {});
|
|
29
|
+
return meta;
|
|
30
|
+
}
|
|
31
|
+
const _reflect = {
|
|
32
|
+
getOwnMetadata(key, target, prop) {
|
|
33
|
+
return getMetaObject(target, prop)[key];
|
|
34
|
+
},
|
|
35
|
+
defineMetadata(key, data, target, prop) {
|
|
36
|
+
const meta = getMetaObject(target, prop);
|
|
37
|
+
meta[key] = data;
|
|
38
|
+
},
|
|
39
|
+
metadata(key, data) {
|
|
40
|
+
return ((target, propKey) => {
|
|
41
|
+
Reflect$1.defineMetadata(key, data, target, propKey);
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
if (!root.Reflect) {
|
|
46
|
+
root.Reflect = _reflect;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const funcs = [
|
|
50
|
+
'getOwnMetadata',
|
|
51
|
+
'defineMetadata',
|
|
52
|
+
'metadata',
|
|
53
|
+
];
|
|
54
|
+
const target = root.Reflect;
|
|
55
|
+
let isOriginalReflectMetadata = true;
|
|
56
|
+
for (const func of funcs) {
|
|
57
|
+
if (typeof target[func] !== 'function') {
|
|
58
|
+
Object.defineProperty(target, func, { configurable: true, writable: true, value: _reflect[func] });
|
|
59
|
+
isOriginalReflectMetadata = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!isOriginalReflectMetadata) {
|
|
63
|
+
warn('A limited \'reflect-metadata\' implementation is used. In case of any issues include original \'reflect-metadata\' package and require it before any @prostojs/mate import.');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const Reflect$1 = _reflect;
|
|
67
|
+
|
|
7
68
|
function panic(error) {
|
|
8
69
|
logError(error);
|
|
9
70
|
return new Error(error);
|
|
10
71
|
}
|
|
11
72
|
|
|
12
|
-
|
|
13
|
-
return Object.getPrototypeOf(instance).constructor;
|
|
14
|
-
}
|
|
15
|
-
function isConstructor(v) {
|
|
16
|
-
return typeof v === 'function' && Object.getOwnPropertyNames(v).includes('prototype') && !Object.getOwnPropertyNames(v).includes('caller') && !!v.name;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
require('reflect-metadata');
|
|
73
|
+
const Reflect = (global === null || global === void 0 ? void 0 : global.Reflect) || (self === null || self === void 0 ? void 0 : self.Reflect) || Reflect$1;
|
|
20
74
|
class Mate {
|
|
21
75
|
constructor(workspace, options = {}) {
|
|
22
76
|
this.workspace = workspace;
|
|
@@ -24,18 +78,18 @@ class Mate {
|
|
|
24
78
|
}
|
|
25
79
|
set(args, key, value, isArray) {
|
|
26
80
|
var _a;
|
|
27
|
-
let meta = Reflect.
|
|
81
|
+
let meta = Reflect.getOwnMetadata(this.workspace, args.target, args.propKey) || {};
|
|
28
82
|
if (args.propKey && this.options.readReturnType && !meta.returnType) {
|
|
29
|
-
meta.returnType = Reflect.
|
|
83
|
+
meta.returnType = Reflect.getOwnMetadata('design:returntype', args.target, args.propKey);
|
|
30
84
|
}
|
|
31
85
|
if (args.propKey && this.options.readType && !meta.type) {
|
|
32
|
-
meta.type = Reflect.
|
|
86
|
+
meta.type = Reflect.getOwnMetadata('design:type', args.target, args.propKey);
|
|
33
87
|
}
|
|
34
88
|
const { index } = args;
|
|
35
89
|
const cb = typeof key === 'function' ? key : undefined;
|
|
36
90
|
let data = meta;
|
|
37
91
|
if (!data.params) {
|
|
38
|
-
data.params = (_a = Reflect.
|
|
92
|
+
data.params = (_a = Reflect.getOwnMetadata('design:paramtypes', args.target, args.propKey)) === null || _a === void 0 ? void 0 : _a.map((f) => ({ type: f }));
|
|
39
93
|
}
|
|
40
94
|
if (typeof index === 'number') {
|
|
41
95
|
data.params = data.params || [];
|
|
@@ -68,7 +122,31 @@ class Mate {
|
|
|
68
122
|
Reflect.defineMetadata(this.workspace, meta, args.target, args.propKey);
|
|
69
123
|
}
|
|
70
124
|
read(target, propKey) {
|
|
71
|
-
|
|
125
|
+
const isConstr = isConstructor(target);
|
|
126
|
+
const constructor = isConstr ? target : getConstructor(target);
|
|
127
|
+
const proto = constructor.prototype;
|
|
128
|
+
let ownMeta = Reflect.getOwnMetadata(this.workspace, typeof propKey === 'string' ? proto : constructor, propKey);
|
|
129
|
+
if (this.options.inherit) {
|
|
130
|
+
const inheritFn = typeof this.options.inherit === 'function' ? this.options.inherit : undefined;
|
|
131
|
+
let shouldInherit = this.options.inherit;
|
|
132
|
+
if (inheritFn) {
|
|
133
|
+
if (typeof propKey === 'string') {
|
|
134
|
+
const classMeta = Reflect.getOwnMetadata(this.workspace, constructor);
|
|
135
|
+
shouldInherit = inheritFn(classMeta, propKey, ownMeta);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
shouldInherit = inheritFn(ownMeta);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (shouldInherit) {
|
|
142
|
+
const parent = Object.getPrototypeOf(constructor);
|
|
143
|
+
if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
|
|
144
|
+
const inheritedMeta = this.read(parent, propKey);
|
|
145
|
+
ownMeta = { ...inheritedMeta, ...ownMeta, params: ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return ownMeta;
|
|
72
150
|
}
|
|
73
151
|
apply(...decorators) {
|
|
74
152
|
return ((target, propKey, descriptor) => {
|
|
@@ -88,6 +166,7 @@ class Mate {
|
|
|
88
166
|
this.set(args, key, value, isArray);
|
|
89
167
|
});
|
|
90
168
|
}
|
|
91
|
-
}
|
|
169
|
+
}
|
|
170
|
+
const fnProto = Object.getPrototypeOf(Function);
|
|
92
171
|
|
|
93
172
|
export { Mate, getConstructor, isConstructor };
|
package/dist/mate.global.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ProstoMate=function(
|
|
1
|
+
var ProstoMate=function(t){"use strict";function e(t){return o(t)?t:t.constructor?t.constructor:Object.getPrototypeOf(t).constructor}function o(t){return"function"==typeof t&&Object.getOwnPropertyNames(t).includes("prototype")&&!Object.getOwnPropertyNames(t).includes("caller")&&!!t.name}const r=()=>`[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `;const a={},n={},s="object"==typeof global?global:"object"==typeof self?self:{};function i(t,o){const r=void 0!==o,s=r?n:a,i=Symbol.for(e(t));let p=s[i]=s[i]||{};return r&&(p=p[o]=p[o]||{}),p}const p={getOwnMetadata:(t,e,o)=>i(e,o)[t],defineMetadata(t,e,o,r){i(o,r)[t]=e},metadata:(t,e)=>(o,r)=>{f.defineMetadata(t,e,o,r)}};if(s.Reflect){const t=["getOwnMetadata","defineMetadata","metadata"],e=s.Reflect;let o=!0;for(const r of t)"function"!=typeof e[r]&&(Object.defineProperty(e,r,{configurable:!0,writable:!0,value:p[r]}),o=!1);o||(c="A limited 'reflect-metadata' implementation is used. In case of any issues include original 'reflect-metadata' package and require it before any @prostojs/mate import.",console.log("[33m"+r()+c+"[0m"))}else s.Reflect=p;var c;const f=p;function l(t){return function(t){console.error("[91m[1m"+r()+t+"[0m")}(t),new Error(t)}const d=(null===global||void 0===global?void 0:global.Reflect)||(null===self||void 0===self?void 0:self.Reflect)||f;const u=Object.getPrototypeOf(Function);return t.Mate=class{constructor(t,e={}){this.workspace=t,this.options=e}set(t,e,o,r){var a;let n=d.getOwnMetadata(this.workspace,t.target,t.propKey)||{};t.propKey&&this.options.readReturnType&&!n.returnType&&(n.returnType=d.getOwnMetadata("design:returntype",t.target,t.propKey)),t.propKey&&this.options.readType&&!n.type&&(n.type=d.getOwnMetadata("design:type",t.target,t.propKey));const{index:s}=t,i="function"==typeof e?e:void 0;let p=n;if(p.params||(p.params=null===(a=d.getOwnMetadata("design:paramtypes",t.target,t.propKey))||void 0===a?void 0:a.map((t=>({type:t})))),"number"==typeof s&&(p.params=p.params||[],p.params[s]=p.params[s]||{type:void 0},i?p.params[s]=i(p.params[s]):p=p.params[s]),"function"!=typeof e)if(r){const t=p[e]||[];Array.isArray(t)||l("Mate.add (isArray=true) called for non-array metadata"),t.unshift(o),p[e]=t}else p[e]=o;else i&&"number"!=typeof s&&(n=i(p));d.defineMetadata(this.workspace,n,t.target,t.propKey)}read(t,r){const a=o(t)?t:e(t);let n=d.getOwnMetadata(this.workspace,"string"==typeof r?a.prototype:a,r);if(this.options.inherit){const t="function"==typeof this.options.inherit?this.options.inherit:void 0;let e=this.options.inherit;if(t)if("string"==typeof r){e=t(d.getOwnMetadata(this.workspace,a),r,n)}else e=t(n);if(e){const t=Object.getPrototypeOf(a);if("function"==typeof t&&t!==u&&t!==a){n={...this.read(t,r),...n,params:null==n?void 0:n.params}}}}return n}apply(...t){return(e,o,r)=>{for(const a of t)a(e,o,r)}}decorate(t,e,o){return(r,a,n)=>{this.set({target:r,propKey:a,descriptor:"number"==typeof n?void 0:n,index:"number"==typeof n?n:void 0},t,e,o)}}},t.getConstructor=e,t.isConstructor=o,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
package/dist/src/mate.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
import { TAny, TFunction, TObject } from './types';
|
|
3
2
|
export interface TMergedDecoratorArgs {
|
|
4
3
|
target: TFunction | TObject;
|
|
@@ -14,18 +13,19 @@ export interface TProstoMetadata<TParams extends TProstoParamsMetadata = TProsto
|
|
|
14
13
|
export interface TProstoParamsMetadata {
|
|
15
14
|
type?: TFunction;
|
|
16
15
|
}
|
|
17
|
-
export interface TMateOptions {
|
|
16
|
+
export interface TMateOptions<T extends TProstoMetadata = TProstoMetadata> {
|
|
18
17
|
readReturnType?: boolean;
|
|
19
18
|
readType?: boolean;
|
|
19
|
+
inherit?: boolean | ((classMeta: T, propKey?: string, methodMeta?: T) => boolean);
|
|
20
20
|
}
|
|
21
21
|
export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
|
|
22
22
|
protected workspace: string;
|
|
23
|
-
protected options: TMateOptions
|
|
24
|
-
constructor(workspace: string, options?: TMateOptions);
|
|
23
|
+
protected options: TMateOptions<T>;
|
|
24
|
+
constructor(workspace: string, options?: TMateOptions<T>);
|
|
25
25
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, cb: ((meta: R & RP) => R & RP)): void;
|
|
26
26
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, key: keyof R | keyof RP, value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined): void;
|
|
27
27
|
set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, key: keyof R | keyof RP, value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined, isArray: boolean | undefined): void;
|
|
28
|
-
read<R = T>(target: TFunction | TObject, propKey?: string | symbol): R | undefined;
|
|
28
|
+
read<R extends T = T>(target: TFunction | TObject, propKey?: string | symbol): R | undefined;
|
|
29
29
|
apply(...decorators: (MethodDecorator & ClassDecorator & ParameterDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator;
|
|
30
30
|
decorate<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator;
|
|
31
31
|
decorate<R extends T = T, RP = R['params'][0]>(key: keyof R | keyof RP | ((meta: R & RP) => R & RP), value: ((R & RP)[keyof R] & (R & RP)[keyof RP]) | undefined): MethodDecorator & ClassDecorator & ParameterDecorator;
|
package/dist/src/mate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TFunction, TObject } from './types';
|
|
2
|
+
export declare const Reflect: {
|
|
3
|
+
getOwnMetadata(key: string | symbol, target: TObject | TFunction, prop?: string | symbol): unknown;
|
|
4
|
+
defineMetadata(key: string | symbol, data: unknown, target: TObject | TFunction, prop?: string | symbol): void;
|
|
5
|
+
metadata(key: string | symbol, data: unknown): ClassDecorator & MethodDecorator & ParameterDecorator;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=reflect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../../src/reflect.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAuD5C,eAAO,MAAM,OAAO;wBAnCI,MAAM,GAAG,MAAM,UAAU,OAAO,GAAG,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO;wBAG9E,MAAM,GAAG,MAAM,QAAQ,OAAO,UAAU,OAAO,GAAG,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI;kBAIhG,MAAM,GAAG,MAAM,QAAQ,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,kBAAkB;CA4BzE,CAAA"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { Mate, TProstoMetadata } from '..';
|
|
2
|
+
export declare const mate: Mate<{
|
|
3
|
+
inherit?: boolean | undefined;
|
|
4
|
+
} & TProstoMetadata<import("..").TProstoParamsMetadata>>;
|
|
5
|
+
export declare class MateTestClass {
|
|
2
6
|
constructor(_a: string);
|
|
3
7
|
test(_b: string): string;
|
|
4
8
|
viaCB(_c: string): void;
|
|
5
9
|
}
|
|
6
|
-
export declare class
|
|
10
|
+
export declare class MateTestClass2 {
|
|
11
|
+
constructor(a: string);
|
|
7
12
|
test(): void;
|
|
13
|
+
toOverwriteMeta(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class MateTestClass3 extends MateTestClass2 {
|
|
16
|
+
constructor();
|
|
17
|
+
test2(): void;
|
|
18
|
+
toOverwriteMeta(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class MateTestClass4 extends MateTestClass2 {
|
|
21
|
+
constructor();
|
|
22
|
+
test2(): void;
|
|
23
|
+
toOverwriteMeta(): void;
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=mate.artifacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mate.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.artifacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mate.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.artifacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAE1C,eAAO,MAAM,IAAI;;wDASf,CAAA;AAMF,qBAGa,aAAa;gBAKd,EAAE,EAAE,MAAM;IAQlB,IAAI,CAII,EAAE,EAAE,MAAM,GAAG,MAAM;IAgB3B,KAAK,CAMG,EAAE,EAAE,MAAM;CAGrB;AAED,qBACa,cAAc;gBACX,CAAC,EAAE,MAAM;IAOrB,IAAI;IAMJ,eAAe;CAGlB;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAML,eAAe;CAGlB;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAKL,eAAe;CAGlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/reflect.artifacts.ts"],"names":[],"mappings":"AAIA,qBAEa,gBAAgB;gBAIrB,CAAC,EAAE,OAAO,EAGV,CAAC,EAAE,IAAI;IAKX,MAAM,CAGF,CAAC,EAAE,MAAM,EAGT,CAAC,EAAE,MAAM;CAEhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.spec.d.ts","sourceRoot":"","sources":["../../../src/tests/reflect.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TAny, TClassConstructor, TFunction
|
|
2
|
-
export declare function getConstructor<T =
|
|
1
|
+
import { TAny, TClassConstructor, TFunction } from '../types';
|
|
2
|
+
export declare function getConstructor<T = TAny>(instance: T): TFunction;
|
|
3
3
|
export declare function isConstructor<T = TAny>(v: T): v is (T & TClassConstructor);
|
|
4
4
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAW,MAAM,UAAU,CAAA;AAEtE,wBAAgB,cAAc,CAAC,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,CAK/D;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAE1E"}
|
package/dist/src/utils/log.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/utils/log.ts"],"names":[],"mappings":"AAGA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,QAE/B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,QAErC"}
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/utils/log.ts"],"names":[],"mappings":"AAGA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,QAE/B;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,QAEhC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,QAErC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prostojs/mate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MATE is TS Metadata Organizer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/mate.esm-bundler.js",
|
|
@@ -39,9 +39,7 @@
|
|
|
39
39
|
"global"
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"reflect-metadata": "^0.1.13"
|
|
44
|
-
},
|
|
42
|
+
"dependencies": {},
|
|
45
43
|
"gitHooks": {
|
|
46
44
|
"commit-msg": "node scripts/verifyCommit.js"
|
|
47
45
|
},
|
|
@@ -52,6 +50,7 @@
|
|
|
52
50
|
},
|
|
53
51
|
"homepage": "https://github.com/prostojs/mate#readme",
|
|
54
52
|
"devDependencies": {
|
|
53
|
+
"reflect-metadata": "^0.1.13",
|
|
55
54
|
"@microsoft/api-extractor": "^7.30.0",
|
|
56
55
|
"@prostojs/dye": "^0.3.0",
|
|
57
56
|
"@rollup/plugin-commonjs": "^21.0.0",
|