-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-transformer.system.min.js
1 lines (1 loc) · 15.4 KB
/
class-transformer.system.min.js
1
System.register("class-transformer/ClassTransformOptions",[],function(t,e){"use strict";e&&e.id;return{setters:[],execute:function(){}}}),System.register("class-transformer/metadata/ExposeExcludeOptions",[],function(t,e){"use strict";e&&e.id;return{setters:[],execute:function(){}}}),System.register("class-transformer/metadata/TypeMetadata",[],function(t,e){"use strict";var r;e&&e.id;return{setters:[],execute:function(){r=function(){function t(t,e,r,n){this.target=t,this.propertyName=e,this.reflectedType=r,this.typeFunction=n}return t}(),t("TypeMetadata",r)}}}),System.register("class-transformer/metadata/ExposeMetadata",[],function(t,e){"use strict";var r;e&&e.id;return{setters:[],execute:function(){r=function(){function t(t,e,r){this.target=t,this.propertyName=e,this.options=r}return t}(),t("ExposeMetadata",r)}}}),System.register("class-transformer/metadata/ExcludeMetadata",[],function(t,e){"use strict";var r;e&&e.id;return{setters:[],execute:function(){r=function(){function t(t,e,r){this.target=t,this.propertyName=e,this.options=r}return t}(),t("ExcludeMetadata",r)}}}),System.register("class-transformer/metadata/TransformMetadata",[],function(t,e){"use strict";var r;e&&e.id;return{setters:[],execute:function(){r=function(){function t(t,e,r,n){this.target=t,this.propertyName=e,this.transformFn=r,this.options=n}return t}(),t("TransformMetadata",r)}}}),System.register("class-transformer/metadata/MetadataStorage",["class-transformer/TransformOperationExecutor"],function(t,e){"use strict";var r,n;e&&e.id;return{setters:[function(t){r=t}],execute:function(){n=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,n){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?n===r.TransformationType.CLASS_TO_CLASS||n===r.TransformationType.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||n===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 n=t.find(function(t){return t.target===e&&t.propertyName===r}),a=t.find(function(t){return e&&e.prototype instanceof t.target&&t.propertyName===r});return n||a},t.prototype.findMetadatas=function(t,e,r){var n=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(n.reverse())},t}(),t("MetadataStorage",n)}}}),System.register("class-transformer/storage",["class-transformer/metadata/MetadataStorage"],function(t,e){"use strict";var r,n;e&&e.id;return{setters:[function(t){r=t}],execute:function(){t("defaultMetadataStorage",n=new r.MetadataStorage)}}}),System.register("class-transformer/TransformOperationExecutor",["class-transformer/storage"],function(t,e){"use strict";var r,n,a;e&&e.id;return{setters:[function(t){r=t}],execute:function(){!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"}(n||(n={})),t("TransformationType",n),a=function(){function t(t,e){this.transformationType=t,this.options=e,this.transformedTypesMap=new Map}return t.prototype.transform=function(t,e,a,o,s,i){var f=this;if(void 0===i&&(i=0),e instanceof Array||e instanceof Set){var u=o&&this.transformationType===n.PLAIN_TO_CLASS?new o:[];return e.forEach(function(e,r){var o=t?t[r]:void 0;if(f.options.enableCircularCheck&&f.isCircular(e,i))f.transformationType===n.CLASS_TO_CLASS&&(u instanceof Set?u.add(e):u.push(e));else{var s=f.transform(o,e,a,void 0,e instanceof Map,i+1);u instanceof Set?u.add(s):u.push(s)}}),u}if(a!==String||s){if(a!==Number||s){if(a!==Boolean||s){if((a===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){a||e.constructor===Object||(a=e.constructor),!a&&t&&(a=t.constructor),this.options.enableCircularCheck&&this.transformedTypesMap.set(e,{level:i,object:e});var c=this.getKeys(a,e),p=t||{};t||this.transformationType!==n.PLAIN_TO_CLASS&&this.transformationType!==n.CLASS_TO_CLASS||(p=s?new Map:a?new a:{});for(var d=this,l=0,m=c;l<m.length;l++){var T=m[l];!function(o){var f=o,u=o,c=o;if(!d.options.ignoreDecorators&&a)if(d.transformationType===n.PLAIN_TO_CLASS){var l=r.defaultMetadataStorage.findExposeMetadataByCustomName(a,o);l&&(c=l.propertyName,u=l.propertyName)}else if(d.transformationType===n.CLASS_TO_PLAIN||d.transformationType===n.CLASS_TO_CLASS){var l=r.defaultMetadataStorage.findExposeMetadata(a,o);l&&l.options&&l.options.name&&(u=l.options.name)}var m=void 0;m=e instanceof Map?e.get(f):e[f]instanceof Function?e[f]():e[f];var T=void 0,y=m instanceof Map;if(a&&s)T=a;else if(a){var S=r.defaultMetadataStorage.findTypeMetadata(a,c);if(S){var v={newObject:p,object:e,property:c};T=S.typeFunction(v),y=y||S.reflectedType===Map}else d.options.targetMaps&&d.options.targetMaps.filter(function(t){return t.target===a&&!!t.properties[c]}).forEach(function(t){return T=t.properties[c]})}var h=e[f]instanceof Array?d.getReflectedType(a,c):void 0,C=t?t[f]:void 0;if(p.constructor.prototype){var M=Object.getOwnPropertyDescriptor(p.constructor.prototype,u);if((d.transformationType===n.PLAIN_TO_CLASS||d.transformationType===n.CLASS_TO_CLASS)&&(p[u]instanceof Function||M&&!M.set))return"continue"}if(d.options.enableCircularCheck&&d.isCircular(m,i)){if(d.transformationType===n.CLASS_TO_CLASS){var g=m;g=d.applyCustomTransformations(g,a,o,e,d.transformationType),p instanceof Map?p.set(u,g):p[u]=g}}else{var _=d.transformationType===n.PLAIN_TO_CLASS?u:o,g=d.transform(C,m,T,h,y,i+1);g=d.applyCustomTransformations(g,a,_,e,d.transformationType),p instanceof Map?p.set(u,g):p[u]=g}}(T)}return p}return e}return Boolean(e)}return Number(e)}return String(e)},t.prototype.applyCustomTransformations=function(t,e,n,a,o){var s=this,i=r.defaultMetadataStorage.findTransformMetadatas(e,n,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,a,o)}),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 n=r.defaultMetadataStorage.findTypeMetadata(t,e);return n?n.reflectedType:void 0}},t.prototype.getKeys=function(t,e){var a=this,o=r.defaultMetadataStorage.getStrategy(t);"none"===o&&(o=this.options.strategy||"exposeAll");var s=[];if("exposeAll"===o&&(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===n.PLAIN_TO_CLASS&&(i=i.map(function(e){var n=r.defaultMetadataStorage.findExposeMetadata(t,e);return n&&n.options&&n.options.name?n.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 n=r.defaultMetadataStorage.findExposeMetadata(t,e);return!n||!n.options||a.checkVersion(n.options.since,n.options.until)})),s=this.options.groups&&this.options.groups.length?s.filter(function(e){var n=r.defaultMetadataStorage.findExposeMetadata(t,e);return!n||!n.options||a.checkGroups(n.options.groups)}):s.filter(function(e){var n=r.defaultMetadataStorage.findExposeMetadata(t,e);return!(n&&n.options&&n.options.groups&&n.options.groups.length)})}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(s=s.filter(function(t){return a.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}(),t("TransformOperationExecutor",a)}}}),System.register("class-transformer/ClassTransformer",["class-transformer/TransformOperationExecutor"],function(t,e){"use strict";var r,n;e&&e.id;return{setters:[function(t){r=t}],execute:function(){n=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,n){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_PLAIN,n||{}).transform(e,t,void 0,void 0,void 0,void 0)},t.prototype.plainToClass=function(t,e,n){return new r.TransformOperationExecutor(r.TransformationType.PLAIN_TO_CLASS,n||{}).transform(void 0,e,t,void 0,void 0,void 0)},t.prototype.plainToClassFromExist=function(t,e,n){return new r.TransformOperationExecutor(r.TransformationType.PLAIN_TO_CLASS,n||{}).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,n){return new r.TransformOperationExecutor(r.TransformationType.CLASS_TO_CLASS,n||{}).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 n=JSON.parse(e);return this.plainToClass(t,n,r)},t.prototype.deserializeArray=function(t,e,r){var n=JSON.parse(e);return this.plainToClass(t,n,r)},t}(),t("ClassTransformer",n)}}}),System.register("class-transformer/decorators",["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){"use strict";function r(t,e){return function(r,n){var a=new l.TransformMetadata(r.constructor,n,t,e);u.defaultMetadataStorage.addTransformMetadata(a)}}function n(t){return function(e,r){var n=Reflect.getMetadata("design:type",e,r),a=new c.TypeMetadata(e.constructor,r,n,t);u.defaultMetadataStorage.addTypeMetadata(a)}}function a(t){return function(e,r){var n=new p.ExposeMetadata(e instanceof Function?e:e.constructor,r,t||{});u.defaultMetadataStorage.addExposeMetadata(n)}}function o(t){return function(e,r){var n=new d.ExcludeMetadata(e instanceof Function?e:e.constructor,r,t||{});u.defaultMetadataStorage.addExcludeMetadata(n)}}function s(t){return function(e,r,n){var a=new f.ClassTransformer,o=n.value;n.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=o.apply(this,e);return!n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then?a.classToPlain(n,t):n.then(function(e){return a.classToPlain(e,t)})}}}function i(t){return function(e,r,n){var a=new f.ClassTransformer,o=n.value;n.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=o.apply(this,e);return!n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then?a.classToClass(n,t):n.then(function(e){return a.classToClass(e,t)})}}}e&&e.id;t("Transform",r),t("Type",n),t("Expose",a),t("Exclude",o),t("TransformClassToPlain",s),t("TransformClassToClass",i);var f,u,c,p,d,l;return{setters:[function(t){f=t},function(t){u=t},function(t){c=t},function(t){p=t},function(t){d=t},function(t){l=t}],execute:function(){}}}),System.register("class-transformer/index",["class-transformer/ClassTransformer","class-transformer/decorators"],function(t,e){"use strict";function r(t,e){return l.classToPlain(t,e)}function n(t,e,r){return l.classToPlainFromExist(t,e,r)}function a(t,e,r){return l.plainToClass(t,e,r)}function o(t,e,r){return l.plainToClassFromExist(t,e,r)}function s(t,e){return l.classToClass(t,e)}function i(t,e,r){return l.classToClassFromExist(t,e,r)}function f(t,e){return l.serialize(t,e)}function u(t,e,r){return l.deserialize(t,e,r)}function c(t,e,r){return l.deserializeArray(t,e,r)}function p(e){var r={};for(var n in e)"default"===n||T.hasOwnProperty(n)||(r[n]=e[n]);t(r)}e&&e.id;t("classToPlain",r),t("classToPlainFromExist",n),t("plainToClass",a),t("plainToClassFromExist",o),t("classToClass",s),t("classToClassFromExist",i),t("serialize",f),t("deserialize",u),t("deserializeArray",c);var d,l,m,T={classToPlain:!0,classToPlainFromExist:!0,plainToClass:!0,plainToClassFromExist:!0,classToClass:!0,classToClassFromExist:!0,serialize:!0,deserialize:!0,deserializeArray:!0,TransformationType:!0,ClassTransformer:!0};return{setters:[function(e){d=e,t({ClassTransformer:e.ClassTransformer})},function(t){p(t)}],execute:function(){l=new d.ClassTransformer,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"}(m||(m={})),t("TransformationType",m)}}}),System.register("class-transformer",["class-transformer/index"],function(t,e){"use strict";function r(e){var r={};for(var n in e)"default"!==n&&(r[n]=e[n]);t(r)}e&&e.id;return{setters:[function(t){r(t)}],execute:function(){}}});