@tsed/core 7.0.0-alpha.2 → 7.0.0-beta.11
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/jest.config.js +14 -0
- package/lib/cjs/decorators/configurable.js +14 -0
- package/lib/cjs/decorators/configurable.js.map +1 -0
- package/lib/cjs/decorators/deprecated.js +44 -0
- package/lib/cjs/decorators/deprecated.js.map +1 -0
- package/lib/cjs/decorators/enumerable.js +14 -0
- package/lib/cjs/decorators/enumerable.js.map +1 -0
- package/lib/cjs/decorators/notConfigurable.js +9 -0
- package/lib/cjs/decorators/notConfigurable.js.map +1 -0
- package/lib/cjs/decorators/notEnumerable.js +9 -0
- package/lib/cjs/decorators/notEnumerable.js.map +1 -0
- package/lib/cjs/decorators/readOnly.js +9 -0
- package/lib/cjs/decorators/readOnly.js.map +1 -0
- package/lib/cjs/decorators/storeFn.js +22 -0
- package/lib/cjs/decorators/storeFn.js.map +1 -0
- package/lib/cjs/decorators/storeMerge.js +11 -0
- package/lib/cjs/decorators/storeMerge.js.map +1 -0
- package/lib/cjs/decorators/storeSet.js +11 -0
- package/lib/cjs/decorators/storeSet.js.map +1 -0
- package/lib/cjs/decorators/writable.js +14 -0
- package/lib/cjs/decorators/writable.js.map +1 -0
- package/lib/cjs/domain/AnyToPromise.js +148 -0
- package/lib/cjs/domain/AnyToPromise.js.map +1 -0
- package/lib/cjs/domain/DecoratorTypes.js +15 -0
- package/lib/cjs/domain/DecoratorTypes.js.map +1 -0
- package/lib/cjs/domain/Env.js +19 -0
- package/lib/cjs/domain/Env.js.map +1 -0
- package/lib/cjs/domain/Hooks.js +89 -0
- package/lib/cjs/domain/Hooks.js.map +1 -0
- package/lib/cjs/domain/Metadata.js +508 -0
- package/lib/cjs/domain/Metadata.js.map +1 -0
- package/lib/cjs/domain/Store.js +157 -0
- package/lib/cjs/domain/Store.js.map +1 -0
- package/lib/cjs/domain/Type.js +7 -0
- package/lib/cjs/domain/Type.js.map +1 -0
- package/lib/cjs/errors/UnsupportedDecoratorType.js +23 -0
- package/lib/cjs/errors/UnsupportedDecoratorType.js.map +1 -0
- package/lib/cjs/index.js +85 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/AnyDecorator.js +3 -0
- package/lib/cjs/interfaces/AnyDecorator.js.map +1 -0
- package/lib/cjs/interfaces/DecoratorParameters.js +3 -0
- package/lib/cjs/interfaces/DecoratorParameters.js.map +1 -0
- package/lib/cjs/interfaces/HashOf.js +3 -0
- package/lib/cjs/interfaces/HashOf.js.map +1 -0
- package/lib/cjs/interfaces/MetadataTypes.js +3 -0
- package/lib/cjs/interfaces/MetadataTypes.js.map +1 -0
- package/lib/cjs/interfaces/ValueOf.js +3 -0
- package/lib/cjs/interfaces/ValueOf.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/catchError.js +22 -0
- package/lib/cjs/utils/catchError.js.map +1 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js +24 -0
- package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +1 -0
- package/lib/cjs/utils/decorators/decoratorArgs.js +9 -0
- package/lib/cjs/utils/decorators/decoratorArgs.js.map +1 -0
- package/lib/cjs/utils/decorators/decoratorTypeOf.js +23 -0
- package/lib/cjs/utils/decorators/decoratorTypeOf.js.map +1 -0
- package/lib/cjs/utils/decorators/inheritedDescriptorOf.js +15 -0
- package/lib/cjs/utils/decorators/inheritedDescriptorOf.js.map +1 -0
- package/lib/cjs/utils/decorators/useDecorators.js +14 -0
- package/lib/cjs/utils/decorators/useDecorators.js.map +1 -0
- package/lib/cjs/utils/decorators/useMethodDecorators.js +15 -0
- package/lib/cjs/utils/decorators/useMethodDecorators.js.map +1 -0
- package/lib/cjs/utils/http/getHostInfoFromPort.js +21 -0
- package/lib/cjs/utils/http/getHostInfoFromPort.js.map +1 -0
- package/lib/cjs/utils/imports/importPackage.js +39 -0
- package/lib/cjs/utils/imports/importPackage.js.map +1 -0
- package/lib/cjs/utils/objects/ancestorOf.js +12 -0
- package/lib/cjs/utils/objects/ancestorOf.js.map +1 -0
- package/lib/cjs/utils/objects/ancestorsOf.js +22 -0
- package/lib/cjs/utils/objects/ancestorsOf.js.map +1 -0
- package/lib/cjs/utils/objects/classOf.js +23 -0
- package/lib/cjs/utils/objects/classOf.js.map +1 -0
- package/lib/cjs/utils/objects/cleanObject.js +24 -0
- package/lib/cjs/utils/objects/cleanObject.js.map +1 -0
- package/lib/cjs/utils/objects/constructorOf.js +20 -0
- package/lib/cjs/utils/objects/constructorOf.js.map +1 -0
- package/lib/cjs/utils/objects/createInstance.js +9 -0
- package/lib/cjs/utils/objects/createInstance.js.map +1 -0
- package/lib/cjs/utils/objects/deepClone.js +63 -0
- package/lib/cjs/utils/objects/deepClone.js.map +1 -0
- package/lib/cjs/utils/objects/deepMerge.js +63 -0
- package/lib/cjs/utils/objects/deepMerge.js.map +1 -0
- package/lib/cjs/utils/objects/descriptorOf.js +19 -0
- package/lib/cjs/utils/objects/descriptorOf.js.map +1 -0
- package/lib/cjs/utils/objects/getClassOrSymbol.js +10 -0
- package/lib/cjs/utils/objects/getClassOrSymbol.js.map +1 -0
- package/lib/cjs/utils/objects/getConstructorArgNames.js +14 -0
- package/lib/cjs/utils/objects/getConstructorArgNames.js.map +1 -0
- package/lib/cjs/utils/objects/getEnumerableKeys.js +20 -0
- package/lib/cjs/utils/objects/getEnumerableKeys.js.map +1 -0
- package/lib/cjs/utils/objects/getValue.js +49 -0
- package/lib/cjs/utils/objects/getValue.js.map +1 -0
- package/lib/cjs/utils/objects/isArray.js +23 -0
- package/lib/cjs/utils/objects/isArray.js.map +1 -0
- package/lib/cjs/utils/objects/isArrowFn.js +9 -0
- package/lib/cjs/utils/objects/isArrowFn.js.map +1 -0
- package/lib/cjs/utils/objects/isBoolean.js +17 -0
- package/lib/cjs/utils/objects/isBoolean.js.map +1 -0
- package/lib/cjs/utils/objects/isBuffer.js +13 -0
- package/lib/cjs/utils/objects/isBuffer.js.map +1 -0
- package/lib/cjs/utils/objects/isClass.js +28 -0
- package/lib/cjs/utils/objects/isClass.js.map +1 -0
- package/lib/cjs/utils/objects/isCollection.js +22 -0
- package/lib/cjs/utils/objects/isCollection.js.map +1 -0
- package/lib/cjs/utils/objects/isDate.js +13 -0
- package/lib/cjs/utils/objects/isDate.js.map +1 -0
- package/lib/cjs/utils/objects/isEmpty.js +14 -0
- package/lib/cjs/utils/objects/isEmpty.js.map +1 -0
- package/lib/cjs/utils/objects/isEnumerable.js +22 -0
- package/lib/cjs/utils/objects/isEnumerable.js.map +1 -0
- package/lib/cjs/utils/objects/isFunction.js +8 -0
- package/lib/cjs/utils/objects/isFunction.js.map +1 -0
- package/lib/cjs/utils/objects/isInheritedFrom.js +26 -0
- package/lib/cjs/utils/objects/isInheritedFrom.js.map +1 -0
- package/lib/cjs/utils/objects/isNil.js +8 -0
- package/lib/cjs/utils/objects/isNil.js.map +1 -0
- package/lib/cjs/utils/objects/isNumber.js +17 -0
- package/lib/cjs/utils/objects/isNumber.js.map +1 -0
- package/lib/cjs/utils/objects/isObject.js +8 -0
- package/lib/cjs/utils/objects/isObject.js.map +1 -0
- package/lib/cjs/utils/objects/isObservable.js +8 -0
- package/lib/cjs/utils/objects/isObservable.js.map +1 -0
- package/lib/cjs/utils/objects/isPlainObject.js +18 -0
- package/lib/cjs/utils/objects/isPlainObject.js.map +1 -0
- package/lib/cjs/utils/objects/isPrimitive.js +30 -0
- package/lib/cjs/utils/objects/isPrimitive.js.map +1 -0
- package/lib/cjs/utils/objects/isPromise.js +16 -0
- package/lib/cjs/utils/objects/isPromise.js.map +1 -0
- package/lib/cjs/utils/objects/isProtectedKey.js +12 -0
- package/lib/cjs/utils/objects/isProtectedKey.js.map +1 -0
- package/lib/cjs/utils/objects/isSerializable.js +13 -0
- package/lib/cjs/utils/objects/isSerializable.js.map +1 -0
- package/lib/cjs/utils/objects/isStream.js +8 -0
- package/lib/cjs/utils/objects/isStream.js.map +1 -0
- package/lib/cjs/utils/objects/isString.js +16 -0
- package/lib/cjs/utils/objects/isString.js.map +1 -0
- package/lib/cjs/utils/objects/isSymbol.js +16 -0
- package/lib/cjs/utils/objects/isSymbol.js.map +1 -0
- package/lib/cjs/utils/objects/methodsOf.js +25 -0
- package/lib/cjs/utils/objects/methodsOf.js.map +1 -0
- package/lib/cjs/utils/objects/nameOf.js +32 -0
- package/lib/cjs/utils/objects/nameOf.js.map +1 -0
- package/lib/cjs/utils/objects/objectKeys.js +9 -0
- package/lib/cjs/utils/objects/objectKeys.js.map +1 -0
- package/lib/cjs/utils/objects/primitiveOf.js +20 -0
- package/lib/cjs/utils/objects/primitiveOf.js.map +1 -0
- package/lib/cjs/utils/objects/prototypeOf.js +14 -0
- package/lib/cjs/utils/objects/prototypeOf.js.map +1 -0
- package/lib/cjs/utils/objects/setValue.js +34 -0
- package/lib/cjs/utils/objects/setValue.js.map +1 -0
- package/lib/cjs/utils/objects/toMap.js +32 -0
- package/lib/cjs/utils/objects/toMap.js.map +1 -0
- package/lib/cjs/utils/objects/toStringConstructor.js +12 -0
- package/lib/cjs/utils/objects/toStringConstructor.js.map +1 -0
- package/lib/cjs/utils/proxyDelegation.js +54 -0
- package/lib/cjs/utils/proxyDelegation.js.map +1 -0
- package/lib/cjs/utils/uniq.js +16 -0
- package/lib/cjs/utils/uniq.js.map +1 -0
- package/lib/esm/decorators/configurable.js +10 -0
- package/lib/esm/decorators/configurable.js.map +1 -0
- package/lib/esm/decorators/deprecated.js +40 -0
- package/lib/esm/decorators/deprecated.js.map +1 -0
- package/lib/esm/decorators/enumerable.js +10 -0
- package/lib/esm/decorators/enumerable.js.map +1 -0
- package/lib/esm/decorators/notConfigurable.js +5 -0
- package/lib/esm/decorators/notConfigurable.js.map +1 -0
- package/lib/esm/decorators/notEnumerable.js +5 -0
- package/lib/esm/decorators/notEnumerable.js.map +1 -0
- package/lib/esm/decorators/readOnly.js +5 -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 +10 -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/errors/UnsupportedDecoratorType.js +19 -0
- package/lib/esm/errors/UnsupportedDecoratorType.js.map +1 -0
- package/lib/esm/index.js +82 -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/package.json +3 -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 +20 -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/http/getHostInfoFromPort.js +17 -0
- package/lib/esm/utils/http/getHostInfoFromPort.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/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 +59 -0
- package/lib/esm/utils/objects/deepClone.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 +10 -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/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/isBuffer.js +9 -0
- package/lib/esm/utils/objects/isBuffer.js.map +1 -0
- package/lib/esm/utils/objects/isClass.js +24 -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/{decorators → types/decorators}/configurable.d.ts +0 -1
- package/lib/{decorators → types/decorators}/deprecated.d.ts +0 -0
- package/lib/{decorators → types/decorators}/enumerable.d.ts +0 -1
- package/lib/{decorators → types/decorators}/notConfigurable.d.ts +0 -1
- package/lib/{decorators → types/decorators}/notEnumerable.d.ts +0 -1
- package/lib/{decorators → types/decorators}/readOnly.d.ts +0 -1
- package/lib/{decorators → types/decorators}/storeFn.d.ts +0 -0
- package/lib/{decorators → types/decorators}/storeMerge.d.ts +0 -0
- package/lib/{decorators → types/decorators}/storeSet.d.ts +0 -0
- package/lib/{decorators → types/decorators}/writable.d.ts +0 -1
- package/lib/{domain → types/domain}/AnyToPromise.d.ts +0 -0
- package/lib/{domain → types/domain}/DecoratorTypes.d.ts +0 -0
- package/lib/{domain → types/domain}/Env.d.ts +0 -0
- package/lib/{domain → types/domain}/Hooks.d.ts +0 -0
- package/lib/{domain → types/domain}/Metadata.d.ts +0 -0
- package/lib/{domain → types/domain}/Store.d.ts +0 -0
- package/lib/{domain → types/domain}/Type.d.ts +0 -0
- package/lib/{errors → types/errors}/UnsupportedDecoratorType.d.ts +0 -0
- package/lib/types/index.d.ts +81 -0
- package/lib/{interfaces → types/interfaces}/AnyDecorator.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/DecoratorParameters.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/HashOf.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/MetadataTypes.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/ValueOf.d.ts +0 -0
- package/lib/{utils → types/utils}/catchError.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/decorateMethodsOf.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/decoratorArgs.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/decoratorTypeOf.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/inheritedDescriptorOf.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/useDecorators.d.ts +0 -0
- package/lib/{utils → types/utils}/decorators/useMethodDecorators.d.ts +0 -0
- package/lib/types/utils/http/getHostInfoFromPort.d.ts +6 -0
- package/lib/types/utils/imports/importPackage.d.ts +1 -0
- package/lib/{utils → types/utils}/objects/ancestorOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/ancestorsOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/classOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/cleanObject.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/constructorOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/createInstance.d.ts +0 -0
- package/lib/types/utils/objects/deepClone.d.ts +6 -0
- package/lib/{utils → types/utils}/objects/deepMerge.d.ts +1 -1
- package/lib/{utils → types/utils}/objects/descriptorOf.d.ts +1 -0
- package/lib/{utils → types/utils}/objects/getClassOrSymbol.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/getConstructorArgNames.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/getEnumerableKeys.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/getValue.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isArray.d.ts +0 -0
- package/lib/types/utils/objects/isArrowFn.d.ts +1 -0
- package/lib/{utils → types/utils}/objects/isBoolean.d.ts +0 -0
- package/lib/types/utils/objects/isBuffer.d.ts +7 -0
- package/lib/{utils → types/utils}/objects/isClass.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isCollection.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isDate.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isEmpty.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isEnumerable.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isFunction.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isInheritedFrom.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isNil.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isNumber.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isObject.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isObservable.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isPlainObject.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isPrimitive.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isPromise.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isProtectedKey.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isSerializable.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isStream.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isString.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/isSymbol.d.ts +0 -0
- package/lib/types/utils/objects/methodsOf.d.ts +9 -0
- package/lib/{utils → types/utils}/objects/nameOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/objectKeys.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/primitiveOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/prototypeOf.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/setValue.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/toMap.d.ts +0 -0
- package/lib/{utils → types/utils}/objects/toStringConstructor.d.ts +0 -0
- package/lib/{utils → types/utils}/proxyDelegation.d.ts +0 -0
- package/lib/{utils → types/utils}/uniq.d.ts +0 -0
- package/package.json +16 -12
- package/readme.md +1 -2
- package/tsconfig.compile.esm.json +12 -0
- package/lib/decorators/index.d.ts +0 -14
- package/lib/domain/Entity.d.ts +0 -97
- package/lib/domain/index.d.ts +0 -8
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -2298
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -2210
- package/lib/index.modern.js.map +0 -1
- package/lib/interfaces/index.d.ts +0 -4
- package/lib/utils/index.d.ts +0 -11
- package/lib/utils/objects/deepClone.d.ts +0 -5
- package/lib/utils/objects/index.d.ts +0 -42
- package/lib/utils/objects/isArrowFn.d.ts +0 -1
- package/lib/utils/objects/methodsOf.d.ts +0 -5
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { DecoratorTypes } from "../domain/DecoratorTypes.js";
|
|
2
|
+
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf.js";
|
|
3
|
+
import { deepClone } from "../utils/objects/deepClone.js";
|
|
4
|
+
import { deepMerge } from "../utils/objects/deepMerge.js";
|
|
5
|
+
import { descriptorOf } from "../utils/objects/descriptorOf.js";
|
|
6
|
+
import { isSymbol } from "../utils/objects/isSymbol.js";
|
|
7
|
+
import { nameOf } from "../utils/objects/nameOf.js";
|
|
8
|
+
import { Metadata } from "./Metadata.js";
|
|
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":"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","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,19 @@
|
|
|
1
|
+
import { decoratorTypeOf } from "../utils/decorators/decoratorTypeOf.js";
|
|
2
|
+
import { classOf } from "../utils/objects/classOf.js";
|
|
3
|
+
import { nameOf } from "../utils/objects/nameOf.js";
|
|
4
|
+
export class UnsupportedDecoratorType extends Error {
|
|
5
|
+
constructor(decorator, args) {
|
|
6
|
+
super(UnsupportedDecoratorType.buildMessage(decorator, args));
|
|
7
|
+
}
|
|
8
|
+
static buildMessage(decorator, args) {
|
|
9
|
+
const [target, propertyKey, index] = args;
|
|
10
|
+
const bindingType = decoratorTypeOf(args);
|
|
11
|
+
const shortBinding = bindingType.split("/")[0];
|
|
12
|
+
const param = shortBinding === "parameter" ? ".[" + index + "]" : "";
|
|
13
|
+
const cstr = shortBinding === "parameter" ? ".constructor" : "";
|
|
14
|
+
const method = propertyKey ? "." + propertyKey : cstr;
|
|
15
|
+
const path = nameOf(classOf(target)) + method + param;
|
|
16
|
+
return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=UnsupportedDecoratorType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAE/C,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 {decoratorTypeOf} from \"../utils/decorators/decoratorTypeOf\";\nimport {classOf} from \"../utils/objects/classOf\";\nimport {nameOf} from \"../utils/objects/nameOf\";\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,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./decorators/configurable.js";
|
|
5
|
+
export * from "./decorators/deprecated.js";
|
|
6
|
+
export * from "./decorators/enumerable.js";
|
|
7
|
+
export * from "./decorators/notConfigurable.js";
|
|
8
|
+
export * from "./decorators/notEnumerable.js";
|
|
9
|
+
export * from "./decorators/readOnly.js";
|
|
10
|
+
export * from "./decorators/storeFn.js";
|
|
11
|
+
export * from "./decorators/storeMerge.js";
|
|
12
|
+
export * from "./decorators/storeSet.js";
|
|
13
|
+
export * from "./decorators/writable.js";
|
|
14
|
+
export * from "./domain/AnyToPromise.js";
|
|
15
|
+
export * from "./domain/DecoratorTypes.js";
|
|
16
|
+
export * from "./domain/Env.js";
|
|
17
|
+
export * from "./domain/Hooks.js";
|
|
18
|
+
export * from "./domain/Metadata.js";
|
|
19
|
+
export * from "./domain/Store.js";
|
|
20
|
+
export * from "./domain/Type.js";
|
|
21
|
+
export * from "./errors/UnsupportedDecoratorType.js";
|
|
22
|
+
export * from "./interfaces/AnyDecorator.js";
|
|
23
|
+
export * from "./interfaces/DecoratorParameters.js";
|
|
24
|
+
export * from "./interfaces/HashOf.js";
|
|
25
|
+
export * from "./interfaces/MetadataTypes.js";
|
|
26
|
+
export * from "./interfaces/ValueOf.js";
|
|
27
|
+
export * from "./utils/catchError.js";
|
|
28
|
+
export * from "./utils/proxyDelegation.js";
|
|
29
|
+
export * from "./utils/uniq.js";
|
|
30
|
+
export * from "./utils/decorators/decorateMethodsOf.js";
|
|
31
|
+
export * from "./utils/decorators/decoratorArgs.js";
|
|
32
|
+
export * from "./utils/decorators/decoratorTypeOf.js";
|
|
33
|
+
export * from "./utils/decorators/inheritedDescriptorOf.js";
|
|
34
|
+
export * from "./utils/decorators/useDecorators.js";
|
|
35
|
+
export * from "./utils/decorators/useMethodDecorators.js";
|
|
36
|
+
export * from "./utils/http/getHostInfoFromPort.js";
|
|
37
|
+
export * from "./utils/imports/importPackage.js";
|
|
38
|
+
export * from "./utils/objects/ancestorOf.js";
|
|
39
|
+
export * from "./utils/objects/ancestorsOf.js";
|
|
40
|
+
export * from "./utils/objects/classOf.js";
|
|
41
|
+
export * from "./utils/objects/cleanObject.js";
|
|
42
|
+
export * from "./utils/objects/constructorOf.js";
|
|
43
|
+
export * from "./utils/objects/createInstance.js";
|
|
44
|
+
export * from "./utils/objects/deepClone.js";
|
|
45
|
+
export * from "./utils/objects/deepMerge.js";
|
|
46
|
+
export * from "./utils/objects/descriptorOf.js";
|
|
47
|
+
export * from "./utils/objects/getClassOrSymbol.js";
|
|
48
|
+
export * from "./utils/objects/getConstructorArgNames.js";
|
|
49
|
+
export * from "./utils/objects/getEnumerableKeys.js";
|
|
50
|
+
export * from "./utils/objects/getValue.js";
|
|
51
|
+
export * from "./utils/objects/isArray.js";
|
|
52
|
+
export * from "./utils/objects/isArrowFn.js";
|
|
53
|
+
export * from "./utils/objects/isBoolean.js";
|
|
54
|
+
export * from "./utils/objects/isBuffer.js";
|
|
55
|
+
export * from "./utils/objects/isClass.js";
|
|
56
|
+
export * from "./utils/objects/isCollection.js";
|
|
57
|
+
export * from "./utils/objects/isDate.js";
|
|
58
|
+
export * from "./utils/objects/isEmpty.js";
|
|
59
|
+
export * from "./utils/objects/isEnumerable.js";
|
|
60
|
+
export * from "./utils/objects/isFunction.js";
|
|
61
|
+
export * from "./utils/objects/isInheritedFrom.js";
|
|
62
|
+
export * from "./utils/objects/isNil.js";
|
|
63
|
+
export * from "./utils/objects/isNumber.js";
|
|
64
|
+
export * from "./utils/objects/isObject.js";
|
|
65
|
+
export * from "./utils/objects/isObservable.js";
|
|
66
|
+
export * from "./utils/objects/isPlainObject.js";
|
|
67
|
+
export * from "./utils/objects/isPrimitive.js";
|
|
68
|
+
export * from "./utils/objects/isPromise.js";
|
|
69
|
+
export * from "./utils/objects/isProtectedKey.js";
|
|
70
|
+
export * from "./utils/objects/isSerializable.js";
|
|
71
|
+
export * from "./utils/objects/isStream.js";
|
|
72
|
+
export * from "./utils/objects/isString.js";
|
|
73
|
+
export * from "./utils/objects/isSymbol.js";
|
|
74
|
+
export * from "./utils/objects/methodsOf.js";
|
|
75
|
+
export * from "./utils/objects/nameOf.js";
|
|
76
|
+
export * from "./utils/objects/objectKeys.js";
|
|
77
|
+
export * from "./utils/objects/primitiveOf.js";
|
|
78
|
+
export * from "./utils/objects/prototypeOf.js";
|
|
79
|
+
export * from "./utils/objects/setValue.js";
|
|
80
|
+
export * from "./utils/objects/toMap.js";
|
|
81
|
+
export * from "./utils/objects/toStringConstructor.js";
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./decorators/configurable\";\nexport * from \"./decorators/deprecated\";\nexport * from \"./decorators/enumerable\";\nexport * from \"./decorators/notConfigurable\";\nexport * from \"./decorators/notEnumerable\";\nexport * from \"./decorators/readOnly\";\nexport * from \"./decorators/storeFn\";\nexport * from \"./decorators/storeMerge\";\nexport * from \"./decorators/storeSet\";\nexport * from \"./decorators/writable\";\nexport * from \"./domain/AnyToPromise\";\nexport * from \"./domain/DecoratorTypes\";\nexport * from \"./domain/Env\";\nexport * from \"./domain/Hooks\";\nexport * from \"./domain/Metadata\";\nexport * from \"./domain/Store\";\nexport * from \"./domain/Type\";\nexport * from \"./errors/UnsupportedDecoratorType\";\nexport * from \"./interfaces/AnyDecorator\";\nexport * from \"./interfaces/DecoratorParameters\";\nexport * from \"./interfaces/HashOf\";\nexport * from \"./interfaces/MetadataTypes\";\nexport * from \"./interfaces/ValueOf\";\nexport * from \"./utils/catchError\";\nexport * from \"./utils/proxyDelegation\";\nexport * from \"./utils/uniq\";\nexport * from \"./utils/decorators/decorateMethodsOf\";\nexport * from \"./utils/decorators/decoratorArgs\";\nexport * from \"./utils/decorators/decoratorTypeOf\";\nexport * from \"./utils/decorators/inheritedDescriptorOf\";\nexport * from \"./utils/decorators/useDecorators\";\nexport * from \"./utils/decorators/useMethodDecorators\";\nexport * from \"./utils/http/getHostInfoFromPort\";\nexport * from \"./utils/imports/importPackage\";\nexport * from \"./utils/objects/ancestorOf\";\nexport * from \"./utils/objects/ancestorsOf\";\nexport * from \"./utils/objects/classOf\";\nexport * from \"./utils/objects/cleanObject\";\nexport * from \"./utils/objects/constructorOf\";\nexport * from \"./utils/objects/createInstance\";\nexport * from \"./utils/objects/deepClone\";\nexport * from \"./utils/objects/deepMerge\";\nexport * from \"./utils/objects/descriptorOf\";\nexport * from \"./utils/objects/getClassOrSymbol\";\nexport * from \"./utils/objects/getConstructorArgNames\";\nexport * from \"./utils/objects/getEnumerableKeys\";\nexport * from \"./utils/objects/getValue\";\nexport * from \"./utils/objects/isArray\";\nexport * from \"./utils/objects/isArrowFn\";\nexport * from \"./utils/objects/isBoolean\";\nexport * from \"./utils/objects/isBuffer\";\nexport * from \"./utils/objects/isClass\";\nexport * from \"./utils/objects/isCollection\";\nexport * from \"./utils/objects/isDate\";\nexport * from \"./utils/objects/isEmpty\";\nexport * from \"./utils/objects/isEnumerable\";\nexport * from \"./utils/objects/isFunction\";\nexport * from \"./utils/objects/isInheritedFrom\";\nexport * from \"./utils/objects/isNil\";\nexport * from \"./utils/objects/isNumber\";\nexport * from \"./utils/objects/isObject\";\nexport * from \"./utils/objects/isObservable\";\nexport * from \"./utils/objects/isPlainObject\";\nexport * from \"./utils/objects/isPrimitive\";\nexport * from \"./utils/objects/isPromise\";\nexport * from \"./utils/objects/isProtectedKey\";\nexport * from \"./utils/objects/isSerializable\";\nexport * from \"./utils/objects/isStream\";\nexport * from \"./utils/objects/isString\";\nexport * from \"./utils/objects/isSymbol\";\nexport * from \"./utils/objects/methodsOf\";\nexport * from \"./utils/objects/nameOf\";\nexport * from \"./utils/objects/objectKeys\";\nexport * from \"./utils/objects/primitiveOf\";\nexport * from \"./utils/objects/prototypeOf\";\nexport * from \"./utils/objects/setValue\";\nexport * from \"./utils/objects/toMap\";\nexport * from \"./utils/objects/toStringConstructor\";\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":"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,20 @@
|
|
|
1
|
+
import { classOf } from "../objects/classOf.js";
|
|
2
|
+
import { methodsOf } from "../objects/methodsOf.js";
|
|
3
|
+
import { prototypeOf } from "../objects/prototypeOf.js";
|
|
4
|
+
import { descriptorOf } from "../objects/descriptorOf.js";
|
|
5
|
+
import { Store } from "../../domain/Store.js";
|
|
6
|
+
export function decorateMethodsOf(klass, decorator) {
|
|
7
|
+
methodsOf(klass).forEach(({ target, propertyKey }) => {
|
|
8
|
+
if (target !== classOf(klass)) {
|
|
9
|
+
Object.defineProperty(prototypeOf(klass), propertyKey, {
|
|
10
|
+
writable: true,
|
|
11
|
+
value(...args) {
|
|
12
|
+
return prototypeOf(target)[propertyKey].apply(this, args);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Store.mergeStoreMethodFrom(klass, target, propertyKey);
|
|
16
|
+
}
|
|
17
|
+
decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# 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,QAAQ,EAAE,IAAI;gBACd,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 writable: true,\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.js";
|
|
2
|
+
import { classOf } from "../objects/classOf.js";
|
|
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.js";
|
|
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.js";
|
|
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,17 @@
|
|
|
1
|
+
export function getHostInfoFromPort(protocol, addressPort) {
|
|
2
|
+
let address = "0.0.0.0";
|
|
3
|
+
let port = addressPort;
|
|
4
|
+
if (typeof addressPort === "string" && addressPort.indexOf(":") > -1) {
|
|
5
|
+
[address, port] = addressPort.split(":");
|
|
6
|
+
port = +port;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
protocol,
|
|
10
|
+
address,
|
|
11
|
+
port: port,
|
|
12
|
+
toString() {
|
|
13
|
+
return [`${this.protocol}://${this.address}`, typeof this.port === "number" && this.port].filter(Boolean).join(":");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=getHostInfoFromPort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHostInfoFromPort.js","sourceRoot":"","sources":["../../../../src/utils/http/getHostInfoFromPort.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,WAAgB;IACpE,IAAI,OAAO,GAAG,SAAS,CAAC;IACxB,IAAI,IAAI,GAAG,WAAW,CAAC;IAEvB,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;QACpE,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,IAAI,CAAC;KACd;IAED,OAAO;QACL,QAAQ;QACR,OAAO;QACP,IAAI,EAAE,IAAc;QACpB,QAAQ;YACN,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["export function getHostInfoFromPort(protocol: string, addressPort: any) {\n let address = \"0.0.0.0\";\n let port = addressPort;\n\n if (typeof addressPort === \"string\" && addressPort.indexOf(\":\") > -1) {\n [address, port] = addressPort.split(\":\");\n port = +port;\n }\n\n return {\n protocol,\n address,\n port: port as number,\n toString() {\n return [`${this.protocol}://${this.address}`, typeof this.port === \"number\" && this.port].filter(Boolean).join(\":\");\n }\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 e;
|
|
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,CAAC,CAAC;SACT;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 e;\n }\n\n return {};\n }\n}\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.js";
|
|
2
|
+
import { getInheritedClass } from "./ancestorOf.js";
|
|
3
|
+
import { nameOf } from "./nameOf.js";
|
|
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"]}
|