@prostojs/mate 0.3.3 → 0.4.0
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 +32 -30
- package/dist/index.cjs +204 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.mjs +200 -0
- package/package.json +68 -79
- package/dist/mate.cjs.prod.js +0 -263
- package/dist/mate.d.ts +0 -84
- package/dist/mate.esm-bundler.js +0 -257
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/mate.d.ts +0 -62
- package/dist/src/mate.d.ts.map +0 -1
- package/dist/src/reflect.d.ts +0 -8
- package/dist/src/reflect.d.ts.map +0 -1
- package/dist/src/tests/mate.artifacts.d.ts +0 -70
- package/dist/src/tests/mate.artifacts.d.ts.map +0 -1
- package/dist/src/tests/mate.spec.d.ts +0 -2
- package/dist/src/tests/mate.spec.d.ts.map +0 -1
- package/dist/src/tests/reflect.artifacts.d.ts +0 -5
- package/dist/src/tests/reflect.artifacts.d.ts.map +0 -1
- package/dist/src/tests/reflect.spec.d.ts +0 -2
- package/dist/src/tests/reflect.spec.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -5
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/helpers.d.ts +0 -4
- package/dist/src/utils/helpers.d.ts.map +0 -1
- package/index.js +0 -2
package/dist/mate.esm-bundler.js
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
let classMetadata = new WeakMap();
|
|
11
|
-
let paramMetadata = new WeakMap();
|
|
12
|
-
const root = typeof global === 'object' ? global : typeof self === 'object' ? self : {};
|
|
13
|
-
function getMetaObject(target, prop) {
|
|
14
|
-
const isParam = typeof prop !== 'undefined';
|
|
15
|
-
const metadata = isParam ? paramMetadata : classMetadata;
|
|
16
|
-
const targetKey = getConstructor(target);
|
|
17
|
-
let meta = metadata.get(targetKey);
|
|
18
|
-
if (!meta) {
|
|
19
|
-
meta = {};
|
|
20
|
-
metadata.set(targetKey, meta);
|
|
21
|
-
}
|
|
22
|
-
if (isParam) {
|
|
23
|
-
meta = (meta[prop] =
|
|
24
|
-
meta[prop] || {});
|
|
25
|
-
}
|
|
26
|
-
return meta;
|
|
27
|
-
}
|
|
28
|
-
const _reflect = {
|
|
29
|
-
getOwnMetadata(key, target, prop) {
|
|
30
|
-
return getMetaObject(target, prop)[key];
|
|
31
|
-
},
|
|
32
|
-
defineMetadata(key, data, target, prop) {
|
|
33
|
-
const meta = getMetaObject(target, prop);
|
|
34
|
-
meta[key] = data;
|
|
35
|
-
},
|
|
36
|
-
metadata(key, data) {
|
|
37
|
-
return ((target, propKey) => {
|
|
38
|
-
Reflect$1.defineMetadata(key, data, target, propKey);
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
_cleanup: (() => {
|
|
42
|
-
classMetadata = new WeakMap();
|
|
43
|
-
paramMetadata = new WeakMap();
|
|
44
|
-
}),
|
|
45
|
-
};
|
|
46
|
-
if (!root.Reflect) {
|
|
47
|
-
root.Reflect = _reflect;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const funcs = [
|
|
51
|
-
'getOwnMetadata',
|
|
52
|
-
'defineMetadata',
|
|
53
|
-
'metadata',
|
|
54
|
-
];
|
|
55
|
-
const target = root.Reflect;
|
|
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
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const Reflect$1 = _reflect;
|
|
63
|
-
|
|
64
|
-
const Reflect = ((global === null || global === void 0 ? void 0 : global.Reflect) ||
|
|
65
|
-
(self === null || self === void 0 ? void 0 : self.Reflect) ||
|
|
66
|
-
Reflect$1);
|
|
67
|
-
class Mate {
|
|
68
|
-
constructor(workspace, options = {}) {
|
|
69
|
-
this.workspace = workspace;
|
|
70
|
-
this.options = options;
|
|
71
|
-
this.logger = options.logger || console;
|
|
72
|
-
}
|
|
73
|
-
_cleanup() {
|
|
74
|
-
var _a;
|
|
75
|
-
(_a = Reflect._cleanup) === null || _a === void 0 ? void 0 : _a.call(Reflect);
|
|
76
|
-
}
|
|
77
|
-
set(args, key, value, isArray) {
|
|
78
|
-
var _a;
|
|
79
|
-
let level = 'CLASS';
|
|
80
|
-
const newArgs = args.level === 'CLASS'
|
|
81
|
-
? { target: args.target }
|
|
82
|
-
: args.level === 'PROP'
|
|
83
|
-
? { target: args.target, propKey: args.propKey }
|
|
84
|
-
: args;
|
|
85
|
-
let meta = (Reflect.getOwnMetadata(this.workspace, newArgs.target, newArgs.propKey) || {});
|
|
86
|
-
if (newArgs.propKey &&
|
|
87
|
-
this.options.readReturnType &&
|
|
88
|
-
!meta.returnType &&
|
|
89
|
-
args.descriptor) {
|
|
90
|
-
meta.returnType = Reflect.getOwnMetadata('design:returntype', newArgs.target, newArgs.propKey);
|
|
91
|
-
}
|
|
92
|
-
if (newArgs.propKey && this.options.readType && !meta.type) {
|
|
93
|
-
meta.type = Reflect.getOwnMetadata('design:type', newArgs.target, newArgs.propKey);
|
|
94
|
-
}
|
|
95
|
-
const { index } = newArgs;
|
|
96
|
-
const cb = typeof key === 'function' ? key : undefined;
|
|
97
|
-
let data = meta;
|
|
98
|
-
if (!data.params) {
|
|
99
|
-
data.params = (_a = Reflect.getOwnMetadata('design:paramtypes', newArgs.target, newArgs.propKey)) === null || _a === void 0 ? void 0 : _a.map((f) => ({ type: f }));
|
|
100
|
-
}
|
|
101
|
-
if (typeof index === 'number') {
|
|
102
|
-
level = 'PARAM';
|
|
103
|
-
data.params = data.params || [];
|
|
104
|
-
data.params[index] = data.params[index] || {
|
|
105
|
-
type: undefined,
|
|
106
|
-
};
|
|
107
|
-
if (cb) {
|
|
108
|
-
data.params[index] = cb(data.params[index], level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
data = data.params[index];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (!index &&
|
|
115
|
-
!args.descriptor &&
|
|
116
|
-
args.propKey &&
|
|
117
|
-
this.options.collectPropKeys &&
|
|
118
|
-
args.level !== 'CLASS') {
|
|
119
|
-
this.set({ ...args, level: 'CLASS' }, (meta) => {
|
|
120
|
-
if (!meta.properties) {
|
|
121
|
-
meta.properties = [args.propKey];
|
|
122
|
-
}
|
|
123
|
-
else if (!meta.properties.includes(args.propKey)) {
|
|
124
|
-
meta.properties.push(args.propKey);
|
|
125
|
-
}
|
|
126
|
-
return meta;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
level =
|
|
130
|
-
typeof index === 'number'
|
|
131
|
-
? 'PARAM'
|
|
132
|
-
: newArgs.propKey && newArgs.descriptor
|
|
133
|
-
? 'METHOD'
|
|
134
|
-
: newArgs.propKey
|
|
135
|
-
? 'PROP'
|
|
136
|
-
: 'CLASS';
|
|
137
|
-
if (typeof key !== 'function') {
|
|
138
|
-
if (isArray) {
|
|
139
|
-
const newArray = (data[key] || []);
|
|
140
|
-
if (!Array.isArray(newArray)) {
|
|
141
|
-
this.logger.error('Mate.add (isArray=true) called for non-array metadata');
|
|
142
|
-
}
|
|
143
|
-
newArray.unshift(value);
|
|
144
|
-
data[key] = newArray;
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
data[key] = value;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else if (cb && typeof index !== 'number') {
|
|
151
|
-
meta = cb(data, level, args.propKey, typeof args.index === 'number' ? args.index : undefined);
|
|
152
|
-
}
|
|
153
|
-
Reflect.defineMetadata(this.workspace, meta, newArgs.target, newArgs.propKey);
|
|
154
|
-
}
|
|
155
|
-
read(target, propKey) {
|
|
156
|
-
var _a;
|
|
157
|
-
const isConstr = isConstructor(target);
|
|
158
|
-
const constructor = isConstr ? target : getConstructor(target);
|
|
159
|
-
const proto = constructor.prototype;
|
|
160
|
-
let ownMeta = Reflect.getOwnMetadata(this.workspace, typeof propKey === 'string' ? proto : constructor, propKey);
|
|
161
|
-
if (ownMeta && propKey === undefined && ownMeta.params === undefined) {
|
|
162
|
-
const parent = Object.getPrototypeOf(constructor);
|
|
163
|
-
if (typeof parent === 'function' &&
|
|
164
|
-
parent !== fnProto &&
|
|
165
|
-
parent !== constructor) {
|
|
166
|
-
ownMeta.params = (_a = this.read(parent)) === null || _a === void 0 ? void 0 : _a.params;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (this.options.inherit) {
|
|
170
|
-
const inheritFn = typeof this.options.inherit === 'function'
|
|
171
|
-
? this.options.inherit
|
|
172
|
-
: undefined;
|
|
173
|
-
let shouldInherit = this.options.inherit;
|
|
174
|
-
if (inheritFn) {
|
|
175
|
-
if (typeof propKey === 'string') {
|
|
176
|
-
const classMeta = Reflect.getOwnMetadata(this.workspace, constructor);
|
|
177
|
-
shouldInherit = inheritFn(classMeta, ownMeta, 'PROP', propKey);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
shouldInherit = inheritFn(ownMeta, ownMeta, 'CLASS');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (shouldInherit) {
|
|
184
|
-
const parent = Object.getPrototypeOf(constructor);
|
|
185
|
-
if (typeof parent === 'function' &&
|
|
186
|
-
parent !== fnProto &&
|
|
187
|
-
parent !== constructor) {
|
|
188
|
-
const inheritedMeta = (this.read(parent, propKey) ||
|
|
189
|
-
{});
|
|
190
|
-
const ownParams = ownMeta === null || ownMeta === void 0 ? void 0 : ownMeta.params;
|
|
191
|
-
ownMeta = { ...inheritedMeta, ...ownMeta };
|
|
192
|
-
if (typeof propKey === 'string' &&
|
|
193
|
-
ownParams &&
|
|
194
|
-
(inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params)) {
|
|
195
|
-
for (let i = 0; i < ownParams.length; i++) {
|
|
196
|
-
if (typeof (inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i]) !== 'undefined') {
|
|
197
|
-
const ownParam = ownParams[i];
|
|
198
|
-
if (ownMeta.params &&
|
|
199
|
-
inheritFn &&
|
|
200
|
-
inheritFn(ownMeta, ownParam, 'PARAM', typeof propKey === 'string'
|
|
201
|
-
? propKey
|
|
202
|
-
: undefined)) {
|
|
203
|
-
ownMeta.params[i] = {
|
|
204
|
-
...inheritedMeta === null || inheritedMeta === void 0 ? void 0 : inheritedMeta.params[i],
|
|
205
|
-
...ownParams[i],
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return ownMeta;
|
|
215
|
-
}
|
|
216
|
-
apply(...decorators) {
|
|
217
|
-
return ((target, propKey, descriptor) => {
|
|
218
|
-
for (const d of decorators) {
|
|
219
|
-
d(target, propKey, descriptor);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
decorate(key, value, isArray, level) {
|
|
224
|
-
return ((target, propKey, descriptor) => {
|
|
225
|
-
const args = {
|
|
226
|
-
target,
|
|
227
|
-
propKey,
|
|
228
|
-
descriptor: typeof descriptor === 'number' ? undefined : descriptor,
|
|
229
|
-
index: typeof descriptor === 'number' ? descriptor : undefined,
|
|
230
|
-
level,
|
|
231
|
-
};
|
|
232
|
-
this.set(args, key, value, isArray);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
decorateConditional(ccb) {
|
|
236
|
-
return ((target, propKey, descriptor) => {
|
|
237
|
-
const hasIndex = typeof descriptor === 'number';
|
|
238
|
-
const decoratorLevel = hasIndex
|
|
239
|
-
? 'PARAM'
|
|
240
|
-
: propKey && descriptor
|
|
241
|
-
? 'METHOD'
|
|
242
|
-
: propKey
|
|
243
|
-
? 'PROP'
|
|
244
|
-
: 'CLASS';
|
|
245
|
-
const d = ccb(decoratorLevel);
|
|
246
|
-
if (d) {
|
|
247
|
-
d(target, propKey, descriptor);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
decorateClass(key, value, isArray) {
|
|
252
|
-
return this.decorate(key, value, isArray, 'CLASS');
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
const fnProto = Object.getPrototypeOf(Function);
|
|
256
|
-
|
|
257
|
-
export { Mate, getConstructor, isConstructor };
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA"}
|
package/dist/src/mate.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { TAny, TFunction, TObject } from './types';
|
|
2
|
-
declare type TLevels = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
|
|
3
|
-
export interface TMergedDecoratorArgs {
|
|
4
|
-
target: TFunction | TObject;
|
|
5
|
-
propKey?: string | symbol;
|
|
6
|
-
descriptor?: TypedPropertyDescriptor<TAny>;
|
|
7
|
-
index?: number;
|
|
8
|
-
level?: TLevels;
|
|
9
|
-
}
|
|
10
|
-
export interface TMateParamMeta {
|
|
11
|
-
type?: TFunction;
|
|
12
|
-
}
|
|
13
|
-
export interface TMatePropMeta<TParam extends TObject = TEmpty> {
|
|
14
|
-
params?: (TParam & TMateParamMeta)[];
|
|
15
|
-
}
|
|
16
|
-
export interface TMateClassMeta<TParam> {
|
|
17
|
-
properties?: (string | symbol)[];
|
|
18
|
-
type?: TFunction;
|
|
19
|
-
returnType?: TFunction;
|
|
20
|
-
params?: (TParam & TMateParamMeta)[];
|
|
21
|
-
}
|
|
22
|
-
declare type TCommonMate<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam>;
|
|
23
|
-
declare type TCommonMateWithParam<TParam extends TObject> = TMateClassMeta<TParam> & TMatePropMeta<TParam> & TParam;
|
|
24
|
-
interface TConsoleBase {
|
|
25
|
-
error: ((...args: any) => void);
|
|
26
|
-
}
|
|
27
|
-
export interface TMateOptions<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
28
|
-
params: TMateParamMeta[];
|
|
29
|
-
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
30
|
-
logger?: TConsoleBase;
|
|
31
|
-
readReturnType?: boolean;
|
|
32
|
-
readType?: boolean;
|
|
33
|
-
collectPropKeys?: boolean;
|
|
34
|
-
inherit?: boolean | ((classMeta: TClass & TMateClassMeta<TMateParamMeta>, targetMeta: (TMatePropMeta<TProp['params'][0]> & TProp) | (TMateParamMeta & TProp['params'][0]), level: 'CLASS' | 'PROP' | 'PARAM', key?: string) => boolean);
|
|
35
|
-
}
|
|
36
|
-
interface TEmpty {
|
|
37
|
-
}
|
|
38
|
-
export declare class Mate<TClass extends TObject = TMateClassMeta<TMateParamMeta>, TProp extends {
|
|
39
|
-
params: TMateParamMeta[];
|
|
40
|
-
} = Required<TMatePropMeta<TMateParamMeta>>> {
|
|
41
|
-
protected workspace: string;
|
|
42
|
-
protected options: TMateOptions<TClass, TProp>;
|
|
43
|
-
protected logger: TConsoleBase;
|
|
44
|
-
constructor(workspace: string, options?: TMateOptions<TClass, TProp>);
|
|
45
|
-
_cleanup(): void;
|
|
46
|
-
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(args: TMergedDecoratorArgs, cb: (meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T): void;
|
|
47
|
-
set<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(args: TMergedDecoratorArgs, key: keyof T, value: T[K]): void;
|
|
48
|
-
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;
|
|
49
|
-
read<PK>(target: TFunction | TObject, propKey?: PK): PK extends PropertyKey ? (TClass & TProp & TCommonMate<TProp['params'][0]>) | undefined : TClass | undefined;
|
|
50
|
-
apply(...decorators: (MethodDecorator | ClassDecorator | ParameterDecorator | PropertyDecorator)[]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
51
|
-
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>>(cb: (meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
52
|
-
decorate<T = TClass & TProp & TCommonMateWithParam<TProp['params'][0]>, K extends keyof T = keyof T>(key: K, value: T[K]): 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, value: TIsArray extends true ? ArrayElementType<T[K]> : T[K], isArray: TIsArray): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
54
|
-
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;
|
|
55
|
-
decorateConditional(ccb: (level: TLevels) => (MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator) | void | undefined): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
56
|
-
decorateClass<T = TClass>(cb: (meta: T, level: TLevels, propKey?: string | symbol, index?: number) => T): 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]): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
|
|
58
|
-
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;
|
|
59
|
-
}
|
|
60
|
-
declare type ArrayElementType<T> = T extends (infer E)[] ? E : never;
|
|
61
|
-
export {};
|
|
62
|
-
//# sourceMappingURL=mate.d.ts.map
|
package/dist/src/mate.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAQjD,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;IAC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AAG,MAAM,EACpB,EAAE,EAAE,CACA,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EACzB,KAAK,CAAC,EAAE,MAAM,KACb,CAAC,GACP,eAAe,GACd,cAAc,GACd,kBAAkB,GAClB,iBAAiB;IAErB,aAAa,CACT,CAAC,GAAG,MAAM,EACV,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,EAC3B,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAC7D,eAAe,GACd,cAAc,GACd,kBAAkB,GAClB,iBAAiB;IAErB,aAAa,CACT,CAAC,GAAG,MAAM,EACV,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,EAC3B,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,GAAG,EAAE,CAAC,EACN,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,GACd,cAAc,GACd,kBAAkB,GAClB,iBAAiB;CA4BxB;AAID,aAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
package/dist/src/reflect.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
_cleanup: (() => void) | undefined;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=reflect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../../src/reflect.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA6E5C,eAAO,MAAM,OAAO;wBA9CI,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;qBAevF,IAAI;CAwBU,CAAA"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Mate, TMateParamMeta } from '..';
|
|
2
|
-
interface TClass<TParam> {
|
|
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
|
-
params?: (TMateParamMeta & TParam)[];
|
|
13
|
-
}
|
|
14
|
-
interface TProp<TParam> {
|
|
15
|
-
inherit?: boolean;
|
|
16
|
-
fromPropertyCb?: string[];
|
|
17
|
-
prop1D?: string;
|
|
18
|
-
prop2D?: string;
|
|
19
|
-
method?: string;
|
|
20
|
-
methodArray?: string[];
|
|
21
|
-
method2?: string;
|
|
22
|
-
property?: string;
|
|
23
|
-
empty?: string;
|
|
24
|
-
params: (TMateParamMeta & TParam)[];
|
|
25
|
-
}
|
|
26
|
-
interface TParam {
|
|
27
|
-
inherit?: boolean;
|
|
28
|
-
propS?: string;
|
|
29
|
-
param?: string;
|
|
30
|
-
param1?: string;
|
|
31
|
-
param2?: string;
|
|
32
|
-
paramArray?: string[];
|
|
33
|
-
}
|
|
34
|
-
export declare const mate: Mate<TClass<TParam>, TProp<TParam>>;
|
|
35
|
-
export declare class MateTestClass {
|
|
36
|
-
constructor(_a: string);
|
|
37
|
-
prop1?: string;
|
|
38
|
-
prop2?: number;
|
|
39
|
-
test(_b: string): string;
|
|
40
|
-
viaCB(_c: string): void;
|
|
41
|
-
param: string;
|
|
42
|
-
empty(): void;
|
|
43
|
-
}
|
|
44
|
-
export declare class MateTestClass2 {
|
|
45
|
-
constructor(a: string);
|
|
46
|
-
test(arg1: number, arg2: boolean): void;
|
|
47
|
-
toOverwriteMeta(arg: string): void;
|
|
48
|
-
}
|
|
49
|
-
export declare class MateTestClass3 extends MateTestClass2 {
|
|
50
|
-
constructor();
|
|
51
|
-
test2(): void;
|
|
52
|
-
toOverwriteMeta(): void;
|
|
53
|
-
}
|
|
54
|
-
export declare class MateTestClass4 extends MateTestClass2 {
|
|
55
|
-
constructor();
|
|
56
|
-
test2(): void;
|
|
57
|
-
toOverwriteMeta(): void;
|
|
58
|
-
}
|
|
59
|
-
export declare class MateTestParentClass {
|
|
60
|
-
a: string;
|
|
61
|
-
constructor(a: string);
|
|
62
|
-
}
|
|
63
|
-
export declare class MateTestChildClass extends MateTestParentClass {
|
|
64
|
-
}
|
|
65
|
-
export declare class MateTestChildClass2 extends MateTestParentClass {
|
|
66
|
-
b: number;
|
|
67
|
-
constructor(b: number);
|
|
68
|
-
}
|
|
69
|
-
export {};
|
|
70
|
-
//# sourceMappingURL=mate.artifacts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mate.artifacts.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.artifacts.ts"],"names":[],"mappings":"AACA,OA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AM;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;AAED,qBACa,mBAAmB;IACT,CAAC,EAAE,MAAM;gBAAT,CAAC,EAAE,MAAM;CAC/B;AAED,qBACa,kBAAmB,SAAQ,mBAAmB;CAAG;AAE9D,qBACa,mBAAoB,SAAQ,mBAAmB;IACrC,CAAC,EAAE,MAAM;gBAAT,CAAC,EAAE,MAAM;CAG/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mate.spec.d.ts","sourceRoot":"","sources":["../../../src/tests/mate.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.spec.d.ts","sourceRoot":"","sources":["../../../src/tests/reflect.spec.ts"],"names":[],"mappings":""}
|
package/dist/src/types.d.ts
DELETED
package/dist/src/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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/index.js
DELETED