@alterior/runtime 3.0.0-rc.5 → 3.0.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/dist/reflector.js CHANGED
@@ -1,494 +1,307 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Reflector = exports.Type = exports.Parameter = exports.ConstructorMethod = exports.Field = exports.Method = exports.Property = void 0;
4
- var tslib_1 = require("tslib");
5
- var annotations_1 = require("@alterior/annotations");
6
- var common_1 = require("@alterior/common");
4
+ const annotations_1 = require("@alterior/annotations");
5
+ const common_1 = require("@alterior/common");
7
6
  /**
8
7
  * Represents a property on a class. A property can also be a field or a method.
9
8
  */
10
- var Property = /** @class */ (function () {
11
- function Property(_type, _name, _isStatic) {
12
- if (_isStatic === void 0) { _isStatic = false; }
9
+ class Property {
10
+ constructor(_type, _name, _isStatic = false) {
13
11
  this._type = _type;
14
12
  this._name = _name;
15
13
  this._isStatic = _isStatic;
16
14
  this._descriptor = null;
17
15
  this._visibility = _name[0] === '_' ? 'private' : 'public';
18
16
  }
19
- Property.prototype.defineMetadata = function (key, value) {
17
+ defineMetadata(key, value) {
20
18
  Reflect.defineMetadata(key, value, this.type, this.name);
21
- };
22
- Property.prototype.getMetadata = function (key) {
19
+ }
20
+ getMetadata(key) {
23
21
  return Reflect.getMetadata(key, this.type, this.name);
24
- };
25
- Property.prototype.deleteMetadata = function (key) {
22
+ }
23
+ deleteMetadata(key) {
26
24
  Reflect.deleteMetadata(key, this.type, this.name);
27
- };
28
- Object.defineProperty(Property.prototype, "valueType", {
29
- get: function () {
30
- if (!this._valueType) {
31
- var rawType = this.getMetadata('design:type');
32
- if (!rawType)
33
- return undefined;
34
- this._valueType = new Type(rawType);
35
- }
36
- return this._valueType;
37
- },
38
- enumerable: false,
39
- configurable: true
40
- });
41
- Object.defineProperty(Property.prototype, "isStatic", {
42
- get: function () {
43
- return this._isStatic;
44
- },
45
- enumerable: false,
46
- configurable: true
47
- });
48
- Object.defineProperty(Property.prototype, "type", {
49
- get: function () {
50
- return this._type;
51
- },
52
- enumerable: false,
53
- configurable: true
54
- });
55
- Object.defineProperty(Property.prototype, "annotations", {
56
- get: function () {
57
- if (!this._annotations) {
58
- if (this._name === 'constructor')
59
- this._annotations = annotations_1.Annotations.getClassAnnotations(this._type);
60
- else
61
- this._annotations = annotations_1.Annotations.getPropertyAnnotations(this._type, this.name, this.isStatic);
62
- }
63
- return this._annotations;
64
- },
65
- enumerable: false,
66
- configurable: true
67
- });
68
- Property.prototype.annotationsOfType = function (type) {
25
+ }
26
+ get valueType() {
27
+ if (!this._valueType) {
28
+ let rawType = this.getMetadata('design:type');
29
+ if (!rawType)
30
+ return undefined;
31
+ this._valueType = new Type(rawType);
32
+ }
33
+ return this._valueType;
34
+ }
35
+ get isStatic() {
36
+ return this._isStatic;
37
+ }
38
+ get type() {
39
+ return this._type;
40
+ }
41
+ get annotations() {
42
+ if (!this._annotations) {
43
+ if (this._name === 'constructor')
44
+ this._annotations = annotations_1.Annotations.getClassAnnotations(this._type);
45
+ else
46
+ this._annotations = annotations_1.Annotations.getPropertyAnnotations(this._type, this.name, this.isStatic);
47
+ }
48
+ return this._annotations;
49
+ }
50
+ annotationsOfType(type) {
69
51
  return type.filter(this.annotations);
70
- };
71
- Property.prototype.annotationOfType = function (type) {
52
+ }
53
+ annotationOfType(type) {
72
54
  return type.filter(this.annotations)[0];
73
- };
74
- Object.defineProperty(Property.prototype, "descriptor", {
75
- get: function () {
76
- if (!this._descriptor)
77
- this._descriptor = Object.getOwnPropertyDescriptor(this._type.prototype, this._name);
78
- return this._descriptor;
79
- },
80
- enumerable: false,
81
- configurable: true
82
- });
83
- Object.defineProperty(Property.prototype, "name", {
84
- get: function () {
85
- return this._name;
86
- },
87
- enumerable: false,
88
- configurable: true
89
- });
90
- Object.defineProperty(Property.prototype, "visibility", {
91
- get: function () {
92
- return this._visibility;
93
- },
94
- enumerable: false,
95
- configurable: true
96
- });
97
- return Property;
98
- }());
55
+ }
56
+ get descriptor() {
57
+ if (!this._descriptor)
58
+ this._descriptor = Object.getOwnPropertyDescriptor(this._type.prototype, this._name);
59
+ return this._descriptor;
60
+ }
61
+ get name() {
62
+ return this._name;
63
+ }
64
+ get visibility() {
65
+ return this._visibility;
66
+ }
67
+ }
99
68
  exports.Property = Property;
100
69
  /**
101
70
  * Represents a method on a class. A method can be a static or instance method, and has a set of parameters
102
71
  * and a return type.
103
72
  */
104
- var Method = /** @class */ (function (_super) {
105
- (0, tslib_1.__extends)(Method, _super);
106
- function Method(type, name, isStatic) {
107
- if (isStatic === void 0) { isStatic = false; }
108
- return _super.call(this, type, name, isStatic) || this;
109
- }
110
- Object.defineProperty(Method.prototype, "returnType", {
111
- get: function () {
112
- if (!this._returnType) {
113
- var rawType = this.getMetadata('design:returntype');
114
- if (!rawType)
115
- return undefined;
116
- this._returnType = new Type(rawType);
117
- }
118
- return this._returnType;
119
- },
120
- enumerable: false,
121
- configurable: true
122
- });
123
- Object.defineProperty(Method.prototype, "parameterTypes", {
124
- get: function () {
125
- if (!this._parameterTypes) {
126
- var rawTypes = this.getMetadata('design:paramtypes');
127
- this._parameterTypes = rawTypes.map(function (x) { return x ? new Type(x) : undefined; });
128
- }
129
- return this._parameterTypes;
130
- },
131
- enumerable: false,
132
- configurable: true
133
- });
134
- Object.defineProperty(Method.prototype, "implementation", {
135
- get: function () {
136
- return this.type[this.name];
137
- },
138
- enumerable: false,
139
- configurable: true
140
- });
141
- Object.defineProperty(Method.prototype, "parameterNames", {
142
- get: function () {
143
- if (!this._parameterNames)
144
- this._parameterNames = (0, common_1.getParameterNames)(this.implementation);
145
- return this._parameterNames;
146
- },
147
- enumerable: false,
148
- configurable: true
149
- });
150
- Object.defineProperty(Method.prototype, "parameters", {
151
- get: function () {
152
- var _this = this;
153
- var parameterNames = this.parameterNames;
154
- return (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(Array(this.implementation.length).keys()), false).map(function (i) { return new Parameter(_this, i, parameterNames[i]); });
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(Method.prototype, "parameterAnnotations", {
160
- get: function () {
161
- if (!this._parameterAnnotations)
162
- this._parameterAnnotations = annotations_1.Annotations.getParameterAnnotations(this.type, this.name);
163
- return this._parameterAnnotations;
164
- },
165
- enumerable: false,
166
- configurable: true
167
- });
168
- return Method;
169
- }(Property));
73
+ class Method extends Property {
74
+ constructor(type, name, isStatic = false) {
75
+ super(type, name, isStatic);
76
+ }
77
+ get returnType() {
78
+ if (!this._returnType) {
79
+ let rawType = this.getMetadata('design:returntype');
80
+ if (!rawType)
81
+ return undefined;
82
+ this._returnType = new Type(rawType);
83
+ }
84
+ return this._returnType;
85
+ }
86
+ get parameterTypes() {
87
+ if (!this._parameterTypes) {
88
+ let rawTypes = this.getMetadata('design:paramtypes');
89
+ this._parameterTypes = rawTypes.map(x => x ? new Type(x) : undefined);
90
+ }
91
+ return this._parameterTypes;
92
+ }
93
+ get implementation() {
94
+ return this.type[this.name];
95
+ }
96
+ get parameterNames() {
97
+ if (!this._parameterNames)
98
+ this._parameterNames = (0, common_1.getParameterNames)(this.implementation);
99
+ return this._parameterNames;
100
+ }
101
+ get parameters() {
102
+ let parameterNames = this.parameterNames;
103
+ return [...Array(this.implementation.length).keys()]
104
+ .map(i => new Parameter(this, i, parameterNames[i]));
105
+ }
106
+ get parameterAnnotations() {
107
+ if (!this._parameterAnnotations)
108
+ this._parameterAnnotations = annotations_1.Annotations.getParameterAnnotations(this.type, this.name);
109
+ return this._parameterAnnotations;
110
+ }
111
+ }
170
112
  exports.Method = Method;
171
- var Field = /** @class */ (function (_super) {
172
- (0, tslib_1.__extends)(Field, _super);
173
- function Field(type, name, isStatic) {
174
- if (isStatic === void 0) { isStatic = false; }
175
- return _super.call(this, type, name, isStatic) || this;
176
- }
177
- return Field;
178
- }(Property));
113
+ class Field extends Property {
114
+ constructor(type, name, isStatic = false) {
115
+ super(type, name, isStatic);
116
+ }
117
+ }
179
118
  exports.Field = Field;
180
- var ConstructorMethod = /** @class */ (function (_super) {
181
- (0, tslib_1.__extends)(ConstructorMethod, _super);
182
- function ConstructorMethod(type) {
183
- return _super.call(this, type, 'constructor') || this;
184
- }
185
- Object.defineProperty(ConstructorMethod.prototype, "parameterAnnotations", {
186
- get: function () {
187
- if (!this._ctorParameterAnnotations)
188
- this._ctorParameterAnnotations = annotations_1.Annotations.getConstructorParameterAnnotations(this.type);
189
- return this._ctorParameterAnnotations;
190
- },
191
- enumerable: false,
192
- configurable: true
193
- });
194
- return ConstructorMethod;
195
- }(Method));
119
+ class ConstructorMethod extends Method {
120
+ constructor(type) {
121
+ super(type, 'constructor');
122
+ }
123
+ get parameterAnnotations() {
124
+ if (!this._ctorParameterAnnotations)
125
+ this._ctorParameterAnnotations = annotations_1.Annotations.getConstructorParameterAnnotations(this.type);
126
+ return this._ctorParameterAnnotations;
127
+ }
128
+ }
196
129
  exports.ConstructorMethod = ConstructorMethod;
197
- var Parameter = /** @class */ (function () {
198
- function Parameter(_method, _index, _name) {
199
- if (_name === void 0) { _name = null; }
130
+ class Parameter {
131
+ constructor(_method, _index, _name = null) {
200
132
  this._method = _method;
201
133
  this._index = _index;
202
134
  this._name = _name;
203
135
  }
204
- Object.defineProperty(Parameter.prototype, "annotations", {
205
- get: function () {
206
- return this.method.parameterAnnotations[this.index];
207
- },
208
- enumerable: false,
209
- configurable: true
210
- });
211
- Parameter.prototype.annotationsOfType = function (type) {
136
+ get annotations() {
137
+ return this.method.parameterAnnotations[this.index];
138
+ }
139
+ annotationsOfType(type) {
212
140
  return type.filter(this.annotations);
213
- };
214
- Parameter.prototype.annotationOfType = function (type) {
141
+ }
142
+ annotationOfType(type) {
215
143
  return type.filter(this.annotations)[0];
216
- };
217
- Object.defineProperty(Parameter.prototype, "method", {
218
- get: function () {
219
- return this._method;
220
- },
221
- enumerable: false,
222
- configurable: true
223
- });
224
- Object.defineProperty(Parameter.prototype, "valueType", {
225
- get: function () {
226
- return this.method.parameterTypes[this.index];
227
- },
228
- enumerable: false,
229
- configurable: true
230
- });
231
- Object.defineProperty(Parameter.prototype, "index", {
232
- get: function () {
233
- return this._index;
234
- },
235
- enumerable: false,
236
- configurable: true
237
- });
238
- Object.defineProperty(Parameter.prototype, "name", {
239
- get: function () {
240
- return this._name;
241
- },
242
- enumerable: false,
243
- configurable: true
244
- });
245
- return Parameter;
246
- }());
144
+ }
145
+ get method() {
146
+ return this._method;
147
+ }
148
+ get valueType() {
149
+ return this.method.parameterTypes[this.index];
150
+ }
151
+ get index() {
152
+ return this._index;
153
+ }
154
+ get name() {
155
+ return this._name;
156
+ }
157
+ }
247
158
  exports.Parameter = Parameter;
248
159
  /**
249
160
  * Represents a class Type and it's metadata
250
161
  */
251
- var Type = /** @class */ (function () {
252
- function Type(_class) {
162
+ class Type {
163
+ constructor(_class) {
253
164
  this._class = _class;
254
165
  this._staticPropertyNames = [];
255
166
  this._staticMethodNames = [];
256
167
  this._staticFieldNames = [];
257
168
  }
258
- Object.defineProperty(Type.prototype, "name", {
259
- get: function () {
260
- return this._class.name;
261
- },
262
- enumerable: false,
263
- configurable: true
264
- });
265
- Type.prototype.getMetadata = function (key) {
169
+ get name() {
170
+ return this._class.name;
171
+ }
172
+ getMetadata(key) {
266
173
  Reflect.getOwnMetadata(key, this._class);
267
- };
268
- Type.prototype.defineMetadata = function (key, value) {
174
+ }
175
+ defineMetadata(key, value) {
269
176
  Reflect.defineMetadata(key, value, this._class.prototype);
270
- };
271
- Type.prototype.deleteMetadata = function (key) {
177
+ }
178
+ deleteMetadata(key) {
272
179
  Reflect.deleteMetadata(key, this._class);
273
- };
274
- Object.defineProperty(Type.prototype, "metadataKeys", {
275
- get: function () {
276
- if (!this._metadataKeys)
277
- this._metadataKeys = Reflect.getOwnMetadataKeys(this._class);
278
- return this._metadataKeys;
279
- },
280
- enumerable: false,
281
- configurable: true
282
- });
283
- Object.defineProperty(Type.prototype, "annotations", {
284
- /**
285
- * Get all annotations attached to this class
286
- */
287
- get: function () {
288
- if (!this._annotations)
289
- this._annotations = annotations_1.Annotations.getClassAnnotations(this._class);
290
- return this._annotations;
291
- },
292
- enumerable: false,
293
- configurable: true
294
- });
295
- Type.prototype.annotationsOfType = function (type) {
180
+ }
181
+ get metadataKeys() {
182
+ if (!this._metadataKeys)
183
+ this._metadataKeys = Reflect.getOwnMetadataKeys(this._class);
184
+ return this._metadataKeys;
185
+ }
186
+ /**
187
+ * Get all annotations attached to this class
188
+ */
189
+ get annotations() {
190
+ if (!this._annotations)
191
+ this._annotations = annotations_1.Annotations.getClassAnnotations(this._class);
192
+ return this._annotations;
193
+ }
194
+ annotationsOfType(type) {
296
195
  return type.filter(this.annotations);
297
- };
298
- Type.prototype.annotationOfType = function (type) {
196
+ }
197
+ annotationOfType(type) {
299
198
  return type.filter(this.annotations)[0];
300
- };
301
- Type.prototype.fetchPropertyNames = function () {
302
- var e_1, _a;
199
+ }
200
+ fetchPropertyNames() {
303
201
  this._propertyNames = Object.getOwnPropertyNames(this._class.prototype);
304
- try {
305
- for (var _b = (0, tslib_1.__values)(this._propertyNames), _c = _b.next(); !_c.done; _c = _b.next()) {
306
- var propertyName = _c.value;
307
- if (typeof this._class.prototype[propertyName] === 'function') {
308
- this._methodNames.push(propertyName);
309
- }
310
- else {
311
- this._fieldNames.push(propertyName);
312
- }
202
+ for (let propertyName of this._propertyNames) {
203
+ if (typeof this._class.prototype[propertyName] === 'function') {
204
+ this._methodNames.push(propertyName);
313
205
  }
314
- }
315
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
316
- finally {
317
- try {
318
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
206
+ else {
207
+ this._fieldNames.push(propertyName);
319
208
  }
320
- finally { if (e_1) throw e_1.error; }
321
209
  }
322
- };
323
- Type.prototype.fetchStaticPropertyNames = function () {
324
- var e_2, _a;
325
- this._staticPropertyNames = Object.getOwnPropertyNames(this._class).filter(function (x) { return !['length', 'prototype', 'name'].includes(x); });
326
- try {
327
- for (var _b = (0, tslib_1.__values)(this._staticPropertyNames), _c = _b.next(); !_c.done; _c = _b.next()) {
328
- var propertyName = _c.value;
329
- if (typeof this._class[propertyName] === 'function') {
330
- this._staticMethodNames.push(propertyName);
331
- }
332
- else {
333
- this._staticFieldNames.push(propertyName);
334
- }
210
+ }
211
+ fetchStaticPropertyNames() {
212
+ this._staticPropertyNames = Object.getOwnPropertyNames(this._class).filter(x => !['length', 'prototype', 'name'].includes(x));
213
+ for (let propertyName of this._staticPropertyNames) {
214
+ if (typeof this._class[propertyName] === 'function') {
215
+ this._staticMethodNames.push(propertyName);
335
216
  }
336
- }
337
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
338
- finally {
339
- try {
340
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
217
+ else {
218
+ this._staticFieldNames.push(propertyName);
341
219
  }
342
- finally { if (e_2) throw e_2.error; }
343
220
  }
344
- };
345
- Object.defineProperty(Type.prototype, "staticPropertyNames", {
346
- get: function () {
347
- if (!this._staticPropertyNames)
348
- this.fetchStaticPropertyNames();
349
- return this._staticPropertyNames.slice();
350
- },
351
- enumerable: false,
352
- configurable: true
353
- });
354
- Object.defineProperty(Type.prototype, "staticMethodNames", {
355
- get: function () {
356
- if (!this._staticPropertyNames)
357
- this.fetchStaticPropertyNames();
358
- return this._staticMethodNames.slice();
359
- },
360
- enumerable: false,
361
- configurable: true
362
- });
363
- Object.defineProperty(Type.prototype, "staticFieldNames", {
364
- get: function () {
365
- if (!this._staticPropertyNames)
366
- this.fetchStaticPropertyNames();
367
- return this._staticFieldNames.slice();
368
- },
369
- enumerable: false,
370
- configurable: true
371
- });
372
- Object.defineProperty(Type.prototype, "staticMethods", {
373
- get: function () {
374
- var _this = this;
375
- if (this._staticMethods)
376
- return this._staticMethods;
377
- this._staticMethods = this.staticMethodNames.map(function (methodName) { return new Method(_this._class, methodName, true); });
221
+ }
222
+ get staticPropertyNames() {
223
+ if (!this._staticPropertyNames)
224
+ this.fetchStaticPropertyNames();
225
+ return this._staticPropertyNames.slice();
226
+ }
227
+ get staticMethodNames() {
228
+ if (!this._staticPropertyNames)
229
+ this.fetchStaticPropertyNames();
230
+ return this._staticMethodNames.slice();
231
+ }
232
+ get staticFieldNames() {
233
+ if (!this._staticPropertyNames)
234
+ this.fetchStaticPropertyNames();
235
+ return this._staticFieldNames.slice();
236
+ }
237
+ get staticMethods() {
238
+ if (this._staticMethods)
378
239
  return this._staticMethods;
379
- },
380
- enumerable: false,
381
- configurable: true
382
- });
383
- Object.defineProperty(Type.prototype, "staticFields", {
384
- get: function () {
385
- var _this = this;
386
- if (this._staticFields)
387
- return this._staticFields;
388
- this._staticFields = this.staticFieldNames.map(function (fieldName) { return new Field(_this._class, fieldName, true); });
240
+ this._staticMethods = this.staticMethodNames.map(methodName => new Method(this._class, methodName, true));
241
+ return this._staticMethods;
242
+ }
243
+ get staticFields() {
244
+ if (this._staticFields)
389
245
  return this._staticFields;
390
- },
391
- enumerable: false,
392
- configurable: true
393
- });
394
- Object.defineProperty(Type.prototype, "staticProperties", {
395
- get: function () {
396
- if (this._staticProperties)
397
- return this._staticProperties;
398
- this._staticProperties = [].concat(this.staticFields, this.staticMethods);
246
+ this._staticFields = this.staticFieldNames.map(fieldName => new Field(this._class, fieldName, true));
247
+ return this._staticFields;
248
+ }
249
+ get staticProperties() {
250
+ if (this._staticProperties)
399
251
  return this._staticProperties;
400
- },
401
- enumerable: false,
402
- configurable: true
403
- });
404
- Object.defineProperty(Type.prototype, "propertyNames", {
405
- get: function () {
406
- if (!this._propertyNames)
407
- this.fetchPropertyNames();
408
- return this._propertyNames.slice();
409
- },
410
- enumerable: false,
411
- configurable: true
412
- });
413
- Object.defineProperty(Type.prototype, "methodNames", {
414
- get: function () {
415
- if (!this._propertyNames)
416
- this.fetchPropertyNames();
417
- return this._methodNames.slice();
418
- },
419
- enumerable: false,
420
- configurable: true
421
- });
422
- Object.defineProperty(Type.prototype, "fieldNames", {
423
- get: function () {
424
- if (!this._propertyNames)
425
- this.fetchPropertyNames();
426
- return this._fieldNames.slice();
427
- },
428
- enumerable: false,
429
- configurable: true
430
- });
431
- Object.defineProperty(Type.prototype, "constructorMethod", {
432
- get: function () {
433
- if (!this._ctor)
434
- this._ctor = new ConstructorMethod(this._class);
435
- return this._ctor;
436
- },
437
- enumerable: false,
438
- configurable: true
439
- });
440
- Object.defineProperty(Type.prototype, "methods", {
441
- get: function () {
442
- var _this = this;
443
- if (this._methods)
444
- return this._methods;
445
- this._methods = this.methodNames.map(function (methodName) { return new Method(_this._class, methodName); });
252
+ this._staticProperties = [].concat(this.staticFields, this.staticMethods);
253
+ return this._staticProperties;
254
+ }
255
+ get propertyNames() {
256
+ if (!this._propertyNames)
257
+ this.fetchPropertyNames();
258
+ return this._propertyNames.slice();
259
+ }
260
+ get methodNames() {
261
+ if (!this._propertyNames)
262
+ this.fetchPropertyNames();
263
+ return this._methodNames.slice();
264
+ }
265
+ get fieldNames() {
266
+ if (!this._propertyNames)
267
+ this.fetchPropertyNames();
268
+ return this._fieldNames.slice();
269
+ }
270
+ get constructorMethod() {
271
+ if (!this._ctor)
272
+ this._ctor = new ConstructorMethod(this._class);
273
+ return this._ctor;
274
+ }
275
+ get methods() {
276
+ if (this._methods)
446
277
  return this._methods;
447
- },
448
- enumerable: false,
449
- configurable: true
450
- });
451
- Object.defineProperty(Type.prototype, "properties", {
452
- get: function () {
453
- if (this._properties)
454
- return this._properties;
455
- this._properties = [].concat(this.fields, this.methods);
278
+ this._methods = this.methodNames.map(methodName => new Method(this._class, methodName));
279
+ return this._methods;
280
+ }
281
+ get properties() {
282
+ if (this._properties)
456
283
  return this._properties;
457
- },
458
- enumerable: false,
459
- configurable: true
460
- });
461
- Object.defineProperty(Type.prototype, "fields", {
462
- get: function () {
463
- var _this = this;
464
- if (this._fields)
465
- return this._fields;
466
- this._fields = this.fieldNames.map(function (fieldName) { return new Field(_this._class, fieldName); });
284
+ this._properties = [].concat(this.fields, this.methods);
285
+ return this._properties;
286
+ }
287
+ get fields() {
288
+ if (this._fields)
467
289
  return this._fields;
468
- },
469
- enumerable: false,
470
- configurable: true
471
- });
472
- Object.defineProperty(Type.prototype, "base", {
473
- get: function () {
474
- return new Type(Object.getPrototypeOf(this._class));
475
- },
476
- enumerable: false,
477
- configurable: true
478
- });
479
- return Type;
480
- }());
481
- exports.Type = Type;
482
- var Reflector = /** @class */ (function () {
483
- function Reflector() {
290
+ this._fields = this.fieldNames.map(fieldName => new Field(this._class, fieldName));
291
+ return this._fields;
484
292
  }
485
- Reflector.prototype.getTypeFromInstance = function (instance) {
293
+ get base() {
294
+ return new Type(Object.getPrototypeOf(this._class));
295
+ }
296
+ }
297
+ exports.Type = Type;
298
+ class Reflector {
299
+ getTypeFromInstance(instance) {
486
300
  return this.getTypeFromClass(instance.constructor);
487
- };
488
- Reflector.prototype.getTypeFromClass = function (typeClass) {
301
+ }
302
+ getTypeFromClass(typeClass) {
489
303
  return new Type(typeClass);
490
- };
491
- return Reflector;
492
- }());
304
+ }
305
+ }
493
306
  exports.Reflector = Reflector;
494
307
  //# sourceMappingURL=reflector.js.map