@prostojs/mate 0.1.11 → 0.1.13

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.
@@ -74,11 +74,12 @@ class Mate {
74
74
  }
75
75
  set(args, key, value, isArray) {
76
76
  var _a;
77
+ let level = 'CLASS';
77
78
  const newArgs = args.level === 'CLASS' ? { target: args.target }
78
- : args.level === 'PROPERTY' ? { target: args.target, propKey: args.propKey }
79
+ : args.level === 'PROP' ? { target: args.target, propKey: args.propKey }
79
80
  : args;
80
81
  let meta = Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {};
81
- if (newArgs.propKey && this.options.readReturnType && !meta.returnType) {
82
+ if (newArgs.propKey && this.options.readReturnType && !meta.returnType && args.descriptor) {
82
83
  meta.returnType = Reflect.getOwnMetadata('design:returntype', newArgs.target, newArgs.propKey);
83
84
  }
84
85
  if (newArgs.propKey && this.options.readType && !meta.type) {
@@ -91,17 +92,30 @@ class Mate {
91
92
  data.params = (_a = Reflect.getOwnMetadata('design:paramtypes', newArgs.target, newArgs.propKey)) === null || _a === void 0 ? void 0 : _a.map((f) => ({ type: f }));
92
93
  }
93
94
  if (typeof index === 'number') {
95
+ level = 'PARAM';
94
96
  data.params = data.params || [];
95
97
  data.params[index] = data.params[index] || {
96
98
  type: undefined,
97
99
  };
98
100
  if (cb) {
99
- data.params[index] = cb(data.params[index], args.propKey, typeof args.index === 'number' ? args.index : undefined);
101
+ data.params[index] = cb(data.params[index], level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
100
102
  }
101
103
  else {
102
104
  data = data.params[index];
103
105
  }
104
106
  }
107
+ else if (!index && !args.descriptor && args.propKey && this.options.collectPropKeys && args.level !== 'CLASS') {
108
+ this.set({ ...args, level: 'CLASS' }, (meta) => {
109
+ if (!meta.properties) {
110
+ meta.properties = [args.propKey];
111
+ }
112
+ else if (!meta.properties.includes(args.propKey)) {
113
+ meta.properties.push(args.propKey);
114
+ }
115
+ return meta;
116
+ });
117
+ }
118
+ level = typeof index === 'number' ? 'PARAM' : newArgs.propKey && newArgs.descriptor ? 'METHOD' : newArgs.propKey ? 'PROP' : 'CLASS';
105
119
  if (typeof key !== 'function') {
106
120
  if (isArray) {
107
121
  const newArray = (data[key] || []);
@@ -116,11 +130,11 @@ class Mate {
116
130
  }
117
131
  }
118
132
  else if (cb && typeof index !== 'number') {
119
- meta = cb(data, args.propKey, typeof args.index === 'number' ? args.index : undefined);
133
+ meta = cb(data, level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
120
134
  }
121
135
  Reflect.defineMetadata(this.workspace, meta, newArgs.target, newArgs.propKey);
122
136
  }
123
- read(target, propKey, index) {
137
+ read(target, propKey) {
124
138
  const isConstr = isConstructor(target);
125
139
  const constructor = isConstr ? target : getConstructor(target);
126
140
  const proto = constructor.prototype;
@@ -131,17 +145,31 @@ class Mate {
131
145
  if (inheritFn) {
132
146
  if (typeof propKey === 'string') {
133
147
  const classMeta = Reflect.getOwnMetadata(this.workspace, constructor);
134
- shouldInherit = inheritFn(classMeta, propKey, ownMeta);
148
+ shouldInherit = inheritFn(classMeta, ownMeta, 'PROP', propKey);
135
149
  }
136
150
  else {
137
- shouldInherit = inheritFn(ownMeta);
151
+ shouldInherit = inheritFn(ownMeta, ownMeta, 'CLASS');
138
152
  }
139
153
  }
140
154
  if (shouldInherit) {
141
155
  const parent = Object.getPrototypeOf(constructor);
142
156
  if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
143
- const inheritedMeta = this.read(parent, propKey);
144
- ownMeta = { ...inheritedMeta, ...ownMeta, params: ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params };
157
+ const inheritedMeta = this.read(parent, propKey) || {};
158
+ const ownParams = ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params;
159
+ ownMeta = { ...inheritedMeta, ...ownMeta };
160
+ if (typeof propKey === 'string' && ownParams && (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params)) {
161
+ for (let i = 0; i < ownParams.length; i++) {
162
+ if (typeof (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i]) !== 'undefined') {
163
+ const ownParam = ownParams[i];
164
+ if (ownMeta.params && inheritFn && inheritFn(ownMeta, ownParam, 'PARAM', typeof propKey === 'string' ? propKey : undefined)) {
165
+ ownMeta.params[i] = {
166
+ ...inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i],
167
+ ...ownParams[i],
168
+ };
169
+ }
170
+ }
171
+ }
172
+ }
145
173
  }
146
174
  }
147
175
  }
@@ -166,6 +194,16 @@ class Mate {
166
194
  this.set(args, key, value, isArray);
167
195
  });
168
196
  }
197
+ decorateConditional(ccb) {
198
+ return ((target, propKey, descriptor) => {
199
+ const hasIndex = typeof descriptor === 'number';
200
+ const decoratorLevel = hasIndex ? 'PARAM' : propKey && descriptor ? 'METHOD' : propKey ? 'PROP' : 'CLASS';
201
+ const d = ccb(decoratorLevel);
202
+ if (d) {
203
+ d(target, propKey, descriptor);
204
+ }
205
+ });
206
+ }
169
207
  decorateClass(key, value, isArray) {
170
208
  return this.decorate(key, value, isArray, 'CLASS');
171
209
  }
package/dist/mate.d.ts CHANGED
@@ -1,35 +1,58 @@
1
+ declare type ArrayElementType<T> = T extends (infer E)[] ? E : never;
2
+
1
3
  export declare function getConstructor<T = TAny>(instance: T): TFunction;
2
4
 
3
5
  export declare function isConstructor<T = TAny>(v: T): v is (T & TClassConstructor);
4
6
 
5
- export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
7
+ export declare class Mate<TClass extends TObject = TEmpty, TProp extends TObject = TEmpty, TParam extends TObject = TEmpty> {
6
8
  protected workspace: string;
7
- protected options: TMateOptions<T>;
8
- constructor(workspace: string, options?: TMateOptions<T>);
9
- set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): void;
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
- 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 extends T = T>(target: TFunction | TObject, propKey?: string | symbol, index?: number): R | undefined;
9
+ protected options: TMateOptions<TClass, TProp, TParam>;
10
+ constructor(workspace: string, options?: TMateOptions<TClass, TProp, TParam>);
11
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>>(args: TMergedDecoratorArgs, cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): void;
12
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta>(args: TMergedDecoratorArgs, key: keyof TMeta, value: TMeta[TKey]): void;
13
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta>(args: TMergedDecoratorArgs, key: keyof TMeta, value: TMeta[TKey], isArray: boolean | undefined): void;
14
+ read<TMeta extends Partial<TClass & TMateClassMeta & TProp & TMatePropMeta<TParam> & TParam & TMateParamMeta>>(target: TFunction | TObject, propKey?: string | symbol): TMeta | undefined;
13
15
  apply(...decorators: (MethodDecorator | ClassDecorator | ParameterDecorator | PropertyDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
14
- decorate<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
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 & PropertyDecorator;
16
- 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, isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
17
- 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, isArray: boolean | undefined, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
18
- decorateClass<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
19
- decorateClass<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 & PropertyDecorator;
20
- decorateClass<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, isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
16
+ decorate<TMeta extends TObject = Partial<TClass & TProp & TParam>>(cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
17
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta>(key: TKey, value: TMeta[TKey]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
18
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: TIsArray): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
19
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta, TIsArray extends boolean = false>(key: TKey | ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta), value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: TIsArray, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
20
+ decorateConditional(ccb: (level: TLevels) => (MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator) | void | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
21
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>>(cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
22
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
23
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
21
24
  }
22
25
 
23
26
  declare type TAny = any;
24
27
 
25
28
  declare type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
26
29
 
30
+ declare interface TEmpty {
31
+ }
32
+
27
33
  declare type TFunction = Function;
28
34
 
29
- export declare interface TMateOptions<T extends TProstoMetadata = TProstoMetadata> {
35
+ declare type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
36
+
37
+ export declare interface TMateClassMeta {
38
+ properties?: (string | symbol)[];
39
+ type?: TFunction;
40
+ returnType?: TFunction;
41
+ }
42
+
43
+ export declare interface TMateOptions<TClass extends TObject = TEmpty, TProp extends TObject = TEmpty, TParam extends TObject = TEmpty> {
30
44
  readReturnType?: boolean;
31
45
  readType?: boolean;
32
- inherit?: boolean | ((classMeta: T, propKey?: string, methodMeta?: T) => boolean);
46
+ collectPropKeys?: boolean;
47
+ inherit?: boolean | ((classMeta: TClass & TMateClassMeta, targetMeta: (TMatePropMeta<TParam> & TProp) | (TMateParamMeta & TParam), level: 'CLASS' | 'PROP' | 'PARAM', key?: string) => boolean);
48
+ }
49
+
50
+ export declare interface TMateParamMeta {
51
+ type?: TFunction;
52
+ }
53
+
54
+ export declare interface TMatePropMeta<TParam extends TObject = TEmpty> {
55
+ params?: (TParam & TMateParamMeta)[];
33
56
  }
34
57
 
35
58
  export declare interface TMergedDecoratorArgs {
@@ -37,19 +60,9 @@ export declare interface TMergedDecoratorArgs {
37
60
  propKey?: string | symbol;
38
61
  descriptor?: TypedPropertyDescriptor<TAny>;
39
62
  index?: number;
40
- level?: 'CLASS' | 'PROPERTY';
63
+ level?: TLevels;
41
64
  }
42
65
 
43
66
  declare type TObject = object;
44
67
 
45
- export declare interface TProstoMetadata<TParams extends TProstoParamsMetadata = TProstoParamsMetadata> {
46
- params: TParams[];
47
- type?: TFunction;
48
- returnType?: TFunction;
49
- }
50
-
51
- export declare interface TProstoParamsMetadata {
52
- type?: TFunction;
53
- }
54
-
55
68
  export { }
@@ -70,11 +70,12 @@ class Mate {
70
70
  }
71
71
  set(args, key, value, isArray) {
72
72
  var _a;
73
+ let level = 'CLASS';
73
74
  const newArgs = args.level === 'CLASS' ? { target: args.target }
74
- : args.level === 'PROPERTY' ? { target: args.target, propKey: args.propKey }
75
+ : args.level === 'PROP' ? { target: args.target, propKey: args.propKey }
75
76
  : args;
76
77
  let meta = Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {};
77
- if (newArgs.propKey && this.options.readReturnType && !meta.returnType) {
78
+ if (newArgs.propKey && this.options.readReturnType && !meta.returnType && args.descriptor) {
78
79
  meta.returnType = Reflect.getOwnMetadata('design:returntype', newArgs.target, newArgs.propKey);
79
80
  }
80
81
  if (newArgs.propKey && this.options.readType && !meta.type) {
@@ -87,17 +88,30 @@ class Mate {
87
88
  data.params = (_a = Reflect.getOwnMetadata('design:paramtypes', newArgs.target, newArgs.propKey)) === null || _a === void 0 ? void 0 : _a.map((f) => ({ type: f }));
88
89
  }
89
90
  if (typeof index === 'number') {
91
+ level = 'PARAM';
90
92
  data.params = data.params || [];
91
93
  data.params[index] = data.params[index] || {
92
94
  type: undefined,
93
95
  };
94
96
  if (cb) {
95
- data.params[index] = cb(data.params[index], args.propKey, typeof args.index === 'number' ? args.index : undefined);
97
+ data.params[index] = cb(data.params[index], level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
96
98
  }
97
99
  else {
98
100
  data = data.params[index];
99
101
  }
100
102
  }
103
+ else if (!index && !args.descriptor && args.propKey && this.options.collectPropKeys && args.level !== 'CLASS') {
104
+ this.set({ ...args, level: 'CLASS' }, (meta) => {
105
+ if (!meta.properties) {
106
+ meta.properties = [args.propKey];
107
+ }
108
+ else if (!meta.properties.includes(args.propKey)) {
109
+ meta.properties.push(args.propKey);
110
+ }
111
+ return meta;
112
+ });
113
+ }
114
+ level = typeof index === 'number' ? 'PARAM' : newArgs.propKey && newArgs.descriptor ? 'METHOD' : newArgs.propKey ? 'PROP' : 'CLASS';
101
115
  if (typeof key !== 'function') {
102
116
  if (isArray) {
103
117
  const newArray = (data[key] || []);
@@ -112,11 +126,11 @@ class Mate {
112
126
  }
113
127
  }
114
128
  else if (cb && typeof index !== 'number') {
115
- meta = cb(data, args.propKey, typeof args.index === 'number' ? args.index : undefined);
129
+ meta = cb(data, level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
116
130
  }
117
131
  Reflect.defineMetadata(this.workspace, meta, newArgs.target, newArgs.propKey);
118
132
  }
119
- read(target, propKey, index) {
133
+ read(target, propKey) {
120
134
  const isConstr = isConstructor(target);
121
135
  const constructor = isConstr ? target : getConstructor(target);
122
136
  const proto = constructor.prototype;
@@ -127,17 +141,31 @@ class Mate {
127
141
  if (inheritFn) {
128
142
  if (typeof propKey === 'string') {
129
143
  const classMeta = Reflect.getOwnMetadata(this.workspace, constructor);
130
- shouldInherit = inheritFn(classMeta, propKey, ownMeta);
144
+ shouldInherit = inheritFn(classMeta, ownMeta, 'PROP', propKey);
131
145
  }
132
146
  else {
133
- shouldInherit = inheritFn(ownMeta);
147
+ shouldInherit = inheritFn(ownMeta, ownMeta, 'CLASS');
134
148
  }
135
149
  }
136
150
  if (shouldInherit) {
137
151
  const parent = Object.getPrototypeOf(constructor);
138
152
  if (typeof parent === 'function' && parent !== fnProto && parent !== constructor) {
139
- const inheritedMeta = this.read(parent, propKey);
140
- ownMeta = { ...inheritedMeta, ...ownMeta, params: ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params };
153
+ const inheritedMeta = this.read(parent, propKey) || {};
154
+ const ownParams = ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params;
155
+ ownMeta = { ...inheritedMeta, ...ownMeta };
156
+ if (typeof propKey === 'string' && ownParams && (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params)) {
157
+ for (let i = 0; i < ownParams.length; i++) {
158
+ if (typeof (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i]) !== 'undefined') {
159
+ const ownParam = ownParams[i];
160
+ if (ownMeta.params && inheritFn && inheritFn(ownMeta, ownParam, 'PARAM', typeof propKey === 'string' ? propKey : undefined)) {
161
+ ownMeta.params[i] = {
162
+ ...inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i],
163
+ ...ownParams[i],
164
+ };
165
+ }
166
+ }
167
+ }
168
+ }
141
169
  }
142
170
  }
143
171
  }
@@ -162,6 +190,16 @@ class Mate {
162
190
  this.set(args, key, value, isArray);
163
191
  });
164
192
  }
193
+ decorateConditional(ccb) {
194
+ return ((target, propKey, descriptor) => {
195
+ const hasIndex = typeof descriptor === 'number';
196
+ const decoratorLevel = hasIndex ? 'PARAM' : propKey && descriptor ? 'METHOD' : propKey ? 'PROP' : 'CLASS';
197
+ const d = ccb(decoratorLevel);
198
+ if (d) {
199
+ d(target, propKey, descriptor);
200
+ }
201
+ });
202
+ }
165
203
  decorateClass(key, value, isArray) {
166
204
  return this.decorate(key, value, isArray, 'CLASS');
167
205
  }
@@ -1,39 +1,49 @@
1
1
  import { TAny, TFunction, TObject } from './types';
2
+ type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
2
3
  export interface TMergedDecoratorArgs {
3
4
  target: TFunction | TObject;
4
5
  propKey?: string | symbol;
5
6
  descriptor?: TypedPropertyDescriptor<TAny>;
6
7
  index?: number;
7
- level?: 'CLASS' | 'PROPERTY';
8
+ level?: TLevels;
8
9
  }
9
- export interface TProstoMetadata<TParams extends TProstoParamsMetadata = TProstoParamsMetadata> {
10
- params: TParams[];
10
+ export interface TMateParamMeta {
11
11
  type?: TFunction;
12
- returnType?: TFunction;
13
12
  }
14
- export interface TProstoParamsMetadata {
13
+ export interface TMatePropMeta<TParam extends TObject = TEmpty> {
14
+ params?: (TParam & TMateParamMeta)[];
15
+ }
16
+ export interface TMateClassMeta {
17
+ properties?: (string | symbol)[];
15
18
  type?: TFunction;
19
+ returnType?: TFunction;
16
20
  }
17
- export interface TMateOptions<T extends TProstoMetadata = TProstoMetadata> {
21
+ export interface TMateOptions<TClass extends TObject = TEmpty, TProp extends TObject = TEmpty, TParam extends TObject = TEmpty> {
18
22
  readReturnType?: boolean;
19
23
  readType?: boolean;
20
- inherit?: boolean | ((classMeta: T, propKey?: string, methodMeta?: T) => boolean);
24
+ collectPropKeys?: boolean;
25
+ inherit?: boolean | ((classMeta: TClass & TMateClassMeta, targetMeta: (TMatePropMeta<TParam> & TProp) | (TMateParamMeta & TParam), level: 'CLASS' | 'PROP' | 'PARAM', key?: string) => boolean);
26
+ }
27
+ interface TEmpty {
21
28
  }
22
- export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
29
+ export declare class Mate<TClass extends TObject = TEmpty, TProp extends TObject = TEmpty, TParam extends TObject = TEmpty> {
23
30
  protected workspace: string;
24
- protected options: TMateOptions<T>;
25
- constructor(workspace: string, options?: TMateOptions<T>);
26
- set<R extends T = T, RP = R['params'][0]>(args: TMergedDecoratorArgs, cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): void;
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): void;
28
- 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;
29
- read<R extends T = T>(target: TFunction | TObject, propKey?: string | symbol, index?: number): R | undefined;
31
+ protected options: TMateOptions<TClass, TProp, TParam>;
32
+ constructor(workspace: string, options?: TMateOptions<TClass, TProp, TParam>);
33
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>>(args: TMergedDecoratorArgs, cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): void;
34
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta>(args: TMergedDecoratorArgs, key: keyof TMeta, value: TMeta[TKey]): void;
35
+ set<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta>(args: TMergedDecoratorArgs, key: keyof TMeta, value: TMeta[TKey], isArray: boolean | undefined): void;
36
+ read<TMeta extends Partial<TClass & TMateClassMeta & TProp & TMatePropMeta<TParam> & TParam & TMateParamMeta>>(target: TFunction | TObject, propKey?: string | symbol): TMeta | undefined;
30
37
  apply(...decorators: (MethodDecorator | ClassDecorator | ParameterDecorator | PropertyDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
31
- decorate<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
32
- 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 & PropertyDecorator;
33
- 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, isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
34
- 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, isArray: boolean | undefined, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
35
- decorateClass<R extends T = T, RP = R['params'][0]>(cb: ((meta: R & RP, propKey?: string | symbol, index?: number) => R & RP)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
36
- decorateClass<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 & PropertyDecorator;
37
- decorateClass<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, isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
38
+ decorate<TMeta extends TObject = Partial<TClass & TProp & TParam>>(cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
39
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta>(key: TKey, value: TMeta[TKey]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
40
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: TIsArray): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
41
+ decorate<TMeta extends Partial<TClass & TProp & TParam>, TKey extends keyof TMeta, TIsArray extends boolean = false>(key: TKey | ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta), value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: TIsArray, level: TMergedDecoratorArgs['level']): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
42
+ decorateConditional(ccb: (level: TLevels) => (MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator) | void | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
43
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>>(cb: ((meta: TMeta, level: TLevels, propKey?: string | symbol, index?: number) => TMeta)): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
44
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
45
+ decorateClass<TMeta extends TObject = Partial<TClass & TProp & TParam>, TKey extends keyof TMeta = keyof TMeta, TIsArray extends boolean = false>(key: TKey, value: TIsArray extends true ? ArrayElementType<TMeta[TKey]> : TMeta[TKey], isArray: boolean | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
38
46
  }
47
+ type ArrayElementType<T> = T extends (infer E)[] ? E : never;
48
+ export {};
39
49
  //# sourceMappingURL=mate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mate.d.ts","sourceRoot":"","sources":["../../src/mate.ts"],"names":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AAO,EAAE,OAAO,GAAG,SAAS,GAC7B,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,iBAAiB;CAS/E;AAID,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
@@ -1,18 +1,48 @@
1
- import { Mate, TProstoMetadata } from '..';
2
- export declare const mate: Mate<{
3
- inherit?: boolean | undefined;
4
- fromPropertyCb?: string[] | undefined;
5
- } & TProstoMetadata<import("..").TProstoParamsMetadata>>;
1
+ import { Mate } from '..';
2
+ interface TClass {
3
+ inherit?: boolean;
4
+ fromPropertyCb?: string[];
5
+ d1?: string;
6
+ d2?: string;
7
+ d3?: string;
8
+ multi?: string;
9
+ class?: string;
10
+ classArray?: string[];
11
+ fromProperty?: string;
12
+ }
13
+ interface TProp {
14
+ inherit?: boolean;
15
+ fromPropertyCb?: string[];
16
+ prop1D?: string;
17
+ prop2D?: string;
18
+ method?: string;
19
+ methodArray?: string[];
20
+ method2?: string;
21
+ property?: string;
22
+ empty?: string;
23
+ }
24
+ interface TParam {
25
+ inherit?: boolean;
26
+ propS?: string;
27
+ param?: string;
28
+ param1?: string;
29
+ param2?: string;
30
+ paramArray?: string[];
31
+ }
32
+ export declare const mate: Mate<TClass, TProp, TParam>;
6
33
  export declare class MateTestClass {
7
34
  constructor(_a: string);
35
+ prop1?: string;
36
+ prop2?: number;
8
37
  test(_b: string): string;
9
38
  viaCB(_c: string): void;
10
39
  param: string;
40
+ empty(): void;
11
41
  }
12
42
  export declare class MateTestClass2 {
13
43
  constructor(a: string);
14
44
  test(arg1: number, arg2: boolean): void;
15
- toOverwriteMeta(): void;
45
+ toOverwriteMeta(arg: string): void;
16
46
  }
17
47
  export declare class MateTestClass3 extends MateTestClass2 {
18
48
  constructor();
@@ -24,4 +54,5 @@ export declare class MateTestClass4 extends MateTestClass2 {
24
54
  test2(): void;
25
55
  toOverwriteMeta(): void;
26
56
  }
57
+ export {};
27
58
  //# 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":"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;IAWlB,KAAK,EAAE,MAAM,CAAK;CACrB;AAED,qBACa,cAAc;gBACX,CAAC,EAAE,MAAM;IAOrB,IAAI,CAGD,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAM9B,eAAe;CAGlB;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAML,eAAe;CAGlB;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAKL,eAAe;CAGlB"}
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;AAEzB,UAAU,MAAM;IACZ,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;CACxB;AAED,UAAU,KAAK;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,MAAM;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,eAAO,MAAM,IAAI,6BAaf,CAAA;AAcF,qBAIa,aAAa;gBAKd,EAAE,EAAE,MAAM;IAOlB,KAAK,CAAC,EAAE,MAAM,CAAA;IAGd,KAAK,CAAC,EAAE,MAAM,CAAA;IAMd,IAAI,CAKI,EAAE,EAAE,MAAM,GAAG,MAAM;IAgB3B,KAAK,CAMG,EAAE,EAAE,MAAM;IAWlB,KAAK,EAAE,MAAM,CAAK;IAGlB,KAAK;CAGR;AAED,qBACa,cAAc;gBACX,CAAC,EAAE,MAAM;IAOrB,IAAI,CAGD,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAM9B,eAAe,CAAC,GAAG,EAAE,MAAM;CAG9B;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAML,eAAe;CAGlB;AAED,qBACa,cAAe,SAAQ,cAAc;;IAM9C,KAAK;IAKL,eAAe;CAGlB"}
@@ -1,5 +1,5 @@
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;
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;
5
5
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,IAAI,GAAG,GAAG,CAAA;AACtB,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAC5B,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAA;AAChC,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,GAAG,IAAI,EAAG,IAAI,EAAE,KAAK,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prostojs/mate",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "MATE is TS Metadata Organizer",
5
5
  "main": "index.js",
6
6
  "module": "dist/mate.esm-bundler.js",