@tsed/core 6.80.1 → 6.84.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.
@@ -125,6 +125,18 @@ function uniqBy(list, key = "id") {
125
125
  return Array.from(map.values());
126
126
  }
127
127
 
128
+ async function importPackage(packageName, loaderFn = () => import(packageName), optional = false) {
129
+ try {
130
+ return await loaderFn();
131
+ } catch (e) {
132
+ if (!optional) {
133
+ throw new Error(`The "${packageName}\" package is missing.`);
134
+ }
135
+
136
+ return {};
137
+ }
138
+ }
139
+
128
140
  /**
129
141
  * Get the provide constructor if target is an instance.
130
142
  * @param target
@@ -240,6 +252,11 @@ function methodsOf(target) {
240
252
  function descriptorOf(target, propertyKey) {
241
253
  return Object.getOwnPropertyDescriptor(target && target.prototype || target, propertyKey);
242
254
  }
255
+ function isMethodDescriptor(target, propertyKey) {
256
+ var _descriptorOf;
257
+
258
+ return (_descriptorOf = descriptorOf(target, propertyKey)) == null ? void 0 : _descriptorOf.value;
259
+ }
243
260
 
244
261
  var DecoratorTypes;
245
262
 
@@ -1690,121 +1707,6 @@ function toMap(input, keyOrFn) {
1690
1707
  }, new Map());
1691
1708
  }
1692
1709
 
1693
- class Entity {
1694
- constructor({
1695
- target,
1696
- propertyKey,
1697
- descriptor,
1698
- index
1699
- }) {
1700
- this._target = target;
1701
- this.propertyKey = propertyKey;
1702
- this.propertyName = String(propertyKey);
1703
- this.descriptor = descriptor;
1704
- this.index = index;
1705
- this.decoratorType = decoratorTypeOf([target, propertyKey, descriptor || index]);
1706
- this.token = target && classOf(target);
1707
- }
1708
- /**
1709
- * Reference to the class
1710
- */
1711
-
1712
-
1713
- get target() {
1714
- return this._target;
1715
- }
1716
- /**
1717
- * Return the class name of the entity.
1718
- * @returns {string}
1719
- */
1720
-
1721
-
1722
- get targetName() {
1723
- return nameOf(this.token);
1724
- }
1725
- /**
1726
- *
1727
- * @returns {Type<any>}
1728
- */
1729
-
1730
-
1731
- get type() {
1732
- return this._type;
1733
- }
1734
- /**
1735
- * Get original type without transformation
1736
- * @param value
1737
- */
1738
-
1739
-
1740
- set type(value) {
1741
- this._type = value;
1742
- }
1743
- /**
1744
- * Return the itemSchema target type. if the type is a function used for recursive model, the function will be called to
1745
- * get the right type.
1746
- */
1747
-
1748
-
1749
- get computedType() {
1750
- return this._type;
1751
- }
1752
- /**
1753
- *
1754
- * @returns {boolean}
1755
- */
1756
-
1757
-
1758
- get isCollection() {
1759
- return !!this.collectionType;
1760
- }
1761
- /**
1762
- *
1763
- * @returns {boolean}
1764
- */
1765
-
1766
-
1767
- get isArray() {
1768
- return isArrayOrArrayClass(this.collectionType);
1769
- }
1770
- /**
1771
- *
1772
- * @returns {boolean}
1773
- */
1774
-
1775
-
1776
- get isPrimitive() {
1777
- return isPrimitiveOrPrimitiveClass(this._type);
1778
- }
1779
- /**
1780
- *
1781
- * @returns {boolean}
1782
- */
1783
-
1784
-
1785
- get isDate() {
1786
- return isDate(this.computedType);
1787
- }
1788
- /**
1789
- *
1790
- * @returns {boolean}
1791
- */
1792
-
1793
-
1794
- get isObject() {
1795
- return isObject(this.computedType);
1796
- }
1797
- /**
1798
- *
1799
- */
1800
-
1801
-
1802
- get isClass() {
1803
- return isClass(this.computedType);
1804
- }
1805
-
1806
- }
1807
-
1808
1710
  /**
1809
1711
  *
1810
1712
  */
@@ -2300,5 +2202,5 @@ function StoreMerge(key, value) {
2300
2202
  });
2301
2203
  }
2302
2204
 
2303
- export { AnyToPromise, AnyToPromiseResponseTypes, AnyToPromiseStatus, CLASS_STORE, Configurable, DecoratorTypes, Deprecated, Entity, Enumerable, Env, EnvTypes, Hooks, METHOD_STORE, Metadata, NotConfigurable, NotEnumerable, PARAM_STORE, PROPERTY_STORE, Readonly, Store, StoreFn, StoreMerge, StoreSet, Type, UnsupportedDecoratorType, Writable, ancestorOf, ancestorsOf, catchAsyncError, catchError, classOf, cleanObject, constructorOf, decorateMethodsOf, decoratorArgs, decoratorTypeOf, deepClone, deepExtends, deepMerge, descriptorOf, getClass, getClassOrSymbol, getConstructor, getConstructorArgNames, getEnumerableKeys, getInheritedClass, getValue, inheritedDescriptorOf, isArray, isArrayOrArrayClass, isArrowFn, isBoolean, isBooleanOrBooleanClass, isClass, isClassObject, isCollection, isDate, isEmpty, isEnumerable, isFunction, isInheritedFrom, isNil, isNumber, isNumberOrNumberClass, isObject, isObservable, isPlainObject, isPrimitive, isPrimitiveClass, isPrimitiveOrPrimitiveClass, isPromise, isProtectedKey, isSerializable, isStream, isString, isStringOrStringClass, isSymbol, isSymbolOrSymbolClass, mergeReducerBuilder, methodsOf, nameOf, nameOfClass, nameOfSymbol, objectKeys, primitiveOf, prototypeOf, proxyDelegation, setValue, toMap, toStringConstructor, uniq, uniqBy, useDecorators, useMethodDecorator, useMethodDecorators };
2205
+ export { AnyToPromise, AnyToPromiseResponseTypes, AnyToPromiseStatus, CLASS_STORE, Configurable, DecoratorTypes, Deprecated, Enumerable, Env, EnvTypes, Hooks, METHOD_STORE, Metadata, NotConfigurable, NotEnumerable, PARAM_STORE, PROPERTY_STORE, Readonly, Store, StoreFn, StoreMerge, StoreSet, Type, UnsupportedDecoratorType, Writable, ancestorOf, ancestorsOf, catchAsyncError, catchError, classOf, cleanObject, constructorOf, decorateMethodsOf, decoratorArgs, decoratorTypeOf, deepClone, deepExtends, deepMerge, descriptorOf, getClass, getClassOrSymbol, getConstructor, getConstructorArgNames, getEnumerableKeys, getInheritedClass, getValue, importPackage, inheritedDescriptorOf, isArray, isArrayOrArrayClass, isArrowFn, isBoolean, isBooleanOrBooleanClass, isClass, isClassObject, isCollection, isDate, isEmpty, isEnumerable, isFunction, isInheritedFrom, isMethodDescriptor, isNil, isNumber, isNumberOrNumberClass, isObject, isObservable, isPlainObject, isPrimitive, isPrimitiveClass, isPrimitiveOrPrimitiveClass, isPromise, isProtectedKey, isSerializable, isStream, isString, isStringOrStringClass, isSymbol, isSymbolOrSymbolClass, mergeReducerBuilder, methodsOf, nameOf, nameOfClass, nameOfSymbol, objectKeys, primitiveOf, prototypeOf, proxyDelegation, setValue, toMap, toStringConstructor, uniq, uniqBy, useDecorators, useMethodDecorator, useMethodDecorators };
2304
2206
  //# sourceMappingURL=index.modern.js.map