tserialize
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -0,1 +1,5 @@ | ||
# 1.5.0 | ||
- Полный отказ от reflect-metadata, библиотека не имеет зависимостей | ||
- Закреплена сигнатура JsonStruct и JsonMeta | ||
# 1.4.0 | ||
@@ -2,0 +6,0 @@ - Полный рефакторинг внутреннего хранилища данных, тесты проходит, но надо тестировать использование библиотеки в стороннем пакете |
{ | ||
"name": "tserialize", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "TypeScript serialize utils", | ||
@@ -44,5 +44,2 @@ "types": "index.d.ts", | ||
}, | ||
"dependencies": { | ||
"reflect-metadata": "0.1.10" | ||
}, | ||
"jest": { | ||
@@ -49,0 +46,0 @@ "verbose": true, |
@@ -9,3 +9,3 @@ import { PropertyMetadata, TDeserializeFunc, TSerializeFunc } from './types'; | ||
static make(propertyKey: string, name: string): PropertyMetaBuilder { | ||
static make(propertyKey: string, name?: string): PropertyMetaBuilder { | ||
const retVal = new PropertyMetaBuilder(); | ||
@@ -12,0 +12,0 @@ retVal.data.propertyKey = propertyKey; |
@@ -9,15 +9,6 @@ import {ParentKey, PropertyMetaBuilder, RootMetaStore} from '../core'; | ||
*/ | ||
export function JsonMeta(TargetClass?: any): (target: object, propertyKey: string) => void { | ||
export function JsonMeta(TargetClass: any): (target: object, propertyKey: string) => void { | ||
return (target: object, propertyKey: string): void => { | ||
const isDeprecatedUsage = !TargetClass || typeof TargetClass === 'string'; | ||
const proto = TargetClass; | ||
if (isDeprecatedUsage) { | ||
const targetClassName = (Reflect as any).getMetadata('design:type', target, propertyKey).name; | ||
console.error( | ||
`JsonMeta signature has changed, use(copy it) "JsonMeta(${targetClassName})"` | ||
); | ||
} | ||
const proto = isDeprecatedUsage ? (Reflect as any).getMetadata('design:type', target, propertyKey) : TargetClass; | ||
const deserializeFunc = proto.fromServer ? proto.fromServer : (value): any => deserialize(value, proto); | ||
@@ -24,0 +15,0 @@ |
@@ -13,21 +13,11 @@ import { PropertyMetaBuilder, RootMetaStore } from './../core'; | ||
*/ | ||
export function JsonStruct(TargetClass?: any, rawName?: string): (target: object, propertyKey: string) => void { | ||
export function JsonStruct(TargetClass: any, rawName?: string): (target: object, propertyKey: string) => void { | ||
return (target: object, propertyKey: string): void => { | ||
const isDeprecatedUsage = !TargetClass || typeof TargetClass === 'string'; | ||
const proto = TargetClass; | ||
if (isDeprecatedUsage) { | ||
const targetClassName = (Reflect as any).getMetadata('design:type', target, propertyKey).name; | ||
console.error( | ||
`JsonStruct signature has changed, use(copy it) "JsonStruct(${targetClassName}${TargetClass ? `, '${TargetClass}'` : ''})"` | ||
); | ||
} | ||
const proto = isDeprecatedUsage ? (Reflect as any).getMetadata('design:type', target, propertyKey) : TargetClass; | ||
const name = isDeprecatedUsage ? TargetClass : rawName; | ||
const deserializeFunc = proto.fromServer ? proto.fromServer : (value): any => deserialize(value, proto); | ||
const propertyMetadata = PropertyMetaBuilder.make(propertyKey, name).deserializer(deserializeFunc).struct().raw; | ||
const propertyMetadata = PropertyMetaBuilder.make(propertyKey, rawName).deserializer(deserializeFunc).struct().raw; | ||
RootMetaStore.setupPropertyMetadata(target, propertyMetadata); | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
0
339367
46
1311
- Removedreflect-metadata@0.1.10
- Removedreflect-metadata@0.1.10(transitive)