@simplysm/sd-core-common
Advanced tools
Comparing version 3.1.10 to 3.1.13
1427
dist/index.js
@@ -1,2 +0,1427 @@ | ||
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1);class i extends n.CustomError{constructor(t){super("인수가 잘못되었습니다: "+JSON.stringify(t))}}e.ArgumentError=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n extends Error{constructor(t,e){if(t instanceof Error||"string"==typeof e?super(e+(t instanceof Error?` => ${t.message}`:"")):super(t),Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name,Error.captureStackTrace)Error.captureStackTrace(this,new.target);else try{throw new Error(this.message)}catch(t){this.stack=t.stack}t instanceof Error&&t.stack&&(this.stack+="\n-- inner error stack --\n"+t.stack)}}e.CustomError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3),i=r(5),o=r(6),s=r(7);class u{static clone(t,e){return u._clone(t,e)}static _clone(t,e,r){var a,c,l,d;if(null!=t){if(t instanceof Array)return t.map(t=>e?u._clone(t,e):u._clone(t));if(t instanceof Date)return new Date(t.getTime());if(t instanceof n.DateTime)return new n.DateTime(t.tick);if(t instanceof i.DateOnly)return new i.DateOnly(t.tick);if(t instanceof o.Time)return new o.Time(t.tick);if(t instanceof s.Uuid)return new s.Uuid(t.toString());if("object"==typeof t){const n={};Object.setPrototypeOf(n,t.constructor.prototype);const i=null!=r?r:[];i.push({source:t,clone:n});for(const o of Object.keys(t).filter(t=>{var r,n;return!(null===(n=null===(r=e)||void 0===r?void 0:r.excludes)||void 0===n?void 0:n.includes(t))}))if(null==t[o])n[o]=void 0;else if(null===(c=null===(a=e)||void 0===a?void 0:a.useRefTypes)||void 0===c?void 0:c.includes(t[o].constructor))n[o]=t[o];else{const s=null===(l=r)||void 0===l?void 0:l.single(e=>e.source===t[o]);n[o]=s?s.clone:u._clone(t[o],{useRefTypes:null===(d=e)||void 0===d?void 0:d.useRefTypes},i)}return n}return t}}static merge(t,e){if(void 0===t)return u.clone(e);if(void 0===e)return u.clone(t);if("object"!=typeof e)return e;if(e instanceof Date||e instanceof n.DateTime||e instanceof i.DateOnly||e instanceof o.Time||e instanceof s.Uuid)return u.clone(e);if(typeof t!=typeof e)throw new Error("병합하려고 하는 두 객체의 타입이 서로 다릅니다.");const r=u.clone(t);for(const n of Object.keys(e))r[n]=u.merge(t[n],e[n]);return r}static equal(t,e,r){var s,a;if(t===e)return!0;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof o.Time&&e instanceof n.DateTime||t instanceof o.Time&&e instanceof i.DateOnly||t instanceof o.Time&&e instanceof o.Time)return t.tick===e.tick;if(t instanceof Array&&e instanceof Array){if(t.length!==e.length)return!1;if(null===(s=r)||void 0===s?void 0:s.ignoreArrayIndex)return t.every(t=>e.some(e=>u.equal(e,t,r)));for(let n=0;n<t.length;n++)if(!u.equal(t[n],e[n],r))return!1;return!0}if("object"==typeof t&&"object"==typeof e){const n=Object.keys(t).filter(e=>{var n,i,o,s;return(!(null===(n=r)||void 0===n?void 0:n.keys)||(null===(i=r)||void 0===i?void 0:i.keys.includes(e)))&&!(null===(s=null===(o=r)||void 0===o?void 0:o.excludes)||void 0===s?void 0:s.includes(e))&&void 0!==t[e]}),i=Object.keys(e).filter(t=>{var n,i,o,s;return(!(null===(n=r)||void 0===n?void 0:n.keys)||(null===(i=r)||void 0===i?void 0:i.keys.includes(t)))&&!(null===(s=null===(o=r)||void 0===o?void 0:o.excludes)||void 0===s?void 0:s.includes(t))&&void 0!==e[t]});if(n.length!==i.length)return!1;for(const i of n)if(!u.equal(t[i],e[i],{ignoreArrayIndex:null===(a=r)||void 0===a?void 0:a.ignoreArrayIndex}))return!1;return!0}return!1}static validate(t,e){let r;r=e instanceof Array?{type:e}:"function"==typeof e?{type:[e]}:{...e,type:e.type?e.type instanceof Array?e.type:[e.type]:void 0};const n={};if(r.notnull&&void 0===t&&(n.notnull=r.notnull),r.notnull||void 0!==t)return r.type&&!r.type.some(e=>{var r;return e===(null===(r=t)||void 0===r?void 0:r.constructor)})&&(n.type=r.type),r.validator&&!r.validator(t)&&(n.validator=r.validator),r.includes&&!r.includes.includes(t)&&(n.includes=r.includes),Object.keys(n).length>0?{value:t,invalidateDef:n}:void 0}static validateObject(t,e){const r={};for(const n of Object.keys(e)){const i=u.validate(t[n],e[n]);i&&(r[n]=i)}return r}static validateArray(t,e){const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=u.validateObject(i,"function"==typeof e?e(i):e);Object.keys(o).length>0&&r.push({index:n,item:i,result:o})}return r}static getChainValueByDepth(t,e,r,n){let i=t;for(let t=0;t<r;t++)i=n?i?i[e]:void 0:i[e];return i}static getChainValue(t,e,r){const n=e.split(".");let i=t;for(const t of n)i=r&&void 0===i?void 0:i[t];return i}static setChainValue(t,e,r){const n=e.split(".");let i=t;for(const t of n.slice(0,-1))i=i[t];i[n.last()]=r}static deleteChainValue(t,e){const r=e.split(".");let n=t;for(const t of r.slice(0,-1))n=n[t];delete n[r.last()]}static clearUndefined(t){if(void 0===t)return t;for(const e of Object.keys(t))void 0===t[e]&&delete t[e];return t}}e.ObjectUtil=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(0),i=r(4);class o{constructor(t,e,r,n,i,o,s){this._date=void 0===t?new Date:void 0!==e&&void 0!==r?new Date(t,e-1,null!=r?r:0,null!=n?n:0,null!=i?i:0,null!=o?o:0,null!=s?s:0):new Date(t)}static parse(t){const e=Date.parse(t);if(e&&!Number.isNaN(e))return new o(e);const r=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) (오전|오후) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/);if(r)return new o(Number(r[1]),Number(r[2]),Number(r[3]),Number(r[5])+("오후"===r[4]?12:0),Number(r[6]),Number(r[7]));if(t.match(/^[0-9]{14}$/))return new o(Number(t.substr(0,4)),Number(t.substr(4,2)),Number(t.substr(6,2)),Number(t.substr(8,2)),Number(t.substr(10,2)),Number(t.substr(12,2)));const i=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3}))?$/);if(i)return new o(Number(i[1]),Number(i[2]),Number(i[3]),Number(i[4]),Number(i[5]),Number(i[6]),i[7]?Number(i[8]):void 0);throw new n.ArgumentError({str:t})}get year(){return this._date.getFullYear()}set year(t){this._date.setFullYear(t)}get month(){return this._date.getMonth()+1}set month(t){this._date.setMonth(t-1)}get day(){return this._date.getDate()}set day(t){this._date.setDate(t)}get hour(){return this._date.getHours()}set hour(t){this._date.setHours(t)}get minute(){return this._date.getMinutes()}set minute(t){this._date.setMinutes(t)}get second(){return this._date.getSeconds()}set second(t){this._date.setSeconds(t)}get millisecond(){return this._date.getMilliseconds()}set millisecond(t){this._date.setMilliseconds(t)}get tick(){return this._date.getTime()}set tick(t){this._date.setTime(t)}get week(){return this._date.getDay()}get timezoneOffsetMinutes(){return-this._date.getTimezoneOffset()}setYear(t){return new o(new Date(this.tick).setFullYear(t))}setMonth(t){return new o(new Date(this.tick).setMonth(t-1))}setDay(t){return new o(new Date(this.tick).setDate(t))}setHour(t){return new o(new Date(this.tick).setHours(t))}setMinute(t){return new o(new Date(this.tick).setMinutes(t))}setSecond(t){return new o(new Date(this.tick).setSeconds(t))}setMillisecond(t){return new o(new Date(this.tick).setMilliseconds(t))}addYears(t){return this.setYear(this.year+t)}addMonths(t){return this.setMonth(this.month+t)}addDays(t){return this.setDay(this.day+t)}addHours(t){return this.setHour(this.hour+t)}addMinutes(t){return this.setMinute(this.minute+t)}addSeconds(t){return this.setSecond(this.second+t)}addMilliseconds(t){return this.setMillisecond(this.millisecond+t)}toFormatString(t){return i.DateTimeFormatUtil.format(t,{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second,millisecond:this.millisecond,timezoneOffsetMinutes:this.timezoneOffsetMinutes})}toString(){return this.toFormatString("yyyy-MM-ddTHH:mm:ss.fffzzz")}}e.DateTime=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.DateTimeFormatUtil=class{static format(t,e){const r=e.year,n=e.month,i=e.day,o=e.hour,s=e.minute,u=e.second,a=e.millisecond,c=void 0!==e.timezoneOffsetMinutes?Math.floor(e.timezoneOffsetMinutes/60):void 0,l=void 0!==e.timezoneOffsetMinutes?e.timezoneOffsetMinutes%60:void 0,d=r&&n&&i?new Date(r,n-1,i).getDay():void 0,f=0===d?"일":1===d?"월":2===d?"화":3===d?"수":4===d?"목":5===d?"금":6===d?"토":void 0;let h=t;return void 0!==r&&(h=h.replace(/yyyy/g,r.toString()),h=h.replace(/yy/g,r.toString().substr(2,2))),void 0!==n&&(h=h.replace(/MM/g,n.toString().padStart(2,"0")),h=h.replace(/M/g,n.toString())),void 0!==f&&(h=h.replace(/ddd/g,f)),void 0!==i&&(h=h.replace(/dd/g,i.toString().padStart(2,"0")),h=h.replace(/d/g,i.toString())),void 0!==o&&(h=h.replace(/tt/g,o<12?"오전":"오후"),h=h.replace(/hh/g,(o%12).toString().padStart(2,"0")),h=h.replace(/h/g,(o%12).toString()),h=h.replace(/HH/g,o.toString().padStart(2,"0")),h=h.replace(/H/g,o.toString())),void 0!==s&&(h=h.replace(/mm/g,s.toString().padStart(2,"0")),h=h.replace(/m/g,s.toString())),void 0!==u&&(h=h.replace(/ss/g,u.toString().padStart(2,"0")),h=h.replace(/s/g,u.toString())),void 0!==a&&(h=h.replace(/fff/g,a.toString().padStart(3,"0")),h=h.replace(/ff/g,a.toString().padStart(3,"0").substr(0,2)),h=h.replace(/f/g,a.toString().padStart(3,"0").substr(0,1))),void 0!==c&&void 0!==l&&(h=h.replace(/zzz/g,(c>0?"+":"-")+Math.abs(c).toString().padStart(2,"0")+":"+Math.abs(l).toString().padStart(2,"0")),h=h.replace(/zz/g,(c>0?"+":"-")+Math.abs(c).toString().padStart(2,"0")),h=h.replace(/z/g,(c>0?"+":"-")+Math.abs(c).toString())),h}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(0),i=r(4);class o{constructor(t,e,r){if(void 0===t){const t=Date.now();this._date=new Date(t-t%864e5)}else this._date=void 0!==e&&void 0!==r?new Date(t,e-1,null!=r?r:0):new Date(t-t%864e5)}static parse(t){const e=Date.parse(t);if(e&&!Number.isNaN(e))return new o(e);if(t.match(/^[0-9]{8}$/))return new o(Number(t.substr(0,4)),Number(t.substr(4,2)),Number(t.substr(6,2)));throw new n.ArgumentError({str:t})}get year(){return this._date.getFullYear()}set year(t){this._date.setFullYear(t)}get month(){return this._date.getMonth()+1}set month(t){this._date.setMonth(t-1)}get day(){return this._date.getDate()}set day(t){this._date.setDate(t)}get tick(){return this._date.getTime()}set tick(t){this._date.setTime(t-t%864e5)}get week(){return this._date.getDay()}setYear(t){return new o(new Date(this.tick).setFullYear(t))}setMonth(t){return new o(new Date(this.tick).setMonth(t-1))}setDay(t){return new o(new Date(this.tick).setDate(t))}addYears(t){return this.setYear(this.year+t)}addMonths(t){return this.setMonth(this.month+t)}addDays(t){return this.setDay(this.day+t)}toFormatString(t){return i.DateTimeFormatUtil.format(t,{year:this.year,month:this.month,day:this.day})}toString(){return this.toFormatString("yyyy-MM-dd")}}e.DateOnly=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(0),i=r(4);class o{constructor(t,e,r,n,i,o,s){if(void 0===t){const t=new Date;this._tick=(t.getMilliseconds()+1e3*t.getSeconds()+60*t.getMinutes()*1e3+60*t.getHours()*60*1e3)%864e5}else this._tick=void 0!==e?((null!=n?n:0)+1e3*(null!=r?r:0)+60*e*1e3+60*t*60*1e3)%864e5:t%864e5}static parse(t){const e=t.match(/^(오전|오후) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);if(e)return new o(Number(e[2])+("오후"===e[1]?12:0),Number(e[3]),Number(e[4]),Number(e[5]?e[6].padEnd(3,"0"):"0"));const r=t.match(/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);if(r)return new o(Number(r[1]),Number(r[2]),Number(r[3]),Number(r[4]?r[5].padEnd(3,"0"):"0"));throw new n.ArgumentError({str:t})}get hour(){return Math.floor(this._tick/36e5)}set hour(t){this._tick=(this._tick+60*(t-this.hour)*60*1e3)%864e5}get minute(){return Math.floor(this._tick/6e4)%60}set minute(t){this._tick=(this._tick+60*(t-this.minute)*1e3)%864e5}get second(){return Math.floor(this._tick/1e3)%60}set second(t){this._tick=(this._tick+1e3*(t-this.second))%864e5}get millisecond(){return this._tick%1e3}set millisecond(t){this._tick=(this._tick+(t-this.millisecond))%864e5}get tick(){return this._tick}set tick(t){this._tick=t%864e5}setHour(t){return new o(t,this.minute,this.second,this.millisecond)}setMinute(t){return new o(this.hour,t,this.second,this.millisecond)}setSecond(t){return new o(this.hour,this.minute,t,this.millisecond)}setMillisecond(t){return new o(this.hour,this.minute,this.second,t)}addHours(t){return this.setHour(this.hour+t)}addMinutes(t){return this.setMinute(this.minute+t)}addSeconds(t){return this.setSecond(this.second+t)}addMilliseconds(t){return this.setMillisecond(this.millisecond+t)}toFormatString(t){return i.DateTimeFormatUtil.format(t,{hour:this.hour,minute:this.minute,second:this.second,millisecond:this.millisecond})}toString(){return this.toFormatString("HH:mm:ss.fff")}}e.Time=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n{constructor(t){this._uuid=t}static new(){let t;for(;t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}),n._prevUuids.some(e=>e._uuid===t););const e=new n(t);return n._prevUuids.push(e),e}toString(){return this._uuid}}e.Uuid=n,n._prevUuids=[]},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PropertyGetSetDecoratorBase=function(t){return function(e,r,n){var i,o;const s=null!=n?n:Object.getOwnPropertyDescriptor(e,r),u=null===(i=s)||void 0===i?void 0:i.get,a=null===(o=s)||void 0===o?void 0:o.set;let c=e[r];const l=function(){const e=u?u.bind(this)():c;return t.get&&t.get(this,r,e),e},d=function(e){const n=u?u.bind(this)():c;let i=e;if(t.beforeSet){const e=t.beforeSet(this,r,n,i);e&&(i=e())}a?a.bind(this)(i):c=i,t.afterSet&&t.afterSet(this,r,n,i)};delete e[r]&&Object.defineProperty(e,r,{get:l,set:d,enumerable:!0,configurable:!0})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1);class i extends n.CustomError{constructor(t,e){super(`대기시간이 초과되었습니다${t?`(${t}ms)`:""}${e?`: ${e}`:""}`)}}e.TimeoutError=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(11);r(12),r(13),n.__exportStar(r(14),e),n.__exportStar(r(8),e),n.__exportStar(r(15),e),n.__exportStar(r(0),e),n.__exportStar(r(1),e),n.__exportStar(r(16),e),n.__exportStar(r(9),e),n.__exportStar(r(17),e),n.__exportStar(r(5),e),n.__exportStar(r(3),e),n.__exportStar(r(6),e),n.__exportStar(r(7),e),n.__exportStar(r(18),e),n.__exportStar(r(19),e),n.__exportStar(r(20),e),n.__exportStar(r(2),e),n.__exportStar(r(21),e)},function(t,e){t.exports=require("tslib")},function(t,e){t.exports=require("core-js")},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2);Array.prototype.single=function(t){const e=t?this.filter(t.bind(this)):this;if(e.length>1)throw new Error("복수의 결과물이 있습니다.");return e[0]},Array.prototype.last=function(t){if(!t)return this[this.length-1];for(let e=this.length-1;e>=0;e--)if(t(this[e],e))return this[e]},Array.prototype.filterExists=function(){return this.filter(t=>void 0!==t)},Array.prototype.ofType=function(t){return this.filter(e=>{var r;return e instanceof t||(null===(r=e)||void 0===r?void 0:r.constructor)===t})},Array.prototype.mapMany=function(t){return(t?this.map(t):this).reduce((t,e)=>t.concat(e))},Array.prototype.groupBy=function(t,e){const r=[];for(let i=0;i<this.length;i++){const o=t(this[i],i),s=e?e(this[i],i):this[i],u=r.single(t=>n.ObjectUtil.equal(t.key,o));u?u.values.push(s):r.push({key:o,values:[s]})}return r},Array.prototype.toMap=function(t,e){const r=new Map;for(let n=0;n<this.length;n++){const i=this[n],o=t(i,n),s=e?e(i,n):i;if(r.has(o))throw new Error(`키가 중복되었습니다. (중복된키: ${JSON.stringify(o)})`);r.set(o,s)}return r},Array.prototype.distinct=function(){const t=[];for(const e of this)t.some(t=>n.ObjectUtil.equal(t,e))||t.push(e);return t},Array.prototype.orderBy=function(t){return this.concat().sort((e,r)=>{const n=t?t(r):r,i=t?t(e):e;if("string"!=typeof n&&"number"!=typeof n||"string"!=typeof i&&"number"!=typeof i)throw new Error("orderBy 는 string 이나 number 에 대해서만 사용할 수 있습니다.");return n>i?-1:n<i?1:0})},Array.prototype.orderByDesc=function(t){return this.concat().sort((e,r)=>{const n=t?t(r):r,i=t?t(e):e;if("string"!=typeof n&&"number"!=typeof n||"string"!=typeof i&&"number"!=typeof i)throw new Error("orderBy 는 string 이나 number 에 대해서만 사용할 수 있습니다.");return n<i?-1:n>i?1:0})},Array.prototype.diffs=function(t,e){var r;const i=[],o=[].concat(t);for(const t of this){const s=o.single(r=>{var i,o;return n.ObjectUtil.equal(r,t,(null===(i=e)||void 0===i?void 0:i.excludes)?{excludes:null===(o=e)||void 0===o?void 0:o.excludes}:void 0)});if(s)o.remove(s);else{if(null===(r=e)||void 0===r?void 0:r.keys){const r=o.single(r=>n.ObjectUtil.equal(r,t,{keys:e.keys}));if(r){i.push({source:t,target:r}),o.remove(r);continue}}i.push({source:t})}}for(const t of o)i.push({target:t});return i},Array.prototype.merge=function(t,e){const r=this.diffs(t,e),i=n.ObjectUtil.clone(this);for(const t of r)if(t.source&&t.target){const e=i.single(e=>n.ObjectUtil.equal(e,t.source));i[i.indexOf(e)]=n.ObjectUtil.merge(t.source,t.target)}else t.target&&i.push(t.target);return i},Array.prototype.sum=function(t){let e=0;for(let r=0;r<this.length;r++){const n=t?t(this[r],r):this[r];if("number"!=typeof n)throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");e+=n}return e},Array.prototype.min=function(t){let e;for(let r=0;r<this.length;r++){const n=t?t(this[r],r):this[r];if("number"!=typeof n)throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");(!e||e>n)&&(e=n)}return e},Array.prototype.max=function(t){let e;for(let r=0;r<this.length;r++){const n=t?t(this[r],r):this[r];if("number"!=typeof n)throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");(!e||e<n)&&(e=n)}return e},Array.prototype.shuffle=function(){if(this.length<=1)return n.ObjectUtil.clone(this);let t=this;for(;t=t.orderBy(()=>Math.random()),n.ObjectUtil.equal(t,this););return t},Array.prototype.insert=function(t,e){return this.splice(t,0,e),this},Array.prototype.remove=function(t){const e="function"==typeof t?this.filter(t.bind(this)):[t];for(const t of e)for(;this.indexOf(t)>=0;)this.splice(this.indexOf(t),1);return this},Array.prototype.clear=function(){return this.remove(()=>!0)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8);e.NotifyPropertyChange=function(){return n.PropertyGetSetDecoratorBase({afterSet:(t,e,r,n)=>{t.onPropertyChange(e,r,n)}})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8),i=r(2);e.PropertyValidate=function(t){return n.PropertyGetSetDecoratorBase({beforeSet:(e,r)=>{const n=i.ObjectUtil.validate(e[r],t);if(n)throw new Error(`입력값이 잘못되었습니다: ${JSON.stringify({component:e.constructor.name,propertyName:r,value:n.value,errorKeys:Object.keys(n.invalidateDef)})}`)}})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1);class i extends n.CustomError{constructor(t){super("구현되어있지 않습니다"+(t?": "+t:""))}}e.NotImplementError=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.FunctionUtil=class{static parse(t){let e=t.toString().match(/function\s?\(([^)]*)\)[^{]*{((?!return)(.|\r|\n))*return\s?((.|\r|\n)*);?\s?}$/);if(null===e){if(e=t.toString().match(/^\(?([^)]*)\)?(\s?)=>(\s?)(.*)$/),null===e)throw new Error("Function 파싱 실패: "+t.toString()+"\n");if(!e[4])throw new Error("Function 파싱 실패: "+t.toString()+"\n");if(e[4].startsWith("{")){const r=e[4].match(/(?!return)(.|\r|\n)*return\s((.|\r|\n)*);/);if(!r||!r[2])throw new Error("Function 파싱 실패: "+t.toString()+"\n");e[4]=r[2]}}const r=e[1].split(",").map(t=>t.trim());let n=e[4].trim();return n.endsWith(";")&&(n=n.slice(0,-1)),{params:r,returnContent:n}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3),i=r(5),o=r(6),s=r(7);e.JsonConvert=class{static stringify(t,e){var r;function u(t,r){var u,a,c;const l=(null===(u=e)||void 0===u?void 0:u.replacer)?e.replacer(t,r):r;return l instanceof Date?{__type__:"Date",data:l.toISOString()}:l instanceof n.DateTime?{__type__:"DateTime",data:l.toString()}:l instanceof i.DateOnly?{__type__:"DateOnly",data:l.toString()}:l instanceof o.Time?{__type__:"Time",data:l.toString()}:l instanceof s.Uuid?{__type__:"Uuid",data:l.toString()}:l instanceof Error?{__type__:"Error",data:{message:l.message,name:l.name,stack:l.stack,...l}}:l instanceof Buffer||"Buffer"===(null===(a=l)||void 0===a?void 0:a.type)?{__type__:"Buffer",data:(null===(c=e)||void 0===c?void 0:c.hideBuffer)?"__hidden__":r.data}:l}const a=Date.prototype.toJSON;delete Date.prototype.toJSON;const c=JSON.stringify(u(void 0,t),u,null===(r=e)||void 0===r?void 0:r.space);return Date.prototype.toJSON=a,c}static parse(t){return t&&JSON.parse(t,(t,e)=>{if(null!=e){if("object"==typeof e&&"Date"===e.__type__)return new Date(Date.parse(e.data));if("object"==typeof e&&"DateTime"===e.__type__)return n.DateTime.parse(e.data);if("object"==typeof e&&"DateOnly"===e.__type__)return i.DateOnly.parse(e.data);if("object"==typeof e&&"Time"===e.__type__)return o.Time.parse(e.data);if("object"==typeof e&&"Uuid"===e.__type__)return new s.Uuid(e.data);if("object"==typeof e&&"Error"===e.__type__){const t=new Error(e.data.message);return Object.assign(t,e.data),t}return"object"==typeof e&&"Buffer"===e.__type__?Buffer.from(e.data):e}})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.MathUtil=class{static getRandomInt(t,e){return Math.floor(Math.random()*(e-t)+t)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9);class i{static async true(t,e,r){let o=0;for(;!await t();)if(await i.time(null!=e?e:100),r&&(o+=null!=e?e:100,o>=r))throw new n.TimeoutError}static async time(t){await new Promise(e=>{setTimeout(()=>{e()},t)})}}e.Wait=i}]); | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = function(exports) { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ | ||
/******/ // create a fake namespace object | ||
/******/ // mode & 1: value is a module id, require it | ||
/******/ // mode & 2: merge all properties of value into the ns | ||
/******/ // mode & 4: return value when already ns object | ||
/******/ // mode & 8|1: behave like require | ||
/******/ __webpack_require__.t = function(value, mode) { | ||
/******/ if(mode & 1) value = __webpack_require__(value); | ||
/******/ if(mode & 8) return value; | ||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | ||
/******/ var ns = Object.create(null); | ||
/******/ __webpack_require__.r(ns); | ||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | ||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | ||
/******/ return ns; | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 10); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const CustomError_1 = __webpack_require__(1); | ||
class ArgumentError extends CustomError_1.CustomError { | ||
constructor(argObj) { | ||
super("인수가 잘못되었습니다: " + JSON.stringify(argObj)); | ||
} | ||
} | ||
exports.ArgumentError = ArgumentError; | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class CustomError extends Error { | ||
constructor(arg1, arg2) { | ||
if (arg1 instanceof Error || typeof arg2 === "string") { | ||
super(arg2 + (arg1 instanceof Error ? ` => ${arg1.message}` : "")); | ||
} | ||
else { | ||
super(arg1); | ||
} | ||
Object.setPrototypeOf(this, new.target.prototype); | ||
this.name = new.target.name; | ||
if (Error.captureStackTrace) { | ||
Error.captureStackTrace(this, new.target); | ||
} | ||
else { | ||
try { | ||
throw new Error(this.message); | ||
} | ||
catch (err) { | ||
this.stack = err.stack; | ||
} | ||
} | ||
if (arg1 instanceof Error && arg1.stack) { | ||
this.stack += "\n-- inner error stack --\n" + arg1.stack; | ||
} | ||
} | ||
} | ||
exports.CustomError = CustomError; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const DateTime_1 = __webpack_require__(3); | ||
const DateOnly_1 = __webpack_require__(5); | ||
const Time_1 = __webpack_require__(6); | ||
const Uuid_1 = __webpack_require__(7); | ||
class ObjectUtil { | ||
static clone(source, options) { | ||
return ObjectUtil._clone(source, options); | ||
} | ||
static _clone(source, options, prevClones) { | ||
var _a, _b, _c, _d; | ||
if (source == undefined) { | ||
return undefined; | ||
} | ||
if (source instanceof Array) { | ||
return source.map((item) => options ? ObjectUtil._clone(item, options) : ObjectUtil._clone(item)); | ||
} | ||
if (source instanceof Date) { | ||
return new Date(source.getTime()); | ||
} | ||
if (source instanceof DateTime_1.DateTime) { | ||
return new DateTime_1.DateTime(source.tick); | ||
} | ||
if (source instanceof DateOnly_1.DateOnly) { | ||
return new DateOnly_1.DateOnly(source.tick); | ||
} | ||
if (source instanceof Time_1.Time) { | ||
return new Time_1.Time(source.tick); | ||
} | ||
if (source instanceof Uuid_1.Uuid) { | ||
return new Uuid_1.Uuid(source.toString()); | ||
} | ||
if (typeof source === "object") { | ||
const result = {}; | ||
Object.setPrototypeOf(result, source["constructor"].prototype); | ||
const currPrevClones = (prevClones !== null && prevClones !== void 0 ? prevClones : []); | ||
currPrevClones.push({ source, clone: result }); | ||
for (const key of Object.keys(source).filter((sourceKey) => { var _a, _b; return !((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.excludes) === null || _b === void 0 ? void 0 : _b.includes(sourceKey)); })) { | ||
if (source[key] == undefined) { | ||
result[key] = undefined; | ||
} | ||
else if ((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.useRefTypes) === null || _b === void 0 ? void 0 : _b.includes(source[key].constructor)) { | ||
result[key] = source[key]; | ||
} | ||
else { | ||
const matchedPrevClone = (_c = prevClones) === null || _c === void 0 ? void 0 : _c.single((item) => item.source === source[key]); | ||
if (matchedPrevClone) { | ||
result[key] = matchedPrevClone.clone; | ||
} | ||
else { | ||
result[key] = ObjectUtil._clone(source[key], { useRefTypes: (_d = options) === null || _d === void 0 ? void 0 : _d.useRefTypes }, currPrevClones); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
return source; | ||
} | ||
static merge(source, target) { | ||
if (source === undefined) { | ||
return ObjectUtil.clone(target); | ||
} | ||
if (target === undefined) { | ||
return ObjectUtil.clone(source); | ||
} | ||
if (typeof target !== "object") { | ||
return target; | ||
} | ||
if (target instanceof Date || target instanceof DateTime_1.DateTime || target instanceof DateOnly_1.DateOnly || target instanceof Time_1.Time || target instanceof Uuid_1.Uuid) { | ||
return ObjectUtil.clone(target); | ||
} | ||
if (typeof source !== typeof target) { | ||
throw new Error("병합하려고 하는 두 객체의 타입이 서로 다릅니다."); | ||
} | ||
const result = ObjectUtil.clone(source); | ||
for (const key of Object.keys(target)) { | ||
result[key] = ObjectUtil.merge(source[key], target[key]); | ||
} | ||
return result; | ||
} | ||
static equal(source, target, options) { | ||
var _a, _b; | ||
if (source === target) { | ||
return true; | ||
} | ||
if (source instanceof Date && target instanceof Date) { | ||
return source.getTime() === target.getTime(); | ||
} | ||
if ((source instanceof Time_1.Time && target instanceof DateTime_1.DateTime) || | ||
(source instanceof Time_1.Time && target instanceof DateOnly_1.DateOnly) || | ||
(source instanceof Time_1.Time && target instanceof Time_1.Time)) { | ||
return source.tick === target.tick; | ||
} | ||
if (source instanceof Array && target instanceof Array) { | ||
if (source.length !== target.length) { | ||
return false; | ||
} | ||
if ((_a = options) === null || _a === void 0 ? void 0 : _a.ignoreArrayIndex) { | ||
return source.every((sourceItem) => target.some((targetItem) => ObjectUtil.equal(targetItem, sourceItem, options))); | ||
} | ||
else { | ||
for (let i = 0; i < source.length; i++) { | ||
if (!ObjectUtil.equal(source[i], target[i], options)) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
if (typeof source === "object" && typeof target === "object") { | ||
const sourceKeys = Object.keys(source) | ||
.filter((key) => { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && source[key] !== undefined; }); | ||
const targetKeys = Object.keys(target) | ||
.filter((key) => { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && target[key] !== undefined; }); | ||
if (sourceKeys.length !== targetKeys.length) { | ||
return false; | ||
} | ||
for (const key of sourceKeys) { | ||
if (!ObjectUtil.equal(source[key], target[key], { ignoreArrayIndex: (_b = options) === null || _b === void 0 ? void 0 : _b.ignoreArrayIndex })) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
static validate(value, def) { | ||
let currDef; | ||
if (def instanceof Array) { | ||
currDef = { | ||
type: def | ||
}; | ||
} | ||
else if (typeof def === "function") { | ||
currDef = { | ||
type: [def] | ||
}; | ||
} | ||
else { | ||
currDef = { | ||
...def, | ||
type: def.type ? def.type instanceof Array ? def.type : [def.type] : undefined | ||
}; | ||
} | ||
const invalidateDef = {}; | ||
if (currDef.notnull && value === undefined) { | ||
invalidateDef.notnull = currDef.notnull; | ||
} | ||
if (!currDef.notnull && value === undefined) { | ||
return undefined; | ||
} | ||
if (currDef.type && | ||
!currDef.type.some((type) => { var _a; return type === ((_a = value) === null || _a === void 0 ? void 0 : _a.constructor); })) { | ||
invalidateDef.type = currDef.type; | ||
} | ||
if (currDef.validator && !currDef.validator(value)) { | ||
invalidateDef.validator = currDef.validator; | ||
} | ||
if (currDef.includes && !currDef.includes.includes(value)) { | ||
invalidateDef.includes = currDef.includes; | ||
} | ||
if (Object.keys(invalidateDef).length > 0) { | ||
return { value, invalidateDef }; | ||
} | ||
return undefined; | ||
} | ||
static validateObject(obj, def) { | ||
const result = {}; | ||
for (const defKey of Object.keys(def)) { | ||
const validateResult = ObjectUtil.validate(obj[defKey], def[defKey]); | ||
if (validateResult) { | ||
result[defKey] = validateResult; | ||
} | ||
} | ||
return result; | ||
} | ||
static validateArray(arr, def) { | ||
const result = []; | ||
for (let i = 0; i < arr.length; i++) { | ||
const item = arr[i]; | ||
const validateObjectResult = ObjectUtil.validateObject(item, typeof def === "function" ? def(item) : def); | ||
if (Object.keys(validateObjectResult).length > 0) { | ||
result.push({ | ||
index: i, | ||
item, | ||
result: validateObjectResult | ||
}); | ||
} | ||
} | ||
return result; | ||
} | ||
static getChainValueByDepth(obj, key, depth, optional) { | ||
let result = obj; | ||
for (let i = 0; i < depth; i++) { | ||
if (optional) { | ||
result = result ? result[key] : undefined; | ||
} | ||
else { | ||
result = result[key]; | ||
} | ||
} | ||
return result; | ||
} | ||
static getChainValue(obj, chain, optional) { | ||
const split = chain.split("."); | ||
let result = obj; | ||
for (const splitItem of split) { | ||
if (optional && result === undefined) { | ||
result = undefined; | ||
} | ||
else { | ||
result = result[splitItem]; | ||
} | ||
} | ||
return result; | ||
} | ||
static setChainValue(obj, chain, value) { | ||
const split = chain.split("."); | ||
let curr = obj; | ||
for (const splitItem of split.slice(0, -1)) { | ||
curr = curr[splitItem]; | ||
} | ||
curr[split.last()] = value; | ||
} | ||
static deleteChainValue(obj, chain) { | ||
const split = chain.split("."); | ||
let curr = obj; | ||
for (const splitItem of split.slice(0, -1)) { | ||
curr = curr[splitItem]; | ||
} | ||
delete curr[split.last()]; | ||
} | ||
static clearUndefined(obj) { | ||
if (obj === undefined) { | ||
return obj; | ||
} | ||
for (const key of Object.keys(obj)) { | ||
if (obj[key] === undefined) { | ||
delete obj[key]; | ||
} | ||
} | ||
return obj; | ||
} | ||
} | ||
exports.ObjectUtil = ObjectUtil; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ArgumentError_1 = __webpack_require__(0); | ||
const DateTimeFormatUtil_1 = __webpack_require__(4); | ||
class DateTime { | ||
constructor(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { | ||
if (arg1 === undefined) { | ||
this._date = new Date(); | ||
} | ||
else if (arg2 !== undefined && arg3 !== undefined) { | ||
this._date = new Date(arg1, arg2 - 1, (arg3 !== null && arg3 !== void 0 ? arg3 : 0), (arg4 !== null && arg4 !== void 0 ? arg4 : 0), (arg5 !== null && arg5 !== void 0 ? arg5 : 0), (arg6 !== null && arg6 !== void 0 ? arg6 : 0), (arg7 !== null && arg7 !== void 0 ? arg7 : 0)); | ||
} | ||
else { | ||
this._date = new Date(arg1); | ||
} | ||
} | ||
static parse(str) { | ||
const parsedTick = Date.parse(str); | ||
if (parsedTick && !Number.isNaN(parsedTick)) { | ||
return new DateTime(parsedTick); | ||
} | ||
const match1 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) (오전|오후) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/); | ||
if (match1) { | ||
return new DateTime(Number(match1[1]), Number(match1[2]), Number(match1[3]), Number(match1[5]) + (match1[4] === "오후" ? 12 : 0), Number(match1[6]), Number(match1[7])); | ||
} | ||
const match2 = str.match(/^[0-9]{14}$/); | ||
if (match2) { | ||
return new DateTime(Number(str.substr(0, 4)), Number(str.substr(4, 2)), Number(str.substr(6, 2)), Number(str.substr(8, 2)), Number(str.substr(10, 2)), Number(str.substr(12, 2))); | ||
} | ||
const match3 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3}))?$/); | ||
if (match3) { | ||
return new DateTime(Number(match3[1]), Number(match3[2]), Number(match3[3]), Number(match3[4]), Number(match3[5]), Number(match3[6]), match3[7] ? Number(match3[8]) : undefined); | ||
} | ||
throw new ArgumentError_1.ArgumentError({ str }); | ||
} | ||
get year() { | ||
return this._date.getFullYear(); | ||
} | ||
set year(value) { | ||
this._date.setFullYear(value); | ||
} | ||
get month() { | ||
return this._date.getMonth() + 1; | ||
} | ||
set month(value) { | ||
this._date.setMonth(value - 1); | ||
} | ||
get day() { | ||
return this._date.getDate(); | ||
} | ||
set day(value) { | ||
this._date.setDate(value); | ||
} | ||
get hour() { | ||
return this._date.getHours(); | ||
} | ||
set hour(value) { | ||
this._date.setHours(value); | ||
} | ||
get minute() { | ||
return this._date.getMinutes(); | ||
} | ||
set minute(value) { | ||
this._date.setMinutes(value); | ||
} | ||
get second() { | ||
return this._date.getSeconds(); | ||
} | ||
set second(value) { | ||
this._date.setSeconds(value); | ||
} | ||
get millisecond() { | ||
return this._date.getMilliseconds(); | ||
} | ||
set millisecond(value) { | ||
this._date.setMilliseconds(value); | ||
} | ||
get tick() { | ||
return this._date.getTime(); | ||
} | ||
set tick(tick) { | ||
this._date.setTime(tick); | ||
} | ||
get week() { | ||
return this._date.getDay(); | ||
} | ||
get timezoneOffsetMinutes() { | ||
return -this._date.getTimezoneOffset(); | ||
} | ||
setYear(year) { | ||
return new DateTime(new Date(this.tick).setFullYear(year)); | ||
} | ||
setMonth(month) { | ||
return new DateTime(new Date(this.tick).setMonth(month - 1)); | ||
} | ||
setDay(day) { | ||
return new DateTime(new Date(this.tick).setDate(day)); | ||
} | ||
setHour(hour) { | ||
return new DateTime(new Date(this.tick).setHours(hour)); | ||
} | ||
setMinute(minute) { | ||
return new DateTime(new Date(this.tick).setMinutes(minute)); | ||
} | ||
setSecond(second) { | ||
return new DateTime(new Date(this.tick).setSeconds(second)); | ||
} | ||
setMillisecond(millisecond) { | ||
return new DateTime(new Date(this.tick).setMilliseconds(millisecond)); | ||
} | ||
addYears(years) { | ||
return this.setYear(this.year + years); | ||
} | ||
addMonths(months) { | ||
return this.setMonth(this.month + months); | ||
} | ||
addDays(days) { | ||
return this.setDay(this.day + days); | ||
} | ||
addHours(hours) { | ||
return this.setHour(this.hour + hours); | ||
} | ||
addMinutes(minutes) { | ||
return this.setMinute(this.minute + minutes); | ||
} | ||
addSeconds(seconds) { | ||
return this.setSecond(this.second + seconds); | ||
} | ||
addMilliseconds(milliseconds) { | ||
return this.setMillisecond(this.millisecond + milliseconds); | ||
} | ||
toFormatString(format) { | ||
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, { | ||
year: this.year, | ||
month: this.month, | ||
day: this.day, | ||
hour: this.hour, | ||
minute: this.minute, | ||
second: this.second, | ||
millisecond: this.millisecond, | ||
timezoneOffsetMinutes: this.timezoneOffsetMinutes | ||
}); | ||
} | ||
toString() { | ||
return this.toFormatString("yyyy-MM-ddTHH:mm:ss.fffzzz"); | ||
} | ||
} | ||
exports.DateTime = DateTime; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class DateTimeFormatUtil { | ||
static format(format, args) { | ||
const year = args.year; | ||
const month = args.month; | ||
const day = args.day; | ||
const hour = args.hour; | ||
const minute = args.minute; | ||
const second = args.second; | ||
const millisecond = args.millisecond; | ||
const offsetHour = args.timezoneOffsetMinutes !== undefined ? Math.floor(args.timezoneOffsetMinutes / 60) : undefined; | ||
const offsetMinute = args.timezoneOffsetMinutes !== undefined ? args.timezoneOffsetMinutes % 60 : undefined; | ||
const week = (year && month && day) ? new Date(year, month - 1, day).getDay() : undefined; | ||
const weekString = week === 0 ? "일" : | ||
week === 1 ? "월" : | ||
week === 2 ? "화" : | ||
week === 3 ? "수" : | ||
week === 4 ? "목" : | ||
week === 5 ? "금" : | ||
week === 6 ? "토" : | ||
undefined; | ||
let result = format; | ||
if (year !== undefined) { | ||
result = result.replace(/yyyy/g, year.toString()); | ||
result = result.replace(/yy/g, year.toString().substr(2, 2)); | ||
} | ||
if (month !== undefined) { | ||
result = result.replace(/MM/g, month.toString().padStart(2, "0")); | ||
result = result.replace(/M/g, month.toString()); | ||
} | ||
if (weekString !== undefined) { | ||
result = result.replace(/ddd/g, weekString); | ||
} | ||
if (day !== undefined) { | ||
result = result.replace(/dd/g, day.toString().padStart(2, "0")); | ||
result = result.replace(/d/g, day.toString()); | ||
} | ||
if (hour !== undefined) { | ||
result = result.replace(/tt/g, hour < 12 ? "오전" : "오후"); | ||
result = result.replace(/hh/g, (hour % 12).toString().padStart(2, "0")); | ||
result = result.replace(/h/g, (hour % 12).toString()); | ||
result = result.replace(/HH/g, hour.toString().padStart(2, "0")); | ||
result = result.replace(/H/g, hour.toString()); | ||
} | ||
if (minute !== undefined) { | ||
result = result.replace(/mm/g, minute.toString().padStart(2, "0")); | ||
result = result.replace(/m/g, minute.toString()); | ||
} | ||
if (second !== undefined) { | ||
result = result.replace(/ss/g, second.toString().padStart(2, "0")); | ||
result = result.replace(/s/g, second.toString()); | ||
} | ||
if (millisecond !== undefined) { | ||
result = result.replace(/fff/g, millisecond.toString().padStart(3, "0")); | ||
result = result.replace(/ff/g, millisecond.toString().padStart(3, "0").substr(0, 2)); | ||
result = result.replace(/f/g, millisecond.toString().padStart(3, "0").substr(0, 1)); | ||
} | ||
if (offsetHour !== undefined && offsetMinute !== undefined) { | ||
result = result.replace(/zzz/g, (offsetHour > 0 ? "+" : "-") + Math.abs(offsetHour).toString().padStart(2, "0") + ":" + Math.abs(offsetMinute).toString().padStart(2, "0")); | ||
result = result.replace(/zz/g, (offsetHour > 0 ? "+" : "-") + Math.abs(offsetHour).toString().padStart(2, "0")); | ||
result = result.replace(/z/g, (offsetHour > 0 ? "+" : "-") + Math.abs(offsetHour).toString()); | ||
} | ||
return result; | ||
} | ||
} | ||
exports.DateTimeFormatUtil = DateTimeFormatUtil; | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ArgumentError_1 = __webpack_require__(0); | ||
const DateTimeFormatUtil_1 = __webpack_require__(4); | ||
class DateOnly { | ||
constructor(arg1, arg2, arg3) { | ||
if (arg1 === undefined) { | ||
const tick = Date.now(); | ||
this._date = new Date(tick - (tick % (24 * 60 * 60 * 1000))); | ||
} | ||
else if (arg2 !== undefined && arg3 !== undefined) { | ||
this._date = new Date(arg1, arg2 - 1, (arg3 !== null && arg3 !== void 0 ? arg3 : 0)); | ||
} | ||
else { | ||
this._date = new Date(arg1 - (arg1 % (24 * 60 * 60 * 1000))); | ||
} | ||
} | ||
static parse(str) { | ||
const parsedTick = Date.parse(str); | ||
if (parsedTick && !Number.isNaN(parsedTick)) { | ||
return new DateOnly(parsedTick); | ||
} | ||
const match1 = str.match(/^[0-9]{8}$/); | ||
if (match1) { | ||
return new DateOnly(Number(str.substr(0, 4)), Number(str.substr(4, 2)), Number(str.substr(6, 2))); | ||
} | ||
throw new ArgumentError_1.ArgumentError({ str }); | ||
} | ||
get year() { | ||
return this._date.getFullYear(); | ||
} | ||
set year(value) { | ||
this._date.setFullYear(value); | ||
} | ||
get month() { | ||
return this._date.getMonth() + 1; | ||
} | ||
set month(value) { | ||
this._date.setMonth(value - 1); | ||
} | ||
get day() { | ||
return this._date.getDate(); | ||
} | ||
set day(value) { | ||
this._date.setDate(value); | ||
} | ||
get tick() { | ||
return this._date.getTime(); | ||
} | ||
set tick(tick) { | ||
this._date.setTime(tick - (tick % (24 * 60 * 60 * 1000))); | ||
} | ||
get week() { | ||
return this._date.getDay(); | ||
} | ||
setYear(year) { | ||
return new DateOnly(new Date(this.tick).setFullYear(year)); | ||
} | ||
setMonth(month) { | ||
return new DateOnly(new Date(this.tick).setMonth(month - 1)); | ||
} | ||
setDay(day) { | ||
return new DateOnly(new Date(this.tick).setDate(day)); | ||
} | ||
addYears(years) { | ||
return this.setYear(this.year + years); | ||
} | ||
addMonths(months) { | ||
return this.setMonth(this.month + months); | ||
} | ||
addDays(days) { | ||
return this.setDay(this.day + days); | ||
} | ||
toFormatString(format) { | ||
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, { | ||
year: this.year, | ||
month: this.month, | ||
day: this.day | ||
}); | ||
} | ||
toString() { | ||
return this.toFormatString("yyyy-MM-dd"); | ||
} | ||
} | ||
exports.DateOnly = DateOnly; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ArgumentError_1 = __webpack_require__(0); | ||
const DateTimeFormatUtil_1 = __webpack_require__(4); | ||
class Time { | ||
constructor(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { | ||
if (arg1 === undefined) { | ||
const now = new Date(); | ||
this._tick = (now.getMilliseconds() | ||
+ now.getSeconds() * 1000 | ||
+ now.getMinutes() * 60 * 1000 | ||
+ now.getHours() * 60 * 60 * 1000) % (24 * 60 * 60 * 1000); | ||
} | ||
else if (arg2 !== undefined) { | ||
this._tick = (((arg4 !== null && arg4 !== void 0 ? arg4 : 0)) | ||
+ ((arg3 !== null && arg3 !== void 0 ? arg3 : 0)) * 1000 | ||
+ arg2 * 60 * 1000 | ||
+ arg1 * 60 * 60 * 1000) % (24 * 60 * 60 * 1000); | ||
} | ||
else { | ||
this._tick = arg1 % (24 * 60 * 60 * 1000); | ||
} | ||
} | ||
static parse(str) { | ||
const match1 = str.match(/^(오전|오후) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/); | ||
if (match1) { | ||
return new Time(Number(match1[2]) + (match1[1] === "오후" ? 12 : 0), Number(match1[3]), Number(match1[4]), Number(match1[5] ? match1[6].padEnd(3, "0") : "0")); | ||
} | ||
const match2 = str.match(/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/); | ||
if (match2) { | ||
return new Time(Number(match2[1]), Number(match2[2]), Number(match2[3]), Number(match2[4] ? match2[5].padEnd(3, "0") : "0")); | ||
} | ||
throw new ArgumentError_1.ArgumentError({ str }); | ||
} | ||
get hour() { | ||
return Math.floor(this._tick / (60 * 60 * 1000)); | ||
} | ||
set hour(value) { | ||
this._tick = (this._tick + ((value - this.hour) * 60 * 60 * 1000)) % (24 * 60 * 60 * 1000); | ||
} | ||
get minute() { | ||
return Math.floor(this._tick / (60 * 1000)) % 60; | ||
} | ||
set minute(value) { | ||
this._tick = (this._tick + ((value - this.minute) * 60 * 1000)) % (24 * 60 * 60 * 1000); | ||
} | ||
get second() { | ||
return Math.floor(this._tick / 1000) % 60; | ||
} | ||
set second(value) { | ||
this._tick = (this._tick + ((value - this.second) * 1000)) % (24 * 60 * 60 * 1000); | ||
} | ||
get millisecond() { | ||
return this._tick % 1000; | ||
} | ||
set millisecond(value) { | ||
this._tick = (this._tick + (value - this.millisecond)) % (24 * 60 * 60 * 1000); | ||
} | ||
get tick() { | ||
return this._tick; | ||
} | ||
set tick(tick) { | ||
this._tick = tick % (24 * 60 * 60 * 1000); | ||
} | ||
setHour(hour) { | ||
return new Time(hour, this.minute, this.second, this.millisecond); | ||
} | ||
setMinute(minute) { | ||
return new Time(this.hour, minute, this.second, this.millisecond); | ||
} | ||
setSecond(second) { | ||
return new Time(this.hour, this.minute, second, this.millisecond); | ||
} | ||
setMillisecond(millisecond) { | ||
return new Time(this.hour, this.minute, this.second, millisecond); | ||
} | ||
addHours(hours) { | ||
return this.setHour(this.hour + hours); | ||
} | ||
addMinutes(minutes) { | ||
return this.setMinute(this.minute + minutes); | ||
} | ||
addSeconds(seconds) { | ||
return this.setSecond(this.second + seconds); | ||
} | ||
addMilliseconds(milliseconds) { | ||
return this.setMillisecond(this.millisecond + milliseconds); | ||
} | ||
toFormatString(format) { | ||
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, { | ||
hour: this.hour, | ||
minute: this.minute, | ||
second: this.second, | ||
millisecond: this.millisecond | ||
}); | ||
} | ||
toString() { | ||
return this.toFormatString("HH:mm:ss.fff"); | ||
} | ||
} | ||
exports.Time = Time; | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class Uuid { | ||
constructor(uuid) { | ||
this._uuid = uuid; | ||
} | ||
static new() { | ||
const fn = () => { | ||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { | ||
const r = Math.random() * 16 | 0; | ||
const v = c === "x" ? r : (r & 0x3 | 0x8); | ||
return v.toString(16); | ||
}); | ||
}; | ||
let uuid; | ||
while (true) { | ||
uuid = fn(); | ||
if (!Uuid._prevUuids.some((item) => item._uuid === uuid)) { | ||
break; | ||
} | ||
} | ||
const uuidObj = new Uuid(uuid); | ||
Uuid._prevUuids.push(uuidObj); | ||
return uuidObj; | ||
} | ||
toString() { | ||
return this._uuid; | ||
} | ||
} | ||
exports.Uuid = Uuid; | ||
Uuid._prevUuids = []; | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function PropertyGetSetDecoratorBase(arg) { | ||
return function (target, propertyName, inputDescriptor) { | ||
var _a, _b; | ||
const prevDescriptor = (inputDescriptor !== null && inputDescriptor !== void 0 ? inputDescriptor : Object.getOwnPropertyDescriptor(target, propertyName)); | ||
const prevGetter = (_a = prevDescriptor) === null || _a === void 0 ? void 0 : _a.get; | ||
const prevSetter = (_b = prevDescriptor) === null || _b === void 0 ? void 0 : _b.set; | ||
let _val = target[propertyName]; | ||
const getter = function () { | ||
const value = prevGetter ? prevGetter.bind(this)() : _val; | ||
if (arg.get) { | ||
arg.get(this, propertyName, value); | ||
} | ||
return value; | ||
}; | ||
const setter = function (value) { | ||
const prevValue = prevGetter ? prevGetter.bind(this)() : _val; | ||
let realValue = value; | ||
if (arg.beforeSet) { | ||
const beforeSetResult = arg.beforeSet(this, propertyName, prevValue, realValue); | ||
if (beforeSetResult) { | ||
realValue = beforeSetResult(); | ||
} | ||
} | ||
if (prevSetter) { | ||
prevSetter.bind(this)(realValue); | ||
} | ||
else { | ||
_val = realValue; | ||
} | ||
if (arg.afterSet) { | ||
arg.afterSet(this, propertyName, prevValue, realValue); | ||
} | ||
}; | ||
if (delete target[propertyName]) { | ||
Object.defineProperty(target, propertyName, { | ||
get: getter, | ||
set: setter, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
} | ||
}; | ||
} | ||
exports.PropertyGetSetDecoratorBase = PropertyGetSetDecoratorBase; | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const CustomError_1 = __webpack_require__(1); | ||
class TimeoutError extends CustomError_1.CustomError { | ||
constructor(millisecond, message) { | ||
super(`대기시간이 초과되었습니다${millisecond ? `(${millisecond}ms)` : ""}${message ? `: ${message}` : ""}`); | ||
} | ||
} | ||
exports.TimeoutError = TimeoutError; | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = __webpack_require__(11); | ||
__webpack_require__(12); | ||
__webpack_require__(13); | ||
tslib_1.__exportStar(__webpack_require__(14), exports); | ||
tslib_1.__exportStar(__webpack_require__(8), exports); | ||
tslib_1.__exportStar(__webpack_require__(15), exports); | ||
tslib_1.__exportStar(__webpack_require__(0), exports); | ||
tslib_1.__exportStar(__webpack_require__(1), exports); | ||
tslib_1.__exportStar(__webpack_require__(16), exports); | ||
tslib_1.__exportStar(__webpack_require__(9), exports); | ||
tslib_1.__exportStar(__webpack_require__(17), exports); | ||
tslib_1.__exportStar(__webpack_require__(5), exports); | ||
tslib_1.__exportStar(__webpack_require__(3), exports); | ||
tslib_1.__exportStar(__webpack_require__(6), exports); | ||
tslib_1.__exportStar(__webpack_require__(7), exports); | ||
tslib_1.__exportStar(__webpack_require__(18), exports); | ||
tslib_1.__exportStar(__webpack_require__(19), exports); | ||
tslib_1.__exportStar(__webpack_require__(20), exports); | ||
tslib_1.__exportStar(__webpack_require__(2), exports); | ||
tslib_1.__exportStar(__webpack_require__(21), exports); | ||
/***/ }), | ||
/* 11 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("tslib"); | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("core-js"); | ||
/***/ }), | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ObjectUtil_1 = __webpack_require__(2); | ||
Array.prototype.single = function (predicate) { | ||
const arr = predicate ? this.filter(predicate.bind(this)) : this; | ||
if (arr.length > 1) { | ||
throw new Error("복수의 결과물이 있습니다."); | ||
} | ||
return arr[0]; | ||
}; | ||
Array.prototype.last = function (predicate) { | ||
if (predicate) { | ||
for (let i = this.length - 1; i >= 0; i--) { | ||
if (predicate(this[i], i)) { | ||
return this[i]; | ||
} | ||
} | ||
return undefined; | ||
} | ||
else { | ||
return this[this.length - 1]; | ||
} | ||
}; | ||
Array.prototype.filterExists = function () { | ||
return this.filter((item) => item !== undefined); | ||
}; | ||
Array.prototype.ofType = function (type) { | ||
return this.filter((item) => { var _a; return item instanceof type || ((_a = item) === null || _a === void 0 ? void 0 : _a.constructor) === type; }); | ||
}; | ||
Array.prototype.mapMany = function (selector) { | ||
const arr = selector ? this.map(selector) : this; | ||
return arr.reduce((p, n) => p.concat(n)); | ||
}; | ||
Array.prototype.groupBy = function (keySelector, valueSelector) { | ||
const result = []; | ||
for (let i = 0; i < this.length; i++) { | ||
const keyObj = keySelector(this[i], i); | ||
const valueObj = valueSelector ? valueSelector(this[i], i) : this[i]; | ||
const existsRecord = result.single((item) => ObjectUtil_1.ObjectUtil.equal(item.key, keyObj)); | ||
if (existsRecord) { | ||
existsRecord.values.push(valueObj); | ||
} | ||
else { | ||
result.push({ key: keyObj, values: [valueObj] }); | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.toMap = function (keySelector, valueSelector) { | ||
const result = new Map(); | ||
for (let i = 0; i < this.length; i++) { | ||
const item = this[i]; | ||
const keyObj = keySelector(item, i); | ||
const valueObj = valueSelector ? valueSelector(item, i) : item; | ||
if (result.has(keyObj)) { | ||
throw new Error(`키가 중복되었습니다. (중복된키: ${JSON.stringify(keyObj)})`); | ||
} | ||
result.set(keyObj, valueObj); | ||
} | ||
return result; | ||
}; | ||
Array.prototype.distinct = function () { | ||
const result = []; | ||
for (const item of this) { | ||
if (!result.some((item1) => ObjectUtil_1.ObjectUtil.equal(item1, item))) { | ||
result.push(item); | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.orderBy = function (selector) { | ||
return this.concat().sort((p, n) => { | ||
const pn = selector ? selector(n) : n; | ||
const pp = selector ? selector(p) : p; | ||
if ((typeof pn !== "string" && typeof pn !== "number") || | ||
(typeof pp !== "string" && typeof pp !== "number")) { | ||
throw new Error("orderBy 는 string 이나 number 에 대해서만 사용할 수 있습니다."); | ||
} | ||
return (pn > pp ? -1 : pn < pp ? 1 : 0); | ||
}); | ||
}; | ||
Array.prototype.orderByDesc = function (selector) { | ||
return this.concat().sort((p, n) => { | ||
const pn = selector ? selector(n) : n; | ||
const pp = selector ? selector(p) : p; | ||
if ((typeof pn !== "string" && typeof pn !== "number") || | ||
(typeof pp !== "string" && typeof pp !== "number")) { | ||
throw new Error("orderBy 는 string 이나 number 에 대해서만 사용할 수 있습니다."); | ||
} | ||
return (pn < pp ? -1 : pn > pp ? 1 : 0); | ||
}); | ||
}; | ||
Array.prototype.diffs = function (target, options) { | ||
var _a; | ||
const result = []; | ||
const uncheckedTarget = [].concat(target); | ||
for (const sourceItem of this) { | ||
const sameTarget = uncheckedTarget.single((targetItem) => { var _a, _b; return ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, ((_a = options) === null || _a === void 0 ? void 0 : _a.excludes) ? { excludes: (_b = options) === null || _b === void 0 ? void 0 : _b.excludes } : undefined); }); | ||
if (!sameTarget) { | ||
if ((_a = options) === null || _a === void 0 ? void 0 : _a.keys) { | ||
const sameKeyTargetItem = uncheckedTarget.single((targetItem) => ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, { keys: options.keys })); | ||
if (sameKeyTargetItem) { | ||
result.push({ source: sourceItem, target: sameKeyTargetItem }); | ||
uncheckedTarget.remove(sameKeyTargetItem); | ||
continue; | ||
} | ||
} | ||
result.push({ source: sourceItem }); | ||
} | ||
else { | ||
uncheckedTarget.remove(sameTarget); | ||
} | ||
} | ||
for (const uncheckedTargetItem of uncheckedTarget) { | ||
result.push({ target: uncheckedTargetItem }); | ||
} | ||
return result; | ||
}; | ||
Array.prototype.merge = function (target, options) { | ||
const diffs = this.diffs(target, options); | ||
const result = ObjectUtil_1.ObjectUtil.clone(this); | ||
for (const diff of diffs) { | ||
if (diff.source && diff.target) { | ||
const resultSourceItem = result.single((item) => ObjectUtil_1.ObjectUtil.equal(item, diff.source)); | ||
result[result.indexOf(resultSourceItem)] = ObjectUtil_1.ObjectUtil.merge(diff.source, diff.target); | ||
} | ||
else if (diff.target) { | ||
result.push(diff.target); | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.sum = function (selector) { | ||
let result = 0; | ||
for (let i = 0; i < this.length; i++) { | ||
const item = selector ? selector(this[i], i) : this[i]; | ||
if (typeof item !== "number") { | ||
throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다."); | ||
} | ||
result += item; | ||
} | ||
return result; | ||
}; | ||
Array.prototype.min = function (selector) { | ||
let result; | ||
for (let i = 0; i < this.length; i++) { | ||
const item = selector ? selector(this[i], i) : this[i]; | ||
if (typeof item !== "number") { | ||
throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다."); | ||
} | ||
if (!result || result > item) { | ||
result = item; | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.max = function (selector) { | ||
let result; | ||
for (let i = 0; i < this.length; i++) { | ||
const item = selector ? selector(this[i], i) : this[i]; | ||
if (typeof item !== "number") { | ||
throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다."); | ||
} | ||
if (!result || result < item) { | ||
result = item; | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.shuffle = function () { | ||
if (this.length <= 1) { | ||
return ObjectUtil_1.ObjectUtil.clone(this); | ||
} | ||
let result = this; | ||
while (true) { | ||
result = result.orderBy(() => Math.random()); | ||
if (!ObjectUtil_1.ObjectUtil.equal(result, this)) { | ||
break; | ||
} | ||
} | ||
return result; | ||
}; | ||
Array.prototype.insert = function (index, item) { | ||
this.splice(index, 0, item); | ||
return this; | ||
}; | ||
Array.prototype.remove = function (itemOrSelector) { | ||
const removeItems = typeof itemOrSelector === "function" ? this.filter(itemOrSelector.bind(this)) : [itemOrSelector]; | ||
for (const removeItem of removeItems) { | ||
while (this.indexOf(removeItem) >= 0) { | ||
this.splice(this.indexOf(removeItem), 1); | ||
} | ||
} | ||
return this; | ||
}; | ||
Array.prototype.clear = function () { | ||
return this.remove(() => true); | ||
}; | ||
/***/ }), | ||
/* 14 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const PropertyGetSetDecoratorBase_1 = __webpack_require__(8); | ||
function NotifyPropertyChange() { | ||
return PropertyGetSetDecoratorBase_1.PropertyGetSetDecoratorBase({ | ||
afterSet: (target, propertyName, oldValue, newValue) => { | ||
target.onPropertyChange(propertyName, oldValue, newValue); | ||
} | ||
}); | ||
} | ||
exports.NotifyPropertyChange = NotifyPropertyChange; | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const PropertyGetSetDecoratorBase_1 = __webpack_require__(8); | ||
const ObjectUtil_1 = __webpack_require__(2); | ||
function PropertyValidate(def) { | ||
return PropertyGetSetDecoratorBase_1.PropertyGetSetDecoratorBase({ | ||
beforeSet: (target, propertyName) => { | ||
const error = ObjectUtil_1.ObjectUtil.validate(target[propertyName], def); | ||
if (error) { | ||
throw new Error(`입력값이 잘못되었습니다: ${JSON.stringify({ | ||
component: target.constructor.name, | ||
propertyName, | ||
value: error.value, | ||
errorKeys: Object.keys(error.invalidateDef) | ||
})}`); | ||
} | ||
} | ||
}); | ||
} | ||
exports.PropertyValidate = PropertyValidate; | ||
/***/ }), | ||
/* 16 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const CustomError_1 = __webpack_require__(1); | ||
class NotImplementError extends CustomError_1.CustomError { | ||
constructor(message) { | ||
super("구현되어있지 않습니다" + (message ? ": " + message : "")); | ||
} | ||
} | ||
exports.NotImplementError = NotImplementError; | ||
/***/ }), | ||
/* 17 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/***/ }), | ||
/* 18 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class FunctionUtil { | ||
static parse(fn) { | ||
let matches = fn.toString().match(/function\s?\(([^)]*)\)[^{]*{((?!return)(.|\r|\n))*return\s?((.|\r|\n)*);?\s?}$/); | ||
if (matches === null) { | ||
matches = fn.toString().match(/^\(?([^)]*)\)?(\s?)=>(\s?)(.*)$/); | ||
if (matches === null) { | ||
throw new Error("Function 파싱 실패: " + fn.toString() + "\n"); | ||
} | ||
if (!matches[4]) { | ||
throw new Error("Function 파싱 실패: " + fn.toString() + "\n"); | ||
} | ||
if (matches[4].startsWith("{")) { | ||
const newMatch = matches[4].match(/(?!return)(.|\r|\n)*return\s((.|\r|\n)*);/); | ||
if (newMatch && newMatch[2]) { | ||
matches[4] = newMatch[2]; | ||
} | ||
else { | ||
throw new Error("Function 파싱 실패: " + fn.toString() + "\n"); | ||
} | ||
} | ||
} | ||
const params = matches[1].split(",").map((item) => item.trim()); | ||
let returnContent = matches[4].trim(); | ||
if (returnContent.endsWith(";")) { | ||
returnContent = returnContent.slice(0, -1); | ||
} | ||
return { | ||
params, | ||
returnContent | ||
}; | ||
} | ||
} | ||
exports.FunctionUtil = FunctionUtil; | ||
/***/ }), | ||
/* 19 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const DateTime_1 = __webpack_require__(3); | ||
const DateOnly_1 = __webpack_require__(5); | ||
const Time_1 = __webpack_require__(6); | ||
const Uuid_1 = __webpack_require__(7); | ||
class JsonConvert { | ||
static stringify(obj, options) { | ||
var _a; | ||
function replacer(key, value) { | ||
var _a, _b, _c; | ||
const currValue = ((_a = options) === null || _a === void 0 ? void 0 : _a.replacer) ? options.replacer(key, value) : value; | ||
if (currValue instanceof Date) { | ||
return { __type__: "Date", data: currValue.toISOString() }; | ||
} | ||
if (currValue instanceof DateTime_1.DateTime) { | ||
return { __type__: "DateTime", data: currValue.toString() }; | ||
} | ||
else if (currValue instanceof DateOnly_1.DateOnly) { | ||
return { __type__: "DateOnly", data: currValue.toString() }; | ||
} | ||
else if (currValue instanceof Time_1.Time) { | ||
return { __type__: "Time", data: currValue.toString() }; | ||
} | ||
else if (currValue instanceof Uuid_1.Uuid) { | ||
return { __type__: "Uuid", data: currValue.toString() }; | ||
} | ||
else if (currValue instanceof Error) { | ||
return { | ||
__type__: "Error", | ||
data: { | ||
message: currValue.message, | ||
name: currValue.name, | ||
stack: currValue.stack, | ||
...currValue | ||
} | ||
}; | ||
} | ||
else if (currValue instanceof Buffer || ((_b = currValue) === null || _b === void 0 ? void 0 : _b.type) === "Buffer") { | ||
return { __type__: "Buffer", data: ((_c = options) === null || _c === void 0 ? void 0 : _c.hideBuffer) ? "__hidden__" : value["data"] }; | ||
} | ||
return currValue; | ||
} | ||
const prevDateToJson = Date.prototype.toJSON; | ||
delete Date.prototype.toJSON; | ||
const result1 = JSON.stringify(replacer(undefined, obj), replacer, (_a = options) === null || _a === void 0 ? void 0 : _a.space); | ||
Date.prototype.toJSON = prevDateToJson; | ||
return result1; | ||
} | ||
static parse(json) { | ||
return json && JSON.parse(json, (key, value) => { | ||
if (value == undefined) { | ||
return undefined; | ||
} | ||
else if (typeof value === "object" && value.__type__ === "Date") { | ||
return new Date(Date.parse(value.data)); | ||
} | ||
else if (typeof value === "object" && value.__type__ === "DateTime") { | ||
return DateTime_1.DateTime.parse(value.data); | ||
} | ||
else if (typeof value === "object" && value.__type__ === "DateOnly") { | ||
return DateOnly_1.DateOnly.parse(value.data); | ||
} | ||
else if (typeof value === "object" && value.__type__ === "Time") { | ||
return Time_1.Time.parse(value.data); | ||
} | ||
else if (typeof value === "object" && value.__type__ === "Uuid") { | ||
return new Uuid_1.Uuid(value.data); | ||
} | ||
else if (typeof value === "object" && value.__type__ === "Error") { | ||
const error = new Error(value.data.message); | ||
Object.assign(error, value.data); | ||
return error; | ||
} | ||
else if (typeof value === "object" && value.__type__ === "Buffer") { | ||
return Buffer.from(value.data); | ||
} | ||
return value; | ||
}); | ||
} | ||
} | ||
exports.JsonConvert = JsonConvert; | ||
/***/ }), | ||
/* 20 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class MathUtil { | ||
static getRandomInt(min, max) { | ||
return Math.floor((Math.random() * (max - min)) + min); | ||
} | ||
} | ||
exports.MathUtil = MathUtil; | ||
/***/ }), | ||
/* 21 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const TimeoutError_1 = __webpack_require__(9); | ||
class Wait { | ||
static async true(forwarder, milliseconds, timeout) { | ||
let currMs = 0; | ||
while (true) { | ||
if (await forwarder()) { | ||
break; | ||
} | ||
await Wait.time((milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100)); | ||
if (timeout) { | ||
currMs += (milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100); | ||
if (currMs >= timeout) { | ||
throw new TimeoutError_1.TimeoutError(); | ||
} | ||
} | ||
} | ||
} | ||
static async time(millisecond) { | ||
await new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, millisecond); | ||
}); | ||
} | ||
} | ||
exports.Wait = Wait; | ||
/***/ }) | ||
/******/ ]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@simplysm/sd-core-common", | ||
"version": "3.1.10", | ||
"version": "3.1.13", | ||
"description": "심플리즘 패키지 - 코어 모듈 (browser/node)", | ||
@@ -5,0 +5,0 @@ "author": "김석래", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
419710
6028
1
2