You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@nartc/automapper

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nartc/automapper - npm Package Compare versions

Comparing version

to
6.5.0

101

dist/automapper.cjs.development.js

@@ -1079,11 +1079,16 @@ 'use strict';

function getMapProps(args) {
function getMapProps(args, skipUnmappedAssertion) {
var destination = args[0];
var defaultOptions = {
skipUnmappedAssertion: skipUnmappedAssertion,
beforeMap: undefined,
afterMap: undefined
};
if (args.length === 1) {
return [destination];
return [destination, defaultOptions];
}
if (args.length === 3) {
return [destination, args[1], args[2]];
return [destination, _extends(_extends({}, defaultOptions), args[2]), args[1]];
}

@@ -1094,6 +1099,6 @@

if ((typeof temp === 'function' || isClass(temp)) && !temp['beforeMap'] && !temp['afterMap']) {
return [destination, temp];
return [destination, defaultOptions, temp];
}
return [destination, undefined, temp];
return [destination, _extends(_extends({}, defaultOptions), temp)];
}

@@ -1150,9 +1155,2 @@

function map(sourceObj, mapping, options, mappingStorage, isArrayMap) {
if (options === void 0) {
options = {
beforeMap: undefined,
afterMap: undefined
};
}
if (isArrayMap === void 0) {

@@ -1183,5 +1181,5 @@ isArrayMap = false;

afterAction = actions[1];
var _options = options,
beforeMap = _options.beforeMap,
afterMap = _options.afterMap;
var skipUnmappedAssertion = options.skipUnmappedAssertion,
beforeMap = options.beforeMap,
afterMap = options.afterMap;
var configKeys = [];

@@ -1245,3 +1243,5 @@ var destination = instantiate(destinationModel);

var nestedMapping = getMappingForNestedKey(destinationModel, memberPath, first.constructor, mappingStorage);
set(destination, memberPath, mapArray(mapInitializeValue, nestedMapping, undefined, mappingStorage));
set(destination, memberPath, mapArray(mapInitializeValue, nestedMapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage));
continue;

@@ -1254,3 +1254,5 @@ }

set(destination, memberPath, map(mapInitializeValue, _nestedMapping, undefined, mappingStorage));
set(destination, memberPath, map(mapInitializeValue, _nestedMapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage));
continue;

@@ -1274,3 +1276,6 @@ }

assertMappingConfiguration(destination, configKeys, sourceModel, destinationModel);
if (!skipUnmappedAssertion) {
assertMappingConfiguration(destination, configKeys, sourceModel, destinationModel);
}
return destination;

@@ -1290,13 +1295,5 @@ }

function mapArray(sourceArray, mapping, options, mappingStorage) {
if (options === void 0) {
options = {
beforeMap: undefined,
afterMap: undefined
};
}
var destination = [];
var _options2 = options,
beforeMap = _options2.beforeMap,
afterMap = _options2.afterMap;
var beforeMap = options.beforeMap,
afterMap = options.afterMap;

@@ -1308,3 +1305,5 @@ if (beforeMap) {

for (var i = 0, len = sourceArray.length; i < len; i++) {
destination.push(map(sourceArray[i], mapping, {}, mappingStorage, true));
destination.push(map(sourceArray[i], mapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage, true));
}

@@ -1386,12 +1385,14 @@

var useUndefined = settings.useUndefined,
skipUnmappedAssertion = settings.skipUnmappedAssertion,
sourceNamingConvention = settings.sourceNamingConvention,
destinationNamingConvention = settings.destinationNamingConvention;
this.defaultGlobalSettings[0] = useUndefined !== null && useUndefined !== void 0 ? useUndefined : false;
this.defaultGlobalSettings[1] = skipUnmappedAssertion !== null && skipUnmappedAssertion !== void 0 ? skipUnmappedAssertion : false;
if (sourceNamingConvention) {
this.defaultGlobalSettings[1] = sourceNamingConvention;
this.defaultGlobalSettings[2] = sourceNamingConvention;
}
if (destinationNamingConvention) {
this.defaultGlobalSettings[2] = destinationNamingConvention;
this.defaultGlobalSettings[3] = destinationNamingConvention;
}

@@ -1426,4 +1427,4 @@

useUndefined: this.defaultGlobalSettings[0],
sourceMemberNamingConvention: this.defaultGlobalSettings[1],
destinationMemberNamingConvention: this.defaultGlobalSettings[2]
sourceMemberNamingConvention: this.defaultGlobalSettings[2],
destinationMemberNamingConvention: this.defaultGlobalSettings[3]
}, options);

@@ -1440,6 +1441,6 @@

var _getMapProps = getMapProps(args),
var _getMapProps = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps[0],
source = _getMapProps[1],
options = _getMapProps[2];
options = _getMapProps[1],
source = _getMapProps[2];

@@ -1457,6 +1458,6 @@ var mapping = getMappingForDestination(destination, source || sourceObj.constructor, this._mappingStorage);

var _getMapProps2 = getMapProps(args),
var _getMapProps2 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps2[0],
source = _getMapProps2[1],
options = _getMapProps2[2];
options = _getMapProps2[1],
source = _getMapProps2[2];

@@ -1478,6 +1479,6 @@ var mapping = getMappingForDestination(destination, source || sourceObj.constructor, this._mappingStorage);

var _getMapProps3 = getMapProps(args),
var _getMapProps3 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps3[0],
source = _getMapProps3[1],
options = _getMapProps3[2];
options = _getMapProps3[1],
source = _getMapProps3[2];

@@ -1501,6 +1502,6 @@ var mapping = getMappingForDestination(destination, source || sourceArr[0].constructor, this._mappingStorage);

var _getMapProps4 = getMapProps(args),
var _getMapProps4 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps4[0],
source = _getMapProps4[1],
options = _getMapProps4[2];
options = _getMapProps4[1],
source = _getMapProps4[2];

@@ -1543,3 +1544,3 @@ var mapping = getMappingForDestination(destination, source || sourceArr[0].constructor, this._mappingStorage);

this.defaultGlobalSettings = [false, defaultNamingConvention, defaultNamingConvention];
this.defaultGlobalSettings = [false, false, defaultNamingConvention, defaultNamingConvention];
};

@@ -1630,3 +1631,5 @@

return mapArray(sourceValue, _mapping, undefined, mappingStorage);
return mapArray(sourceValue, _mapping, {
skipUnmappedAssertion: true
}, mappingStorage);
}

@@ -1644,3 +1647,5 @@

var mapping = getMappingForDestination(withDestination, (valueModel === null || valueModel === void 0 ? void 0 : valueModel()) || sourceValue.constructor, mappingStorage);
return map(sourceValue, mapping, undefined, mappingStorage);
return map(sourceValue, mapping, {
skipUnmappedAssertion: true
}, mappingStorage);
}];

@@ -1647,0 +1652,0 @@ }

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("reflect-metadata");var t,n=(t=require("lodash.set"))&&"object"==typeof t&&"default"in t?t.default:t;function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function a(t){var n=0;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,n){if(t){if("string"==typeof t)return o(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,void 0):void 0}}(t)))return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var i=function(){function t(){this.separatorCharacter="",this.splittingExpression=/(^[a-z]+(?=$|[A-Z]{1}[a-z0-9]+)|[A-Z]?[a-z0-9]+)/}return t.prototype.transformPropertyName=function(t){for(var n="",r=0,e=t.length;r<e;r++)n+=0===r?t[r].charAt(0).toLowerCase():t[r].charAt(0).toUpperCase(),n+=t[r].substr(1);return n},t}(),u=function(){function t(){this.separatorCharacter="_",this.splittingExpression=/_/}return t.prototype.transformPropertyName=function(t){return t.length<=1?t[0].toLowerCase()||"":t.map((function(t){return t.toLowerCase()})).join(this.separatorCharacter)},t}(),s=function(){function t(){this.separatorCharacter="",this.splittingExpression=/(^[A-Z]+(?=$|[A-Z]{1}[a-z0-9]+)|[A-Z]?[a-z0-9]+)/}return t.prototype.transformPropertyName=function(t){for(var n="",r=0,e=t.length;r<e;r++)n+=t[r].charAt(0).toUpperCase()+t[r].substr(1);return n},t}(),c=i,f=function(){function t(){this.storage=new WeakMap}var n=t.prototype;return n.set=function(t,n,r){this.setInternal(this.storage,t,n,r)},n.get=function(t,n){return this.getInternal(this.storage,t,n)},n.has=function(t,n){return this.hasInternal(this.storage,t,n)},n.getInternal=function(t,n,r){var e;return null===(e=t.get(n))||void 0===e?void 0:e.get(r)},n.hasInternal=function(t,n,r){var e;return(null===(e=t.get(n))||void 0===e?void 0:e.has(r))||!1},t}(),p=function(t){function n(){return t.call(this)||this}e(n,t);var r=n.prototype;return r.dispose=function(){this.storage=new WeakMap},r.setInternal=function(t,n,r,e){t.has(n)?this.hasInternal(t,n,r)||t.get(n).set(r,e):t.set(n,(new WeakMap).set(r,e))},n}(f),l=function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.setInternal=function(t,n,r,e){t.has(n)?this.hasInternal(t,n,r)||t.get(n).set(r,e):t.set(n,(new Map).set(r,e))},n}(f),h=function(t){function n(){return t.call(this)||this}return e(n,t),n}(p),v=new(function(){function t(){this._metadataMap=new Map}var n=t.prototype;return n.getMetadata=function(t){var n=this._metadataMap.get(t),r=(null==n?void 0:n.length)||0;if(!r){var e=Object.getPrototypeOf(t);return e?this.getMetadata(e):n}for(var o=[],a=function(){var t=n[r][0];if(o.some((function(n){return n[0]===t})))return"continue";o.push(n[r])};r--;)a();return o},n.getMetadataForKey=function(t,n){return this.getMetadata(t).find((function(t){return t[0]===n}))},n.addMetadata=function(t,n){for(var r,e=this._metadataMap.get(t)||[],o=Object.getPrototypeOf(t),i=o&&o.name&&this._metadataMap.get(o)||[],u=[].concat(i,e),s=a(u);!(r=s()).done;)if(n[0][0]===r.value[0])return;this._metadataMap.set(t,[].concat(u,n))},t}()),g=function(){function t(){this.profiles=new WeakMap}var n=t.prototype;return n.initialize=function(t){this.profiles.set(t,[])},n.add=function(t,n){var r=this.profiles.get(t);if(r.some((function(t){return t.profileName===n.profileName})))throw new Error(n.profileName+" already exists on this mapper instance");r.push(n)},t}();function d(t,n,r,e){switch(n){case"String":case"Number":case"Boolean":v.addMetadata(t,[[r,function(){return!1}]]);break;case"Date":v.addMetadata(t,[[r,function(){return Date}]]);break;case"Array":v.addMetadata(t,[[r,function(){return[]}]]);break;default:v.addMetadata(t,[[r,function(){return e}]])}}function m(t){return Array.isArray(t)?!t.length:t instanceof Map?!t.size:!t||!Object.keys(t).length}function y(t){return Array.isArray(t)||t instanceof Date||"[object Object]"===Object.prototype.toString.call(t)}function M(t){return("object"==typeof t||"function"==typeof t)&&t.constructor&&(/^\s*function/.test(t.constructor.toString())||/^\s*class/.test(t.constructor.toString()))&&t.constructor.toString().includes(t.constructor.name)}function b(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.some((function(n){return t[0]===n}))}function A(t,n){function r(t,r){var e=r.split(".").filter(Boolean).reduce((function(t,n){return t&&t[n]}),t);return null!=e?e:n}for(var e=arguments.length,o=new Array(e>2?e-2:0),a=2;a<e;a++)o[a-2]=arguments[a];for(var i=r(t,o[0]),u=1,s=o.length;u<s;u++)i=r(null==i?t:i,o[u]);return i}function w(t,n){var r=t[0],e=t[1],o=n.split(".");if(o.length>1)return o.map((function(t){return w([r,e],t)})).join(".");var a=n.split((new e).splittingExpression).filter(Boolean);return a.length?(new r).transformPropertyName(a):n}function C(t){var n=t.toString();return function(t){return/^[^{]+?=>/gm.test(t)}(n)?S(function(t){var n,r=t.replace(/(?:\s|;|{|}|\(|\)|)+/gm,"").split(/=>(.+)/),e=r[1],o=e.match(/return/g);return(null==o?void 0:o.length)&&o.length>1?(n=[r[0]]).concat.apply(n,e.split(/return(.+)/).filter(Boolean)):r}(n)):S(function(t){return t.replace(/(?:\s|function|;|{|}|\(|\)|)+/gm,"").split(/return(.+)/)}(n))}function S(t){var n=t.join("").split(new RegExp(t[0]+"\\.{1}","g")).filter(Boolean).slice(1);return 1===n.length?n.pop():""}function O(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return[6,null,function(n){return A.apply(void 0,[n,t].concat(r))}]}var _=new(function(t){function n(){var n;return(n=t.call(this)||this).recursiveCounts=new WeakMap,n}e(n,t);var r=n.prototype;return r.getDepthAndCount=function(t,n){return[this.get(t,n),this.getCount(t,n)]},r.setCount=function(t,n,r){this.recursiveCounts.has(t)?this.recursiveCounts.get(t).set(n,r):this.setInternal(this.recursiveCounts,t,n,r)},r.resetCount=function(t,n){var r;null===(r=this.recursiveCounts.get(t))||void 0===r||r.set(n,0)},r.getCount=function(t,n){return this.getInternal(this.recursiveCounts,t,n)},r.dispose=function(){this.recursiveCounts=new WeakMap},n}(l));function j(t,n,r){var e=v.getMetadata(t),o=n?Object.assign(new t,n):new t;if(m(e)||!e)return o;for(var a=function(a,i){var u=e[a],s=u[0],c=o[s],f=(0,u[1])();if(!f)return o[s]=null!=c?c:void 0,"continue";if(Array.isArray(f))return o[s]=null!=c?c:f,"continue";if("Date"===f.prototype.constructor.name||"Moment"===f.prototype.constructor.name)return o[s]=null!=c?new f(c):new f,"continue";if(Array.isArray(c))return o[s]=c.map((function(t){return j(f,t)})),"continue";if(null==c&&null!=n)return o[s]=c,"continue";if(null==r||f!==r||null!=c)return o[s]=j(f,c,t),"continue";var p=_.getDepthAndCount(t,s),l=p[0],h=p[1];if(null!=l&&h&&l===h||0===l)return _.resetCount(t,s),"continue";_.setCount(t,s,null!=h?h+1:1),o[s]=j(f,c,t)},i=0,u=e.length;i<u;i++)a(i);return o}function x(t,n,r,e){void 0===e&&(e=!1);var o=r.get(n,t);if(!o&&!e)throw new Error("Mapping not found for source "+n.toString()+" and destination "+t.toString());return o}function P(t,n){for(var e=t[2],o=n[2],a=function(t,n){var a=o[t],i=a[0],u=a[1];if(e.map((function(t){return t[0]})).some((function(t){return t===i})))return"continue";e.push([i,Object.seal(r({},u))])},i=0,u=o.length;i<u;i++)a(i);t[4]=[n[0][0],n[0][1]]}function N(t){for(var n=j(t[0][0]),r=Object.getPrototypeOf(n),e=[],o=t[2],a=o.length,i=function(){var i,u=o[a][1],s=u.paths,c=u.transformation,f=s[0],p=s[1];return p||1===c.type||4===c.type?(i=p||C(c.mapFn[2]),!n.hasOwnProperty(i)&&!r.hasOwnProperty(i)||e.some((function(t){return t[0]===i}))?"continue":void e.push([i,Object.seal({paths:[i,f],transformation:{type:6,preCond:void 0,mapFn:O(t[1][0]?void 0:null,f)}})])):"continue"};a--;)i();return e}function E(t,n,r,e){var o=r[0],a=r[1],i=C(n);null==a&&(a=o,o=void 0);var u="";b(a,1,4)&&(u=C(a[1]));var s=Object.seal({paths:u?[i,u]:[i],transformation:{mapFn:a,type:a[0],preCond:o}}),c=t[2].find((function(t){return t[0]===i}));return null!=c?(c[1]=s,e):(t[2].push([i,s]),e)}function k(t,n,r,e){var o=v.getMetadataForKey(t,n)[1]();if(!o||Array.isArray(o))throw new Error("Metadata for "+n+" is a primitive or Array. Consider manual map this property");var a=e.get(r,o);if(!a)throw new Error("Mapping for "+n+" cannot be found. Consider manual map this property with MapWith");return a}function I(t){var n=t[0];if(1===t.length)return[n];if(3===t.length)return[n,t[1],t[2]];var r=t[1];return"function"!=typeof r&&!M(r)||r.beforeMap||r.afterMap?[n,void 0,r]:[n,r]}function T(t,n,r,e,o,a){return b(t,7)?t[2](n,r):b(t,2)?t[2](n,a,r):b(t,1)?t[2](n,e):b(t,4)?t[2](n,o):b(t,5)?t[2](n):b(t,3)?t[2]():b(t,0)?a:T(t[2](n,r),n,r,e,o,a)}function D(t,e,o,a,i){void 0===o&&(o={beforeMap:void 0,afterMap:void 0}),void 0===i&&(i=!1);var u=e[0],s=u[0],c=u[1],f=e[1],p=f[0],l=f[1],h=f[2],v=e[2],g=e[3];t instanceof s||(t=j(s,t));var d=p?void 0:null,C=g[0],S=g[1],O=o.beforeMap,_=o.afterMap,P=[],N=j(c);i||(O?O(t,N,r({},e)):C&&C(t,N,r({},e)));for(var E=v.length;E--;){var I=v[E],U=I[0],B=I[1].transformation;if(P.push(U),!B.preCond||B.preCond[0](t)){var R=w([l,h],U);if(b(B.mapFn,6)){var W=B.mapFn[2](t);if(null==W){n(N,U,d);continue}if(y(W)){if(W instanceof Date){n(N,U,new Date(W));continue}if(Array.isArray(W)){var z=W[0];if(m(z)){n(N,U,[]);continue}if(!y(z)){n(N,U,W.slice());continue}var G=k(c,U,z.constructor,a);n(N,U,F(W,G,void 0,a));continue}}if(("object"==typeof W||"function"==typeof W)&&M(W)){var Z=x(A(N,null,U).constructor,W.constructor,a);n(N,U,D(W,Z,void 0,a));continue}n(N,U,W)}else n(N,U,T(B.mapFn,t,R,N,a,d))}else{var L;n(N,U,null!==(L=B.preCond[1])&&void 0!==L?L:d)}}return i||(_?_(t,N,r({},e)):S&&S(t,N,r({},e))),function(t,n,r,e){var o=Object.keys(t).filter((function(t){return!n.includes(t)}));if(o.length>0)throw new Error("\nError mapping:\n- Source: "+r.toString()+"\n- Destination: "+e.toString()+"\n\nUnmapped properties:\n-------------------\n"+o.join(",\n")+"\n")}(N,P,s,c),N}function F(t,n,e,o){void 0===e&&(e={beforeMap:void 0,afterMap:void 0});var a=[],i=e.beforeMap,u=e.afterMap;i&&i(t,a,r({},n));for(var s=0,c=t.length;s<c;s++)a.push(D(t[s],n,{},o,!0));return u&&u(t,a,r({},n)),a}var U=function(){function t(){}return t.explore=function(t,n){this.exploreInternal(t),this.exploreInternal(n)},t.exploreInternal=function(t){if(t.prototype&&!this.metadataTrackMap.has(t)){var n=t[this.AUTOMAPPER_METADATA_FACTORY];if(n){var r=n(),e=Object.entries(r),o=e.length;if(o){for(;o--;){var a=e[o],i=a[0],u=a[1];if(u){var s=u();d(t,s.prototype.constructor.name,i,s)}else d(t,"String",i)}this.metadataTrackMap.set(t,1)}}}},t}();U.metadataTrackMap=new Map,U.AUTOMAPPER_METADATA_FACTORY="__NARTC_AUTOMAPPER_METADATA_FACTORY";var B=function(){function t(){this._mappingStorage=new h,this._profileStorage=new g,this.setDefault()}var n,e=t.prototype;return e.withGlobalSettings=function(t){var n=t.useUndefined,r=t.sourceNamingConvention,e=t.destinationNamingConvention;return this.defaultGlobalSettings[0]=null!=n&&n,r&&(this.defaultGlobalSettings[1]=r),e&&(this.defaultGlobalSettings[2]=e),this},e.addProfile=function(t){return this._profileStorage.add(this,new t(this)),this},e.createMap=function(t,n,e){U.explore(t,n);var o=r({useUndefined:this.defaultGlobalSettings[0],sourceMemberNamingConvention:this.defaultGlobalSettings[1],destinationMemberNamingConvention:this.defaultGlobalSettings[2]},e);return function(t,n,r){var e;if(null===(e=n.includeBase)||void 0===e?void 0:e.length){var o=n.includeBase,a=x(o[1],o[0],r,!0);null!=a&&P(t,a)}var i={forMember:function(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];return E(t,n,e,i)},beforeMap:function(n){return t[3][0]=n,i},afterMap:function(n){return t[3][1]=n,i},reverseMap:function(){return function(t){var n={forPath:function(r){for(var e=arguments.length,o=new Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];return E(t,r,o,n)},beforeMap:function(r){return t[3][0]=r,n},afterMap:function(r){return t[3][1]=r,n}};return n}(function(t,n){var r=t[0],e=r[0],o=r[1],a=t[1],i=a[0],u=a[1],s=a[2],c=t[4],f=n.get(o,e);if(f)return f;var p=x((f=[[o,e],[i,s,u],N(t),[],(null==c?void 0:c.slice().reverse())||[]])[4][1],f[4][0],n,!0);return p&&P(f,p),n.set(o,e,f),f}(t,r))}};return i}(function(t,n,r,e){if(e.has(t,n))throw new Error("Mapping for source "+t.toString()+" and destination "+n.toString()+" already exists");var o=[[t,n],[r.useUndefined,r.sourceMemberNamingConvention,r.destinationMemberNamingConvention],[],[]];return function(t){var n=t[0],r=n[0],e=j(n[1]),o=j(r),i=Object.getPrototypeOf(o.constructor);i.name&&(o=Object.assign(o,j(i)));for(var u=Object.getPrototypeOf(o),s=function t(n,r,e){void 0===r&&(r="");for(var o=e||[],i=Object.getOwnPropertyNames(n),u=0,s=i.length;u<s;u++){var c=i[u],f=r+c;o.push(f);var p=n[c];if(y(p)){var l=[p];Array.isArray(p)&&(l=p);for(var h,v=a(l);!(h=v()).done;)for(var g,d=a(t(h.value,f+"."));!(g=d()).done;)o.push(g.value)}}return o}(e),c=t[1],f=c[0],p=c[1],l=c[2],h=s.length;h--;){var v=s[h],g=w([p,l],v),d=g.split(".");if(!(d.length>1&&(!o.hasOwnProperty(d[0])||o[d[0]]&&M(o[d[0]])))){var m=f?void 0:null;if(!o.hasOwnProperty(g)&&!u.hasOwnProperty(g)&&"continue"===function(){var n=new p,r=g.split(n.splittingExpression).filter(Boolean).filter((function(t){return"."!==t})),e=r[0],a=r.slice(1);if(!a.length||!o.hasOwnProperty(e))return"continue";var i=[[e].concat(a.map((function(t){return n.transformPropertyName([t])}))).join(".")];return a.length>1&&i.push([e].concat(n.transformPropertyName(a)).join(".")),t[2].push([v,Object.seal({paths:[v],transformation:{type:6,preCond:void 0,mapFn:O.apply(void 0,[m].concat(i))}})]),"continue"}())continue;t[2].push([v,Object.seal({paths:[v,g],transformation:{type:6,preCond:void 0,mapFn:O(m,g)}})])}}}(o),e.set(t,n,o),o}(t,n,o,this._mappingStorage),o,this._mappingStorage)},e.map=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var o=I(r),a=o[0],i=o[1],u=o[2],s=x(a,i||t.constructor,this._mappingStorage);return D(t,s,u,this._mappingStorage)},e.mapAsync=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];var a=I(e),i=a[0],u=a[1],s=a[2],c=x(i,u||t.constructor,this._mappingStorage);return Promise.resolve().then((function(){return D(t,c,s,n._mappingStorage)}))},e.mapArray=function(t){if(!t.length)return[];for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var o=I(r),a=o[0],i=o[1],u=o[2],s=x(a,i||t[0].constructor,this._mappingStorage);return F(t,s,u,this._mappingStorage)},e.mapArrayAsync=function(t){var n=this;if(!t.length)return Promise.resolve().then((function(){return[]}));for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];var a=I(e),i=a[0],u=a[1],s=a[2],c=x(i,u||t[0].constructor,this._mappingStorage);return Promise.resolve().then((function(){return F(t,c,s,n._mappingStorage)}))},e.getMapping=function(t,n){return this._mappingStorage.get(t,n)},e.dispose=function(){this.setDefault(),this._mappingStorage.dispose(),_.dispose()},e.setDefault=function(){this._profileStorage.initialize(this),this.defaultGlobalSettings=[!1,c,c]},(n=[{key:"mappingStorage",get:function(){return this._mappingStorage}},{key:"profileStorage",get:function(){return this._profileStorage}}])&&function(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}(t.prototype,n),t}(),R=new B;exports.AutoMap=function(t,n){return void 0===n&&(n=0),function(r,e){if(t)v.addMetadata(r.constructor,[[e,t]]),_.set(r.constructor,e,n);else{var o=Reflect.getMetadata("design:type",r,e);o&&d(r.constructor,o.prototype.constructor.name,e)}}},exports.AutoMapper=B,exports.CamelCaseNamingConvention=i,exports.Mapper=R,exports.PascalCaseNamingConvention=s,exports.ProfileBase=function(){this.profileName=this.constructor.name},exports.SnakeCaseNamingConvention=u,exports.condition=function(t,n){return[2,null,function(r,e){if(t(r)){for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i<o;i++)a[i-2]=arguments[i];return A.apply(void 0,[r,e].concat(a))}return n||e}]},exports.convertUsing=function(t,n){return[5,null,function(r){var e;return e=n?n(r):r,t.convert(e)}]},exports.createMapMetadata=function(t,n){var r=Object.entries(n),e=r.length;if(e)for(;e--;){var o,a=r[e],i=a[1];d(t,(null===(o=i.prototype)||void 0===o?void 0:o.constructor.name)||i.constructor.name,a[0],i)}},exports.defaultNamingConvention=c,exports.fromValue=function(t){return[3,null,function(){return t}]},exports.ignore=function(){return[0,null,function(){}]},exports.mapDefer=function(t){return[8,null,t]},exports.mapFrom=function(t){return[1,t,function(n,r){return"resolve"in t?t.resolve(n,r):t(n)}]},exports.mapWith=function(t,n,r){return[4,n,function(e,o){var a=n(e);return Array.isArray(a)?m(a[0])?[]:F(a,x(t,(null==r?void 0:r())||a[0].constructor,o),void 0,o):m(a)?null:M(a)?D(a,x(t,(null==r?void 0:r())||a.constructor,o),void 0,o):(console.warn("MapWith was invoked with a primitive. No mapping was executed"),null)}]},exports.nullSubstitution=function(t){return[7,null,function(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];return A.apply(void 0,[n,t].concat(e))}]},exports.preCondition=function(t,n){return[function(n){return t(n)},n]};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("reflect-metadata");var t,n=(t=require("lodash.set"))&&"object"==typeof t&&"default"in t?t.default:t;function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function a(t){var n=0;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,n){if(t){if("string"==typeof t)return o(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,void 0):void 0}}(t)))return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var i=function(){function t(){this.separatorCharacter="",this.splittingExpression=/(^[a-z]+(?=$|[A-Z]{1}[a-z0-9]+)|[A-Z]?[a-z0-9]+)/}return t.prototype.transformPropertyName=function(t){for(var n="",r=0,e=t.length;r<e;r++)n+=0===r?t[r].charAt(0).toLowerCase():t[r].charAt(0).toUpperCase(),n+=t[r].substr(1);return n},t}(),u=function(){function t(){this.separatorCharacter="_",this.splittingExpression=/_/}return t.prototype.transformPropertyName=function(t){return t.length<=1?t[0].toLowerCase()||"":t.map((function(t){return t.toLowerCase()})).join(this.separatorCharacter)},t}(),s=function(){function t(){this.separatorCharacter="",this.splittingExpression=/(^[A-Z]+(?=$|[A-Z]{1}[a-z0-9]+)|[A-Z]?[a-z0-9]+)/}return t.prototype.transformPropertyName=function(t){for(var n="",r=0,e=t.length;r<e;r++)n+=t[r].charAt(0).toUpperCase()+t[r].substr(1);return n},t}(),c=i,p=function(){function t(){this.storage=new WeakMap}var n=t.prototype;return n.set=function(t,n,r){this.setInternal(this.storage,t,n,r)},n.get=function(t,n){return this.getInternal(this.storage,t,n)},n.has=function(t,n){return this.hasInternal(this.storage,t,n)},n.getInternal=function(t,n,r){var e;return null===(e=t.get(n))||void 0===e?void 0:e.get(r)},n.hasInternal=function(t,n,r){var e;return(null===(e=t.get(n))||void 0===e?void 0:e.has(r))||!1},t}(),f=function(t){function n(){return t.call(this)||this}e(n,t);var r=n.prototype;return r.dispose=function(){this.storage=new WeakMap},r.setInternal=function(t,n,r,e){t.has(n)?this.hasInternal(t,n,r)||t.get(n).set(r,e):t.set(n,(new WeakMap).set(r,e))},n}(p),l=function(t){function n(){return t.call(this)||this}return e(n,t),n.prototype.setInternal=function(t,n,r,e){t.has(n)?this.hasInternal(t,n,r)||t.get(n).set(r,e):t.set(n,(new Map).set(r,e))},n}(p),h=function(t){function n(){return t.call(this)||this}return e(n,t),n}(f),g=new(function(){function t(){this._metadataMap=new Map}var n=t.prototype;return n.getMetadata=function(t){var n=this._metadataMap.get(t),r=(null==n?void 0:n.length)||0;if(!r){var e=Object.getPrototypeOf(t);return e?this.getMetadata(e):n}for(var o=[],a=function(){var t=n[r][0];if(o.some((function(n){return n[0]===t})))return"continue";o.push(n[r])};r--;)a();return o},n.getMetadataForKey=function(t,n){return this.getMetadata(t).find((function(t){return t[0]===n}))},n.addMetadata=function(t,n){for(var r,e=this._metadataMap.get(t)||[],o=Object.getPrototypeOf(t),i=o&&o.name&&this._metadataMap.get(o)||[],u=[].concat(i,e),s=a(u);!(r=s()).done;)if(n[0][0]===r.value[0])return;this._metadataMap.set(t,[].concat(u,n))},t}()),v=function(){function t(){this.profiles=new WeakMap}var n=t.prototype;return n.initialize=function(t){this.profiles.set(t,[])},n.add=function(t,n){var r=this.profiles.get(t);if(r.some((function(t){return t.profileName===n.profileName})))throw new Error(n.profileName+" already exists on this mapper instance");r.push(n)},t}();function d(t,n,r,e){switch(n){case"String":case"Number":case"Boolean":g.addMetadata(t,[[r,function(){return!1}]]);break;case"Date":g.addMetadata(t,[[r,function(){return Date}]]);break;case"Array":g.addMetadata(t,[[r,function(){return[]}]]);break;default:g.addMetadata(t,[[r,function(){return e}]])}}function m(t){return Array.isArray(t)?!t.length:t instanceof Map?!t.size:!t||!Object.keys(t).length}function y(t){return Array.isArray(t)||t instanceof Date||"[object Object]"===Object.prototype.toString.call(t)}function A(t){return("object"==typeof t||"function"==typeof t)&&t.constructor&&(/^\s*function/.test(t.constructor.toString())||/^\s*class/.test(t.constructor.toString()))&&t.constructor.toString().includes(t.constructor.name)}function b(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.some((function(n){return t[0]===n}))}function M(t,n){function r(t,r){var e=r.split(".").filter(Boolean).reduce((function(t,n){return t&&t[n]}),t);return null!=e?e:n}for(var e=arguments.length,o=new Array(e>2?e-2:0),a=2;a<e;a++)o[a-2]=arguments[a];for(var i=r(t,o[0]),u=1,s=o.length;u<s;u++)i=r(null==i?t:i,o[u]);return i}function w(t,n){var r=t[0],e=t[1],o=n.split(".");if(o.length>1)return o.map((function(t){return w([r,e],t)})).join(".");var a=n.split((new e).splittingExpression).filter(Boolean);return a.length?(new r).transformPropertyName(a):n}function S(t){var n=t.toString();return function(t){return/^[^{]+?=>/gm.test(t)}(n)?C(function(t){var n,r=t.replace(/(?:\s|;|{|}|\(|\)|)+/gm,"").split(/=>(.+)/),e=r[1],o=e.match(/return/g);return(null==o?void 0:o.length)&&o.length>1?(n=[r[0]]).concat.apply(n,e.split(/return(.+)/).filter(Boolean)):r}(n)):C(function(t){return t.replace(/(?:\s|function|;|{|}|\(|\)|)+/gm,"").split(/return(.+)/)}(n))}function C(t){var n=t.join("").split(new RegExp(t[0]+"\\.{1}","g")).filter(Boolean).slice(1);return 1===n.length?n.pop():""}function O(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return[6,null,function(n){return M.apply(void 0,[n,t].concat(r))}]}var _=new(function(t){function n(){var n;return(n=t.call(this)||this).recursiveCounts=new WeakMap,n}e(n,t);var r=n.prototype;return r.getDepthAndCount=function(t,n){return[this.get(t,n),this.getCount(t,n)]},r.setCount=function(t,n,r){this.recursiveCounts.has(t)?this.recursiveCounts.get(t).set(n,r):this.setInternal(this.recursiveCounts,t,n,r)},r.resetCount=function(t,n){var r;null===(r=this.recursiveCounts.get(t))||void 0===r||r.set(n,0)},r.getCount=function(t,n){return this.getInternal(this.recursiveCounts,t,n)},r.dispose=function(){this.recursiveCounts=new WeakMap},n}(l));function j(t,n,r){var e=g.getMetadata(t),o=n?Object.assign(new t,n):new t;if(m(e)||!e)return o;for(var a=function(a,i){var u=e[a],s=u[0],c=o[s],p=(0,u[1])();if(!p)return o[s]=null!=c?c:void 0,"continue";if(Array.isArray(p))return o[s]=null!=c?c:p,"continue";if("Date"===p.prototype.constructor.name||"Moment"===p.prototype.constructor.name)return o[s]=null!=c?new p(c):new p,"continue";if(Array.isArray(c))return o[s]=c.map((function(t){return j(p,t)})),"continue";if(null==c&&null!=n)return o[s]=c,"continue";if(null==r||p!==r||null!=c)return o[s]=j(p,c,t),"continue";var f=_.getDepthAndCount(t,s),l=f[0],h=f[1];if(null!=l&&h&&l===h||0===l)return _.resetCount(t,s),"continue";_.setCount(t,s,null!=h?h+1:1),o[s]=j(p,c,t)},i=0,u=e.length;i<u;i++)a(i);return o}function x(t,n,r,e){void 0===e&&(e=!1);var o=r.get(n,t);if(!o&&!e)throw new Error("Mapping not found for source "+n.toString()+" and destination "+t.toString());return o}function P(t,n){for(var e=t[2],o=n[2],a=function(t,n){var a=o[t],i=a[0],u=a[1];if(e.map((function(t){return t[0]})).some((function(t){return t===i})))return"continue";e.push([i,Object.seal(r({},u))])},i=0,u=o.length;i<u;i++)a(i);t[4]=[n[0][0],n[0][1]]}function k(t){for(var n=j(t[0][0]),r=Object.getPrototypeOf(n),e=[],o=t[2],a=o.length,i=function(){var i,u=o[a][1],s=u.paths,c=u.transformation,p=s[0],f=s[1];return f||1===c.type||4===c.type?(i=f||S(c.mapFn[2]),!n.hasOwnProperty(i)&&!r.hasOwnProperty(i)||e.some((function(t){return t[0]===i}))?"continue":void e.push([i,Object.seal({paths:[i,p],transformation:{type:6,preCond:void 0,mapFn:O(t[1][0]?void 0:null,p)}})])):"continue"};a--;)i();return e}function N(t,n,r,e){var o=r[0],a=r[1],i=S(n);null==a&&(a=o,o=void 0);var u="";b(a,1,4)&&(u=S(a[1]));var s=Object.seal({paths:u?[i,u]:[i],transformation:{mapFn:a,type:a[0],preCond:o}}),c=t[2].find((function(t){return t[0]===i}));return null!=c?(c[1]=s,e):(t[2].push([i,s]),e)}function U(t,n,r,e){var o=g.getMetadataForKey(t,n)[1]();if(!o||Array.isArray(o))throw new Error("Metadata for "+n+" is a primitive or Array. Consider manual map this property");var a=e.get(r,o);if(!a)throw new Error("Mapping for "+n+" cannot be found. Consider manual map this property with MapWith");return a}function E(t,n){var e=t[0],o={skipUnmappedAssertion:n,beforeMap:void 0,afterMap:void 0};if(1===t.length)return[e,o];if(3===t.length)return[e,r(r({},o),t[2]),t[1]];var a=t[1];return"function"!=typeof a&&!A(a)||a.beforeMap||a.afterMap?[e,r(r({},o),a)]:[e,o,a]}function I(t,n,r,e,o,a){return b(t,7)?t[2](n,r):b(t,2)?t[2](n,a,r):b(t,1)?t[2](n,e):b(t,4)?t[2](n,o):b(t,5)?t[2](n):b(t,3)?t[2]():b(t,0)?a:I(t[2](n,r),n,r,e,o,a)}function T(t,e,o,a,i){void 0===i&&(i=!1);var u=e[0],s=u[0],c=u[1],p=e[1],f=p[0],l=p[1],h=p[2],g=e[2],v=e[3];t instanceof s||(t=j(s,t));var d=f?void 0:null,S=v[0],C=v[1],O=o.skipUnmappedAssertion,_=o.beforeMap,P=o.afterMap,k=[],N=j(c);i||(_?_(t,N,r({},e)):S&&S(t,N,r({},e)));for(var E=g.length;E--;){var F=g[E],G=F[0],B=F[1].transformation;if(k.push(G),!B.preCond||B.preCond[0](t)){var R=w([l,h],G);if(b(B.mapFn,6)){var W=B.mapFn[2](t);if(null==W){n(N,G,d);continue}if(y(W)){if(W instanceof Date){n(N,G,new Date(W));continue}if(Array.isArray(W)){var z=W[0];if(m(z)){n(N,G,[]);continue}if(!y(z)){n(N,G,W.slice());continue}var Z=U(c,G,z.constructor,a);n(N,G,D(W,Z,{skipUnmappedAssertion:o.skipUnmappedAssertion},a));continue}}if(("object"==typeof W||"function"==typeof W)&&A(W)){var L=x(M(N,null,G).constructor,W.constructor,a);n(N,G,T(W,L,{skipUnmappedAssertion:o.skipUnmappedAssertion},a));continue}n(N,G,W)}else n(N,G,I(B.mapFn,t,R,N,a,d))}else{var Y;n(N,G,null!==(Y=B.preCond[1])&&void 0!==Y?Y:d)}}return i||(P?P(t,N,r({},e)):C&&C(t,N,r({},e))),O||function(t,n,r,e){var o=Object.keys(t).filter((function(t){return!n.includes(t)}));if(o.length>0)throw new Error("\nError mapping:\n- Source: "+r.toString()+"\n- Destination: "+e.toString()+"\n\nUnmapped properties:\n-------------------\n"+o.join(",\n")+"\n")}(N,k,s,c),N}function D(t,n,e,o){var a=[],i=e.beforeMap,u=e.afterMap;i&&i(t,a,r({},n));for(var s=0,c=t.length;s<c;s++)a.push(T(t[s],n,{skipUnmappedAssertion:e.skipUnmappedAssertion},o,!0));return u&&u(t,a,r({},n)),a}var F=function(){function t(){}return t.explore=function(t,n){this.exploreInternal(t),this.exploreInternal(n)},t.exploreInternal=function(t){if(t.prototype&&!this.metadataTrackMap.has(t)){var n=t[this.AUTOMAPPER_METADATA_FACTORY];if(n){var r=n(),e=Object.entries(r),o=e.length;if(o){for(;o--;){var a=e[o],i=a[0],u=a[1];if(u){var s=u();d(t,s.prototype.constructor.name,i,s)}else d(t,"String",i)}this.metadataTrackMap.set(t,1)}}}},t}();F.metadataTrackMap=new Map,F.AUTOMAPPER_METADATA_FACTORY="__NARTC_AUTOMAPPER_METADATA_FACTORY";var G=function(){function t(){this._mappingStorage=new h,this._profileStorage=new v,this.setDefault()}var n,e=t.prototype;return e.withGlobalSettings=function(t){var n=t.useUndefined,r=t.skipUnmappedAssertion,e=t.sourceNamingConvention,o=t.destinationNamingConvention;return this.defaultGlobalSettings[0]=null!=n&&n,this.defaultGlobalSettings[1]=null!=r&&r,e&&(this.defaultGlobalSettings[2]=e),o&&(this.defaultGlobalSettings[3]=o),this},e.addProfile=function(t){return this._profileStorage.add(this,new t(this)),this},e.createMap=function(t,n,e){F.explore(t,n);var o=r({useUndefined:this.defaultGlobalSettings[0],sourceMemberNamingConvention:this.defaultGlobalSettings[2],destinationMemberNamingConvention:this.defaultGlobalSettings[3]},e);return function(t,n,r){var e;if(null===(e=n.includeBase)||void 0===e?void 0:e.length){var o=n.includeBase,a=x(o[1],o[0],r,!0);null!=a&&P(t,a)}var i={forMember:function(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];return N(t,n,e,i)},beforeMap:function(n){return t[3][0]=n,i},afterMap:function(n){return t[3][1]=n,i},reverseMap:function(){return function(t){var n={forPath:function(r){for(var e=arguments.length,o=new Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];return N(t,r,o,n)},beforeMap:function(r){return t[3][0]=r,n},afterMap:function(r){return t[3][1]=r,n}};return n}(function(t,n){var r=t[0],e=r[0],o=r[1],a=t[1],i=a[0],u=a[1],s=a[2],c=t[4],p=n.get(o,e);if(p)return p;var f=x((p=[[o,e],[i,s,u],k(t),[],(null==c?void 0:c.slice().reverse())||[]])[4][1],p[4][0],n,!0);return f&&P(p,f),n.set(o,e,p),p}(t,r))}};return i}(function(t,n,r,e){if(e.has(t,n))throw new Error("Mapping for source "+t.toString()+" and destination "+n.toString()+" already exists");var o=[[t,n],[r.useUndefined,r.sourceMemberNamingConvention,r.destinationMemberNamingConvention],[],[]];return function(t){var n=t[0],r=n[0],e=j(n[1]),o=j(r),i=Object.getPrototypeOf(o.constructor);i.name&&(o=Object.assign(o,j(i)));for(var u=Object.getPrototypeOf(o),s=function t(n,r,e){void 0===r&&(r="");for(var o=e||[],i=Object.getOwnPropertyNames(n),u=0,s=i.length;u<s;u++){var c=i[u],p=r+c;o.push(p);var f=n[c];if(y(f)){var l=[f];Array.isArray(f)&&(l=f);for(var h,g=a(l);!(h=g()).done;)for(var v,d=a(t(h.value,p+"."));!(v=d()).done;)o.push(v.value)}}return o}(e),c=t[1],p=c[0],f=c[1],l=c[2],h=s.length;h--;){var g=s[h],v=w([f,l],g),d=v.split(".");if(!(d.length>1&&(!o.hasOwnProperty(d[0])||o[d[0]]&&A(o[d[0]])))){var m=p?void 0:null;if(!o.hasOwnProperty(v)&&!u.hasOwnProperty(v)&&"continue"===function(){var n=new f,r=v.split(n.splittingExpression).filter(Boolean).filter((function(t){return"."!==t})),e=r[0],a=r.slice(1);if(!a.length||!o.hasOwnProperty(e))return"continue";var i=[[e].concat(a.map((function(t){return n.transformPropertyName([t])}))).join(".")];return a.length>1&&i.push([e].concat(n.transformPropertyName(a)).join(".")),t[2].push([g,Object.seal({paths:[g],transformation:{type:6,preCond:void 0,mapFn:O.apply(void 0,[m].concat(i))}})]),"continue"}())continue;t[2].push([g,Object.seal({paths:[g,v],transformation:{type:6,preCond:void 0,mapFn:O(m,v)}})])}}}(o),e.set(t,n,o),o}(t,n,o,this._mappingStorage),o,this._mappingStorage)},e.map=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var o=E(r,this.defaultGlobalSettings[1]),a=o[0],i=o[1],u=o[2],s=x(a,u||t.constructor,this._mappingStorage);return T(t,s,i,this._mappingStorage)},e.mapAsync=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];var a=E(e,this.defaultGlobalSettings[1]),i=a[0],u=a[1],s=a[2],c=x(i,s||t.constructor,this._mappingStorage);return Promise.resolve().then((function(){return T(t,c,u,n._mappingStorage)}))},e.mapArray=function(t){if(!t.length)return[];for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var o=E(r,this.defaultGlobalSettings[1]),a=o[0],i=o[1],u=o[2],s=x(a,u||t[0].constructor,this._mappingStorage);return D(t,s,i,this._mappingStorage)},e.mapArrayAsync=function(t){var n=this;if(!t.length)return Promise.resolve().then((function(){return[]}));for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];var a=E(e,this.defaultGlobalSettings[1]),i=a[0],u=a[1],s=a[2],c=x(i,s||t[0].constructor,this._mappingStorage);return Promise.resolve().then((function(){return D(t,c,u,n._mappingStorage)}))},e.getMapping=function(t,n){return this._mappingStorage.get(t,n)},e.dispose=function(){this.setDefault(),this._mappingStorage.dispose(),_.dispose()},e.setDefault=function(){this._profileStorage.initialize(this),this.defaultGlobalSettings=[!1,!1,c,c]},(n=[{key:"mappingStorage",get:function(){return this._mappingStorage}},{key:"profileStorage",get:function(){return this._profileStorage}}])&&function(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}(t.prototype,n),t}(),B=new G;exports.AutoMap=function(t,n){return void 0===n&&(n=0),function(r,e){if(t)g.addMetadata(r.constructor,[[e,t]]),_.set(r.constructor,e,n);else{var o=Reflect.getMetadata("design:type",r,e);o&&d(r.constructor,o.prototype.constructor.name,e)}}},exports.AutoMapper=G,exports.CamelCaseNamingConvention=i,exports.Mapper=B,exports.PascalCaseNamingConvention=s,exports.ProfileBase=function(){this.profileName=this.constructor.name},exports.SnakeCaseNamingConvention=u,exports.condition=function(t,n){return[2,null,function(r,e){if(t(r)){for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i<o;i++)a[i-2]=arguments[i];return M.apply(void 0,[r,e].concat(a))}return n||e}]},exports.convertUsing=function(t,n){return[5,null,function(r){var e;return e=n?n(r):r,t.convert(e)}]},exports.createMapMetadata=function(t,n){var r=Object.entries(n),e=r.length;if(e)for(;e--;){var o,a=r[e],i=a[1];d(t,(null===(o=i.prototype)||void 0===o?void 0:o.constructor.name)||i.constructor.name,a[0],i)}},exports.defaultNamingConvention=c,exports.fromValue=function(t){return[3,null,function(){return t}]},exports.ignore=function(){return[0,null,function(){}]},exports.mapDefer=function(t){return[8,null,t]},exports.mapFrom=function(t){return[1,t,function(n,r){return"resolve"in t?t.resolve(n,r):t(n)}]},exports.mapWith=function(t,n,r){return[4,n,function(e,o){var a=n(e);return Array.isArray(a)?m(a[0])?[]:D(a,x(t,(null==r?void 0:r())||a[0].constructor,o),{skipUnmappedAssertion:!0},o):m(a)?null:A(a)?T(a,x(t,(null==r?void 0:r())||a.constructor,o),{skipUnmappedAssertion:!0},o):(console.warn("MapWith was invoked with a primitive. No mapping was executed"),null)}]},exports.nullSubstitution=function(t){return[7,null,function(n){for(var r=arguments.length,e=new Array(r>1?r-1:0),o=1;o<r;o++)e[o-1]=arguments[o];return M.apply(void 0,[n,t].concat(e))}]},exports.preCondition=function(t,n){return[function(n){return t(n)},n]};
//# sourceMappingURL=automapper.cjs.production.min.js.map

@@ -1073,11 +1073,16 @@ import 'reflect-metadata';

function getMapProps(args) {
function getMapProps(args, skipUnmappedAssertion) {
var destination = args[0];
var defaultOptions = {
skipUnmappedAssertion: skipUnmappedAssertion,
beforeMap: undefined,
afterMap: undefined
};
if (args.length === 1) {
return [destination];
return [destination, defaultOptions];
}
if (args.length === 3) {
return [destination, args[1], args[2]];
return [destination, _extends(_extends({}, defaultOptions), args[2]), args[1]];
}

@@ -1088,6 +1093,6 @@

if ((typeof temp === 'function' || isClass(temp)) && !temp['beforeMap'] && !temp['afterMap']) {
return [destination, temp];
return [destination, defaultOptions, temp];
}
return [destination, undefined, temp];
return [destination, _extends(_extends({}, defaultOptions), temp)];
}

@@ -1144,9 +1149,2 @@

function map(sourceObj, mapping, options, mappingStorage, isArrayMap) {
if (options === void 0) {
options = {
beforeMap: undefined,
afterMap: undefined
};
}
if (isArrayMap === void 0) {

@@ -1177,5 +1175,5 @@ isArrayMap = false;

afterAction = actions[1];
var _options = options,
beforeMap = _options.beforeMap,
afterMap = _options.afterMap;
var skipUnmappedAssertion = options.skipUnmappedAssertion,
beforeMap = options.beforeMap,
afterMap = options.afterMap;
var configKeys = [];

@@ -1239,3 +1237,5 @@ var destination = instantiate(destinationModel);

var nestedMapping = getMappingForNestedKey(destinationModel, memberPath, first.constructor, mappingStorage);
set(destination, memberPath, mapArray(mapInitializeValue, nestedMapping, undefined, mappingStorage));
set(destination, memberPath, mapArray(mapInitializeValue, nestedMapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage));
continue;

@@ -1248,3 +1248,5 @@ }

set(destination, memberPath, map(mapInitializeValue, _nestedMapping, undefined, mappingStorage));
set(destination, memberPath, map(mapInitializeValue, _nestedMapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage));
continue;

@@ -1268,3 +1270,6 @@ }

assertMappingConfiguration(destination, configKeys, sourceModel, destinationModel);
if (!skipUnmappedAssertion) {
assertMappingConfiguration(destination, configKeys, sourceModel, destinationModel);
}
return destination;

@@ -1284,13 +1289,5 @@ }

function mapArray(sourceArray, mapping, options, mappingStorage) {
if (options === void 0) {
options = {
beforeMap: undefined,
afterMap: undefined
};
}
var destination = [];
var _options2 = options,
beforeMap = _options2.beforeMap,
afterMap = _options2.afterMap;
var beforeMap = options.beforeMap,
afterMap = options.afterMap;

@@ -1302,3 +1299,5 @@ if (beforeMap) {

for (var i = 0, len = sourceArray.length; i < len; i++) {
destination.push(map(sourceArray[i], mapping, {}, mappingStorage, true));
destination.push(map(sourceArray[i], mapping, {
skipUnmappedAssertion: options.skipUnmappedAssertion
}, mappingStorage, true));
}

@@ -1380,12 +1379,14 @@

var useUndefined = settings.useUndefined,
skipUnmappedAssertion = settings.skipUnmappedAssertion,
sourceNamingConvention = settings.sourceNamingConvention,
destinationNamingConvention = settings.destinationNamingConvention;
this.defaultGlobalSettings[0] = useUndefined !== null && useUndefined !== void 0 ? useUndefined : false;
this.defaultGlobalSettings[1] = skipUnmappedAssertion !== null && skipUnmappedAssertion !== void 0 ? skipUnmappedAssertion : false;
if (sourceNamingConvention) {
this.defaultGlobalSettings[1] = sourceNamingConvention;
this.defaultGlobalSettings[2] = sourceNamingConvention;
}
if (destinationNamingConvention) {
this.defaultGlobalSettings[2] = destinationNamingConvention;
this.defaultGlobalSettings[3] = destinationNamingConvention;
}

@@ -1420,4 +1421,4 @@

useUndefined: this.defaultGlobalSettings[0],
sourceMemberNamingConvention: this.defaultGlobalSettings[1],
destinationMemberNamingConvention: this.defaultGlobalSettings[2]
sourceMemberNamingConvention: this.defaultGlobalSettings[2],
destinationMemberNamingConvention: this.defaultGlobalSettings[3]
}, options);

@@ -1434,6 +1435,6 @@

var _getMapProps = getMapProps(args),
var _getMapProps = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps[0],
source = _getMapProps[1],
options = _getMapProps[2];
options = _getMapProps[1],
source = _getMapProps[2];

@@ -1451,6 +1452,6 @@ var mapping = getMappingForDestination(destination, source || sourceObj.constructor, this._mappingStorage);

var _getMapProps2 = getMapProps(args),
var _getMapProps2 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps2[0],
source = _getMapProps2[1],
options = _getMapProps2[2];
options = _getMapProps2[1],
source = _getMapProps2[2];

@@ -1472,6 +1473,6 @@ var mapping = getMappingForDestination(destination, source || sourceObj.constructor, this._mappingStorage);

var _getMapProps3 = getMapProps(args),
var _getMapProps3 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps3[0],
source = _getMapProps3[1],
options = _getMapProps3[2];
options = _getMapProps3[1],
source = _getMapProps3[2];

@@ -1495,6 +1496,6 @@ var mapping = getMappingForDestination(destination, source || sourceArr[0].constructor, this._mappingStorage);

var _getMapProps4 = getMapProps(args),
var _getMapProps4 = getMapProps(args, this.defaultGlobalSettings[1]),
destination = _getMapProps4[0],
source = _getMapProps4[1],
options = _getMapProps4[2];
options = _getMapProps4[1],
source = _getMapProps4[2];

@@ -1537,3 +1538,3 @@ var mapping = getMappingForDestination(destination, source || sourceArr[0].constructor, this._mappingStorage);

this.defaultGlobalSettings = [false, defaultNamingConvention, defaultNamingConvention];
this.defaultGlobalSettings = [false, false, defaultNamingConvention, defaultNamingConvention];
};

@@ -1624,3 +1625,5 @@

return mapArray(sourceValue, _mapping, undefined, mappingStorage);
return mapArray(sourceValue, _mapping, {
skipUnmappedAssertion: true
}, mappingStorage);
}

@@ -1638,3 +1641,5 @@

var mapping = getMappingForDestination(withDestination, (valueModel === null || valueModel === void 0 ? void 0 : valueModel()) || sourceValue.constructor, mappingStorage);
return map(sourceValue, mapping, undefined, mappingStorage);
return map(sourceValue, mapping, {
skipUnmappedAssertion: true
}, mappingStorage);
}];

@@ -1641,0 +1646,0 @@ }

import { Constructible, Dict, MapOptions } from '../types';
export declare function getMapProps<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(args: any[]): [Constructible<TDestination>, Constructible<TSource>?, MapOptions<TSource, TDestination>?];
export declare function getMapProps<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(args: any[], skipUnmappedAssertion: boolean): [Constructible<TDestination>, MapOptions<TSource, TDestination>, Constructible<TSource>?];
import { MappingStorage } from '../storages';
import { Dict, MapOptions, Mapping } from '../types';
export declare function map<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(sourceObj: TSource, mapping: Mapping<TSource, TDestination>, options: MapOptions<TSource, TDestination> | undefined, mappingStorage: MappingStorage, isArrayMap?: boolean): TDestination;
export declare function mapArray<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(sourceArray: TSource[], mapping: Mapping<TSource, TDestination>, options: MapOptions<TSource[], TDestination[]> | undefined, mappingStorage: MappingStorage): TDestination[];
export declare function map<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(sourceObj: TSource, mapping: Mapping<TSource, TDestination>, options: MapOptions<TSource, TDestination>, mappingStorage: MappingStorage, isArrayMap?: boolean): TDestination;
export declare function mapArray<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any>(sourceArray: TSource[], mapping: Mapping<TSource, TDestination>, options: MapOptions<TSource[], TDestination[]>, mappingStorage: MappingStorage): TDestination[];

@@ -32,2 +32,3 @@ import { MappingStorage } from './storages';

export interface MapOptions<TSource extends Dict<TSource> = any, TDestination extends Dict<TDestination> = any> {
skipUnmappedAssertion?: boolean;
beforeMap?: MapAction<TSource, TDestination>;

@@ -136,2 +137,3 @@ afterMap?: MapAction<TSource, TDestination>;

useUndefined?: boolean;
skipUnmappedAssertion?: boolean;
sourceNamingConvention?: Constructible<NamingConvention>;

@@ -138,0 +140,0 @@ destinationNamingConvention?: Constructible<NamingConvention>;

{
"name": "@nartc/automapper",
"version": "6.4.0",
"version": "6.5.0",
"license": "MIT",

@@ -105,3 +105,3 @@ "author": "Chau Tran",

"@commitlint/config-conventional": "9.1.1",
"@types/jest": "26.0.7",
"@types/jest": "26.0.8",
"@types/lodash.set": "4.3.6",

@@ -108,0 +108,0 @@ "commitizen": "4.1.2",

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