-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-transformer.amd.min.js
1 lines (1 loc) · 15.1 KB
/
class-transformer.amd.min.js
1
define("class-transformer/ClassTransformOptions",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})}),define("class-transformer/metadata/ExposeExcludeOptions",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})}),define("class-transformer/metadata/TypeMetadata",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r,a){this.target=t,this.propertyName=e,this.reflectedType=r,this.typeFunction=a}return t}();e.TypeMetadata=r}),define("class-transformer/metadata/ExposeMetadata",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r){this.target=t,this.propertyName=e,this.options=r}return t}();e.ExposeMetadata=r}),define("class-transformer/metadata/ExcludeMetadata",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r){this.target=t,this.propertyName=e,this.options=r}return t}();e.ExcludeMetadata=r}),define("class-transformer/metadata/TransformMetadata",["require","exports"],function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r,a){this.target=t,this.propertyName=e,this.transformFn=r,this.options=a}return t}();e.TransformMetadata=r}),define("class-transformer/metadata/MetadataStorage",["require","exports","class-transformer/TransformOperationExecutor"],function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(){this._typeMetadatas=[],this._transformMetadatas=[],this._exposeMetadatas=[],this._excludeMetadatas=[]}return t.prototype.addTypeMetadata=function(t){this._typeMetadatas.push(t)},t.prototype.addTransformMetadata=function(t){this._transformMetadatas.push(t)},t.prototype.addExposeMetadata=function(t){this._exposeMetadatas.push(t)},t.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.push(t)},t.prototype.findTransformMetadatas=function(t,e,a){return this.findMetadatas(this._transformMetadatas,t,e).filter(function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?a===r.TransformationType.CLASS_TO_CLASS||a===r.TransformationType.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||a===r.TransformationType.CLASS_TO_PLAIN))})},t.prototype.findExcludeMetadata=function(t,e){return this.findMetadata(this._excludeMetadatas,t,e)},t.prototype.findExposeMetadata=function(t,e){return this.findMetadata(this._exposeMetadatas,t,e)},t.prototype.findExposeMetadataByCustomName=function(t,e){return this.getExposedMetadatas(t).find(function(t){return t.options&&t.options.name===e})},t.prototype.findTypeMetadata=function(t,e){return this.findMetadata(this._typeMetadatas,t,e)},t.prototype.getStrategy=function(t){var e=this._excludeMetadatas.find(function(e){return e.target===t&&void 0===e.propertyName}),r=this._exposeMetadatas.find(function(e){return e.target===t&&void 0===e.propertyName});return e&&r||!e&&!r?"none":e?"excludeAll":"exposeAll"},t.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},t.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},t.prototype.getExposedProperties=function(t,e){return this.getExposedMetadatas(t).filter(function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?e===r.TransformationType.CLASS_TO_CLASS||e===r.TransformationType.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||e===r.TransformationType.CLASS_TO_PLAIN))}).map(function(t){return t.propertyName})},t.prototype.getExcludedProperties=function(t,e){return this.getExcludedMetadatas(t).filter(function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?e===r.TransformationType.CLASS_TO_CLASS||e===r.TransformationType.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||e===r.TransformationType.CLASS_TO_PLAIN))}).map(function(t){return t.propertyName})},t.prototype.clear=function(){this._typeMetadatas=[],this._exposeMetadatas=[],this._excludeMetadatas=[]},t.prototype.getMetadata=function(t,e){var r=t.filter(function(t){return t.target===e&&void 0!==t.propertyName});return t.filter(function(t){return e&&e.prototype instanceof t.target&&void 0!==t.propertyName}).concat(r)},t.prototype.findMetadata=function(t,e,r){var a=t.find(function(t){return t.target===e&&t.propertyName===r}),o=t.find(function(t){return e&&e.prototype instanceof t.target&&t.propertyName===r});return a||o},t.prototype.findMetadatas=function(t,e,r){var a=t.filter(function(t){return t.target===e&&t.propertyName===r});return t.filter(function(t){return e&&e.prototype instanceof t.target&&t.propertyName===r}).reverse().concat(a.reverse())},t}();e.MetadataStorage=a}),define("class-transformer/storage",["require","exports","class-transformer/metadata/MetadataStorage"],function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.defaultMetadataStorage=new r.MetadataStorage}),define("class-transformer/TransformOperationExecutor",["require","exports","class-transformer/storage"],function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a;!function(t){t[t.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",t[t.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",t[t.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(a=e.TransformationType||(e.TransformationType={}));var o=function(){function t(t,e){this.transformationType=t,this.options=e,this.transformedTypesMap=new Map}return t.prototype.transform=function(t,e,o,n,s,i){var f=this;if(void 0===i&&(i=0),e instanceof Array||e instanceof Set){var p=n&&this.transformationType===a.PLAIN_TO_CLASS?new n:[];return e.forEach(function(e,r){var n=t?t[r]:void 0;if(f.options.enableCircularCheck&&f.isCircular(e,i))f.transformationType===a.CLASS_TO_CLASS&&(p instanceof Set?p.add(e):p.push(e));else{var s=f.transform(n,e,o,void 0,e instanceof Map,i+1);p instanceof Set?p.add(s):p.push(s)}}),p}if(o!==String||s){if(o!==Number||s){if(o!==Boolean||s){if((o===Date||e instanceof Date)&&!s)return e instanceof Date?new Date(e.valueOf()):null===e||void 0===e?e:new Date(e);if(e instanceof Object){o||e.constructor===Object||(o=e.constructor),!o&&t&&(o=t.constructor),this.options.enableCircularCheck&&this.transformedTypesMap.set(e,{level:i,object:e});var u=this.getKeys(o,e),c=t||{};t||this.transformationType!==a.PLAIN_TO_CLASS&&this.transformationType!==a.CLASS_TO_CLASS||(c=s?new Map:o?new o:{});for(var d=this,l=0,T=u;l<T.length;l++){var y=T[l];!function(n){var f=n,p=n,u=n;if(!d.options.ignoreDecorators&&o)if(d.transformationType===a.PLAIN_TO_CLASS){var l=r.defaultMetadataStorage.findExposeMetadataByCustomName(o,n);l&&(u=l.propertyName,p=l.propertyName)}else if(d.transformationType===a.CLASS_TO_PLAIN||d.transformationType===a.CLASS_TO_CLASS){var l=r.defaultMetadataStorage.findExposeMetadata(o,n);l&&l.options&&l.options.name&&(p=l.options.name)}var T=void 0;T=e instanceof Map?e.get(f):e[f]instanceof Function?e[f]():e[f];var y=void 0,m=T instanceof Map;if(o&&s)y=o;else if(o){var S=r.defaultMetadataStorage.findTypeMetadata(o,u);if(S){var v={newObject:c,object:e,property:u};y=S.typeFunction(v),m=m||S.reflectedType===Map}else d.options.targetMaps&&d.options.targetMaps.filter(function(t){return t.target===o&&!!t.properties[u]}).forEach(function(t){return y=t.properties[u]})}var _=e[f]instanceof Array?d.getReflectedType(o,u):void 0,M=t?t[f]:void 0;if(c.constructor.prototype){var h=Object.getOwnPropertyDescriptor(c.constructor.prototype,p);if((d.transformationType===a.PLAIN_TO_CLASS||d.transformationType===a.CLASS_TO_CLASS)&&(c[p]instanceof Function||h&&!h.set))return"continue"}if(d.options.enableCircularCheck&&d.isCircular(T,i)){if(d.transformationType===a.CLASS_TO_CLASS){var C=T;C=d.applyCustomTransformations(C,o,n,e,d.transformationType),c instanceof Map?c.set(p,C):c[p]=C}}else{var x=d.transformationType===a.PLAIN_TO_CLASS?p:n,C=d.transform(M,T,y,_,m,i+1);C=d.applyCustomTransformations(C,o,x,e,d.transformationType),c instanceof Map?c.set(p,C):c[p]=C}}(y)}return c}return e}return Boolean(e)}return Number(e)}return String(e)},t.prototype.applyCustomTransformations=function(t,e,a,o,n){var s=this,i=r.defaultMetadataStorage.findTransformMetadatas(e,a,this.transformationType);return void 0!==this.options.version&&(i=i.filter(function(t){return!t.options||s.checkVersion(t.options.since,t.options.until)})),i=this.options.groups&&this.options.groups.length?i.filter(function(t){return!t.options||s.checkGroups(t.options.groups)}):i.filter(function(t){return!t.options||!t.options.groups||!t.options.groups.length}),i.forEach(function(e){t=e.transformFn(t,o,n)}),t},t.prototype.isCircular=function(t,e){var r=this.transformedTypesMap.get(t);return void 0!==r&&r.level<e},t.prototype.getReflectedType=function(t,e){if(t){var a=r.defaultMetadataStorage.findTypeMetadata(t,e);return a?a.reflectedType:void 0}},t.prototype.getKeys=function(t,e){var o=this,n=r.defaultMetadataStorage.getStrategy(t);"none"===n&&(n=this.options.strategy||"exposeAll");var s=[];if("exposeAll"===n&&(s=e instanceof Map?Array.from(e.keys()):Object.keys(e)),!this.options.ignoreDecorators&&t){var i=r.defaultMetadataStorage.getExposedProperties(t,this.transformationType);this.transformationType===a.PLAIN_TO_CLASS&&(i=i.map(function(e){var a=r.defaultMetadataStorage.findExposeMetadata(t,e);return a&&a.options&&a.options.name?a.options.name:e})),s=s.concat(i);var f=r.defaultMetadataStorage.getExcludedProperties(t,this.transformationType);f.length>0&&(s=s.filter(function(t){return-1===f.indexOf(t)})),void 0!==this.options.version&&(s=s.filter(function(e){var a=r.defaultMetadataStorage.findExposeMetadata(t,e);return!a||!a.options||o.checkVersion(a.options.since,a.options.until)})),s=this.options.groups&&this.options.groups.length?s.filter(function(e){var a=r.defaultMetadataStorage.findExposeMetadata(t,e);return!a||!a.options||o.checkGroups(a.options.groups)}):s.filter(function(e){var a=r.defaultMetadataStorage.findExposeMetadata(t,e);return!(a&&a.options&&a.options.groups&&a.options.groups.length)})}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(s=s.filter(function(t){return o.options.excludePrefixes.every(function(e){return t.substr(0,e.length)!==e})})),s=s.filter(function(t,e,r){return r.indexOf(t)===e})},t.prototype.checkVersion=function(t,e){var r=!0;return r&&t&&(r=this.options.version>=t),r&&e&&(r=this.options.version<e),r},t.prototype.checkGroups=function(t){return!t||this.options.groups.some(function(e){return-1!==t.indexOf(e)})},t}();e.TransformOperationExecutor=o}),define("class-transformer/ClassTransformer",["require","exports","class-transformer/TransformOperationExecutor"],function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(){}return t.prototype.classToPlain=function(t,e){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_PLAIN,e||{}).transform(void 0,t,void 0,void 0,void 0,void 0)},t.prototype.classToPlainFromExist=function(t,e,a){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_PLAIN,a||{}).transform(e,t,void 0,void 0,void 0,void 0)},t.prototype.plainToClass=function(t,e,a){return new r.TransformOperationExecutor(r.TransformationType.PLAIN_TO_CLASS,a||{}).transform(void 0,e,t,void 0,void 0,void 0)},t.prototype.plainToClassFromExist=function(t,e,a){return new r.TransformOperationExecutor(r.TransformationType.PLAIN_TO_CLASS,a||{}).transform(t,e,void 0,void 0,void 0,void 0)},t.prototype.classToClass=function(t,e){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_CLASS,e||{}).transform(void 0,t,void 0,void 0,void 0,void 0)},t.prototype.classToClassFromExist=function(t,e,a){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_CLASS,a||{}).transform(e,t,void 0,void 0,void 0,void 0)},t.prototype.serialize=function(t,e){return JSON.stringify(this.classToPlain(t,e))},t.prototype.deserialize=function(t,e,r){var a=JSON.parse(e);return this.plainToClass(t,a,r)},t.prototype.deserializeArray=function(t,e,r){var a=JSON.parse(e);return this.plainToClass(t,a,r)},t}();e.ClassTransformer=a}),define("class-transformer/decorators",["require","exports","class-transformer/ClassTransformer","class-transformer/storage","class-transformer/metadata/TypeMetadata","class-transformer/metadata/ExposeMetadata","class-transformer/metadata/ExcludeMetadata","class-transformer/metadata/TransformMetadata"],function(t,e,r,a,o,n,s,i){"use strict";function f(t,e){return function(r,o){var n=new i.TransformMetadata(r.constructor,o,t,e);a.defaultMetadataStorage.addTransformMetadata(n)}}function p(t){return function(e,r){var n=Reflect.getMetadata("design:type",e,r),s=new o.TypeMetadata(e.constructor,r,n,t);a.defaultMetadataStorage.addTypeMetadata(s)}}function u(t){return function(e,r){var o=new n.ExposeMetadata(e instanceof Function?e:e.constructor,r,t||{});a.defaultMetadataStorage.addExposeMetadata(o)}}function c(t){return function(e,r){var o=new s.ExcludeMetadata(e instanceof Function?e:e.constructor,r,t||{});a.defaultMetadataStorage.addExcludeMetadata(o)}}function d(t){return function(e,a,o){var n=new r.ClassTransformer,s=o.value;o.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=s.apply(this,e);return!a||"object"!=typeof a&&"function"!=typeof a||"function"!=typeof a.then?n.classToPlain(a,t):a.then(function(e){return n.classToPlain(e,t)})}}}function l(t){return function(e,a,o){var n=new r.ClassTransformer,s=o.value;o.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=s.apply(this,e);return!a||"object"!=typeof a&&"function"!=typeof a||"function"!=typeof a.then?n.classToClass(a,t):a.then(function(e){return n.classToClass(e,t)})}}}Object.defineProperty(e,"__esModule",{value:!0}),e.Transform=f,e.Type=p,e.Expose=u,e.Exclude=c,e.TransformClassToPlain=d,e.TransformClassToClass=l}),define("class-transformer/index",["require","exports","class-transformer/ClassTransformer","class-transformer/ClassTransformer","class-transformer/decorators"],function(t,e,r,a,o){"use strict";function n(t,e){return T.classToPlain(t,e)}function s(t,e,r){return T.classToPlainFromExist(t,e,r)}function i(t,e,r){return T.plainToClass(t,e,r)}function f(t,e,r){return T.plainToClassFromExist(t,e,r)}function p(t,e){return T.classToClass(t,e)}function u(t,e,r){return T.classToClassFromExist(t,e,r)}function c(t,e){return T.serialize(t,e)}function d(t,e,r){return T.deserialize(t,e,r)}function l(t,e,r){return T.deserializeArray(t,e,r)}Object.defineProperty(e,"__esModule",{value:!0}),e.ClassTransformer=a.ClassTransformer,function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(o);var T=new r.ClassTransformer;e.classToPlain=n,e.classToPlainFromExist=s,e.plainToClass=i,e.plainToClassFromExist=f,e.classToClass=p,e.classToClassFromExist=u,e.serialize=c,e.deserialize=d,e.deserializeArray=l;!function(t){t[t.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",t[t.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",t[t.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(e.TransformationType||(e.TransformationType={}))}),define("class-transformer",["require","exports","class-transformer/index"],function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(r)});