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ChB,CAAC;IAEO,iDAAY,GAApB,UAAqB,KAAa,EAAE,KAAa;QAC7C,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,IAAI,QAAQ,IAAI,KAAK;YACjB,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;QAC7C,IAAI,QAAQ,IAAI,KAAK;YACjB,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;QAE5C,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEO,gDAAW,GAAnB,UAAoB,MAAgB;QAChC,IAAI,CAAC,MAAM;YACP,OAAO,IAAI,CAAC;QAEhB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAA,WAAW,IAAI,OAAA,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAlC,CAAkC,CAAC,CAAC;IACvF,CAAC;IAEL,iCAAC;AAAD,CAhaA,AAgaC,IAAA;AAhaY,gEAA0B;AAkavC,8BAA8B,SAAmB;IAC7C,IAAM,KAAK,GAAG,IAAK,SAAiB,EAAE,CAAC;IACvC,IAAI,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE;QAC/C,OAAO,EAAE,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;IACI,IAAI;QACA,MAAM,CAAA;QACN,OAAO,IAAI,CAAC;KACf;IAAC,WAAM,GAAG;IACX,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,sCAMC","file":"TransformOperationExecutor.js","sourcesContent":["import { ClassTransformOptions } from \"./ClassTransformOptions\";\r\nimport { defaultMetadataStorage } from \"./storage\";\r\nimport { TypeHelpOptions, TypeOptions } from \"./metadata/ExposeExcludeOptions\";\r\nimport { TypeMetadata } from \"./metadata/TypeMetadata\";\r\n\r\nexport enum TransformationType {\r\n PLAIN_TO_CLASS,\r\n CLASS_TO_PLAIN,\r\n CLASS_TO_CLASS\r\n}\r\n\r\nexport class TransformOperationExecutor {\r\n\r\n // -------------------------------------------------------------------------\r\n // Private Properties\r\n // -------------------------------------------------------------------------\r\n\r\n private recursionStack = new Set<Object>();\r\n\r\n // -------------------------------------------------------------------------\r\n // Constructor\r\n // -------------------------------------------------------------------------\r\n\r\n constructor(private transformationType: TransformationType,\r\n private options: ClassTransformOptions) {\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // Public Methods\r\n // -------------------------------------------------------------------------\r\n\r\n transform(source: Object | Object[] | any,\r\n value: Object | Object[] | any,\r\n targetType: Function | TypeMetadata,\r\n arrayType: Function,\r\n isMap: boolean,\r\n level: number = 0) {\r\n\r\n if (Array.isArray(value) || value instanceof Set) {\r\n const newValue = arrayType && this.transformationType === TransformationType.PLAIN_TO_CLASS ? instantiateArrayType(arrayType) : [];\r\n (value as any[]).forEach((subValue, index) => {\r\n const subSource = source ? source[index] : undefined;\r\n if (!this.options.enableCircularCheck || !this.isCircular(subValue)) {\r\n let realTargetType;\r\n if (typeof targetType !== \"function\" && targetType && targetType.options && targetType.options.discriminator && targetType.options.discriminator.property && targetType.options.discriminator.subTypes) {\r\n if (this.transformationType === TransformationType.PLAIN_TO_CLASS) {\r\n realTargetType = targetType.options.discriminator.subTypes.find((subType) => subType.name === subValue[(targetType as { options: TypeOptions }).options.discriminator.property]);\r\n const options: TypeHelpOptions = { newObject: newValue, object: subValue, property: undefined };\r\n const newType = targetType.typeFunction(options);\r\n realTargetType === undefined ? realTargetType = newType : realTargetType = realTargetType.value;\r\n if (!targetType.options.keepDiscriminatorProperty) delete subValue[targetType.options.discriminator.property];\r\n }\r\n if (this.transformationType === TransformationType.CLASS_TO_CLASS) {\r\n realTargetType = subValue.constructor;\r\n }\r\n if (this.transformationType === TransformationType.CLASS_TO_PLAIN) {\r\n subValue[targetType.options.discriminator.property] = targetType.options.discriminator.subTypes.find((subType) => subType.value === subValue.constructor).name;\r\n }\r\n } else {\r\n realTargetType = targetType;\r\n }\r\n const value = this.transform(subSource, subValue, realTargetType, undefined, subValue instanceof Map, level + 1);\r\n\r\n if (newValue instanceof Set) {\r\n newValue.add(value);\r\n } else {\r\n newValue.push(value);\r\n }\r\n } else if (this.transformationType === TransformationType.CLASS_TO_CLASS) {\r\n if (newValue instanceof Set) {\r\n newValue.add(subValue);\r\n } else {\r\n newValue.push(subValue);\r\n }\r\n }\r\n });\r\n return newValue;\r\n } else if (targetType === String && !isMap) {\r\n if (value === null || value === undefined)\r\n return value;\r\n return String(value);\r\n\r\n } else if (targetType === Number && !isMap) {\r\n if (value === null || value === undefined)\r\n return value;\r\n return Number(value);\r\n\r\n } else if (targetType === Boolean && !isMap) {\r\n if (value === null || value === undefined)\r\n return value;\r\n return Boolean(value);\r\n\r\n } else if ((targetType === Date || value instanceof Date) && !isMap) {\r\n if (value instanceof Date) {\r\n return new Date(value.valueOf());\r\n }\r\n if (value === null || value === undefined)\r\n return value;\r\n return new Date(value);\r\n\r\n } else if (testForBuffer() && (targetType === Buffer || value instanceof Buffer) && !isMap) {\r\n if (value === null || value === undefined)\r\n return value;\r\n return Buffer.from(value);\r\n\r\n } else if (typeof value === \"object\" && value !== null) {\r\n\r\n // try to guess the type\r\n if (!targetType && value.constructor !== Object/* && TransformationType === TransformationType.CLASS_TO_PLAIN*/) targetType = value.constructor;\r\n if (!targetType && source) targetType = source.constructor;\r\n\r\n if (this.options.enableCircularCheck) {\r\n // add transformed type to prevent circular references\r\n this.recursionStack.add(value);\r\n }\r\n\r\n const keys = this.getKeys((targetType as Function), value);\r\n let newValue: any = source ? source : {};\r\n if (!source && (this.transformationType === TransformationType.PLAIN_TO_CLASS || this.transformationType === TransformationType.CLASS_TO_CLASS)) {\r\n if (isMap) {\r\n newValue = new Map();\r\n } else if (targetType) {\r\n newValue = new (targetType as any)();\r\n } else {\r\n newValue = {};\r\n }\r\n }\r\n\r\n // traverse over keys\r\n for (let key of keys) {\r\n\r\n let valueKey = key, newValueKey = key, propertyName = key;\r\n if (!this.options.ignoreDecorators && targetType) {\r\n if (this.transformationType === TransformationType.PLAIN_TO_CLASS) {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadataByCustomName((targetType as Function), key);\r\n if (exposeMetadata) {\r\n propertyName = exposeMetadata.propertyName;\r\n newValueKey = exposeMetadata.propertyName;\r\n }\r\n\r\n } else if (this.transformationType === TransformationType.CLASS_TO_PLAIN || this.transformationType === TransformationType.CLASS_TO_CLASS) {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadata((targetType as Function), key);\r\n if (exposeMetadata && exposeMetadata.options && exposeMetadata.options.name) {\r\n newValueKey = exposeMetadata.options.name;\r\n }\r\n }\r\n }\r\n\r\n // get a subvalue\r\n let subValue: any = undefined;\r\n if (value instanceof Map) {\r\n subValue = value.get(valueKey);\r\n } else if (value[valueKey] instanceof Function) {\r\n subValue = value[valueKey]();\r\n } else {\r\n subValue = value[valueKey];\r\n }\r\n\r\n // determine a type\r\n let type: any = undefined, isSubValueMap = subValue instanceof Map;\r\n if (targetType && isMap) {\r\n type = targetType;\r\n\r\n } else if (targetType) {\r\n\r\n const metadata = defaultMetadataStorage.findTypeMetadata((targetType as Function), propertyName);\r\n if (metadata) {\r\n const options: TypeHelpOptions = { newObject: newValue, object: value, property: propertyName };\r\n const newType = metadata.typeFunction ? metadata.typeFunction(options) : metadata.reflectedType;\r\n if (metadata.options && metadata.options.discriminator && metadata.options.discriminator.property && metadata.options.discriminator.subTypes) {\r\n if (!(value[valueKey] instanceof Array)) {\r\n if (this.transformationType === TransformationType.PLAIN_TO_CLASS) {\r\n type = metadata.options.discriminator.subTypes.find((subType) => {\r\n if (subValue && metadata.options.discriminator.property in subValue) {\r\n return subType.name === subValue[metadata.options.discriminator.property]\r\n }\r\n });\r\n type === undefined ? type = newType : type = type.value;\r\n if (!metadata.options.keepDiscriminatorProperty) {\r\n if (subValue && metadata.options.discriminator.property in subValue) {\r\n delete subValue[metadata.options.discriminator.property];\r\n }\r\n }\r\n }\r\n if (this.transformationType === TransformationType.CLASS_TO_CLASS) {\r\n type = subValue.constructor;\r\n }\r\n if (this.transformationType === TransformationType.CLASS_TO_PLAIN) {\r\n subValue[metadata.options.discriminator.property] = metadata.options.discriminator.subTypes.find((subType) => subType.value === subValue.constructor).name;\r\n }\r\n } else {\r\n type = metadata;\r\n }\r\n } else {\r\n type = newType;\r\n }\r\n isSubValueMap = isSubValueMap || metadata.reflectedType === Map;\r\n } else if (this.options.targetMaps) { // try to find a type in target maps\r\n this.options.targetMaps\r\n .filter(map => map.target === targetType && !!map.properties[propertyName])\r\n .forEach(map => type = map.properties[propertyName]);\r\n } else if(this.transformationType === TransformationType.PLAIN_TO_CLASS) {\r\n // if we have no registererd type via the @Type() decorator then we check if we have any\r\n // type declarations in reflect-metadata (type declaration is emited only if some decorator is added to the property.)\r\n const reflectedType = Reflect.getMetadata(\"design:type\", (targetType as Function).prototype, propertyName);\r\n \r\n if (reflectedType) {\r\n type = reflectedType;\r\n }\r\n }\r\n }\r\n\r\n // if value is an array try to get its custom array type\r\n const arrayType = Array.isArray(value[valueKey]) ? this.getReflectedType((targetType as Function), propertyName) : undefined;\r\n\r\n // const subValueKey = TransformationType === TransformationType.PLAIN_TO_CLASS && newKeyName ? newKeyName : key;\r\n const subSource = source ? source[valueKey] : undefined;\r\n\r\n // if its deserialization then type if required\r\n // if we uncomment this types like string[] will not work\r\n // if (this.transformationType === TransformationType.PLAIN_TO_CLASS && !type && subValue instanceof Object && !(subValue instanceof Date))\r\n // throw new Error(`Cannot determine type for ${(targetType as any).name }.${propertyName}, did you forget to specify a @Type?`);\r\n\r\n // if newValue is a source object that has method that match newKeyName then skip it\r\n if (newValue.constructor.prototype) {\r\n const descriptor = Object.getOwnPropertyDescriptor(newValue.constructor.prototype, newValueKey);\r\n if ((this.transformationType === TransformationType.PLAIN_TO_CLASS || this.transformationType === TransformationType.CLASS_TO_CLASS)\r\n && ((descriptor && !descriptor.writable) || newValue[newValueKey] instanceof Function)) // || TransformationType === TransformationType.CLASS_TO_CLASS\r\n continue;\r\n }\r\n\r\n if (!this.options.enableCircularCheck || !this.isCircular(subValue)) {\r\n let transformKey = this.transformationType === TransformationType.PLAIN_TO_CLASS ? newValueKey : key;\r\n let finalValue;\r\n\r\n if (this.transformationType === TransformationType.CLASS_TO_PLAIN) {\r\n // Get original value\r\n finalValue = value[transformKey];\r\n // Apply custom transformation\r\n finalValue = this.applyCustomTransformations(finalValue, (targetType as Function), transformKey, value, this.transformationType);\r\n // If nothing change, it means no custom transformation was applied, so use the subValue.\r\n finalValue = (value[transformKey] === finalValue) ? subValue : finalValue;\r\n // Apply the default transformation\r\n finalValue = this.transform(subSource, finalValue, type, arrayType, isSubValueMap, level + 1);\r\n } else {\r\n finalValue = this.transform(subSource, subValue, type, arrayType, isSubValueMap, level + 1);\r\n finalValue = this.applyCustomTransformations(finalValue, (targetType as Function), transformKey, value, this.transformationType);\r\n }\r\n\r\n if (newValue instanceof Map) {\r\n newValue.set(newValueKey, finalValue);\r\n } else {\r\n newValue[newValueKey] = finalValue;\r\n }\r\n } else if (this.transformationType === TransformationType.CLASS_TO_CLASS) {\r\n let finalValue = subValue;\r\n finalValue = this.applyCustomTransformations(finalValue, (targetType as Function), key, value, this.transformationType);\r\n if (newValue instanceof Map) {\r\n newValue.set(newValueKey, finalValue);\r\n } else {\r\n newValue[newValueKey] = finalValue;\r\n }\r\n }\r\n\r\n }\r\n\r\n if (this.options.enableCircularCheck) {\r\n this.recursionStack.delete(value);\r\n }\r\n\r\n return newValue;\r\n\r\n } else {\r\n return value;\r\n }\r\n }\r\n\r\n private applyCustomTransformations(value: any, target: Function, key: string, obj: any, transformationType: TransformationType) {\r\n let metadatas = defaultMetadataStorage.findTransformMetadatas(target, key, this.transformationType);\r\n\r\n // apply versioning options\r\n if (this.options.version !== undefined) {\r\n metadatas = metadatas.filter(metadata => {\r\n if (!metadata.options)\r\n return true;\r\n\r\n return this.checkVersion(metadata.options.since, metadata.options.until);\r\n });\r\n }\r\n\r\n // apply grouping options\r\n if (this.options.groups && this.options.groups.length) {\r\n metadatas = metadatas.filter(metadata => {\r\n if (!metadata.options)\r\n return true;\r\n\r\n return this.checkGroups(metadata.options.groups);\r\n });\r\n } else {\r\n metadatas = metadatas.filter(metadata => {\r\n return !metadata.options || !metadata.options.groups || !metadata.options.groups.length;\r\n });\r\n }\r\n\r\n metadatas.forEach(metadata => {\r\n value = metadata.transformFn(value, obj, transformationType);\r\n });\r\n\r\n return value;\r\n }\r\n\r\n // preventing circular references\r\n private isCircular(object: Object) {\r\n return this.recursionStack.has(object);\r\n }\r\n\r\n private getReflectedType(target: Function, propertyName: string) {\r\n if (!target) return undefined;\r\n const meta = defaultMetadataStorage.findTypeMetadata(target, propertyName);\r\n return meta ? meta.reflectedType : undefined;\r\n }\r\n\r\n private getKeys(target: Function, object: Object): string[] {\r\n\r\n // determine exclusion strategy\r\n let strategy = defaultMetadataStorage.getStrategy(target);\r\n if (strategy === \"none\")\r\n strategy = this.options.strategy || \"exposeAll\"; // exposeAll is default strategy\r\n\r\n // get all keys that need to expose\r\n let keys: any[] = [];\r\n if (strategy === \"exposeAll\") {\r\n if (object instanceof Map) {\r\n keys = Array.from(object.keys());\r\n } else {\r\n keys = Object.keys(object);\r\n }\r\n }\r\n\r\n if (!this.options.ignoreDecorators && target) {\r\n\r\n // add all exposed to list of keys\r\n let exposedProperties = defaultMetadataStorage.getExposedProperties(target, this.transformationType);\r\n if (this.transformationType === TransformationType.PLAIN_TO_CLASS) {\r\n exposedProperties = exposedProperties.map(key => {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadata(target, key);\r\n if (exposeMetadata && exposeMetadata.options && exposeMetadata.options.name) {\r\n return exposeMetadata.options.name;\r\n }\r\n\r\n return key;\r\n });\r\n }\r\n if (this.options.excludeExtraneousValues) {\r\n keys = exposedProperties;\r\n } else {\r\n keys = keys.concat(exposedProperties);\r\n }\r\n\r\n // exclude excluded properties\r\n const excludedProperties = defaultMetadataStorage.getExcludedProperties(target, this.transformationType);\r\n if (excludedProperties.length > 0) {\r\n keys = keys.filter(key => {\r\n return excludedProperties.indexOf(key) === -1;\r\n });\r\n }\r\n\r\n // apply versioning options\r\n if (this.options.version !== undefined) {\r\n keys = keys.filter(key => {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadata(target, key);\r\n if (!exposeMetadata || !exposeMetadata.options)\r\n return true;\r\n\r\n return this.checkVersion(exposeMetadata.options.since, exposeMetadata.options.until);\r\n });\r\n }\r\n\r\n // apply grouping options\r\n if (this.options.groups && this.options.groups.length) {\r\n keys = keys.filter(key => {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadata(target, key);\r\n if (!exposeMetadata || !exposeMetadata.options)\r\n return true;\r\n\r\n return this.checkGroups(exposeMetadata.options.groups);\r\n });\r\n } else {\r\n keys = keys.filter(key => {\r\n const exposeMetadata = defaultMetadataStorage.findExposeMetadata(target, key);\r\n return !exposeMetadata || !exposeMetadata.options || !exposeMetadata.options.groups || !exposeMetadata.options.groups.length;\r\n });\r\n }\r\n }\r\n\r\n // exclude prefixed properties\r\n if (this.options.excludePrefixes && this.options.excludePrefixes.length) {\r\n keys = keys.filter(key => this.options.excludePrefixes.every(prefix => {\r\n return key.substr(0, prefix.length) !== prefix;\r\n }));\r\n }\r\n\r\n // make sure we have unique keys\r\n keys = keys.filter((key, index, self) => {\r\n return self.indexOf(key) === index;\r\n });\r\n\r\n return keys;\r\n }\r\n\r\n private checkVersion(since: number, until: number) {\r\n let decision = true;\r\n if (decision && since)\r\n decision = this.options.version >= since;\r\n if (decision && until)\r\n decision = this.options.version < until;\r\n\r\n return decision;\r\n }\r\n\r\n private checkGroups(groups: string[]) {\r\n if (!groups)\r\n return true;\r\n\r\n return this.options.groups.some(optionGroup => groups.indexOf(optionGroup) !== -1);\r\n }\r\n\r\n}\r\n\r\nfunction instantiateArrayType(arrayType: Function): Array<any> | Set<any> {\r\n const array = new (arrayType as any)();\r\n if (!(array instanceof Set) && !(\"push\" in array)) {\r\n return [];\r\n }\r\n return array;\r\n}\r\n\r\nexport function testForBuffer(): boolean {\r\n try {\r\n Buffer\r\n return true;\r\n } catch { }\r\n return false;\r\n}\r\n"],"sourceRoot":"."}
\No newline at end of file