@prostojs/mate 0.1.14 → 0.2.1
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 +93 -181
- package/dist/mate.cjs.prod.js +2 -2
- package/dist/mate.d.ts +26 -17
- package/dist/mate.esm-bundler.js +2 -2
- package/dist/src/mate.d.ts +26 -19
- package/dist/src/mate.d.ts.map +1 -1
- package/dist/src/tests/mate.artifacts.d.ts +6 -4
- package/dist/src/tests/mate.artifacts.d.ts.map +1 -1
- package/dist/src/types.d.ts +4 -4
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,208 +2,110 @@
|
|
|
2
2
|
|
|
3
3
|
This small library is TS Metadata Organizer based on [`reflect-metadata`](https://github.com/rbuckton/reflect-metadata). "MA-TE" is for "ME-TA" in reverse order.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It allows you to define, manipulate, and read metadata at different levels, including classes, properties, methods, and parameters.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The primary purpose of Mate is to streamline the use of metadata, making it simpler and more efficient to handle.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Installation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
You can install Mate from the npm registry.
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
interface TMyMeta extends TProstoMetadata {
|
|
17
|
-
required: boolean
|
|
18
|
-
label: string
|
|
19
|
-
items: string[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Create an instance of Mate with metadata
|
|
23
|
-
// key 'my-metadata-key'
|
|
24
|
-
// This key will be used by Reflect.defineMetadata
|
|
25
|
-
// and Reflect.getMetadata
|
|
26
|
-
const mate = new Mate<TMyMeta>('my-metadata-key')
|
|
27
|
-
|
|
28
|
-
@mate.decorate('required', true)
|
|
29
|
-
@mate.decorate('label', 'My Class')
|
|
30
|
-
@mate.decorate('items', 'first item', true)
|
|
31
|
-
@mate.decorate('items', 'second item', true)
|
|
32
|
-
class MyClass {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log(mate.read(MyClass))
|
|
37
|
-
// {
|
|
38
|
-
// params: undefined,
|
|
39
|
-
// items: [ 'first item', 'second item' ],
|
|
40
|
-
// label: 'My Class',
|
|
41
|
-
// required: true
|
|
42
|
-
// }
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Method Decorators
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
import { Mate } from '@prostojs/mate'
|
|
49
|
-
const mate = new Mate('my-metadata-key')
|
|
50
|
-
class MyClass {
|
|
51
|
-
@mate.decorate('required', true)
|
|
52
|
-
@mate.decorate('label', 'My Method Label')
|
|
53
|
-
methodName() {}
|
|
54
|
-
}
|
|
55
|
-
console.log(mate.read(MyClass, 'methodName'))
|
|
56
|
-
// { params: [], label: 'My Method Label', required: true }
|
|
13
|
+
```bash
|
|
14
|
+
npm install @prostojs/mate
|
|
57
15
|
```
|
|
58
16
|
|
|
59
|
-
##
|
|
17
|
+
## Usage
|
|
60
18
|
|
|
61
|
-
|
|
19
|
+
After installation, you can start using Mate to define and handle metadata in your TypeScript project. Below is an example that showcases different levels of metadata usage.
|
|
62
20
|
|
|
63
21
|
```ts
|
|
64
|
-
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
22
|
+
import { TMateParamMeta } from '@prostojs/mate';
|
|
23
|
+
import { Mate } from '@prostojs/mate';
|
|
24
|
+
|
|
25
|
+
// Define your metadata interfaces
|
|
26
|
+
interface TClassMeta {
|
|
27
|
+
name: string;
|
|
28
|
+
model: string;
|
|
29
|
+
fromParam: string;
|
|
30
|
+
manufacturer: string;
|
|
31
|
+
data: string[];
|
|
32
|
+
inherit?: bolean;
|
|
73
33
|
}
|
|
74
|
-
console.log(mate.read(MyClass))
|
|
75
|
-
// {
|
|
76
|
-
// params: [
|
|
77
|
-
// { type: [Function: String], label: 'my string' },
|
|
78
|
-
// { type: [Function: Number], label: 'my number' }
|
|
79
|
-
// ]
|
|
80
|
-
// }
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Method Params Decorators
|
|
84
|
-
|
|
85
|
-
`params[].type` are filled from `design:paramtypes` automatically
|
|
86
34
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
myMethod(
|
|
92
|
-
@mate.decorate('label', 'my string')
|
|
93
|
-
str: string,
|
|
94
|
-
@mate.decorate('label', 'my number')
|
|
95
|
-
n: number,
|
|
96
|
-
) {}
|
|
35
|
+
interface TPropMeta<TParamMeta> {
|
|
36
|
+
description: string;
|
|
37
|
+
params: (TMateParamMeta & TParamMeta)[];
|
|
38
|
+
inherit?: bolean
|
|
97
39
|
}
|
|
98
|
-
console.log(mate.read(MyClass, 'myMethod'))
|
|
99
|
-
// {
|
|
100
|
-
// params: [
|
|
101
|
-
// { type: [Function: String], label: 'my string' },
|
|
102
|
-
// { type: [Function: Number], label: 'my number' }
|
|
103
|
-
// ]
|
|
104
|
-
// }
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Variety of use of Mate
|
|
108
40
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// Define the metadata type
|
|
113
|
-
interface MyMeta extends TProstoMetadata {
|
|
114
|
-
arg0: string
|
|
115
|
-
arg1: string
|
|
116
|
-
n: number
|
|
117
|
-
simple: boolean
|
|
41
|
+
interface TParamMeta {
|
|
42
|
+
required: boolean;
|
|
118
43
|
}
|
|
119
|
-
const mate = new Mate<MyMeta>('my-metadata-key', {
|
|
120
|
-
readReturnType: true, // to copy `design:returntype` -> `returnType` of metadata object
|
|
121
|
-
readType: true, // to copy `design:type` -> `type` of metadata object
|
|
122
|
-
inherit: false, // allow or disable metadata inheritance
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
// Example of simple decorator
|
|
126
|
-
const SimpleDecorator = mate.decorate('simple', true)
|
|
127
|
-
|
|
128
|
-
// Example of factory decorator
|
|
129
|
-
const FactoryDecorator = (arg: string) => mate.decorate('arg0', arg)
|
|
130
|
-
|
|
131
|
-
// Example of complex decorator
|
|
132
|
-
// mate.apply returns a new decorator that applies
|
|
133
|
-
// all passed decorators
|
|
134
|
-
const ComplexDecorator = (arg: string) => mate.apply(
|
|
135
|
-
SimpleDecorator,
|
|
136
|
-
FactoryDecorator(arg),
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
// Example of Callback Decorator
|
|
140
|
-
// meta.decorate may accept callback function
|
|
141
|
-
// instead of key/value pare in case if some
|
|
142
|
-
// complex logic need
|
|
143
|
-
const CallbackDecorator = (arg1: string, n: number) => mate.decorate(meta => {
|
|
144
|
-
meta.arg1 = [meta.arg0, arg1].join(', ')
|
|
145
|
-
meta.n = meta.simple ? n : n * n
|
|
146
|
-
return meta
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
// Applying decorators to our classes
|
|
150
|
-
@SimpleDecorator
|
|
151
|
-
@FactoryDecorator('arg0 value')
|
|
152
|
-
class MyClass1 {
|
|
153
44
|
|
|
45
|
+
const mate = new Mate<TClassMeta, TPropMeta<TParamMeta>>('robot-meta', {
|
|
46
|
+
readReturnType: true,
|
|
47
|
+
readType: true,
|
|
48
|
+
collectPropKeys: true,
|
|
49
|
+
inherit(classMeta, targetMeta, level, prop) {
|
|
50
|
+
return !!targetMeta?.inherit || !!classMeta?.inherit;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Annotate your class
|
|
55
|
+
@mate.decorate('name', 'NXT')
|
|
56
|
+
@mate.decorate('model', 'EV3')
|
|
57
|
+
@mate.decorate('manufacturer', 'LEGO')
|
|
58
|
+
@mate.decorate('data', 'NXT-0001', true)
|
|
59
|
+
class Robot {
|
|
60
|
+
@mate.decorate('description', 'Robotic arm for grabbing objects')
|
|
61
|
+
arm: string;
|
|
62
|
+
|
|
63
|
+
@mate.decorate('description', 'Sensors to detect objects')
|
|
64
|
+
sensors(
|
|
65
|
+
@mate.decorateClass('fromParam', 'hoised value')
|
|
66
|
+
@mate.decorate('required', true)
|
|
67
|
+
input: string
|
|
68
|
+
): string {
|
|
69
|
+
return 'Activated sensors with input: ' + input;
|
|
70
|
+
}
|
|
154
71
|
}
|
|
155
|
-
console.log(mate.read(MyClass1))
|
|
156
|
-
// { params: undefined, arg0: 'arg0 value', simple: true }
|
|
157
|
-
|
|
158
|
-
@CallbackDecorator('arg1 value', 5)
|
|
159
|
-
@ComplexDecorator('arg0 for complex decorator')
|
|
160
|
-
class MyClass2 {
|
|
161
72
|
|
|
162
|
-
|
|
163
|
-
|
|
73
|
+
// Read the metadata
|
|
74
|
+
let classMeta = mate.read(Robot);
|
|
75
|
+
console.log(classMeta);
|
|
76
|
+
// Expected Output:
|
|
164
77
|
// {
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
78
|
+
// name: 'NXT',
|
|
79
|
+
// model: 'EV3',
|
|
80
|
+
// fromParam: 'hoised value',
|
|
81
|
+
// manufacturer: 'LEGO',
|
|
82
|
+
// data: ['NXT-0001'], // Array type metadata
|
|
83
|
+
// properties: ['arm', 'sensors'],
|
|
84
|
+
// type: Function, // Type of Robot
|
|
85
|
+
// returnType: undefined // Only for methods
|
|
170
86
|
// }
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## TS Typing
|
|
174
|
-
|
|
175
|
-
Metadata type is shared for class metadata and class method metadata and based on `TProstoMetadata` interface.
|
|
176
|
-
|
|
177
|
-
Constructor params and method params metadata are stored in `TProstoMetadata['params']` array.
|
|
178
|
-
|
|
179
|
-
By default `TProstoMetadata['params']` has type `TProstoParamsMetadata`.
|
|
180
87
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
interface TMyParamsMeta extends TProstoParamsMetadata {
|
|
186
|
-
paramProp1: string
|
|
187
|
-
paramProp2: number
|
|
188
|
-
}
|
|
189
|
-
interface TMyMeta extends TProstoMetadata<TMyParamsMeta> {
|
|
190
|
-
prop1: string
|
|
191
|
-
prop2: number
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// class and method metadata will look like this:
|
|
88
|
+
// read the property metadata
|
|
89
|
+
let armMeta = mate.read(Robot, 'arm');
|
|
90
|
+
console.log(armMeta);
|
|
91
|
+
// Expected Output:
|
|
195
92
|
// {
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
// paramProp1: string
|
|
201
|
-
// paramProp2: number
|
|
202
|
-
// }[]
|
|
93
|
+
// description: 'Robotic arm for grabbing objects',
|
|
94
|
+
// params: [],
|
|
95
|
+
// type: Function, // Type of 'arm'
|
|
96
|
+
// returnType: undefined // Only for methods
|
|
203
97
|
// }
|
|
204
98
|
|
|
205
|
-
//
|
|
206
|
-
|
|
99
|
+
// read the method metadata
|
|
100
|
+
let sensorsMeta = mate.read(Robot, 'sensors');
|
|
101
|
+
console.log(sensorsMeta);
|
|
102
|
+
// Expected Output:
|
|
103
|
+
// {
|
|
104
|
+
// description: 'Sensors to detect objects',
|
|
105
|
+
// params: [{ type: String, required: true }],
|
|
106
|
+
// type: Function, // Type of 'sensors'
|
|
107
|
+
// returnType: String // Return type of 'sensors'
|
|
108
|
+
// }
|
|
207
109
|
```
|
|
208
110
|
|
|
209
111
|
## Metadata Inheritance
|
|
@@ -239,7 +141,17 @@ const mate = new Mate<MyMeta>('my-metadata-key', {
|
|
|
239
141
|
})
|
|
240
142
|
```
|
|
241
143
|
|
|
242
|
-
##
|
|
144
|
+
## API Reference
|
|
145
|
+
|
|
146
|
+
1. **`Mate<TClassMeta, TPropMeta>`**: The main Mate class. It provides methods to decorate and read metadata.
|
|
147
|
+
|
|
148
|
+
2. **`decorate(key, value?, isArray?, level?)`**: A method for adding metadata to classes, properties, methods, and parameters.
|
|
149
|
+
|
|
150
|
+
3. **`decorateClass(key, value?, isArray?)`**: A method for hoisting metadata from methods or parameters to the class level.
|
|
151
|
+
|
|
152
|
+
4. **`read(target, prop?, paramIndex?)`**: A method for reading metadata.
|
|
153
|
+
|
|
154
|
+
## Use of **reflect-metadata**
|
|
243
155
|
|
|
244
156
|
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
157
|
|
|
@@ -247,4 +159,4 @@ It is recomended to include `reflect-metadata` dependency to rely on the origina
|
|
|
247
159
|
|
|
248
160
|
- `defineMetadata(key, data, target, prop?)`
|
|
249
161
|
|
|
250
|
-
- `metadata(key, data)`
|
|
162
|
+
- `metadata(key, data)`
|
package/dist/mate.cjs.prod.js
CHANGED
|
@@ -68,7 +68,7 @@ class Mate {
|
|
|
68
68
|
const newArgs = args.level === 'CLASS' ? { target: args.target }
|
|
69
69
|
: args.level === 'PROP' ? { target: args.target, propKey: args.propKey }
|
|
70
70
|
: args;
|
|
71
|
-
let meta = Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {};
|
|
71
|
+
let meta = (Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {});
|
|
72
72
|
if (newArgs.propKey && this.options.readReturnType && !meta.returnType && args.descriptor) {
|
|
73
73
|
meta.returnType = Reflect.getOwnMetadata('design:returntype', newArgs.target, newArgs.propKey);
|
|
74
74
|
}
|
|
@@ -144,7 +144,7 @@ class Mate {
|
|
|
144
144
|
if (shouldInherit) {
|
|
145
145
|
const parent = Object.getPrototypeOf(constructor);
|
|
146
146
|
if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
|
|
147
|
-
const inheritedMeta = this.read(parent, propKey) || {};
|
|
147
|
+
const inheritedMeta = (this.read(parent, propKey) || {});
|
|
148
148
|
const ownParams = ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params;
|
|
149
149
|
ownMeta = { ...inheritedMeta, ...ownMeta };
|
|
150
150
|
if (typeof propKey === 'string' && ownParams && (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params)) {
|
package/dist/mate.d.ts
CHANGED
|
@@ -4,30 +4,36 @@ export declare function getConstructor<T = TAny>(instance: T): TFunction;
|
|
|
4
4
|
|
|
5
5
|
export declare function isConstructor<T = TAny>(v: T): v is (T & TClassConstructor);
|
|
6
6
|
|
|
7
|
-
export declare class Mate<TClass extends TObject =
|
|
7
|
+
export declare class Mate<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
8
|
+
params: TMateParamMeta[];
|
|
9
|
+
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
8
10
|
protected workspace: string;
|
|
9
|
-
protected options: TMateOptions<TClass, TProp
|
|
11
|
+
protected options: TMateOptions<TClass, TProp>;
|
|
10
12
|
protected logger: TConsoleBase;
|
|
11
|
-
constructor(workspace: string, options?: TMateOptions<TClass, TProp
|
|
12
|
-
set<
|
|
13
|
-
set<
|
|
14
|
-
set<
|
|
15
|
-
read<
|
|
13
|
+
constructor(workspace: string, options?: TMateOptions<TClass, TProp>);
|
|
14
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(args: TMergedDecoratorArgs, cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): void;
|
|
15
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(args: TMergedDecoratorArgs, key: keyof T, value: T[K]): void;
|
|
16
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(args: TMergedDecoratorArgs, key: keyof T, value: T[K], isArray: boolean | undefined): void;
|
|
17
|
+
read<PK extends PropertyKey | undefined>(target: TFunction | TObject, propKey?: PK): PK extends PropertyKey ? TClass & TProp & TCommonMate<TProp['params'][0]> : TClass;
|
|
16
18
|
apply(...decorators: (MethodDecorator | ClassDecorator | ParameterDecorator | PropertyDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
17
|
-
decorate<
|
|
18
|
-
decorate<
|
|
19
|
-
decorate<
|
|
20
|
-
decorate<
|
|
19
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
20
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(key: K, value: T[K]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
21
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: TIsArray): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
22
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K | ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T), value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: TIsArray, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
21
23
|
decorateConditional(ccb: (level: TLevels) => (MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator) | void | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
22
|
-
decorateClass<
|
|
23
|
-
decorateClass<
|
|
24
|
-
decorateClass<
|
|
24
|
+
decorateClass<T = TClass>(cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
25
|
+
decorateClass<T = TClass, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
26
|
+
decorateClass<T = TClass, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
declare type TAny = any;
|
|
28
30
|
|
|
29
31
|
declare type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
|
|
30
32
|
|
|
33
|
+
declare type TCommonMate<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam>;
|
|
34
|
+
|
|
35
|
+
declare type TCommonMateWithParam<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam> & TParam;
|
|
36
|
+
|
|
31
37
|
declare interface TConsoleBase {
|
|
32
38
|
error: ((...args: any) => void);
|
|
33
39
|
}
|
|
@@ -39,18 +45,21 @@ declare type TFunction = Function;
|
|
|
39
45
|
|
|
40
46
|
declare type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
|
|
41
47
|
|
|
42
|
-
export declare interface TMateClassMeta {
|
|
48
|
+
export declare interface TMateClassMeta<TParam> {
|
|
43
49
|
properties?: (string | symbol)[];
|
|
44
50
|
type?: TFunction;
|
|
45
51
|
returnType?: TFunction;
|
|
52
|
+
params?: (TParam & TMateParamMeta)[];
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
export declare interface TMateOptions<TClass extends TObject =
|
|
55
|
+
export declare interface TMateOptions<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
56
|
+
params: TMateParamMeta[];
|
|
57
|
+
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
49
58
|
logger?: TConsoleBase;
|
|
50
59
|
readReturnType?: boolean;
|
|
51
60
|
readType?: boolean;
|
|
52
61
|
collectPropKeys?: boolean;
|
|
53
|
-
inherit?: boolean | ((classMeta: TClass & TMateClassMeta
|
|
62
|
+
inherit?: boolean | ((classMeta: TClass & TMateClassMeta<TMateParamMeta>, targetMeta: (TMatePropMeta<TProp['params'][0]> & TProp) | (TMateParamMeta & TProp['params'][0]), level: 'CLASS' | 'PROP' | 'PARAM', key?: string) => boolean);
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
export declare interface TMateParamMeta {
|
package/dist/mate.esm-bundler.js
CHANGED
|
@@ -64,7 +64,7 @@ class Mate {
|
|
|
64
64
|
const newArgs = args.level === 'CLASS' ? { target: args.target }
|
|
65
65
|
: args.level === 'PROP' ? { target: args.target, propKey: args.propKey }
|
|
66
66
|
: args;
|
|
67
|
-
let meta = Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {};
|
|
67
|
+
let meta = (Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {});
|
|
68
68
|
if (newArgs.propKey && this.options.readReturnType && !meta.returnType && args.descriptor) {
|
|
69
69
|
meta.returnType = Reflect.getOwnMetadata('design:returntype', newArgs.target, newArgs.propKey);
|
|
70
70
|
}
|
|
@@ -140,7 +140,7 @@ class Mate {
|
|
|
140
140
|
if (shouldInherit) {
|
|
141
141
|
const parent = Object.getPrototypeOf(constructor);
|
|
142
142
|
if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
|
|
143
|
-
const inheritedMeta = this.read(parent, propKey) || {};
|
|
143
|
+
const inheritedMeta = (this.read(parent, propKey) || {});
|
|
144
144
|
const ownParams = ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params;
|
|
145
145
|
ownMeta = { ...inheritedMeta, ...ownMeta };
|
|
146
146
|
if (typeof propKey === 'string' && ownParams && (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params)) {
|
package/dist/src/mate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TAny, TFunction, TObject } from './types';
|
|
2
|
-
type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
|
|
2
|
+
declare type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
|
|
3
3
|
export interface TMergedDecoratorArgs {
|
|
4
4
|
target: TFunction | TObject;
|
|
5
5
|
propKey?: string | symbol;
|
|
@@ -13,42 +13,49 @@ export interface TMateParamMeta {
|
|
|
13
13
|
export interface TMatePropMeta<TParam extends TObject = TEmpty> {
|
|
14
14
|
params?: (TParam & TMateParamMeta)[];
|
|
15
15
|
}
|
|
16
|
-
export interface TMateClassMeta {
|
|
16
|
+
export interface TMateClassMeta<TParam> {
|
|
17
17
|
properties?: (string | symbol)[];
|
|
18
18
|
type?: TFunction;
|
|
19
19
|
returnType?: TFunction;
|
|
20
|
+
params?: (TParam & TMateParamMeta)[];
|
|
20
21
|
}
|
|
22
|
+
declare type TCommonMate<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam>;
|
|
23
|
+
declare type TCommonMateWithParam<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam> & TParam;
|
|
21
24
|
interface TConsoleBase {
|
|
22
25
|
error: ((...args: any) => void);
|
|
23
26
|
}
|
|
24
|
-
export interface TMateOptions<TClass extends TObject =
|
|
27
|
+
export interface TMateOptions<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
28
|
+
params: TMateParamMeta[];
|
|
29
|
+
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
25
30
|
logger?: TConsoleBase;
|
|
26
31
|
readReturnType?: boolean;
|
|
27
32
|
readType?: boolean;
|
|
28
33
|
collectPropKeys?: boolean;
|
|
29
|
-
inherit?: boolean | ((classMeta: TClass & TMateClassMeta
|
|
34
|
+
inherit?: boolean | ((classMeta: TClass & TMateClassMeta<TMateParamMeta>, targetMeta: (TMatePropMeta<TProp['params'][0]> & TProp) | (TMateParamMeta & TProp['params'][0]), level: 'CLASS' | 'PROP' | 'PARAM', key?: string) => boolean);
|
|
30
35
|
}
|
|
31
36
|
interface TEmpty {
|
|
32
37
|
}
|
|
33
|
-
export declare class Mate<TClass extends TObject =
|
|
38
|
+
export declare class Mate<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
39
|
+
params: TMateParamMeta[];
|
|
40
|
+
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
34
41
|
protected workspace: string;
|
|
35
|
-
protected options: TMateOptions<TClass, TProp
|
|
42
|
+
protected options: TMateOptions<TClass, TProp>;
|
|
36
43
|
protected logger: TConsoleBase;
|
|
37
|
-
constructor(workspace: string, options?: TMateOptions<TClass, TProp
|
|
38
|
-
set<
|
|
39
|
-
set<
|
|
40
|
-
set<
|
|
41
|
-
read<
|
|
44
|
+
constructor(workspace: string, options?: TMateOptions<TClass, TProp>);
|
|
45
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(args: TMergedDecoratorArgs, cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): void;
|
|
46
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(args: TMergedDecoratorArgs, key: keyof T, value: T[K]): void;
|
|
47
|
+
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(args: TMergedDecoratorArgs, key: keyof T, value: T[K], isArray: boolean | undefined): void;
|
|
48
|
+
read<PK extends PropertyKey | undefined>(target: TFunction | TObject, propKey?: PK): PK extends PropertyKey ? TClass & TProp & TCommonMate<TProp['params'][0]> : TClass;
|
|
42
49
|
apply(...decorators: (MethodDecorator | ClassDecorator | ParameterDecorator | PropertyDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
43
|
-
decorate<
|
|
44
|
-
decorate<
|
|
45
|
-
decorate<
|
|
46
|
-
decorate<
|
|
50
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
51
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(key: K, value: T[K]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
52
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: TIsArray): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
53
|
+
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K | ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T), value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: TIsArray, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
47
54
|
decorateConditional(ccb: (level: TLevels) => (MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator) | void | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
48
|
-
decorateClass<
|
|
49
|
-
decorateClass<
|
|
50
|
-
decorateClass<
|
|
55
|
+
decorateClass<T = TClass>(cb: ((meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
56
|
+
decorateClass<T = TClass, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
57
|
+
decorateClass<T = TClass, K extends keyof T = keyof T, TIsArray extends boolean = false>(key: K, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
51
58
|
}
|
|
52
|
-
type ArrayElementType<T> = T extends (infer E)[] ? E : never;
|
|
59
|
+
declare type ArrayElementType<T> = T extends (infer E)[] ? E : never;
|
|
53
60
|
export {};
|
|
54
61
|
//# sourceMappingURL=mate.d.ts.map
|
package/dist/src/mate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAK,SAAS,CAAA;AAMjD,
|
|
1
|
+
{"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAK,SAAS,CAAA;AAMjD,aAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAEpD,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,uBAAuB,CAAC,IAAI,CAAC,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,OAAO,GAAG,MAAM;IAC1D,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,cAAc,CAAC,MAAM;IAClC,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,MAAM,CAAC,EAAE,CAAC,M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,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,QAAQ,SAAS,OAAO,GAAG,KAAK,EACnF,GAAG,EAAG,CAAC,EACP,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAC7D,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,iBAAiB;IAE5E,aAAa,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,QAAQ,SAAS,OAAO,GAAG,KAAK,EACnF,GAAG,EAAG,CAAC,EACP,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAC5D,OAAO,EAAE,OAAO,GAAG,SAAS,GAC7B,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,iBAAiB;CAS/E;AAID,aAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mate } from '..';
|
|
2
|
-
interface TClass {
|
|
1
|
+
import { Mate, TMateParamMeta } from '..';
|
|
2
|
+
interface TClass<TParam> {
|
|
3
3
|
inherit?: boolean;
|
|
4
4
|
fromPropertyCb?: string[];
|
|
5
5
|
d1?: string;
|
|
@@ -9,8 +9,9 @@ interface TClass {
|
|
|
9
9
|
class?: string;
|
|
10
10
|
classArray?: string[];
|
|
11
11
|
fromProperty?: string;
|
|
12
|
+
params?: (TMateParamMeta & TParam)[];
|
|
12
13
|
}
|
|
13
|
-
interface TProp {
|
|
14
|
+
interface TProp<TParam> {
|
|
14
15
|
inherit?: boolean;
|
|
15
16
|
fromPropertyCb?: string[];
|
|
16
17
|
prop1D?: string;
|
|
@@ -20,6 +21,7 @@ interface TProp {
|
|
|
20
21
|
method2?: string;
|
|
21
22
|
property?: string;
|
|
22
23
|
empty?: string;
|
|
24
|
+
params: (TMateParamMeta & TParam)[];
|
|
23
25
|
}
|
|
24
26
|
interface TParam {
|
|
25
27
|
inherit?: boolean;
|
|
@@ -29,7 +31,7 @@ interface TParam {
|
|
|
29
31
|
param2?: string;
|
|
30
32
|
paramArray?: string[];
|
|
31
33
|
}
|
|
32
|
-
export declare const mate: Mate<TClass
|
|
34
|
+
export declare const mate: Mate<TClass<TParam>, TProp<TParam>>;
|
|
33
35
|
export declare class MateTestClass {
|
|
34
36
|
constructor(_a: string);
|
|
35
37
|
prop1?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mate.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.artifacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"mate.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.artifacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,IAAI,CAAA;AAEzC,UAAU,MAAM,CAAC,MAAM;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,CAAC,cAAc,GAAG,MAAM,CAAC,EAAE,CAAA;CACvC;AAED,UAAU,KAAK,CAAC,MA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ANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type TAny = any;
|
|
2
|
-
export type TObject = object;
|
|
3
|
-
export type TFunction = Function;
|
|
4
|
-
export type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
|
|
1
|
+
export declare type TAny = any;
|
|
2
|
+
export declare type TObject = object;
|
|
3
|
+
export declare type TFunction = Function;
|
|
4
|
+
export declare type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
|
|
5
5
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,oBAAY,IAAI,GAAG,GAAG,CAAA;AACtB,oBAAY,OAAO,GAAG,MAAM,CAAA;AAC5B,oBAAY,SAAS,GAAG,QAAQ,CAAA;AAChC,oBAAY,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,GAAG,IAAI,EAAG,IAAI,EAAE,KAAK,CAAC,CAAA"}
|