@tsed/core 7.0.0-alpha.1 → 7.0.0-beta.10
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 +5 -1
- 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/objects/getInheritedClass.d.ts → types/utils/objects/ancestorOf.d.ts} +1 -0
- package/lib/{utils/objects/ancestorOf.d.ts → 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/types/utils/objects/isSerializable.d.ts +1 -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 +15 -8
- 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 -2271
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -2185
- 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 -40
- package/lib/utils/objects/isArrowFn.d.ts +0 -1
- package/lib/utils/objects/methodsOf.d.ts +0 -5
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Store = exports.PARAM_STORE = exports.PROPERTY_STORE = exports.METHOD_STORE = exports.CLASS_STORE = void 0;
|
|
4
|
+
const DecoratorTypes_1 = require("../domain/DecoratorTypes");
|
|
5
|
+
const decoratorTypeOf_1 = require("../utils/decorators/decoratorTypeOf");
|
|
6
|
+
const deepClone_1 = require("../utils/objects/deepClone");
|
|
7
|
+
const deepMerge_1 = require("../utils/objects/deepMerge");
|
|
8
|
+
const descriptorOf_1 = require("../utils/objects/descriptorOf");
|
|
9
|
+
const isSymbol_1 = require("../utils/objects/isSymbol");
|
|
10
|
+
const nameOf_1 = require("../utils/objects/nameOf");
|
|
11
|
+
const Metadata_1 = require("./Metadata");
|
|
12
|
+
/**
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
exports.CLASS_STORE = "tsed:class:store";
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
*/
|
|
19
|
+
exports.METHOD_STORE = "tsed:method:store";
|
|
20
|
+
/**
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
exports.PROPERTY_STORE = "tsed:property:store";
|
|
24
|
+
/**
|
|
25
|
+
* @ignore
|
|
26
|
+
*/
|
|
27
|
+
exports.PARAM_STORE = "tsed:param:store";
|
|
28
|
+
const stores = new Map();
|
|
29
|
+
function storeGet(key, ...args) {
|
|
30
|
+
if ((0, isSymbol_1.isSymbol)(args[0])) {
|
|
31
|
+
if (!stores.has(args[0])) {
|
|
32
|
+
stores.set(args[0], new Store());
|
|
33
|
+
}
|
|
34
|
+
return stores.get(args[0]);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const registry = Metadata_1.Metadata;
|
|
38
|
+
if (!registry.hasOwn(key, ...args)) {
|
|
39
|
+
registry.set(key, new Store(), ...args);
|
|
40
|
+
}
|
|
41
|
+
return registry.getOwn(key, ...args);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function defineStore(args) {
|
|
45
|
+
const [target, propertyKey, descriptor] = args;
|
|
46
|
+
switch ((0, decoratorTypeOf_1.decoratorTypeOf)(args)) {
|
|
47
|
+
case DecoratorTypes_1.DecoratorTypes.PARAM_CTOR:
|
|
48
|
+
case DecoratorTypes_1.DecoratorTypes.PARAM_STC:
|
|
49
|
+
case DecoratorTypes_1.DecoratorTypes.PARAM:
|
|
50
|
+
const store = storeGet(exports.PARAM_STORE, target, propertyKey);
|
|
51
|
+
if (!store.has("" + descriptor)) {
|
|
52
|
+
store.set("" + descriptor, new Store());
|
|
53
|
+
}
|
|
54
|
+
return store.get("" + descriptor);
|
|
55
|
+
case DecoratorTypes_1.DecoratorTypes.PROP:
|
|
56
|
+
case DecoratorTypes_1.DecoratorTypes.PROP_STC:
|
|
57
|
+
return storeGet(exports.PROPERTY_STORE, target, propertyKey);
|
|
58
|
+
case DecoratorTypes_1.DecoratorTypes.METHOD:
|
|
59
|
+
case DecoratorTypes_1.DecoratorTypes.METHOD_STC:
|
|
60
|
+
return storeGet(exports.METHOD_STORE, target, propertyKey);
|
|
61
|
+
case DecoratorTypes_1.DecoratorTypes.CLASS:
|
|
62
|
+
return storeGet(exports.CLASS_STORE, target);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class Store {
|
|
66
|
+
constructor() {
|
|
67
|
+
this._entries = new Map();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create or get a Store from args {target + methodName + descriptor}
|
|
71
|
+
* @param args
|
|
72
|
+
* @returns {Store}
|
|
73
|
+
*/
|
|
74
|
+
static from(...args) {
|
|
75
|
+
return defineStore(args);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create store on the method.
|
|
79
|
+
* @param target
|
|
80
|
+
* @param {string} propertyKey
|
|
81
|
+
* @returns {Store}
|
|
82
|
+
*/
|
|
83
|
+
static fromMethod(target, propertyKey) {
|
|
84
|
+
return Store.from(target, propertyKey, (0, descriptorOf_1.descriptorOf)(target, propertyKey));
|
|
85
|
+
}
|
|
86
|
+
static mergeStoreFrom(target, source, ...args) {
|
|
87
|
+
const store = Store.from(target, ...args);
|
|
88
|
+
Store.from(source, ...args)._entries.forEach((value, key) => {
|
|
89
|
+
store.merge(key, value);
|
|
90
|
+
});
|
|
91
|
+
return store;
|
|
92
|
+
}
|
|
93
|
+
static mergeStoreMethodFrom(target, source, propertyKey) {
|
|
94
|
+
return this.mergeStoreFrom(target, source, propertyKey, (0, descriptorOf_1.descriptorOf)(target, propertyKey));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The get() method returns a specified element from a Map object.
|
|
98
|
+
* @param key Required. The key of the element to return from the Map object.
|
|
99
|
+
* @param defaultValue
|
|
100
|
+
* @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.
|
|
101
|
+
*/
|
|
102
|
+
get(key, defaultValue) {
|
|
103
|
+
return this._entries.get((0, nameOf_1.nameOf)(key)) || defaultValue;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The has() method returns a boolean indicating whether an element with the specified key exists or not.
|
|
107
|
+
* @param key
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
has(key) {
|
|
111
|
+
return this._entries.has((0, nameOf_1.nameOf)(key));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The set() method adds or updates an element with a specified key and value to a Map object.
|
|
115
|
+
* @param key Required. The key of the element to add to the Map object.
|
|
116
|
+
* @param metadata Required. The value of the element to add to the Map object.
|
|
117
|
+
*/
|
|
118
|
+
set(key, metadata) {
|
|
119
|
+
this._entries.set((0, nameOf_1.nameOf)(key), metadata);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The delete() method removes the specified element from a Map object.
|
|
124
|
+
* @param key Required. The key of the element to remove from the Map object.
|
|
125
|
+
* @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.
|
|
126
|
+
*/
|
|
127
|
+
delete(key) {
|
|
128
|
+
return this._entries.delete((0, nameOf_1.nameOf)(key));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Merge given value with existing value.
|
|
132
|
+
* @param key
|
|
133
|
+
* @param value
|
|
134
|
+
* @param inverse Change the merge order. Get the existing value and apply over given value
|
|
135
|
+
* @returns {Store}
|
|
136
|
+
*/
|
|
137
|
+
merge(key, value, inverse = false) {
|
|
138
|
+
let _value_ = this.get(key);
|
|
139
|
+
if (_value_) {
|
|
140
|
+
value = (0, deepClone_1.deepClone)(value);
|
|
141
|
+
_value_ = (0, deepClone_1.deepClone)(_value_);
|
|
142
|
+
value = inverse ? (0, deepMerge_1.deepMerge)(value, _value_) : (0, deepMerge_1.deepMerge)(_value_, value);
|
|
143
|
+
}
|
|
144
|
+
this.set(key, value);
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
toJson() {
|
|
148
|
+
return [...this._entries.entries()].reduce((obj, [key, value]) => {
|
|
149
|
+
return {
|
|
150
|
+
...obj,
|
|
151
|
+
[key]: value
|
|
152
|
+
};
|
|
153
|
+
}, {});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.Store = Store;
|
|
157
|
+
//# 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,QAAA,IAAI,GAAG,QAAQ,CAAC;AAE7B,aAAa;AACb,MAAM,CAAC,IAAI,GAAG,YAAI,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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnsupportedDecoratorType = void 0;
|
|
4
|
+
const decoratorTypeOf_1 = require("../utils/decorators/decoratorTypeOf");
|
|
5
|
+
const classOf_1 = require("../utils/objects/classOf");
|
|
6
|
+
const nameOf_1 = require("../utils/objects/nameOf");
|
|
7
|
+
class UnsupportedDecoratorType extends Error {
|
|
8
|
+
constructor(decorator, args) {
|
|
9
|
+
super(UnsupportedDecoratorType.buildMessage(decorator, args));
|
|
10
|
+
}
|
|
11
|
+
static buildMessage(decorator, args) {
|
|
12
|
+
const [target, propertyKey, index] = args;
|
|
13
|
+
const bindingType = (0, decoratorTypeOf_1.decoratorTypeOf)(args);
|
|
14
|
+
const shortBinding = bindingType.split("/")[0];
|
|
15
|
+
const param = shortBinding === "parameter" ? ".[" + index + "]" : "";
|
|
16
|
+
const cstr = shortBinding === "parameter" ? ".constructor" : "";
|
|
17
|
+
const method = propertyKey ? "." + propertyKey : cstr;
|
|
18
|
+
const path = (0, nameOf_1.nameOf)((0, classOf_1.classOf)(target)) + method + param;
|
|
19
|
+
return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.UnsupportedDecoratorType = UnsupportedDecoratorType;
|
|
23
|
+
//# sourceMappingURL=UnsupportedDecoratorType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsupportedDecoratorType.js","sourceRoot":"","sources":["../../../src/errors/UnsupportedDecoratorType.ts"],"names":[],"mappings":";;;AAAA,yEAAoE;AACpE,sDAAiD;AACjD,oDAA+C;AAE/C,MAAa,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,IAAA,iCAAe,EAAC,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,IAAA,eAAM,EAAC,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;QAEtD,OAAO,GAAG,SAAS,CAAC,IAAI,sBAAsB,WAAW,iBAAiB,IAAI,EAAE,CAAC;IACnF,CAAC;CACF;AApBD,4DAoBC","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/cjs/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./decorators/configurable"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./decorators/deprecated"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./decorators/enumerable"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./decorators/notConfigurable"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./decorators/notEnumerable"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./decorators/readOnly"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./decorators/storeFn"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./decorators/storeMerge"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./decorators/storeSet"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./decorators/writable"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./domain/AnyToPromise"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./domain/DecoratorTypes"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./domain/Env"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./domain/Hooks"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./domain/Metadata"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./domain/Store"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./domain/Type"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./errors/UnsupportedDecoratorType"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./interfaces/AnyDecorator"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./interfaces/DecoratorParameters"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./interfaces/HashOf"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./interfaces/MetadataTypes"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./interfaces/ValueOf"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./utils/catchError"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./utils/proxyDelegation"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./utils/uniq"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./utils/decorators/decorateMethodsOf"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./utils/decorators/decoratorArgs"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./utils/decorators/decoratorTypeOf"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./utils/decorators/inheritedDescriptorOf"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./utils/decorators/useDecorators"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./utils/decorators/useMethodDecorators"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./utils/http/getHostInfoFromPort"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./utils/imports/importPackage"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./utils/objects/ancestorOf"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./utils/objects/ancestorsOf"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./utils/objects/classOf"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./utils/objects/cleanObject"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./utils/objects/constructorOf"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./utils/objects/createInstance"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./utils/objects/deepClone"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./utils/objects/deepMerge"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./utils/objects/descriptorOf"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./utils/objects/getClassOrSymbol"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./utils/objects/getConstructorArgNames"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./utils/objects/getEnumerableKeys"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./utils/objects/getValue"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./utils/objects/isArray"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./utils/objects/isArrowFn"), exports);
|
|
56
|
+
tslib_1.__exportStar(require("./utils/objects/isBoolean"), exports);
|
|
57
|
+
tslib_1.__exportStar(require("./utils/objects/isBuffer"), exports);
|
|
58
|
+
tslib_1.__exportStar(require("./utils/objects/isClass"), exports);
|
|
59
|
+
tslib_1.__exportStar(require("./utils/objects/isCollection"), exports);
|
|
60
|
+
tslib_1.__exportStar(require("./utils/objects/isDate"), exports);
|
|
61
|
+
tslib_1.__exportStar(require("./utils/objects/isEmpty"), exports);
|
|
62
|
+
tslib_1.__exportStar(require("./utils/objects/isEnumerable"), exports);
|
|
63
|
+
tslib_1.__exportStar(require("./utils/objects/isFunction"), exports);
|
|
64
|
+
tslib_1.__exportStar(require("./utils/objects/isInheritedFrom"), exports);
|
|
65
|
+
tslib_1.__exportStar(require("./utils/objects/isNil"), exports);
|
|
66
|
+
tslib_1.__exportStar(require("./utils/objects/isNumber"), exports);
|
|
67
|
+
tslib_1.__exportStar(require("./utils/objects/isObject"), exports);
|
|
68
|
+
tslib_1.__exportStar(require("./utils/objects/isObservable"), exports);
|
|
69
|
+
tslib_1.__exportStar(require("./utils/objects/isPlainObject"), exports);
|
|
70
|
+
tslib_1.__exportStar(require("./utils/objects/isPrimitive"), exports);
|
|
71
|
+
tslib_1.__exportStar(require("./utils/objects/isPromise"), exports);
|
|
72
|
+
tslib_1.__exportStar(require("./utils/objects/isProtectedKey"), exports);
|
|
73
|
+
tslib_1.__exportStar(require("./utils/objects/isSerializable"), exports);
|
|
74
|
+
tslib_1.__exportStar(require("./utils/objects/isStream"), exports);
|
|
75
|
+
tslib_1.__exportStar(require("./utils/objects/isString"), exports);
|
|
76
|
+
tslib_1.__exportStar(require("./utils/objects/isSymbol"), exports);
|
|
77
|
+
tslib_1.__exportStar(require("./utils/objects/methodsOf"), exports);
|
|
78
|
+
tslib_1.__exportStar(require("./utils/objects/nameOf"), exports);
|
|
79
|
+
tslib_1.__exportStar(require("./utils/objects/objectKeys"), exports);
|
|
80
|
+
tslib_1.__exportStar(require("./utils/objects/primitiveOf"), exports);
|
|
81
|
+
tslib_1.__exportStar(require("./utils/objects/prototypeOf"), exports);
|
|
82
|
+
tslib_1.__exportStar(require("./utils/objects/setValue"), exports);
|
|
83
|
+
tslib_1.__exportStar(require("./utils/objects/toMap"), exports);
|
|
84
|
+
tslib_1.__exportStar(require("./utils/objects/toStringConstructor"), exports);
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oEAA0C;AAC1C,kEAAwC;AACxC,kEAAwC;AACxC,uEAA6C;AAC7C,qEAA2C;AAC3C,gEAAsC;AACtC,+DAAqC;AACrC,kEAAwC;AACxC,gEAAsC;AACtC,gEAAsC;AACtC,gEAAsC;AACtC,kEAAwC;AACxC,uDAA6B;AAC7B,yDAA+B;AAC/B,4DAAkC;AAClC,yDAA+B;AAC/B,wDAA8B;AAC9B,4EAAkD;AAClD,oEAA0C;AAC1C,2EAAiD;AACjD,8DAAoC;AACpC,qEAA2C;AAC3C,+DAAqC;AACrC,6DAAmC;AACnC,kEAAwC;AACxC,uDAA6B;AAC7B,+EAAqD;AACrD,2EAAiD;AACjD,6EAAmD;AACnD,mFAAyD;AACzD,2EAAiD;AACjD,iFAAuD;AACvD,2EAAiD;AACjD,wEAA8C;AAC9C,qEAA2C;AAC3C,sEAA4C;AAC5C,kEAAwC;AACxC,sEAA4C;AAC5C,wEAA8C;AAC9C,yEAA+C;AAC/C,oEAA0C;AAC1C,oEAA0C;AAC1C,uEAA6C;AAC7C,2EAAiD;AACjD,iFAAuD;AACvD,4EAAkD;AAClD,mEAAyC;AACzC,kEAAwC;AACxC,oEAA0C;AAC1C,oEAA0C;AAC1C,mEAAyC;AACzC,kEAAwC;AACxC,uEAA6C;AAC7C,iEAAuC;AACvC,kEAAwC;AACxC,uEAA6C;AAC7C,qEAA2C;AAC3C,0EAAgD;AAChD,gEAAsC;AACtC,mEAAyC;AACzC,mEAAyC;AACzC,uEAA6C;AAC7C,wEAA8C;AAC9C,sEAA4C;AAC5C,oEAA0C;AAC1C,yEAA+C;AAC/C,yEAA+C;AAC/C,mEAAyC;AACzC,mEAAyC;AACzC,mEAAyC;AACzC,oEAA0C;AAC1C,iEAAuC;AACvC,qEAA2C;AAC3C,sEAA4C;AAC5C,sEAA4C;AAC5C,mEAAyC;AACzC,gEAAsC;AACtC,8EAAoD","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,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.catchAsyncError = exports.catchError = void 0;
|
|
4
|
+
function catchError(cb) {
|
|
5
|
+
try {
|
|
6
|
+
cb();
|
|
7
|
+
}
|
|
8
|
+
catch (er) {
|
|
9
|
+
return er;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.catchError = catchError;
|
|
13
|
+
async function catchAsyncError(cb) {
|
|
14
|
+
try {
|
|
15
|
+
await cb();
|
|
16
|
+
}
|
|
17
|
+
catch (er) {
|
|
18
|
+
return er;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.catchAsyncError = catchAsyncError;
|
|
22
|
+
//# sourceMappingURL=catchError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catchError.js","sourceRoot":"","sources":["../../../src/utils/catchError.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAkB,EAAY;IACtD,IAAI;QACF,EAAE,EAAE,CAAC;KACN;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAND,gCAMC;AAEM,KAAK,UAAU,eAAe,CAAkB,EAAY;IACjE,IAAI;QACF,MAAM,EAAE,EAAE,CAAC;KACZ;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAND,0CAMC","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,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decorateMethodsOf = void 0;
|
|
4
|
+
const classOf_1 = require("../objects/classOf");
|
|
5
|
+
const methodsOf_1 = require("../objects/methodsOf");
|
|
6
|
+
const prototypeOf_1 = require("../objects/prototypeOf");
|
|
7
|
+
const descriptorOf_1 = require("../objects/descriptorOf");
|
|
8
|
+
const Store_1 = require("../../domain/Store");
|
|
9
|
+
function decorateMethodsOf(klass, decorator) {
|
|
10
|
+
(0, methodsOf_1.methodsOf)(klass).forEach(({ target, propertyKey }) => {
|
|
11
|
+
if (target !== (0, classOf_1.classOf)(klass)) {
|
|
12
|
+
Object.defineProperty((0, prototypeOf_1.prototypeOf)(klass), propertyKey, {
|
|
13
|
+
writable: true,
|
|
14
|
+
value(...args) {
|
|
15
|
+
return (0, prototypeOf_1.prototypeOf)(target)[propertyKey].apply(this, args);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Store_1.Store.mergeStoreMethodFrom(klass, target, propertyKey);
|
|
19
|
+
}
|
|
20
|
+
decorator((0, prototypeOf_1.prototypeOf)(klass), propertyKey, (0, descriptorOf_1.descriptorOf)(klass, propertyKey));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.decorateMethodsOf = decorateMethodsOf;
|
|
24
|
+
//# sourceMappingURL=decorateMethodsOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorateMethodsOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decorateMethodsOf.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAC3C,oDAA+C;AAC/C,wDAAmD;AACnD,0DAAqD;AACrD,8CAAyC;AAEzC,SAAgB,iBAAiB,CAAC,KAAU,EAAE,SAAc;IAC1D,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE;QACjD,IAAI,MAAM,KAAK,IAAA,iBAAO,EAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE;gBACrD,QAAQ,EAAE,IAAI;gBACd,KAAK,CAAC,GAAG,IAAW;oBAClB,OAAO,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5D,CAAC;aACF,CAAC,CAAC;YAEH,aAAK,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACxD;QAED,SAAS,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE,WAAW,EAAE,IAAA,2BAAY,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,8CAeC","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,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decoratorArgs = void 0;
|
|
4
|
+
const descriptorOf_1 = require("../objects/descriptorOf");
|
|
5
|
+
function decoratorArgs(target, propertyKey) {
|
|
6
|
+
return [target, propertyKey, (0, descriptorOf_1.descriptorOf)(target, propertyKey)];
|
|
7
|
+
}
|
|
8
|
+
exports.decoratorArgs = decoratorArgs;
|
|
9
|
+
//# sourceMappingURL=decoratorArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoratorArgs.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decoratorArgs.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,SAAgB,aAAa,CAAC,MAAW,EAAE,WAAmB;IAC5D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAE,CAAC,CAAC;AACnE,CAAC;AAFD,sCAEC","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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decoratorTypeOf = void 0;
|
|
4
|
+
const DecoratorTypes_1 = require("../../domain/DecoratorTypes");
|
|
5
|
+
const classOf_1 = require("../objects/classOf");
|
|
6
|
+
function decoratorTypeOf(args) {
|
|
7
|
+
const [target, propertyKey, descriptor] = args;
|
|
8
|
+
const staticType = (type) => {
|
|
9
|
+
return target !== (0, classOf_1.classOf)(target) ? type : `${type}.static`;
|
|
10
|
+
};
|
|
11
|
+
if (typeof descriptor === "number") {
|
|
12
|
+
return propertyKey ? staticType("parameter") : "parameter.constructor";
|
|
13
|
+
}
|
|
14
|
+
if (descriptor && descriptor.value) {
|
|
15
|
+
return staticType("method");
|
|
16
|
+
}
|
|
17
|
+
if ((propertyKey && descriptor === undefined) || descriptor) {
|
|
18
|
+
return staticType("property");
|
|
19
|
+
}
|
|
20
|
+
return DecoratorTypes_1.DecoratorTypes.CLASS;
|
|
21
|
+
}
|
|
22
|
+
exports.decoratorTypeOf = decoratorTypeOf;
|
|
23
|
+
//# sourceMappingURL=decoratorTypeOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoratorTypeOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/decoratorTypeOf.ts"],"names":[],"mappings":";;;AAAA,gEAA2D;AAC3D,gDAA2C;AAE3C,SAAgB,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,IAAA,iBAAO,EAAC,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,+BAAc,CAAC,KAAK,CAAC;AAC9B,CAAC;AApBD,0CAoBC","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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inheritedDescriptorOf = void 0;
|
|
4
|
+
const ancestorsOf_1 = require("../objects/ancestorsOf");
|
|
5
|
+
function inheritedDescriptorOf(target, propertyKey) {
|
|
6
|
+
for (const klass of (0, ancestorsOf_1.ancestorsOf)(target)) {
|
|
7
|
+
const descriptor = Object.getOwnPropertyDescriptor((klass && klass.prototype) || klass, propertyKey);
|
|
8
|
+
if (descriptor) {
|
|
9
|
+
return descriptor;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
exports.inheritedDescriptorOf = inheritedDescriptorOf;
|
|
15
|
+
//# sourceMappingURL=inheritedDescriptorOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritedDescriptorOf.js","sourceRoot":"","sources":["../../../../src/utils/decorators/inheritedDescriptorOf.ts"],"names":[],"mappings":";;;AAAA,wDAAmD;AAEnD,SAAgB,qBAAqB,CAAC,MAAW,EAAE,WAAmB;IACpE,KAAK,MAAM,KAAK,IAAI,IAAA,yBAAW,EAAC,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;AAVD,sDAUC","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,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDecorators = void 0;
|
|
4
|
+
function useDecorators(...decorators) {
|
|
5
|
+
return (...args) => {
|
|
6
|
+
decorators
|
|
7
|
+
.filter((o) => !!o)
|
|
8
|
+
.forEach((decorator) => {
|
|
9
|
+
decorator(...args);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.useDecorators = useDecorators;
|
|
14
|
+
//# sourceMappingURL=useDecorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDecorators.js","sourceRoot":"","sources":["../../../../src/utils/decorators/useDecorators.ts"],"names":[],"mappings":";;;AAGA,SAAgB,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;AARD,sCAQC","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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMethodDecorators = exports.useMethodDecorator = void 0;
|
|
4
|
+
const descriptorOf_1 = require("../objects/descriptorOf");
|
|
5
|
+
function useMethodDecorator(decorator) {
|
|
6
|
+
return (target, propertyKey) => decorator(target, propertyKey, (0, descriptorOf_1.descriptorOf)(target, propertyKey));
|
|
7
|
+
}
|
|
8
|
+
exports.useMethodDecorator = useMethodDecorator;
|
|
9
|
+
function useMethodDecorators(...decorators) {
|
|
10
|
+
return (target, propertyKey) => {
|
|
11
|
+
decorators.filter(Boolean).forEach((decorator) => decorator(target, propertyKey, (0, descriptorOf_1.descriptorOf)(target, propertyKey)));
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.useMethodDecorators = useMethodDecorators;
|
|
15
|
+
//# sourceMappingURL=useMethodDecorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMethodDecorators.js","sourceRoot":"","sources":["../../../../src/utils/decorators/useMethodDecorators.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,SAAgB,kBAAkB,CAAC,SAAuB;IACxD,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAC1H,CAAC;AAFD,gDAEC;AAED,SAAgB,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,IAAA,2BAAY,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvH,CAAC,CAAC;AACJ,CAAC;AAJD,kDAIC","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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostInfoFromPort = void 0;
|
|
4
|
+
function getHostInfoFromPort(protocol, addressPort) {
|
|
5
|
+
let address = "0.0.0.0";
|
|
6
|
+
let port = addressPort;
|
|
7
|
+
if (typeof addressPort === "string" && addressPort.indexOf(":") > -1) {
|
|
8
|
+
[address, port] = addressPort.split(":");
|
|
9
|
+
port = +port;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
protocol,
|
|
13
|
+
address,
|
|
14
|
+
port: port,
|
|
15
|
+
toString() {
|
|
16
|
+
return [`${this.protocol}://${this.address}`, typeof this.port === "number" && this.port].filter(Boolean).join(":");
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.getHostInfoFromPort = getHostInfoFromPort;
|
|
21
|
+
//# sourceMappingURL=getHostInfoFromPort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHostInfoFromPort.js","sourceRoot":"","sources":["../../../../src/utils/http/getHostInfoFromPort.ts"],"names":[],"mappings":";;;AAAA,SAAgB,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;AAjBD,kDAiBC","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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.importPackage = void 0;
|
|
27
|
+
async function importPackage(packageName, loaderFn = () => Promise.resolve().then(() => __importStar(require(packageName))), optional = false) {
|
|
28
|
+
try {
|
|
29
|
+
return await loaderFn();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
if (!optional) {
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.importPackage = importPackage;
|
|
39
|
+
//# sourceMappingURL=importPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAqB,GAAG,EAAE,mDAAQ,WAAW,GAAC,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;AAVD,sCAUC","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"]}
|