@tsed/core 6.87.2 → 6.90.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/lib/{decorators → cjs/decorators}/configurable.d.ts +0 -0
- package/lib/cjs/decorators/configurable.js +18 -0
- package/lib/cjs/decorators/configurable.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/deprecated.d.ts +0 -0
- package/lib/cjs/decorators/deprecated.js +43 -0
- package/lib/cjs/decorators/deprecated.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/enumerable.d.ts +0 -0
- package/lib/cjs/decorators/enumerable.js +18 -0
- package/lib/cjs/decorators/enumerable.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/index.d.ts +0 -0
- package/lib/cjs/decorators/index.js +18 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/notConfigurable.d.ts +0 -0
- package/lib/cjs/decorators/notConfigurable.js +13 -0
- package/lib/cjs/decorators/notConfigurable.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/notEnumerable.d.ts +0 -0
- package/lib/cjs/decorators/notEnumerable.js +13 -0
- package/lib/cjs/decorators/notEnumerable.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/readOnly.d.ts +0 -0
- package/lib/cjs/decorators/readOnly.js +13 -0
- package/lib/cjs/decorators/readOnly.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/storeFn.d.ts +0 -0
- package/lib/cjs/decorators/storeFn.js +22 -0
- package/lib/cjs/decorators/storeFn.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/storeMerge.d.ts +0 -0
- package/lib/cjs/decorators/storeMerge.js +11 -0
- package/lib/cjs/decorators/storeMerge.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/storeSet.d.ts +0 -0
- package/lib/cjs/decorators/storeSet.js +11 -0
- package/lib/cjs/decorators/storeSet.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/writable.d.ts +0 -0
- package/lib/cjs/decorators/writable.js +18 -0
- package/lib/cjs/decorators/writable.js.map +1 -0
- package/lib/{domain → cjs/domain}/AnyToPromise.d.ts +0 -0
- package/lib/cjs/domain/AnyToPromise.js +148 -0
- package/lib/cjs/domain/AnyToPromise.js.map +1 -0
- package/lib/{domain → cjs/domain}/DecoratorTypes.d.ts +0 -0
- package/lib/cjs/domain/DecoratorTypes.js +15 -0
- package/lib/cjs/domain/DecoratorTypes.js.map +1 -0
- package/lib/{domain → cjs/domain}/Env.d.ts +0 -0
- package/lib/cjs/domain/Env.js +19 -0
- package/lib/cjs/domain/Env.js.map +1 -0
- package/lib/{domain → cjs/domain}/Hooks.d.ts +0 -0
- package/lib/cjs/domain/Hooks.js +89 -0
- package/lib/cjs/domain/Hooks.js.map +1 -0
- package/lib/{domain → cjs/domain}/Metadata.d.ts +0 -0
- package/lib/cjs/domain/Metadata.js +508 -0
- package/lib/cjs/domain/Metadata.js.map +1 -0
- package/lib/{domain → cjs/domain}/Store.d.ts +0 -0
- package/lib/cjs/domain/Store.js +157 -0
- package/lib/cjs/domain/Store.js.map +1 -0
- package/lib/{domain → cjs/domain}/Type.d.ts +0 -0
- package/lib/cjs/domain/Type.js +7 -0
- package/lib/cjs/domain/Type.js.map +1 -0
- package/lib/{domain → cjs/domain}/index.d.ts +0 -0
- package/lib/cjs/domain/index.js +11 -0
- package/lib/cjs/domain/index.js.map +1 -0
- package/lib/{errors → cjs/errors}/UnsupportedDecoratorType.d.ts +0 -0
- package/lib/cjs/errors/UnsupportedDecoratorType.js +21 -0
- package/lib/cjs/errors/UnsupportedDecoratorType.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +9 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/AnyDecorator.d.ts +0 -0
- package/lib/cjs/interfaces/AnyDecorator.js +3 -0
- package/lib/cjs/interfaces/AnyDecorator.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/DecoratorParameters.d.ts +0 -0
- package/lib/cjs/interfaces/DecoratorParameters.js +3 -0
- package/lib/cjs/interfaces/DecoratorParameters.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/HashOf.d.ts +0 -0
- package/lib/cjs/interfaces/HashOf.js +3 -0
- package/lib/cjs/interfaces/HashOf.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/MetadataTypes.d.ts +0 -0
- package/lib/cjs/interfaces/MetadataTypes.js +3 -0
- package/lib/cjs/interfaces/MetadataTypes.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ValueOf.d.ts +0 -0
- package/lib/cjs/interfaces/ValueOf.js +3 -0
- package/lib/cjs/interfaces/ValueOf.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/index.d.ts +0 -0
- package/lib/cjs/interfaces/index.js +3 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/catchError.d.ts +0 -0
- package/lib/cjs/utils/catchError.js +22 -0
- package/lib/cjs/utils/catchError.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/decorateMethodsOf.d.ts +0 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js +23 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/decoratorArgs.d.ts +0 -0
- package/lib/cjs/utils/decorators/decoratorArgs.js +9 -0
- package/lib/cjs/utils/decorators/decoratorArgs.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/decoratorTypeOf.d.ts +0 -0
- package/lib/cjs/utils/decorators/decoratorTypeOf.js +23 -0
- package/lib/cjs/utils/decorators/decoratorTypeOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/inheritedDescriptorOf.d.ts +0 -0
- package/lib/cjs/utils/decorators/inheritedDescriptorOf.js +15 -0
- package/lib/cjs/utils/decorators/inheritedDescriptorOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/useDecorators.d.ts +0 -0
- package/lib/cjs/utils/decorators/useDecorators.js +14 -0
- package/lib/cjs/utils/decorators/useDecorators.js.map +1 -0
- package/lib/{utils → cjs/utils}/decorators/useMethodDecorators.d.ts +0 -0
- package/lib/cjs/utils/decorators/useMethodDecorators.js +15 -0
- package/lib/cjs/utils/decorators/useMethodDecorators.js.map +1 -0
- package/lib/{utils → cjs/utils}/imports/importPackage.d.ts +0 -0
- package/lib/cjs/utils/imports/importPackage.js +35 -0
- package/lib/cjs/utils/imports/importPackage.js.map +1 -0
- package/lib/{utils → cjs/utils}/index.d.ts +0 -0
- package/lib/cjs/utils/index.js +18 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/ancestorOf.d.ts +0 -0
- package/lib/cjs/utils/objects/ancestorOf.js +12 -0
- package/lib/cjs/utils/objects/ancestorOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/ancestorsOf.d.ts +0 -0
- package/lib/cjs/utils/objects/ancestorsOf.js +22 -0
- package/lib/cjs/utils/objects/ancestorsOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/classOf.d.ts +0 -0
- package/lib/cjs/utils/objects/classOf.js +23 -0
- package/lib/cjs/utils/objects/classOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/cleanObject.d.ts +0 -0
- package/lib/cjs/utils/objects/cleanObject.js +24 -0
- package/lib/cjs/utils/objects/cleanObject.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/constructorOf.d.ts +0 -0
- package/lib/cjs/utils/objects/constructorOf.js +20 -0
- package/lib/cjs/utils/objects/constructorOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/createInstance.d.ts +0 -0
- package/lib/cjs/utils/objects/createInstance.js +9 -0
- package/lib/cjs/utils/objects/createInstance.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/deepClone.d.ts +0 -0
- package/lib/cjs/utils/objects/deepClone.js +57 -0
- package/lib/cjs/utils/objects/deepClone.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/deepExtends.d.ts +0 -0
- package/lib/cjs/utils/objects/deepExtends.js +79 -0
- package/lib/cjs/utils/objects/deepExtends.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/deepMerge.d.ts +0 -0
- package/lib/cjs/utils/objects/deepMerge.js +63 -0
- package/lib/cjs/utils/objects/deepMerge.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/descriptorOf.d.ts +0 -0
- package/lib/cjs/utils/objects/descriptorOf.js +19 -0
- package/lib/cjs/utils/objects/descriptorOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/getClassOrSymbol.d.ts +0 -0
- package/lib/cjs/utils/objects/getClassOrSymbol.js +10 -0
- package/lib/cjs/utils/objects/getClassOrSymbol.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/getConstructorArgNames.d.ts +0 -0
- package/lib/cjs/utils/objects/getConstructorArgNames.js +9 -0
- package/lib/cjs/utils/objects/getConstructorArgNames.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/getEnumerableKeys.d.ts +0 -0
- package/lib/cjs/utils/objects/getEnumerableKeys.js +20 -0
- package/lib/cjs/utils/objects/getEnumerableKeys.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/getValue.d.ts +0 -0
- package/lib/cjs/utils/objects/getValue.js +49 -0
- package/lib/cjs/utils/objects/getValue.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/index.d.ts +0 -0
- package/lib/cjs/utils/objects/index.js +47 -0
- package/lib/cjs/utils/objects/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isArray.d.ts +0 -0
- package/lib/cjs/utils/objects/isArray.js +23 -0
- package/lib/cjs/utils/objects/isArray.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isArrowFn.d.ts +0 -0
- package/lib/cjs/utils/objects/isArrowFn.js +9 -0
- package/lib/cjs/utils/objects/isArrowFn.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isBoolean.d.ts +0 -0
- package/lib/cjs/utils/objects/isBoolean.js +17 -0
- package/lib/cjs/utils/objects/isBoolean.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isClass.d.ts +0 -0
- package/lib/cjs/utils/objects/isClass.js +26 -0
- package/lib/cjs/utils/objects/isClass.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isCollection.d.ts +0 -0
- package/lib/cjs/utils/objects/isCollection.js +22 -0
- package/lib/cjs/utils/objects/isCollection.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isDate.d.ts +0 -0
- package/lib/cjs/utils/objects/isDate.js +13 -0
- package/lib/cjs/utils/objects/isDate.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isEmpty.d.ts +0 -0
- package/lib/cjs/utils/objects/isEmpty.js +14 -0
- package/lib/cjs/utils/objects/isEmpty.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isEnumerable.d.ts +0 -0
- package/lib/cjs/utils/objects/isEnumerable.js +22 -0
- package/lib/cjs/utils/objects/isEnumerable.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isFunction.d.ts +0 -0
- package/lib/cjs/utils/objects/isFunction.js +8 -0
- package/lib/cjs/utils/objects/isFunction.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isInheritedFrom.d.ts +0 -0
- package/lib/cjs/utils/objects/isInheritedFrom.js +26 -0
- package/lib/cjs/utils/objects/isInheritedFrom.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isNil.d.ts +0 -0
- package/lib/cjs/utils/objects/isNil.js +8 -0
- package/lib/cjs/utils/objects/isNil.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isNumber.d.ts +0 -0
- package/lib/cjs/utils/objects/isNumber.js +17 -0
- package/lib/cjs/utils/objects/isNumber.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isObject.d.ts +0 -0
- package/lib/cjs/utils/objects/isObject.js +8 -0
- package/lib/cjs/utils/objects/isObject.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isObservable.d.ts +0 -0
- package/lib/cjs/utils/objects/isObservable.js +8 -0
- package/lib/cjs/utils/objects/isObservable.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isPlainObject.d.ts +0 -0
- package/lib/cjs/utils/objects/isPlainObject.js +18 -0
- package/lib/cjs/utils/objects/isPlainObject.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isPrimitive.d.ts +0 -0
- package/lib/cjs/utils/objects/isPrimitive.js +30 -0
- package/lib/cjs/utils/objects/isPrimitive.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isPromise.d.ts +0 -0
- package/lib/cjs/utils/objects/isPromise.js +16 -0
- package/lib/cjs/utils/objects/isPromise.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isProtectedKey.d.ts +0 -0
- package/lib/cjs/utils/objects/isProtectedKey.js +12 -0
- package/lib/cjs/utils/objects/isProtectedKey.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isSerializable.d.ts +0 -0
- package/lib/cjs/utils/objects/isSerializable.js +13 -0
- package/lib/cjs/utils/objects/isSerializable.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isStream.d.ts +0 -0
- package/lib/cjs/utils/objects/isStream.js +8 -0
- package/lib/cjs/utils/objects/isStream.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isString.d.ts +0 -0
- package/lib/cjs/utils/objects/isString.js +16 -0
- package/lib/cjs/utils/objects/isString.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/isSymbol.d.ts +0 -0
- package/lib/cjs/utils/objects/isSymbol.js +16 -0
- package/lib/cjs/utils/objects/isSymbol.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/methodsOf.d.ts +0 -0
- package/lib/cjs/utils/objects/methodsOf.js +25 -0
- package/lib/cjs/utils/objects/methodsOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/nameOf.d.ts +0 -0
- package/lib/cjs/utils/objects/nameOf.js +32 -0
- package/lib/cjs/utils/objects/nameOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/objectKeys.d.ts +0 -0
- package/lib/cjs/utils/objects/objectKeys.js +9 -0
- package/lib/cjs/utils/objects/objectKeys.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/primitiveOf.d.ts +0 -0
- package/lib/cjs/utils/objects/primitiveOf.js +20 -0
- package/lib/cjs/utils/objects/primitiveOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/prototypeOf.d.ts +0 -0
- package/lib/cjs/utils/objects/prototypeOf.js +14 -0
- package/lib/cjs/utils/objects/prototypeOf.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/setValue.d.ts +0 -0
- package/lib/cjs/utils/objects/setValue.js +34 -0
- package/lib/cjs/utils/objects/setValue.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/toMap.d.ts +0 -0
- package/lib/cjs/utils/objects/toMap.js +32 -0
- package/lib/cjs/utils/objects/toMap.js.map +1 -0
- package/lib/{utils → cjs/utils}/objects/toStringConstructor.d.ts +0 -0
- package/lib/cjs/utils/objects/toStringConstructor.js +12 -0
- package/lib/cjs/utils/objects/toStringConstructor.js.map +1 -0
- package/lib/{utils → cjs/utils}/proxyDelegation.d.ts +0 -0
- package/lib/cjs/utils/proxyDelegation.js +54 -0
- package/lib/cjs/utils/proxyDelegation.js.map +1 -0
- package/lib/{utils → cjs/utils}/uniq.d.ts +0 -0
- package/lib/cjs/utils/uniq.js +16 -0
- package/lib/cjs/utils/uniq.js.map +1 -0
- package/lib/esm/decorators/configurable.js +14 -0
- package/lib/esm/decorators/configurable.js.map +1 -0
- package/lib/esm/decorators/deprecated.js +39 -0
- package/lib/esm/decorators/deprecated.js.map +1 -0
- package/lib/esm/decorators/enumerable.js +14 -0
- package/lib/esm/decorators/enumerable.js.map +1 -0
- package/lib/esm/decorators/index.js +15 -0
- package/lib/esm/decorators/index.js.map +1 -0
- package/lib/esm/decorators/notConfigurable.js +9 -0
- package/lib/esm/decorators/notConfigurable.js.map +1 -0
- package/lib/esm/decorators/notEnumerable.js +9 -0
- package/lib/esm/decorators/notEnumerable.js.map +1 -0
- package/lib/esm/decorators/readOnly.js +9 -0
- package/lib/esm/decorators/readOnly.js.map +1 -0
- package/lib/esm/decorators/storeFn.js +18 -0
- package/lib/esm/decorators/storeFn.js.map +1 -0
- package/lib/esm/decorators/storeMerge.js +7 -0
- package/lib/esm/decorators/storeMerge.js.map +1 -0
- package/lib/esm/decorators/storeSet.js +7 -0
- package/lib/esm/decorators/storeSet.js.map +1 -0
- package/lib/esm/decorators/writable.js +14 -0
- package/lib/esm/decorators/writable.js.map +1 -0
- package/lib/esm/domain/AnyToPromise.js +144 -0
- package/lib/esm/domain/AnyToPromise.js.map +1 -0
- package/lib/esm/domain/DecoratorTypes.js +12 -0
- package/lib/esm/domain/DecoratorTypes.js.map +1 -0
- package/lib/esm/domain/Env.js +16 -0
- package/lib/esm/domain/Env.js.map +1 -0
- package/lib/esm/domain/Hooks.js +85 -0
- package/lib/esm/domain/Hooks.js.map +1 -0
- package/lib/esm/domain/Metadata.js +504 -0
- package/lib/esm/domain/Metadata.js.map +1 -0
- package/lib/esm/domain/Store.js +153 -0
- package/lib/esm/domain/Store.js.map +1 -0
- package/lib/esm/domain/Type.js +4 -0
- package/lib/esm/domain/Type.js.map +1 -0
- package/lib/esm/domain/index.js +8 -0
- package/lib/esm/domain/index.js.map +1 -0
- package/lib/esm/errors/UnsupportedDecoratorType.js +17 -0
- package/lib/esm/errors/UnsupportedDecoratorType.js.map +1 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/AnyDecorator.js +2 -0
- package/lib/esm/interfaces/AnyDecorator.js.map +1 -0
- package/lib/esm/interfaces/DecoratorParameters.js +2 -0
- package/lib/esm/interfaces/DecoratorParameters.js.map +1 -0
- package/lib/esm/interfaces/HashOf.js +2 -0
- package/lib/esm/interfaces/HashOf.js.map +1 -0
- package/lib/esm/interfaces/MetadataTypes.js +2 -0
- package/lib/esm/interfaces/MetadataTypes.js.map +1 -0
- package/lib/esm/interfaces/ValueOf.js +2 -0
- package/lib/esm/interfaces/ValueOf.js.map +1 -0
- package/lib/esm/interfaces/index.js +2 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/utils/catchError.js +17 -0
- package/lib/esm/utils/catchError.js.map +1 -0
- package/lib/esm/utils/decorators/decorateMethodsOf.js +19 -0
- package/lib/esm/utils/decorators/decorateMethodsOf.js.map +1 -0
- package/lib/esm/utils/decorators/decoratorArgs.js +5 -0
- package/lib/esm/utils/decorators/decoratorArgs.js.map +1 -0
- package/lib/esm/utils/decorators/decoratorTypeOf.js +19 -0
- package/lib/esm/utils/decorators/decoratorTypeOf.js.map +1 -0
- package/lib/esm/utils/decorators/inheritedDescriptorOf.js +11 -0
- package/lib/esm/utils/decorators/inheritedDescriptorOf.js.map +1 -0
- package/lib/esm/utils/decorators/useDecorators.js +10 -0
- package/lib/esm/utils/decorators/useDecorators.js.map +1 -0
- package/lib/esm/utils/decorators/useMethodDecorators.js +10 -0
- package/lib/esm/utils/decorators/useMethodDecorators.js.map +1 -0
- package/lib/esm/utils/imports/importPackage.js +12 -0
- package/lib/esm/utils/imports/importPackage.js.map +1 -0
- package/lib/esm/utils/index.js +15 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/esm/utils/objects/ancestorOf.js +7 -0
- package/lib/esm/utils/objects/ancestorOf.js.map +1 -0
- package/lib/esm/utils/objects/ancestorsOf.js +18 -0
- package/lib/esm/utils/objects/ancestorsOf.js.map +1 -0
- package/lib/esm/utils/objects/classOf.js +18 -0
- package/lib/esm/utils/objects/classOf.js.map +1 -0
- package/lib/esm/utils/objects/cleanObject.js +20 -0
- package/lib/esm/utils/objects/cleanObject.js.map +1 -0
- package/lib/esm/utils/objects/constructorOf.js +15 -0
- package/lib/esm/utils/objects/constructorOf.js.map +1 -0
- package/lib/esm/utils/objects/createInstance.js +5 -0
- package/lib/esm/utils/objects/createInstance.js.map +1 -0
- package/lib/esm/utils/objects/deepClone.js +53 -0
- package/lib/esm/utils/objects/deepClone.js.map +1 -0
- package/lib/esm/utils/objects/deepExtends.js +75 -0
- package/lib/esm/utils/objects/deepExtends.js.map +1 -0
- package/lib/esm/utils/objects/deepMerge.js +58 -0
- package/lib/esm/utils/objects/deepMerge.js.map +1 -0
- package/lib/esm/utils/objects/descriptorOf.js +14 -0
- package/lib/esm/utils/objects/descriptorOf.js.map +1 -0
- package/lib/esm/utils/objects/getClassOrSymbol.js +6 -0
- package/lib/esm/utils/objects/getClassOrSymbol.js.map +1 -0
- package/lib/esm/utils/objects/getConstructorArgNames.js +5 -0
- package/lib/esm/utils/objects/getConstructorArgNames.js.map +1 -0
- package/lib/esm/utils/objects/getEnumerableKeys.js +16 -0
- package/lib/esm/utils/objects/getEnumerableKeys.js.map +1 -0
- package/lib/esm/utils/objects/getValue.js +45 -0
- package/lib/esm/utils/objects/getValue.js.map +1 -0
- package/lib/esm/utils/objects/index.js +44 -0
- package/lib/esm/utils/objects/index.js.map +1 -0
- package/lib/esm/utils/objects/isArray.js +18 -0
- package/lib/esm/utils/objects/isArray.js.map +1 -0
- package/lib/esm/utils/objects/isArrowFn.js +5 -0
- package/lib/esm/utils/objects/isArrowFn.js.map +1 -0
- package/lib/esm/utils/objects/isBoolean.js +12 -0
- package/lib/esm/utils/objects/isBoolean.js.map +1 -0
- package/lib/esm/utils/objects/isClass.js +22 -0
- package/lib/esm/utils/objects/isClass.js.map +1 -0
- package/lib/esm/utils/objects/isCollection.js +18 -0
- package/lib/esm/utils/objects/isCollection.js.map +1 -0
- package/lib/esm/utils/objects/isDate.js +9 -0
- package/lib/esm/utils/objects/isDate.js.map +1 -0
- package/lib/esm/utils/objects/isEmpty.js +10 -0
- package/lib/esm/utils/objects/isEmpty.js.map +1 -0
- package/lib/esm/utils/objects/isEnumerable.js +18 -0
- package/lib/esm/utils/objects/isEnumerable.js.map +1 -0
- package/lib/esm/utils/objects/isFunction.js +4 -0
- package/lib/esm/utils/objects/isFunction.js.map +1 -0
- package/lib/esm/utils/objects/isInheritedFrom.js +22 -0
- package/lib/esm/utils/objects/isInheritedFrom.js.map +1 -0
- package/lib/esm/utils/objects/isNil.js +4 -0
- package/lib/esm/utils/objects/isNil.js.map +1 -0
- package/lib/esm/utils/objects/isNumber.js +12 -0
- package/lib/esm/utils/objects/isNumber.js.map +1 -0
- package/lib/esm/utils/objects/isObject.js +4 -0
- package/lib/esm/utils/objects/isObject.js.map +1 -0
- package/lib/esm/utils/objects/isObservable.js +4 -0
- package/lib/esm/utils/objects/isObservable.js.map +1 -0
- package/lib/esm/utils/objects/isPlainObject.js +13 -0
- package/lib/esm/utils/objects/isPlainObject.js.map +1 -0
- package/lib/esm/utils/objects/isPrimitive.js +24 -0
- package/lib/esm/utils/objects/isPrimitive.js.map +1 -0
- package/lib/esm/utils/objects/isPromise.js +12 -0
- package/lib/esm/utils/objects/isPromise.js.map +1 -0
- package/lib/esm/utils/objects/isProtectedKey.js +8 -0
- package/lib/esm/utils/objects/isProtectedKey.js.map +1 -0
- package/lib/esm/utils/objects/isSerializable.js +9 -0
- package/lib/esm/utils/objects/isSerializable.js.map +1 -0
- package/lib/esm/utils/objects/isStream.js +4 -0
- package/lib/esm/utils/objects/isStream.js.map +1 -0
- package/lib/esm/utils/objects/isString.js +11 -0
- package/lib/esm/utils/objects/isString.js.map +1 -0
- package/lib/esm/utils/objects/isSymbol.js +11 -0
- package/lib/esm/utils/objects/isSymbol.js.map +1 -0
- package/lib/esm/utils/objects/methodsOf.js +21 -0
- package/lib/esm/utils/objects/methodsOf.js.map +1 -0
- package/lib/esm/utils/objects/nameOf.js +26 -0
- package/lib/esm/utils/objects/nameOf.js.map +1 -0
- package/lib/esm/utils/objects/objectKeys.js +5 -0
- package/lib/esm/utils/objects/objectKeys.js.map +1 -0
- package/lib/esm/utils/objects/primitiveOf.js +16 -0
- package/lib/esm/utils/objects/primitiveOf.js.map +1 -0
- package/lib/esm/utils/objects/prototypeOf.js +10 -0
- package/lib/esm/utils/objects/prototypeOf.js.map +1 -0
- package/lib/esm/utils/objects/setValue.js +30 -0
- package/lib/esm/utils/objects/setValue.js.map +1 -0
- package/lib/esm/utils/objects/toMap.js +28 -0
- package/lib/esm/utils/objects/toMap.js.map +1 -0
- package/lib/esm/utils/objects/toStringConstructor.js +8 -0
- package/lib/esm/utils/objects/toStringConstructor.js.map +1 -0
- package/lib/esm/utils/proxyDelegation.js +50 -0
- package/lib/esm/utils/proxyDelegation.js.map +1 -0
- package/lib/esm/utils/uniq.js +11 -0
- package/lib/esm/utils/uniq.js.map +1 -0
- package/lib/types/decorators/configurable.d.ts +2 -0
- package/lib/types/decorators/deprecated.d.ts +32 -0
- package/lib/types/decorators/enumerable.d.ts +2 -0
- package/lib/types/decorators/index.d.ts +14 -0
- package/lib/types/decorators/notConfigurable.d.ts +2 -0
- package/lib/types/decorators/notEnumerable.d.ts +2 -0
- package/lib/types/decorators/readOnly.d.ts +2 -0
- package/lib/types/decorators/storeFn.d.ts +9 -0
- package/lib/types/decorators/storeMerge.d.ts +1 -0
- package/lib/types/decorators/storeSet.d.ts +1 -0
- package/lib/types/decorators/writable.d.ts +2 -0
- package/lib/types/domain/AnyToPromise.d.ts +42 -0
- package/lib/types/domain/DecoratorTypes.d.ts +10 -0
- package/lib/types/domain/Env.d.ts +13 -0
- package/lib/types/domain/Hooks.d.ts +45 -0
- package/lib/types/domain/Metadata.d.ts +442 -0
- package/lib/types/domain/Store.d.ts +69 -0
- package/lib/types/domain/Type.d.ts +11 -0
- package/lib/types/domain/index.d.ts +7 -0
- package/lib/types/errors/UnsupportedDecoratorType.d.ts +5 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/interfaces/AnyDecorator.d.ts +1 -0
- package/lib/types/interfaces/DecoratorParameters.d.ts +3 -0
- package/lib/types/interfaces/HashOf.d.ts +1 -0
- package/lib/types/interfaces/MetadataTypes.d.ts +5 -0
- package/lib/types/interfaces/ValueOf.d.ts +1 -0
- package/lib/types/interfaces/index.d.ts +4 -0
- package/lib/types/utils/catchError.d.ts +2 -0
- package/lib/types/utils/decorators/decorateMethodsOf.d.ts +1 -0
- package/lib/types/utils/decorators/decoratorArgs.d.ts +2 -0
- package/lib/types/utils/decorators/decoratorTypeOf.d.ts +2 -0
- package/lib/types/utils/decorators/inheritedDescriptorOf.d.ts +1 -0
- package/lib/types/utils/decorators/useDecorators.d.ts +2 -0
- package/lib/types/utils/decorators/useMethodDecorators.d.ts +3 -0
- package/lib/types/utils/imports/importPackage.d.ts +1 -0
- package/lib/types/utils/index.d.ts +12 -0
- package/lib/types/utils/objects/ancestorOf.d.ts +2 -0
- package/lib/types/utils/objects/ancestorsOf.d.ts +6 -0
- package/lib/types/utils/objects/classOf.d.ts +13 -0
- package/lib/types/utils/objects/cleanObject.d.ts +6 -0
- package/lib/types/utils/objects/constructorOf.d.ts +11 -0
- package/lib/types/utils/objects/createInstance.d.ts +1 -0
- package/lib/types/utils/objects/deepClone.d.ts +6 -0
- package/lib/types/utils/objects/deepExtends.d.ts +10 -0
- package/lib/types/utils/objects/deepMerge.d.ts +9 -0
- package/lib/types/utils/objects/descriptorOf.d.ts +8 -0
- package/lib/types/utils/objects/getClassOrSymbol.d.ts +1 -0
- package/lib/types/utils/objects/getConstructorArgNames.d.ts +1 -0
- package/lib/types/utils/objects/getEnumerableKeys.d.ts +5 -0
- package/lib/types/utils/objects/getValue.d.ts +32 -0
- package/lib/types/utils/objects/index.d.ts +43 -0
- package/lib/types/utils/objects/isArray.d.ts +13 -0
- package/lib/types/utils/objects/isArrowFn.d.ts +1 -0
- package/lib/types/utils/objects/isBoolean.d.ts +7 -0
- package/lib/types/utils/objects/isClass.d.ts +1 -0
- package/lib/types/utils/objects/isCollection.d.ts +6 -0
- package/lib/types/utils/objects/isDate.d.ts +6 -0
- package/lib/types/utils/objects/isEmpty.d.ts +6 -0
- package/lib/types/utils/objects/isEnumerable.d.ts +6 -0
- package/lib/types/utils/objects/isFunction.d.ts +1 -0
- package/lib/types/utils/objects/isInheritedFrom.d.ts +1 -0
- package/lib/types/utils/objects/isNil.d.ts +1 -0
- package/lib/types/utils/objects/isNumber.d.ts +7 -0
- package/lib/types/utils/objects/isObject.d.ts +1 -0
- package/lib/types/utils/objects/isObservable.d.ts +1 -0
- package/lib/types/utils/objects/isPlainObject.d.ts +7 -0
- package/lib/types/utils/objects/isPrimitive.d.ts +14 -0
- package/lib/types/utils/objects/isPromise.d.ts +7 -0
- package/lib/types/utils/objects/isProtectedKey.d.ts +5 -0
- package/lib/types/utils/objects/isSerializable.d.ts +1 -0
- package/lib/types/utils/objects/isStream.d.ts +1 -0
- package/lib/types/utils/objects/isString.d.ts +6 -0
- package/lib/types/utils/objects/isSymbol.d.ts +6 -0
- package/lib/types/utils/objects/methodsOf.d.ts +5 -0
- package/lib/types/utils/objects/nameOf.d.ts +14 -0
- package/lib/types/utils/objects/objectKeys.d.ts +1 -0
- package/lib/types/utils/objects/primitiveOf.d.ts +1 -0
- package/lib/types/utils/objects/prototypeOf.d.ts +6 -0
- package/lib/types/utils/objects/setValue.d.ts +1 -0
- package/lib/types/utils/objects/toMap.d.ts +3 -0
- package/lib/types/utils/objects/toStringConstructor.d.ts +1 -0
- package/lib/types/utils/proxyDelegation.d.ts +33 -0
- package/lib/types/utils/uniq.d.ts +2 -0
- package/package.json +10 -6
- package/tsconfig.compile.esm.json +23 -0
- package/lib/index.js +0 -2317
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -2207
- package/lib/index.modern.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../src/domain/Metadata.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AAEjD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C;;;;GAIG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC;;;;G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C,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,IAAI,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE;YAC5C,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC/B,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;SAC9B;QAED,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,WAAY,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,aAAa,CAAC,eAAoB,EAAE,WAA6B;QACtE,OAAO,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,eAAe,EAAE,WAAY,CAAC,IAAI,EAAE,CAAC;IACtF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAW,EAAE,WAA6B;QAChE,OAAO,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAY,CAAC,IAAI,EAAE,CAAC;IAChF,CAAC;;AAzHD;;;GAGG;AACI,kCAAyB,GAAG,CAAC,WAA4B,EAAS,EAAE,CACzE,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC","sourcesContent":["import \"reflect-metadata\";\nimport {classOf} from \"../utils/objects/classOf\";\n\n/**\n * Metadata key\n * @private\n * @type {string}\n */\nconst DESIGN_PARAM_TYPES = \"design:paramtypes\";\n/**\n * Metadata key\n * @private\n * @type {string}\n */\nconst DESIGN_TYPE = \"design:type\";\n/**\n * Metadata key\n * @private\n * @type {string}\n */\nconst DESIGN_RETURN_TYPE = \"design:returntype\";\n\n/**\n * Properties collections\n * @private\n * @type {string}\n */\nconst PROPERTIES: Map<string | symbol, any[]> = new Map<string | symbol, any[]>();\n\n/**\n * @stable\n */\nexport class Metadata {\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param key A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Metadata.get(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Metadata.get(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Metadata.get(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Metadata.get(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Metadata.get(\"custom:annotation\", Example.prototype, \"method\");\n * ```\n *\n */\n static get(key: string, target: any, propertyKey?: string | symbol): any {\n return Reflect.getMetadata(key, classOf(target), propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param key A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Metadata.getOwn(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Metadata.getOwn(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Metadata.getOwn(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Metadata.getOwn(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Metadata.getOwn(\"custom:annotation\", Example.prototype, \"method\");\n * ```\n *\n */\n static getOwn(key: string, target: any, propertyKey?: string | symbol): any {\n return Reflect.getOwnMetadata(key, classOf(target), propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getType(Example);\n *\n * // property (on constructor)\n * result = Metadata.getType(Example, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getType(Example, \"staticMethod\");\n * ```\n *\n */\n static getType(target: any, propertyKey?: string | symbol): any {\n return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getOwnType(Example);\n *\n * // property (on constructor)\n * result = Metadata.getOwnType(Example, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getOwnType(Example, \"staticMethod\");\n * ```\n *\n */\n static getOwnType(target: any, propertyKey?: string | symbol): any {\n return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getReturnType(Example);\n *\n * // property (on constructor)\n * result = Metadata.getReturnType(Example, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getReturnType(Example, \"staticMethod\");\n * ```\n *\n */\n static getReturnType(target: any, propertyKey?: string | symbol): any {\n return Reflect.getMetadata(DESIGN_RETURN_TYPE, target, propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getOwnReturnType(Example);\n *\n * // property (on constructor)\n * result = Metadata.getOwnReturnType(Example, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getOwnReturnType(Example, \"staticMethod\");\n * ```\n *\n */\n static getOwnReturnType(target: any, propertyKey?: string | symbol): any {\n return Reflect.getOwnMetadata(DESIGN_RETURN_TYPE, target, propertyKey!);\n }\n\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param key A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Metadata.has(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Metadata.has(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Metadata.has(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Metadata.has(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Metadata.has(\"custom:annotation\", Example.prototype, \"method\");\n * ```\n *\n */\n static has(key: string, target: any, propertyKey?: string | symbol): boolean {\n try {\n return Reflect.hasMetadata(key, classOf(target), propertyKey!);\n } catch (er) {}\n\n return false;\n }\n\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param key A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Metadata.has(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Metadata.hasOwn(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Metadata.hasOwn(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Metadata.hasOwn(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Metadata.hasOwn(\"custom:annotation\", Example.prototype, \"method\");\n * ```\n *\n */\n static hasOwn(key: string, target: any, propertyKey?: string | symbol): boolean {\n return Reflect.hasOwnMetadata(key, classOf(target), propertyKey!);\n }\n\n /**\n * Deletes the metadata entry from the target object with the provided key.\n * @param key A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns `true` if the metadata entry was found and deleted; otherwise, false.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Metadata.delete(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Metadata.delete(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Metadata.delete(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Metadata.delete(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Metadata.delete(\"custom:annotation\", Example.prototype, \"method\");\n * ```\n *\n */\n static delete(key: string, target: any, propertyKey?: string | symbol): boolean {\n return Reflect.deleteMetadata(key, classOf(target), propertyKey!);\n }\n\n /**\n * Set the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @param value A value that contains attached metadata.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.setParamTypes(Example, undefined, [Object]);\n *\n * // property (on constructor)\n * result = Metadata.setParamTypes(Example, \"staticProperty\", [Object]);\n *\n * // property (on prototype)\n * result = Metadata.setParamTypes(Example.prototype, \"property\", [Object]);\n *\n * // method (on constructor)\n * result = Metadata.setParamTypes(Example, \"staticMethod\", [Object]);\n *\n * // method (on prototype)\n * result = Metadata.setParamTypes(Example.prototype, \"method\", [Object]);\n * ```\n *\n */\n static setParamTypes(target: any, propertyKey: string | symbol, value: any): void {\n return this.set(DESIGN_PARAM_TYPES, value, target.prototype, propertyKey);\n }\n\n /**\n * Get all metadata for a metadataKey.\n * @param metadataKey\n */\n static getTargetsFromPropertyKey = (metadataKey: string | symbol): any[] =>\n PROPERTIES.has(metadataKey) ? PROPERTIES.get(metadataKey) || [] : [];\n\n /**\n * Define a unique metadata entry on the target.\n * @param key A key used to store and retrieve metadata.\n * @param value A value that contains attached metadata.\n * @param target The target object on which to define metadata.\n * @param propertyKey The property key for the target.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Reflect.defineMetadata(\"custom:annotation\", options, Example);\n *\n * // property (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", Number, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", Number, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", Number, Example, \"staticMethod\");\n *\n * // method (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", Number, Example.prototype, \"method\");\n *\n * // decorator factory as metadata-producing annotation.\n * function MyAnnotation(options): PropertyDecorator {\n * return (target, key) => Reflect.defineMetadata(\"custom:annotation\", options, target, key);\n * }\n * ```\n *\n */\n static set(key: string, value: any, target: any, propertyKey?: string | symbol): void {\n const targets: any[] = PROPERTIES.has(key) ? PROPERTIES.get(key) || [] : [];\n const classConstructor = classOf(target);\n\n if (targets.indexOf(classConstructor) === -1) {\n targets.push(classConstructor);\n PROPERTIES.set(key, targets);\n }\n\n Reflect.defineMetadata(key, value, classOf(target), propertyKey!);\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.\n * @param targetPrototype\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getParamTypes(Example.prototype);\n *\n * // property (on constructor)\n * result = Metadata.getParamTypes(Example.prototype, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getParamTypes(Example.prototype, \"staticMethod\");\n * ```\n *\n */\n static getParamTypes(targetPrototype: any, propertyKey?: string | symbol): any[] {\n return Reflect.getMetadata(DESIGN_PARAM_TYPES, targetPrototype, propertyKey!) || [];\n }\n\n /**\n * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * ```typescript\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // on contructor\n * result = Metadata.getParamTypes(Example);\n *\n * // property (on constructor)\n * result = Metadata.getParamTypes(Example, \"staticProperty\");\n *\n * // method (on constructor)\n * result = Metadata.getParamTypes(Example, \"staticMethod\");\n * ```\n *\n */\n static getOwnParamTypes(target: any, propertyKey?: string | symbol): any[] {\n return Reflect.getOwnMetadata(DESIGN_PARAM_TYPES, target, propertyKey!) || [];\n }\n}\n"]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { DecoratorTypes } from "../domain/DecoratorTypes";
|
|
2
|
+
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf";
|
|
3
|
+
import { deepClone } from "../utils/objects/deepClone";
|
|
4
|
+
import { deepMerge } from "../utils/objects/deepMerge";
|
|
5
|
+
import { descriptorOf } from "../utils/objects/descriptorOf";
|
|
6
|
+
import { isSymbol } from "../utils/objects/isSymbol";
|
|
7
|
+
import { nameOf } from "../utils/objects/nameOf";
|
|
8
|
+
import { Metadata } from "./Metadata";
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
export const CLASS_STORE = "tsed:class:store";
|
|
13
|
+
/**
|
|
14
|
+
* @ignore
|
|
15
|
+
*/
|
|
16
|
+
export const METHOD_STORE = "tsed:method:store";
|
|
17
|
+
/**
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
export const PROPERTY_STORE = "tsed:property:store";
|
|
21
|
+
/**
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
export const PARAM_STORE = "tsed:param:store";
|
|
25
|
+
const stores = new Map();
|
|
26
|
+
function storeGet(key, ...args) {
|
|
27
|
+
if (isSymbol(args[0])) {
|
|
28
|
+
if (!stores.has(args[0])) {
|
|
29
|
+
stores.set(args[0], new Store());
|
|
30
|
+
}
|
|
31
|
+
return stores.get(args[0]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const registry = Metadata;
|
|
35
|
+
if (!registry.hasOwn(key, ...args)) {
|
|
36
|
+
registry.set(key, new Store(), ...args);
|
|
37
|
+
}
|
|
38
|
+
return registry.getOwn(key, ...args);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function defineStore(args) {
|
|
42
|
+
const [target, propertyKey, descriptor] = args;
|
|
43
|
+
switch (decoratorTypeOf(args)) {
|
|
44
|
+
case DecoratorTypes.PARAM_CTOR:
|
|
45
|
+
case DecoratorTypes.PARAM_STC:
|
|
46
|
+
case DecoratorTypes.PARAM:
|
|
47
|
+
const store = storeGet(PARAM_STORE, target, propertyKey);
|
|
48
|
+
if (!store.has("" + descriptor)) {
|
|
49
|
+
store.set("" + descriptor, new Store());
|
|
50
|
+
}
|
|
51
|
+
return store.get("" + descriptor);
|
|
52
|
+
case DecoratorTypes.PROP:
|
|
53
|
+
case DecoratorTypes.PROP_STC:
|
|
54
|
+
return storeGet(PROPERTY_STORE, target, propertyKey);
|
|
55
|
+
case DecoratorTypes.METHOD:
|
|
56
|
+
case DecoratorTypes.METHOD_STC:
|
|
57
|
+
return storeGet(METHOD_STORE, target, propertyKey);
|
|
58
|
+
case DecoratorTypes.CLASS:
|
|
59
|
+
return storeGet(CLASS_STORE, target);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export class Store {
|
|
63
|
+
constructor() {
|
|
64
|
+
this._entries = new Map();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create or get a Store from args {target + methodName + descriptor}
|
|
68
|
+
* @param args
|
|
69
|
+
* @returns {Store}
|
|
70
|
+
*/
|
|
71
|
+
static from(...args) {
|
|
72
|
+
return defineStore(args);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create store on the method.
|
|
76
|
+
* @param target
|
|
77
|
+
* @param {string} propertyKey
|
|
78
|
+
* @returns {Store}
|
|
79
|
+
*/
|
|
80
|
+
static fromMethod(target, propertyKey) {
|
|
81
|
+
return Store.from(target, propertyKey, descriptorOf(target, propertyKey));
|
|
82
|
+
}
|
|
83
|
+
static mergeStoreFrom(target, source, ...args) {
|
|
84
|
+
const store = Store.from(target, ...args);
|
|
85
|
+
Store.from(source, ...args)._entries.forEach((value, key) => {
|
|
86
|
+
store.merge(key, value);
|
|
87
|
+
});
|
|
88
|
+
return store;
|
|
89
|
+
}
|
|
90
|
+
static mergeStoreMethodFrom(target, source, propertyKey) {
|
|
91
|
+
return this.mergeStoreFrom(target, source, propertyKey, descriptorOf(target, propertyKey));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The get() method returns a specified element from a Map object.
|
|
95
|
+
* @param key Required. The key of the element to return from the Map object.
|
|
96
|
+
* @param defaultValue
|
|
97
|
+
* @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.
|
|
98
|
+
*/
|
|
99
|
+
get(key, defaultValue) {
|
|
100
|
+
return this._entries.get(nameOf(key)) || defaultValue;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The has() method returns a boolean indicating whether an element with the specified key exists or not.
|
|
104
|
+
* @param key
|
|
105
|
+
* @returns {boolean}
|
|
106
|
+
*/
|
|
107
|
+
has(key) {
|
|
108
|
+
return this._entries.has(nameOf(key));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The set() method adds or updates an element with a specified key and value to a Map object.
|
|
112
|
+
* @param key Required. The key of the element to add to the Map object.
|
|
113
|
+
* @param metadata Required. The value of the element to add to the Map object.
|
|
114
|
+
*/
|
|
115
|
+
set(key, metadata) {
|
|
116
|
+
this._entries.set(nameOf(key), metadata);
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The delete() method removes the specified element from a Map object.
|
|
121
|
+
* @param key Required. The key of the element to remove from the Map object.
|
|
122
|
+
* @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.
|
|
123
|
+
*/
|
|
124
|
+
delete(key) {
|
|
125
|
+
return this._entries.delete(nameOf(key));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Merge given value with existing value.
|
|
129
|
+
* @param key
|
|
130
|
+
* @param value
|
|
131
|
+
* @param inverse Change the merge order. Get the existing value and apply over given value
|
|
132
|
+
* @returns {Store}
|
|
133
|
+
*/
|
|
134
|
+
merge(key, value, inverse = false) {
|
|
135
|
+
let _value_ = this.get(key);
|
|
136
|
+
if (_value_) {
|
|
137
|
+
value = deepClone(value);
|
|
138
|
+
_value_ = deepClone(_value_);
|
|
139
|
+
value = inverse ? deepMerge(value, _value_) : deepMerge(_value_, value);
|
|
140
|
+
}
|
|
141
|
+
this.set(key, value);
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
toJson() {
|
|
145
|
+
return [...this._entries.entries()].reduce((obj, [key, value]) => {
|
|
146
|
+
return {
|
|
147
|
+
...obj,
|
|
148
|
+
[key]: value
|
|
149
|
+
};
|
|
150
|
+
}, {});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=Store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../src/domain/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,0B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AAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,GAAQ,EAAE,KAAU,EAAE,UAAmB,KAAK;QAClD,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE5B,IAAI,OAAO,EAAE;YACX,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;YAC7B,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACzE;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC/D,OAAO;gBACL,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE,KAAK;aACb,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF","sourcesContent":["import {DecoratorTypes} from \"../domain/DecoratorTypes\";\nimport {decoratorTypeOf} from \"../utils/decorators/decoratorTypeOf\";\nimport {deepClone} from \"../utils/objects/deepClone\";\nimport {deepMerge} from \"../utils/objects/deepMerge\";\nimport {descriptorOf} from \"../utils/objects/descriptorOf\";\nimport {isSymbol} from \"../utils/objects/isSymbol\";\nimport {nameOf} from \"../utils/objects/nameOf\";\nimport {Metadata} from \"./Metadata\";\nimport type {Type} from \"./Type\";\n\n/**\n * @ignore\n */\nexport const CLASS_STORE = \"tsed:class:store\";\n/**\n * @ignore\n */\nexport const METHOD_STORE = \"tsed:method:store\";\n/**\n * @ignore\n */\nexport const PROPERTY_STORE = \"tsed:property:store\";\n/**\n * @ignore\n */\nexport const PARAM_STORE = \"tsed:param:store\";\n\nconst stores = new Map<symbol, Store>();\n\nfunction storeGet(key: string, ...args: any[]): Store {\n if (isSymbol(args[0])) {\n if (!stores.has(args[0])) {\n stores.set(args[0], new Store());\n }\n\n return stores.get(args[0])!;\n } else {\n const registry = Metadata as any;\n\n if (!registry.hasOwn(key, ...args)) {\n registry.set(key, new Store(), ...args);\n }\n\n return registry.getOwn(key, ...args);\n }\n}\n\nfunction defineStore(args: any[]): Store {\n const [target, propertyKey, descriptor] = args;\n\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.PARAM_CTOR:\n case DecoratorTypes.PARAM_STC:\n case DecoratorTypes.PARAM:\n const store = storeGet(PARAM_STORE, target, propertyKey);\n if (!store.has(\"\" + descriptor)) {\n store.set(\"\" + descriptor, new Store());\n }\n\n return store.get(\"\" + descriptor);\n case DecoratorTypes.PROP:\n case DecoratorTypes.PROP_STC:\n return storeGet(PROPERTY_STORE, target, propertyKey);\n case DecoratorTypes.METHOD:\n case DecoratorTypes.METHOD_STC:\n return storeGet(METHOD_STORE, target, propertyKey);\n case DecoratorTypes.CLASS:\n return storeGet(CLASS_STORE, target);\n }\n}\n\nexport class Store {\n private _entries = new Map<string, any>();\n /**\n * Create or get a Store from args {target + methodName + descriptor}\n * @param args\n * @returns {Store}\n */\n static from(...args: any[]): Store {\n return defineStore(args);\n }\n\n /**\n * Create store on the method.\n * @param target\n * @param {string} propertyKey\n * @returns {Store}\n */\n static fromMethod(target: any, propertyKey: string | symbol): Store {\n return Store.from(target, propertyKey, descriptorOf(target, propertyKey));\n }\n\n static mergeStoreFrom(target: Type<any>, source: Type<any>, ...args: any[]) {\n const store = Store.from(target, ...args);\n\n Store.from(source, ...args)._entries.forEach((value, key) => {\n store.merge(key, value);\n });\n\n return store;\n }\n\n static mergeStoreMethodFrom(target: Type<any>, source: Type<any>, propertyKey: string | symbol) {\n return this.mergeStoreFrom(target, source, propertyKey, descriptorOf(target, propertyKey));\n }\n\n /**\n * The get() method returns a specified element from a Map object.\n * @param key Required. The key of the element to return from the Map object.\n * @param defaultValue\n * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.\n */\n get<T = any>(key: any, defaultValue?: any): T {\n return this._entries.get(nameOf(key)) || defaultValue;\n }\n\n /**\n * The has() method returns a boolean indicating whether an element with the specified key exists or not.\n * @param key\n * @returns {boolean}\n */\n has(key: any): boolean {\n return this._entries.has(nameOf(key));\n }\n\n /**\n * The set() method adds or updates an element with a specified key and value to a Map object.\n * @param key Required. The key of the element to add to the Map object.\n * @param metadata Required. The value of the element to add to the Map object.\n */\n set(key: any, metadata: any): Store {\n this._entries.set(nameOf(key), metadata);\n\n return this;\n }\n\n /**\n * The delete() method removes the specified element from a Map object.\n * @param key Required. The key of the element to remove from the Map object.\n * @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.\n */\n delete(key: string): boolean {\n return this._entries.delete(nameOf(key));\n }\n\n /**\n * Merge given value with existing value.\n * @param key\n * @param value\n * @param inverse Change the merge order. Get the existing value and apply over given value\n * @returns {Store}\n */\n merge(key: any, value: any, inverse: boolean = false): Store {\n let _value_ = this.get(key);\n\n if (_value_) {\n value = deepClone(value);\n _value_ = deepClone(_value_);\n value = inverse ? deepMerge(value, _value_) : deepMerge(_value_, value);\n }\n\n this.set(key, value);\n\n return this;\n }\n\n toJson() {\n return [...this._entries.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../src/domain/Type.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC;AAE7B,aAAa;AACb,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC","sourcesContent":["/**\n * An example of a `Type` is `MyCustomComponent` filters, which in JavaScript is be represented by\n * the `MyCustomComponent` constructor function.\n */\n// tslint:disable-next-line: variable-name\n/**\n *\n */\nexport interface Type<T = any> extends Function {\n new (...args: any[]): T;\n}\n\nexport const Type = Function;\n\n// @ts-ignore\nglobal.Type = Type;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./DecoratorTypes\";\nexport * from \"./Env\";\nexport * from \"./Hooks\";\nexport * from \"./Metadata\";\nexport * from \"./Store\";\nexport * from \"./Type\";\nexport * from \"./AnyToPromise\";\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { classOf, decoratorTypeOf, nameOf } from "../utils";
|
|
2
|
+
export class UnsupportedDecoratorType extends Error {
|
|
3
|
+
constructor(decorator, args) {
|
|
4
|
+
super(UnsupportedDecoratorType.buildMessage(decorator, args));
|
|
5
|
+
}
|
|
6
|
+
static buildMessage(decorator, args) {
|
|
7
|
+
const [target, propertyKey, index] = args;
|
|
8
|
+
const bindingType = decoratorTypeOf(args);
|
|
9
|
+
const shortBinding = bindingType.split("/")[0];
|
|
10
|
+
const param = shortBinding === "parameter" ? ".[" + index + "]" : "";
|
|
11
|
+
const cstr = shortBinding === "parameter" ? ".constructor" : "";
|
|
12
|
+
const method = propertyKey ? "." + propertyKey : cstr;
|
|
13
|
+
const path = nameOf(classOf(target)) + method + param;
|
|
14
|
+
return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=UnsupportedDecoratorType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAE1D,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAGjD,YAAY,SAAc,EAAE,IAAW;QACrC,KAAK,CAAC,wBAAwB,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,SAAc,EAAE,IAAW;QACrD,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QAE1C,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,GAAG,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;QAEtD,OAAO,GAAG,SAAS,CAAC,IAAI,sBAAsB,WAAW,iBAAiB,IAAI,EAAE,CAAC;IACnF,CAAC;CACF","sourcesContent":["import {classOf, decoratorTypeOf, nameOf} from \"../utils\";\n\nexport class UnsupportedDecoratorType extends Error {\n name: \"UNSUPPORTED_DECORATOR_TYPE\";\n\n constructor(decorator: any, args: any[]) {\n super(UnsupportedDecoratorType.buildMessage(decorator, args));\n }\n\n private static buildMessage(decorator: any, args: any[]): string {\n const [target, propertyKey, index] = args;\n\n const bindingType = decoratorTypeOf(args);\n const shortBinding = bindingType.split(\"/\")[0];\n const param = shortBinding === \"parameter\" ? \".[\" + index + \"]\" : \"\";\n const cstr = shortBinding === \"parameter\" ? \".constructor\" : \"\";\n const method = propertyKey ? \".\" + propertyKey : cstr;\n\n const path = nameOf(classOf(target)) + method + param;\n\n return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;\n }\n}\n"]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,mCAAmC,CAAC;AAClD,cAAc,cAAc,CAAC","sourcesContent":["import \"reflect-metadata\";\n\nexport type {DecoratorParameters, DecoratorMethodParameters, StaticMethodDecorator, MetadataTypes, ValueOf, HashOf} from \"./interfaces\";\nexport * from \"./utils\";\nexport * from \"./domain\";\nexport * from \"./errors/UnsupportedDecoratorType\";\nexport * from \"./decorators\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnyDecorator.js","sourceRoot":"","sources":["../../../src/interfaces/AnyDecorator.ts"],"names":[],"mappings":"","sourcesContent":["export type AnyDecorator = any | ClassDecorator | MethodDecorator | PropertyDescriptor | ParameterDecorator;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecoratorParameters.js","sourceRoot":"","sources":["../../../src/interfaces/DecoratorParameters.ts"],"names":[],"mappings":"","sourcesContent":["export type DecoratorParameters = [any, string | symbol, number | PropertyDescriptor];\nexport type DecoratorMethodParameters = [any, string | symbol, PropertyDescriptor];\n\nexport type StaticMethodDecorator = <TFunction extends Function, T>(\n target: TFunction,\n propertyKey: string | symbol,\n descriptor: TypedPropertyDescriptor<T>\n) => TypedPropertyDescriptor<T> | void;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashOf.js","sourceRoot":"","sources":["../../../src/interfaces/HashOf.ts"],"names":[],"mappings":"","sourcesContent":["export type HashOf<T> = Record<string, T>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetadataTypes.js","sourceRoot":"","sources":["../../../src/interfaces/MetadataTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type {Type} from \"../domain/Type\";\n\nexport interface MetadataTypes<T = any, C = any> {\n type?: Type<T> | T;\n collectionType?: Type<C> | C;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueOf.js","sourceRoot":"","sources":["../../../src/interfaces/ValueOf.ts"],"names":[],"mappings":"","sourcesContent":["export type ValueOf<T> = T[keyof T];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"","sourcesContent":["export type {DecoratorParameters, DecoratorMethodParameters, StaticMethodDecorator} from \"./DecoratorParameters\";\nexport type {MetadataTypes} from \"./MetadataTypes\";\nexport type {ValueOf} from \"./ValueOf\";\nexport type {HashOf} from \"./HashOf\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catchError.js","sourceRoot":"","sources":["../../../src/utils/catchError.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAkB,EAAY;IACtD,IAAI;QACF,EAAE,EAAE,CAAC;KACN;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAkB,EAAY;IACjE,IAAI;QACF,MAAM,EAAE,EAAE,CAAC;KACZ;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,CAAC;KACX;AACH,CAAC","sourcesContent":["export function catchError<T extends Error>(cb: Function): T | undefined {\n try {\n cb();\n } catch (er) {\n return er;\n }\n}\n\nexport async function catchAsyncError<T extends Error>(cb: Function): Promise<T | undefined> {\n try {\n await cb();\n } catch (er) {\n return er;\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { classOf } from "../objects/classOf";
|
|
2
|
+
import { methodsOf } from "../objects/methodsOf";
|
|
3
|
+
import { prototypeOf } from "../objects/prototypeOf";
|
|
4
|
+
import { descriptorOf } from "../objects/descriptorOf";
|
|
5
|
+
import { Store } from "../../domain/Store";
|
|
6
|
+
export function decorateMethodsOf(klass, decorator) {
|
|
7
|
+
methodsOf(klass).forEach(({ target, propertyKey }) => {
|
|
8
|
+
if (target !== classOf(klass)) {
|
|
9
|
+
Object.defineProperty(prototypeOf(klass), propertyKey, {
|
|
10
|
+
value(...args) {
|
|
11
|
+
return prototypeOf(target)[propertyKey].apply(this, args);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Store.mergeStoreMethodFrom(klass, target, propertyKey);
|
|
15
|
+
}
|
|
16
|
+
decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=decorateMethodsOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,KAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {classOf} from \"../objects/classOf\";\nimport {methodsOf} from \"../objects/methodsOf\";\nimport {prototypeOf} from \"../objects/prototypeOf\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\nimport {Store} from \"../../domain/Store\";\n\nexport function decorateMethodsOf(klass: any, decorator: any) {\n methodsOf(klass).forEach(({target, propertyKey}) => {\n if (target !== classOf(klass)) {\n Object.defineProperty(prototypeOf(klass), propertyKey, {\n value(...args: any[]) {\n return prototypeOf(target)[propertyKey].apply(this, args);\n }\n });\n\n Store.mergeStoreMethodFrom(klass, target, propertyKey);\n }\n\n decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoratorArgs.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decoratorArgs.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAErD,MAAM,UAAU,aAAa,CAAC,MAAW,EAAE,WAAmB;IAC5D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAE,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import {DecoratorParameters} from \"../../interfaces/DecoratorParameters\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\n\nexport function decoratorArgs(target: any, propertyKey: string): DecoratorParameters {\n return [target, propertyKey, descriptorOf(target, propertyKey)!];\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DecoratorTypes } from "../../domain/DecoratorTypes";
|
|
2
|
+
import { classOf } from "../objects/classOf";
|
|
3
|
+
export function decoratorTypeOf(args) {
|
|
4
|
+
const [target, propertyKey, descriptor] = args;
|
|
5
|
+
const staticType = (type) => {
|
|
6
|
+
return target !== classOf(target) ? type : `${type}.static`;
|
|
7
|
+
};
|
|
8
|
+
if (typeof descriptor === "number") {
|
|
9
|
+
return propertyKey ? staticType("parameter") : "parameter.constructor";
|
|
10
|
+
}
|
|
11
|
+
if (descriptor && descriptor.value) {
|
|
12
|
+
return staticType("method");
|
|
13
|
+
}
|
|
14
|
+
if ((propertyKey && descriptor === undefined) || descriptor) {
|
|
15
|
+
return staticType("property");
|
|
16
|
+
}
|
|
17
|
+
return DecoratorTypes.CLASS;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=decoratorTypeOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoratorTypeOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decoratorTypeOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAE3C,MAAM,UAAU,eAAe,CAAC,IAAW;IACzC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;IAE/C,MAAM,UAAU,GAAG,CAAC,IAAY,EAAO,EAAE;QACvC,OAAO,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC;IAC9D,CAAC,CAAC;IAEF,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,OAAO,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC;KACxE;IAED,IAAI,UAAU,IAAI,UAAU,CAAC,KAAK,EAAE;QAClC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;KAC7B;IAED,IAAI,CAAC,WAAW,IAAI,UAAU,KAAK,SAAS,CAAC,IAAI,UAAU,EAAE;QAC3D,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;KAC/B;IAED,OAAO,cAAc,CAAC,KAAK,CAAC;AAC9B,CAAC","sourcesContent":["import {DecoratorTypes} from \"../../domain/DecoratorTypes\";\nimport {classOf} from \"../objects/classOf\";\n\nexport function decoratorTypeOf(args: any[]): DecoratorTypes {\n const [target, propertyKey, descriptor] = args;\n\n const staticType = (type: string): any => {\n return target !== classOf(target) ? type : `${type}.static`;\n };\n\n if (typeof descriptor === \"number\") {\n return propertyKey ? staticType(\"parameter\") : \"parameter.constructor\";\n }\n\n if (descriptor && descriptor.value) {\n return staticType(\"method\");\n }\n\n if ((propertyKey && descriptor === undefined) || descriptor) {\n return staticType(\"property\");\n }\n\n return DecoratorTypes.CLASS;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ancestorsOf } from "../objects/ancestorsOf";
|
|
2
|
+
export function inheritedDescriptorOf(target, propertyKey) {
|
|
3
|
+
for (const klass of ancestorsOf(target)) {
|
|
4
|
+
const descriptor = Object.getOwnPropertyDescriptor((klass && klass.prototype) || klass, propertyKey);
|
|
5
|
+
if (descriptor) {
|
|
6
|
+
return descriptor;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=inheritedDescriptorOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritedDescriptorOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/inheritedDescriptorOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAEnD,MAAM,UAAU,qBAAqB,CAAC,MAAW,EAAE,WAAmB;IACpE,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,EAAE,WAAW,CAAE,CAAC;QAEtG,IAAI,UAAU,EAAE;YACd,OAAO,UAAU,CAAC;SACnB;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {ancestorsOf} from \"../objects/ancestorsOf\";\n\nexport function inheritedDescriptorOf(target: any, propertyKey: string): PropertyDescriptor | undefined {\n for (const klass of ancestorsOf(target)) {\n const descriptor = Object.getOwnPropertyDescriptor((klass && klass.prototype) || klass, propertyKey)!;\n\n if (descriptor) {\n return descriptor;\n }\n }\n\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDecorators.js","sourceRoot":"","sources":["../../../../src/utils/decorators/useDecorators.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,aAAa,CAAC,GAAG,UAA0B;IACzD,OAAO,CAAC,GAAG,IAAyB,EAAE,EAAE;QACtC,UAAU;aACP,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACvB,OAAO,CAAC,CAAC,SAAmB,EAAE,EAAE;YAC/B,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters} from \"../../interfaces/DecoratorParameters\";\nimport {AnyDecorator} from \"../../interfaces/AnyDecorator\";\n\nexport function useDecorators(...decorators: AnyDecorator[]): any {\n return (...args: DecoratorParameters) => {\n decorators\n .filter((o: any) => !!o)\n .forEach((decorator: Function) => {\n decorator(...args);\n });\n };\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { descriptorOf } from "../objects/descriptorOf";
|
|
2
|
+
export function useMethodDecorator(decorator) {
|
|
3
|
+
return (target, propertyKey) => decorator(target, propertyKey, descriptorOf(target, propertyKey));
|
|
4
|
+
}
|
|
5
|
+
export function useMethodDecorators(...decorators) {
|
|
6
|
+
return (target, propertyKey) => {
|
|
7
|
+
decorators.filter(Boolean).forEach((decorator) => decorator(target, propertyKey, descriptorOf(target, propertyKey)));
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=useMethodDecorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMethodDecorators.js","sourceRoot":"","sources":["../../../../src/utils/decorators/useMethodDecorators.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAErD,MAAM,UAAU,kBAAkB,CAAC,SAAuB;IACxD,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAC1H,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAG,UAA0B;IAC/D,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE;QACnD,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {AnyDecorator} from \"../../interfaces/AnyDecorator\";\nimport {descriptorOf} from \"../objects/descriptorOf\";\n\nexport function useMethodDecorator(decorator: AnyDecorator) {\n return (target: any, propertyKey: string | symbol) => decorator(target, propertyKey, descriptorOf(target, propertyKey));\n}\n\nexport function useMethodDecorators(...decorators: AnyDecorator[]) {\n return (target: any, propertyKey: string | symbol) => {\n decorators.filter(Boolean).forEach((decorator) => decorator(target, propertyKey, descriptorOf(target, propertyKey)));\n };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export async function importPackage(packageName, loaderFn = () => import(packageName), optional = false) {
|
|
2
|
+
try {
|
|
3
|
+
return await loaderFn();
|
|
4
|
+
}
|
|
5
|
+
catch (e) {
|
|
6
|
+
if (!optional) {
|
|
7
|
+
throw new Error(`The "${packageName}\" package is missing.`);
|
|
8
|
+
}
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=importPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAqB,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,KAAK;IACvH,IAAI;QACF,OAAO,MAAM,QAAQ,EAAE,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,wBAAwB,CAAC,CAAC;SAC9D;QAED,OAAO,EAAE,CAAC;KACX;AACH,CAAC","sourcesContent":["export async function importPackage(packageName: string, loaderFn: Function = () => import(packageName), optional = false) {\n try {\n return await loaderFn();\n } catch (e) {\n if (!optional) {\n throw new Error(`The \"${packageName}\\\" package is missing.`);\n }\n\n return {};\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./catchError";
|
|
2
|
+
export * from "./proxyDelegation";
|
|
3
|
+
export * from "./uniq";
|
|
4
|
+
export * from "./imports/importPackage";
|
|
5
|
+
// methods
|
|
6
|
+
export * from "./decorators/decorateMethodsOf";
|
|
7
|
+
export * from "./decorators/decoratorArgs";
|
|
8
|
+
export * from "./decorators/decoratorTypeOf";
|
|
9
|
+
export * from "./objects/descriptorOf";
|
|
10
|
+
export * from "./decorators/inheritedDescriptorOf";
|
|
11
|
+
export * from "./decorators/useDecorators";
|
|
12
|
+
export * from "./decorators/useMethodDecorators";
|
|
13
|
+
// objects
|
|
14
|
+
export * from "./objects";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AAExC,UAAU;AACV,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AAEjD,UAAU;AACV,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./catchError\";\nexport * from \"./proxyDelegation\";\nexport * from \"./uniq\";\nexport * from \"./imports/importPackage\";\n\n// methods\nexport * from \"./decorators/decorateMethodsOf\";\nexport * from \"./decorators/decoratorArgs\";\nexport * from \"./decorators/decoratorTypeOf\";\nexport * from \"./objects/descriptorOf\";\nexport * from \"./decorators/inheritedDescriptorOf\";\nexport * from \"./decorators/useDecorators\";\nexport * from \"./decorators/useMethodDecorators\";\n\n// objects\nexport * from \"./objects\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ancestorOf.js","sourceRoot":"","sources":["../../../../src/utils/objects/ancestorOf.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,MAAW;IACpC,OAAO,MAAM,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAW;IAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["export function ancestorOf(target: any): any {\n return target && Object.getPrototypeOf(target);\n}\n\nexport function getInheritedClass(target: any): any {\n return ancestorOf(target);\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { classOf } from "./classOf";
|
|
2
|
+
import { getInheritedClass } from "./ancestorOf";
|
|
3
|
+
import { nameOf } from "./nameOf";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param target
|
|
7
|
+
* @returns {Array}
|
|
8
|
+
*/
|
|
9
|
+
export function ancestorsOf(target) {
|
|
10
|
+
const classes = [];
|
|
11
|
+
let currentTarget = classOf(target);
|
|
12
|
+
while (currentTarget && nameOf(currentTarget) !== "") {
|
|
13
|
+
classes.unshift(currentTarget);
|
|
14
|
+
currentTarget = getInheritedClass(currentTarget);
|
|
15
|
+
}
|
|
16
|
+
return classes;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ancestorsOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ancestorsOf.js","sourceRoot":"","sources":["../../../../src/utils/objects/ancestorsOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAW;IACrC,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,IAAI,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE;QACpD,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC/B,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;KAClD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {classOf} from \"./classOf\";\nimport {getInheritedClass} from \"./ancestorOf\";\nimport {nameOf} from \"./nameOf\";\n\n/**\n *\n * @param target\n * @returns {Array}\n */\nexport function ancestorsOf(target: any) {\n const classes = [];\n\n let currentTarget = classOf(target);\n\n while (currentTarget && nameOf(currentTarget) !== \"\") {\n classes.unshift(currentTarget);\n currentTarget = getInheritedClass(currentTarget);\n }\n\n return classes;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the provide constructor if target is an instance.
|
|
3
|
+
* @param target
|
|
4
|
+
* @returns {*}
|
|
5
|
+
*/
|
|
6
|
+
export function getClass(target) {
|
|
7
|
+
return target.prototype ? target : target.constructor;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the provide constructor if target is an instance.
|
|
11
|
+
* @param target
|
|
12
|
+
* @returns {*}
|
|
13
|
+
* @alias getClass
|
|
14
|
+
*/
|
|
15
|
+
export function classOf(target) {
|
|
16
|
+
return getClass(target);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=classOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classOf.js","sourceRoot":"","sources":["../../../../src/utils/objects/classOf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAW;IAClC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,MAAW;IACjC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Get the provide constructor if target is an instance.\n * @param target\n * @returns {*}\n */\nexport function getClass(target: any): any {\n return target.prototype ? target : target.constructor;\n}\n\n/**\n * Get the provide constructor if target is an instance.\n * @param target\n * @returns {*}\n * @alias getClass\n */\nexport function classOf(target: any) {\n return getClass(target);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isProtectedKey } from "./isProtectedKey";
|
|
2
|
+
/**
|
|
3
|
+
* Remove undefined value
|
|
4
|
+
* @param obj
|
|
5
|
+
* @param ignore
|
|
6
|
+
*/
|
|
7
|
+
export function cleanObject(obj, ignore = []) {
|
|
8
|
+
return Object.entries(obj).reduce((obj, [key, value]) => {
|
|
9
|
+
if (isProtectedKey(key) || ignore.includes(key)) {
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
return value === undefined
|
|
13
|
+
? obj
|
|
14
|
+
: {
|
|
15
|
+
...obj,
|
|
16
|
+
[key]: value
|
|
17
|
+
};
|
|
18
|
+
}, {});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cleanObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanObject.js","sourceRoot":"","sources":["../../../../src/utils/objects/cleanObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAQ,EAAE,SAAmB,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC/C,OAAO,GAAG,CAAC;SACZ;QAED,OAAO,KAAK,KAAK,SAAS;YACxB,CAAC,CAAC,GAAG;YACL,CAAC,CAAC;gBACE,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE,KAAK;aACb,CAAC;IACR,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["import {isProtectedKey} from \"./isProtectedKey\";\n/**\n * Remove undefined value\n * @param obj\n * @param ignore\n */\nexport function cleanObject(obj: any, ignore: string[] = []): any {\n return Object.entries(obj).reduce((obj, [key, value]) => {\n if (isProtectedKey(key) || ignore.includes(key)) {\n return obj;\n }\n\n return value === undefined\n ? obj\n : {\n ...obj,\n [key]: value\n };\n }, {});\n}\n"]}
|